APPC ONAP Scripts

Change-Id: Idbad175df1df1c49df22f6c5af2dbf9d311c8873
issue-ID=APPC-193
Signed-off-by: NGUYEN <pn8984@att.com>
diff --git a/test/csit/tests/appc/testsuite/APPC_Netstat.robot b/test/csit/tests/appc/testsuite/APPC_Netstat.robot
new file mode 100644
index 0000000..5544fb5
--- /dev/null
+++ b/test/csit/tests/appc/testsuite/APPC_Netstat.robot
@@ -0,0 +1,19 @@
+*** Settings ***
+Library    SSHLibrary
+Library    OperatingSystem
+*** Variables ***
+${HOST}    104.130.138.49
+${USERNAME}    test            
+${private_key}    H:\\TestSuite\\testsuite\\robot\\testsuites               
+*** Test Cases ***
+APPC Netstat 
+   Open Connection    ${HOST}
+   ${password}=    Get File    ${private_key}
+   Login    ${USERNAME}    ${password}
+   log to console      \nConnected Successfully
+   ${cmd} =    set variable    netstat -a | grep -E '8443 | grep LISTEN
+   execute command     ${cmd}
+       
+Tear Down
+    [Documentation]   Close all connections
+    Close All connections
\ No newline at end of file
diff --git a/test/csit/tests/appc/testsuite/LCM_HEALTHCHECK.robot b/test/csit/tests/appc/testsuite/LCM_HEALTHCHECK.robot
new file mode 100644
index 0000000..c3594ef
--- /dev/null
+++ b/test/csit/tests/appc/testsuite/LCM_HEALTHCHECK.robot
@@ -0,0 +1,33 @@
+*** Settings ***
+Library    Selenium2Library
+Library    OperatingSystem
+
+*** Variable ***
+${ResponseCode}
+${var}
+${RequestJSON}    C:\\RobotSampleForLearning\\LearningSamples\\Resources\\Healthchk.json
+
+
+*** Test Cases ***
+    
+APPC LCM Health check
+	[Documentation]	APPC HealthCheck 
+	Open Browser    http://admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U@104.130.138.49:8282/apidoc/explorer/index.html    chrome
+	Click Element    xpath=.//p[contains(text(),'If you have reason to expect the website is safe, select the I Accept the Risk button to continue.')]//following::img
+	
+	Wait Until Page Contains Element    xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a   
+	Click Element     xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a
+	
+	wait until page contains element    xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:health-check')]
+	Click Element    xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:health-check')]
+	
+	${HealthChk}=    Get File    ${RequestJSON}
+	wait until page contains element    xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:health-check')]//following::table
+	Input Text     xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:health-check')]//following::table//tbody/tr/td[2]/textarea    ${HealthChk}
+	
+	wait until page contains element    xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:health-check')]//following::form/div[2]/input[1]
+	Click Element    xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:health-check')]//following::form/div[2]/input[1]
+	
+Tear Down
+    [Documentation]   Close all browsers
+    Close All Browsers
\ No newline at end of file
diff --git a/test/csit/tests/appc/testsuite/LCM_VM_RESTART.robot b/test/csit/tests/appc/testsuite/LCM_VM_RESTART.robot
new file mode 100644
index 0000000..997ba17
--- /dev/null
+++ b/test/csit/tests/appc/testsuite/LCM_VM_RESTART.robot
@@ -0,0 +1,31 @@
+*** Settings ***
+Library    Selenium2Library
+Library    OperatingSystem
+
+*** Variable ***
+${ResponseCode}
+${var}
+${RequestJSON}    /LearningSamples/Resources/VMRestart.json
+
+
+*** Test Cases ***
+    
+APPC API VM RESTART
+	[Documentation]	APPC VM LCM Restart 
+	Open Browser    http://admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U@104.130.138.49:8282/apidoc/explorer/index.html    chrome 
+	Click Element    xpath=.//p[contains(text(),'If you have reason to expect the website is safe, select the I Accept the Risk button to continue.')]//following::img
+	Click Element     xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a
+	Click Element     xpath=//*[@id="appc-provider-lcm(2016-01-08)_restart_post_23"]/div[1]/h3/span[2]/a
+	${VM_LCM_RESTART}     Get File    ${RequestJSON}
+	Input Text     xpath=//*[@id="appc-provider-lcm(2016-01-08)_restart_post_23_content"]/form/table/tbody/tr/td[2]/textarea     ${VM_LCM_RESTART}
+	Click Element     xpath=//*[@id="appc-provider-lcm(2016-01-08)_restart_post_23_content"]/form/div[2]/input
+	# Get Text locator
+	${ResponseCode}    Get Text     xpath=//*[@id="appc-provider-lcm(2016-01-08)_restart_post_23_content"]/div[2]/h4[contains(text(),'Response Code')]//following::div//pre
+	${var}    Get Value    xpath=//*[@id="appc-provider-lcm(2016-01-08)_restart_post_23_content"]/div[2]/h4[contains(text(),'Response Code')]//following::div//pre
+	Log     Value-->    ${ResponseCode}
+	Log     var-->    ${var}
+	Element Text Should Be     xpath=//*[@id="appc-provider-lcm(2016-01-08)_restart_post_23_content"]/div[2]/h4[contains(text(),'Response Code')]//following::div//pre     400     expected
+	
+Tear Down
+    [Documentation]   Close all browsers
+    Close All Browsers
\ No newline at end of file
diff --git a/test/csit/tests/appc/testsuite/LCM_VNF_RESTART.robot b/test/csit/tests/appc/testsuite/LCM_VNF_RESTART.robot
new file mode 100644
index 0000000..1bb2c13
--- /dev/null
+++ b/test/csit/tests/appc/testsuite/LCM_VNF_RESTART.robot
@@ -0,0 +1,45 @@
+*** Settings ***
+Library    Selenium2Library
+Library    OperatingSystem
+
+*** Variable ***
+${ResponseCode}
+${var}
+${RequestJSON}    C:\\RobotSampleForLearning\\LearningSamples\\Resources\\VNFRestart.json
+
+
+*** Test Cases ***
+    
+APPC API VM RESTART
+	[Documentation]	APPC VM LCM Restart 
+	Open Browser    http://admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U@104.130.138.49:8282/apidoc/explorer/index.html    chrome 
+	Click Element    xpath=.//p[contains(text(),'If you have reason to expect the website is safe, select the I Accept the Risk button to continue.')]//following::img
+	
+	Wait Until Page Contains Element    xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a   
+	Click Element     xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a
+	
+	
+	Wait Until Page Contains Element    xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:restart')]        
+	Click Element     xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:restart')]
+	
+	
+	${VNF_LCM_RESTART}=     Get File    ${RequestJSON}
+	Wait Until Page Contains Element    xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:restart')]//following::table
+	
+	Input Text     xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:restart')]//following::table//tbody/tr/td[2]/textarea     ${VNF_LCM_RESTART}
+	
+	# Wait Until Page Contains Element    xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:restart')]/form/div[2]/input    
+	Click Element     xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:restart')]//following::form/div[2]/input[1]
+	
+	# Get Text locator
+	${ResponseCode}    Get Text     xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:restart')]//following::h4[contains(text(),'Response Code')][1]//following-sibling::div//pre
+	
+	# //*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:restart')]//following::h4[contains(text(),'Response Code')]//following-sibling::div//pre
+	${var}    Get Value    xpath=//*[@id="resource_appc-provider-lcm(2016-01-08)"]/div/h2/a//following::a[contains(text(),'/operations/appc-provider-lcm:restart')]//following::h4[contains(text(),'Response Code')][1]//following-sibling::div//pre
+	Log     Value-->    ${ResponseCode}
+	Log     var-->    ${var}
+	Element Text Should Be     xpath=//*[contains(text(),'/operations/appc-provider-lcm:restart')]//following::h4[text()='Response Code'][1]//following-sibling::div//pre[1]     200     expected
+	
+Tear Down
+    [Documentation]   Close all browsers
+    Close All Browsers
\ No newline at end of file