Merge of new rebased code
[appc.git] / appc-adapters / appc-ssh-adapter / appc-ssh-adapter-api / src / main / java / org / openecomp / appc / adapter / ssh / Constants.java
index 7eb069f..5443d5d 100644 (file)
@@ -46,14 +46,37 @@ public class Constants {
     // input fields names
     public static final String PAYLOAD = "payload";
 
+    public static final String CONNECTION_RETRY_DELAY = "org.openecomp.appc.ssh.connection.retry.delay";
+    public static final String CONNECTION_RETRY_COUNT = "org.openecomp.appc.ssh.connection.retry.count";
+    public static final int DEFAULT_CONNECTION_RETRY_DELAY = 60;
+    public static final int DEFAULT_CONNECTION_RETRY_COUNT = 5;
 
-    public static final String PARAM_IN_connection_details = "connection-details";
+    public static final int DEFAULT_SSH_COMMAND_RETRY_COUNT = 3;
+
+    public static final int DEFAULT_CHECKACTIVE_RETRY_COUNT = 3;
+    public static final int DEFAULT_CHECKACTIVE_RETRY_DELAY = 30;
+
+    public static final int DEFAULT_STOP_RETRY_COUNT = 3;
+    public static final int DEFAULT_STOP_RETRY_DELAY = 30; //seconds
+
+    public static final String PARAM_IN_CONNECTION_DETAILS = "connection-details";
+    public static final String PARAM_IN_NODE_NAME = "node-name";
+    public static final String PARAM_IN_NODE_STATUS = "node-status";
+    public static final String PARAM_IN_VM_URL = "vm-url";
     public static final String SKIP_EXECUTION_INSTALLER_BIN_FILE = "Skip-execution-installer-bin-file";
     public static final String SKIP_DEPLOY = "Skip-deploy";
     public static final String UPGRADE_VERSION = "upgrade-version";
 
     //command to get number of UP hosts
     public static final String STATE_COMMAND = "/opt/jnetx/skyfall-scp/asp-state.sh | grep -o UP | wc -l";
+    //command to get each VNFC status
+    public static final String VNFC_STATE_COMMAND = "/opt/jnetx/skyfall-scp/asp-state.sh";
+    //command to restart node
+    public static final String RESTART_NODE_COMMAND = "/opt/jnetx/skyfall-scp/asp-stop.sh --restart -f --nodes";
+    //command to start node
+    public static final String START_NODE_COMMAND = "/opt/jnetx/skyfall-scp/asp-start.sh -f --nodes";
+    //command to stop node
+    public static final String STOP_NODE_COMMAND = "/opt/jnetx/skyfall-scp/asp-stop.sh -f --nodes";
     public static final int STATE_COMMAND_RESULT = 18;
     //commands to check FE hosts
     public static final String FE_STATE_TRUE_TEST_COMMAND = "ssh -t -q fe1 /opt/omni/bin/swmml -e display-platform-status | grep -o TRUE | wc -l";
@@ -62,6 +85,12 @@ public class Constants {
     public static final int FE_STATE_FALSE_TEST_RESULT = 2;
     public static final String FE_OPERATIONAL_TEST_COMMAND = "ssh -t -q fe1 /opt/omni/bin/swmml -e display-platform-status | grep -o 'NOT FULLY OPERATIONAL' | wc -l";
     public static final int FE_OPERATIONAL_TEST_RESULT = 2;
+
+    //smp commands
+    public static final String SMP_CHECK_ACTIVE_STATE_COMMAND = "cat skyfall-scp/runtime/SCP_SMP_*/smp/log/system.log| grep SSS | tail -1";
+    public static final String SMP_STATE_ACTIVE="SMP is active";
+    public static final String SMP_STATE_INACTIVE="SMP is not active";
+
     //rsync command
     public static final String RSYNC_COMMAND = "yes n | /opt/jnetx/skyfall-scp/asp-rsync.sh --check | grep -o 'is active' | wc -l";
     public static final int RSYNC_COMMAND_RESULT = 9;
@@ -70,17 +99,19 @@ public class Constants {
     public static final String PARAM_IN_FILE_URL = "source-file-url";
     public static final String DOWNLOAD_COMMAND = "wget -N %s";
 
-    // pre-define jnetx VM names
+    // pre-define VM names
     public static final String[] VM_NAMES = {"fe1", "fe2", "be1", "be2", "be3", "be4", "be5", "smp1", "smp2"};
 
     public static final String DEFAULT_DISK_SPACE = "10240000";
     public static final String DF_COMMAND_TEMPLATE = "ssh %s df | grep vda1 | grep -v grep | tr -s ' '|cut -d ' ' -f4";
 
     public static final String DG_OUTPUT_STATUS_MESSAGE = "output.status.message";
+    public static final String ATTRIBUTE_ERROR_MESSAGE = "error-message";
 
 
-    // constants fo DG
-    public static final String CONNECTION_DETAILS_FIELD_NAME = "connection-details";
+    // constants for DG
+    public static final String CONNECTION_DETAILS_FIELD_NAME = PARAM_IN_CONNECTION_DETAILS;
     public static final String VNF_HOST_IP_ADDRESS_FIELD_NAME = "vnf-host-ip-address";
-    public static final String DG_ERROR_FIELD_NAME = "org.openecomp.appc.dg.error";
+    public static final String VNF_HOST_IP2_ADDRESS_FIELD_NAME = "vnf-host-ip2-address";
+    public static final String DG_ERROR_FIELD_NAME = "org.openecom.appc.dg.error";
 }