- if ((key.equals("put")) || (key.equals("get"))) {
- String loginId = parameters.get("loginId");
- String host = parameters.get("host");
- String password = parameters.get("password");
- password = EncryptionTool.getInstance().decrypt(password);
- String fullPathFileName = parameters.get("fullPathFileName");
- String data = null;
-
- SshJcraftWrapper sshJcraftWrapper = getSshJcraftWrapper();
- log.debug("SCP: SshJcraftWrapper has been instantiated");
- DebugLog.printRTAriDebug(fnName, "SCP: SshJcraftWrapper has been instantiated");
- try {
- if (key.equals("put")) {
- data = parameters.get("data");
- if (data != null) {
- DebugLog.printRTAriDebug(fnName, "Command is for put: Length of data is: " + data.length());
- InputStream is = new ByteArrayInputStream(data.getBytes());
- log.debug("SCP: Doing a put: fullPathFileName=" + fullPathFileName);
- DebugLog.printRTAriDebug(fnName, "SCP: Doing a put: fullPathFileName=" + fullPathFileName);
- sshJcraftWrapper.put(is, fullPathFileName, host, loginId, password);
- try {
- DebugLog.printRTAriDebug(fnName, "Sleeping for 180 seconds....");
- Thread.sleep(1000l * 180);
- DebugLog.printRTAriDebug(fnName, "Woke up....");
- } catch (java.lang.InterruptedException ee) {
- boolean ignore = true;
- Thread.currentThread().interrupt();
+ String chg = ctx.getAttribute(
+ "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name");
+ if (chg != null && "prepare".equalsIgnoreCase(action)) {
+ return prepare(ctx, "CHANGE", "change");
+ }
+ if (chg != null && "activate".equalsIgnoreCase(action)) {
+ return activate(ctx, true);
+ }
+
+ String scale = ctx.getAttribute(
+ "service-data.vnf-config-parameters-list.vnf-config-parameters[0].scale-configuration[0].network-type");
+ if (scale != null && "prepare".equalsIgnoreCase(action)) {
+ return prepare(ctx, "CHANGE", "scale");
+ }
+ if (scale != null && "activate".equalsIgnoreCase(action)) {
+ return activate(ctx, true);
+ }
+
+ if ("prepare".equalsIgnoreCase(action)) {
+ return prepare(ctx, "BASE", "create");
+ }
+ if ("activate".equalsIgnoreCase(action)) {
+ return activate(ctx, false);
+ }
+
+ if ("backup".equalsIgnoreCase(action)) {
+ return prepare(ctx, "BACKUP", "backup");
+ }
+ if ("restorebackup".equalsIgnoreCase(action)) {
+ return prepare(ctx, "RESTOREBACKUP", "restorebackup");
+ }
+ if ("deletebackup".equalsIgnoreCase(action)) {
+ return prepare(ctx, "DELETEBACKUP", "deletebackup");
+ }
+ if ("audit".equalsIgnoreCase(action)) {
+ return audit(ctx, "FULL");
+ }
+ if ("getrunningconfig".equalsIgnoreCase(action)) {
+ return audit(ctx, "RUNNING");
+ }
+
+ if (("put".equals(key)) || ("get".equals(key))) {
+ String loginId = parameters.get("loginId");
+ String host = parameters.get("host");
+ String password = parameters.get("password");
+ password = EncryptionTool.getInstance().decrypt(password);
+ String fullPathFileName = parameters.get("fullPathFileName");
+ String data = null;
+
+ SshJcraftWrapper sshJcraftWrapper = getSshJcraftWrapper();
+ log.debug("SCP: SshJcraftWrapper has been instantiated");
+ DebugLog.printRTAriDebug(fnName, "SCP: SshJcraftWrapper has been instantiated");
+ try {
+ if (key.equals("put")) {
+ data = parameters.get("data");
+ if (data != null) {
+ DebugLog.printRTAriDebug(fnName, "Command is for put: Length of data is: " + data.length());
+ InputStream is = new ByteArrayInputStream(data.getBytes());
+ log.debug("SCP: Doing a put: fullPathFileName=" + fullPathFileName);
+ DebugLog.printRTAriDebug(fnName, "SCP: Doing a put: fullPathFileName=" + fullPathFileName);
+ sshJcraftWrapper.put(is, fullPathFileName, host, loginId, password);
+ try {
+ DebugLog.printRTAriDebug(fnName, "Sleeping for 180 seconds....");
+ Thread.sleep(1000l * 180);
+ DebugLog.printRTAriDebug(fnName, "Woke up....");
+ } catch (java.lang.InterruptedException ee) {
+ boolean ignore = true;
+ Thread.currentThread().interrupt();
+ }
+ } else {
+ r.code = HttpURLConnection.HTTP_INTERNAL_ERROR;
+ log.debug(fnName + " Command is for put: data is null");