Robot Test: Included Test are
[osm/devops.git] / robot-systest / lib / cli / ns_lib.robot
index 8be124d..e0eb0c2 100644 (file)
@@ -31,7 +31,6 @@ ${ns_delete_max_wait_time}    1min
 ${ns_delete_pol_time}    15sec
 ${nsconfig}
 
-
 *** Keywords ***
 Get NS List
     [Documentation]  Get ns instance list
@@ -41,8 +40,26 @@ Get NS List
     Should Be Equal As Integers    ${rc}    ${success_return_code}
 
 
+Get NS Instance ID
+    [Arguments]    ${ns_name}
+
+    ${rc}   ${stdout}=      Run and Return RC and Output    osm ns-list --filter name="${ns_name}" | awk 'NR==4{print $4}'
+    log     ${stdout}
+    [Return]    ${stdout}
+
+
+Verify All JUJU Applications Status
+    [Arguments]    ${ns}    ${api_ip}    ${api_port}    ${username}    ${password}    ${api_cert_path}
+
+    ${juju_model}=    Get NS Instance ID    ${ns}
+
+    Import Library    robot_juju.JujuLibrary    ${api_ip}    ${api_port}    ${juju_model}    ${username}    ${password}    ${api_cert_path}
+    Assert status of applications is  ${status_active}
+
+
 Launch Network Services and Return
     [Arguments]  ${vim_name}  ${ns_config}=''
+    [Documentation]  Get Configuration parameter to create Newtork service
 
     Run Keyword If    ${ns_config}==''    Get NS Config
     ...  ELSE  Set NS Config    ${ns_config}
@@ -56,11 +73,15 @@ Launch Network Services and Return
 
 Set NS Config
     [Arguments]   ${ns_config}
+    [Documentation]  Set NS Configuration variable
+
     ${nsconfig}=    Get Variable Value    ${ns_config}    ''
     Set Test Variable    ${nsconfig}
 
 
 Get NS Config
+    [Documentation]  Get NS Configuration from Environment Variable
+
     ${nsconfig}=    Get Environment Variable    NS_CONFIG    ''
     Set Test Variable    ${nsconfig}
 
@@ -111,7 +132,7 @@ Check For NS Instance To Configured
     ${rc}   ${stdout}=      Run and Return RC and Output    osm ns-list --filter name="${ns_name}"
     log     ${stdout}
     Should Be Equal As Integers    ${rc}    ${success_return_code}
-    Should Contain Any      ${stdout}   configured    failed
+    Should Contain Any      ${stdout}   READY    BROKEN
 
 
 Check For NS Instance For Failure
@@ -120,7 +141,7 @@ Check For NS Instance For Failure
     ${rc}   ${stdout}=      Run and Return RC and Output    osm ns-list --filter name="${ns_name}"
     log     ${stdout}
     Should Be Equal As Integers    ${rc}    ${success_return_code}
-    Should Not Contain      ${stdout}   failed
+    Should Not Contain      ${stdout}   BROKEN
 
 
 Check For NS Instance To Be Delete
@@ -140,3 +161,33 @@ Force Delete NS
     log     ${stdout}
     Should Be Equal As Integers    ${rc}    ${success_return_code}
     WAIT UNTIL KEYWORD SUCCEEDS    ${ns_delete_max_wait_time}   ${ns_delete_pol_time}   Check For NS Instance To Be Delete   ${ns}
+
+
+Perform VNF Scale-in Operation
+    [Arguments]  ${ns}    ${vnf_member}    ${scaling_group}
+
+    ${rc}    ${nsr}=    Run and Return RC and Output    osm ns-show ${ns} --literal
+    ${scaled_vnf}=    Get Scaled Vnf    ${nsr}
+    log to console  Scaled VNF befor scale-in operation is ${scaled_vnf}
+    ${rc}   ${stdout}=      Run and Return RC and Output    osm vnf-scale --scale-in --scaling-group ${scaling_group} ${ns} ${vnf_member}
+    Should Be Equal As Integers    ${rc}    ${success_return_code}
+    log     ${stdout}
+    Sleep    1m    Waiting for scale-in operation to complete
+    ${rc}    ${nsr}=    Run and Return RC and Output    osm ns-show ${ns} --literal
+    ${scaled_vnf}=    Get Scaled Vnf    ${nsr}
+    log to console  Scaled VNF after scale-in operation is ${scaled_vnf}
+
+
+Perform VNF Scale-out Operation
+    [Arguments]  ${ns}    ${vnf_member}    ${scaling_group}
+
+    ${rc}    ${nsr}=    Run and Return RC and Output    osm ns-show ${ns} --literal
+    ${scaled_vnf}=    Get Scaled Vnf    ${nsr}
+    log to console  Scaled VNF befor scale-out operation is ${scaled_vnf}
+    ${rc}   ${stdout}=      Run and Return RC and Output    osm vnf-scale --scale-out --scaling-group ${scaling_group} ${ns} ${vnf_member}
+    Should Be Equal As Integers    ${rc}    ${success_return_code}
+    log     ${stdout}
+    Sleep    1m    Waiting for scale-out operation to complete
+    ${rc}    ${nsr}=    Run and Return RC and Output    osm ns-show ${ns} --literal
+    ${scaled_vnf}=    Get Scaled Vnf    ${nsr}
+    log to console  Scaled VNF befor scale-out operation is ${scaled_vnf}