diff options
author | jf9860 <jf9860@att.com> | 2017-03-01 19:43:28 -0500 |
---|---|---|
committer | jf9860 <jf9860@att.com> | 2017-03-02 10:16:14 -0500 |
commit | 3b22a2d4f52f24e0984bb4d712a4cafd83d06d7b (patch) | |
tree | 8a8b8a5b37c01426e9bef3695b878793d8cd1f16 /robot | |
parent | e770718749bf1d2f622a9acf70f1e6ca80c1823d (diff) |
Remove fragile process test from vFW validation.
Process name is vairable. Process validation is implied by susbequent log
validation.
Allow for A&AI teardown delete to fail due to lingering references.
Change-Id: Iea269d24232d4ff711233f5c666da677354ab694
Signed-off-by: jf9860 <jf9860@att.com>
Diffstat (limited to 'robot')
-rw-r--r-- | robot/resources/aai/create_tenant.robot | 67 | ||||
-rw-r--r-- | robot/resources/ssh/files.robot | 24 | ||||
-rw-r--r-- | robot/resources/stack_validation/validate_vfw.robot | 53 |
3 files changed, 72 insertions, 72 deletions
diff --git a/robot/resources/aai/create_tenant.robot b/robot/resources/aai/create_tenant.robot index e5a55966..756882e7 100644 --- a/robot/resources/aai/create_tenant.robot +++ b/robot/resources/aai/create_tenant.robot @@ -11,76 +11,78 @@ Library Collections *** Variables *** -${INDEX PATH} /aai/v8 +${INDEX PATH} /aai/v8 ${ROOT_TENANT_PATH} /cloud-infrastructure/cloud-regions/cloud-region/ ${SYSTEM USER} robot-ete ${AAI_ADD_TENANT_BODY}= robot/assets/templates/aai/add_tenant_body.template -*** Keywords *** +*** Keywords *** Inventory Tenant If Not Exists - [Documentation] Creates a service in A&AI if it doesn't exist + [Documentation] Creates a service in A&AI if it doesn't exist [Arguments] ${cloud_owner} ${cloud_region_id} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${tenant_id} ${tenant_name} ${dict}= Get Tenants ${cloud_owner} ${cloud_region_id} - ${status} ${value}= Run Keyword And Ignore Error Dictionary Should Contain Key ${dict} ${tenant_id} + ${status} ${value}= Run Keyword And Ignore Error Dictionary Should Contain Key ${dict} ${tenant_id} Run Keyword If '${status}' == 'FAIL' Inventory Tenant ${cloud_owner} ${cloud_region_id} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${tenant_id} ${tenant_name} - + Inventory Tenant - [Documentation] Inventorys a Tenant in A&AI - [Arguments] ${cloud_owner} ${cloud_region_id} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${tenant_id} ${tenant_name} + [Documentation] Inventorys a Tenant in A&AI + [Arguments] ${cloud_owner} ${cloud_region_id} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${tenant_id} ${tenant_name} ${json_resource_version}= Get Resource Version If Exists ${cloud_owner} ${cloud_region_id} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${data_template}= OperatingSystem.Get File ${AAI_ADD_TENANT_BODY} - ${arguments}= Create Dictionary cloud_owner=${cloud_owner} cloud_region_id=${cloud_region_id} cloud_type=${cloud_type} owner_defined_type=${owner_defined_type} cloud_region_version=${cloud_region_version} cloud_zone=${cloud_zone} tenant_id=${tenant_id} tenant_name=${tenant_name} resource_version=${json_resource_version} - ${data}= Fill JSON Template ${data_template} ${arguments} + ${arguments}= Create Dictionary cloud_owner=${cloud_owner} cloud_region_id=${cloud_region_id} cloud_type=${cloud_type} owner_defined_type=${owner_defined_type} cloud_region_version=${cloud_region_version} cloud_zone=${cloud_zone} tenant_id=${tenant_id} tenant_name=${tenant_name} resource_version=${json_resource_version} + ${data}= Fill JSON Template ${data_template} ${arguments} ${put_resp}= Run A&AI Put Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id} ${data} ${status_string}= Convert To String ${put_resp.status_code} - Should Match Regexp ${status_string} ^(201|200)$ + Should Match Regexp ${status_string} ^(201|200)$ Get Resource Version If Exists - [Documentation] Creates a service in A&AI if it doesn't exist + [Documentation] Creates a service in A&AI if it doesn't exist [Arguments] ${cloud_owner} ${cloud_region_id} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${resource_version}= Set Variable ${resp}= Get Cloud Region ${cloud_owner} ${cloud_region_id} Return from Keyword if '${resp.status_code}' != '200' ${resource_version} ${json}= Set Variable ${resp.json()} - ${resource_version}= Catenate ${json['resource-version']} - [Return] "resource-version":"${resource_version}", - + ${resource_version}= Catenate ${json['resource-version']} + [Return] "resource-version":"${resource_version}", + Delete Tenant - [Documentation] Removes both Tenant + [Documentation] Removes both Tenant [Arguments] ${tenant_id} ${cloud_owner} ${cloud_region_id} - ${get_resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id}/tenants/tenant/${tenant_id} + ${get_resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id}/tenants/tenant/${tenant_id} Run Keyword If '${get_resp.status_code}' == '200' Delete Tenant Exists ${tenant_id} ${cloud_owner} ${cloud_region_id} ${get_resp.json()['resource-version']} Delete Tenant Exists [Arguments] ${tenant_id} ${cloud_owner} ${cloud_region_id} ${resource_version} - ${put_resp}= Run A&AI Delete Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id}/tenants/tenant/${tenant_id} ${resource_version} - Should Be Equal As Strings ${put_resp.status_code} 204 - + ${put_resp}= Run A&AI Delete Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id}/tenants/tenant/${tenant_id} ${resource_version} + Should Be Equal As Strings ${put_resp.status_code} 204 + Delete Cloud Region [Documentation] Removes both Tenant and Cloud Region in A&AI [Arguments] ${tenant_id} ${cloud_owner} ${cloud_region_id} - ${get_resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id} + ${get_resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id} Run Keyword If '${get_resp.status_code}' == '200' Delete Cloud Region Exists ${tenant_id} ${cloud_owner} ${cloud_region_id} ${get_resp.json()['resource-version']} - + Delete Cloud Region Exists + [Documentation] Delete may get status 400 (Bad Request) if the region is still referenced [Arguments] ${tenant_id} ${cloud_owner} ${cloud_region_id} ${resource_version} ${put_resp}= Run A&AI Delete Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id} ${resource_version} - Should Be Equal As Strings ${put_resp.status_code} 204 - + ${status_string}= Convert To String ${put_resp.status_code} + Should Match Regexp ${status_string} ^(204|400)$ + Get Tenants - [Documentation] Return list of tenants for this cloud owner/region - [Arguments] ${cloud_owner} ${cloud_region_id} + [Documentation] Return list of tenants for this cloud owner/region + [Arguments] ${cloud_owner} ${cloud_region_id} ${resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id}/tenants - ${dict}= Create Dictionary + ${dict}= Create Dictionary ${status} ${value}= Run Keyword And Ignore Error Should Be Equal As Strings ${resp.status_code} 200 - Run Keyword If '${status}' == 'PASS' Update Tenant Dictionary ${dict} ${resp.json()} + Run Keyword If '${status}' == 'PASS' Update Tenant Dictionary ${dict} ${resp.json()} [Return] ${dict} Get Cloud Region - [Documentation] Returns the Cloud Region if it exists - [Arguments] ${cloud_owner} ${cloud_region_id} + [Documentation] Returns the Cloud Region if it exists + [Arguments] ${cloud_owner} ${cloud_region_id} ${resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id} [Return] ${resp} @@ -89,9 +91,8 @@ Update Tenant Dictionary ${list}= Evaluate ${json}['tenant'] :for ${map} in @{list} \ ${status} ${tenant_id}= Run Keyword And Ignore Error Get From Dictionary ${map} tenant-id - \ Run Keyword If '${status}' == 'PASS' Set To Dictionary ${dict} ${tenant_id}=${map} + \ Run Keyword If '${status}' == 'PASS' Set To Dictionary ${dict} ${tenant_id}=${map} Log ${dict} - - -
\ No newline at end of file + + diff --git a/robot/resources/ssh/files.robot b/robot/resources/ssh/files.robot index 798ce89e..fcfffbb3 100644 --- a/robot/resources/ssh/files.robot +++ b/robot/resources/ssh/files.robot @@ -1,7 +1,7 @@ *** Settings *** Documentation Some handy Keywords for accessing log files over SSH. Assumptions are that logs will belong to users other than the currently logged in user and that sudo will be required Library OperatingSystem -Library SSHLibrary +Library SSHLibrary Library HttpLibrary.HTTP Library String Library Collections @@ -11,27 +11,27 @@ Library Collections *** Keywords *** Open Connection And Log In [Documentation] Open a connection using the passed user and SSH key. Connection alias will be the host name by default. - [Arguments] ${HOST} ${user} ${pvt} ${password}= ${alias}=${HOST} ${timeout}=20s + [Arguments] ${HOST} ${user} ${pvt} ${password}= ${alias}=${HOST} ${timeout}=120s Open Connection ${HOST} alias=${alias} timeout=${timeout} Login With Public Key ${user} ${pvt} password=${password} delay=0.5 seconds Grep Local File - [Documentation] Grep the passed file name and return all of the lines that match the passed pattern using the current connection + [Documentation] Grep the passed file name and return all of the lines that match the passed pattern using the current connection [Arguments] ${pattern} ${fullpath} - ${output}= Execute Command grep ${pattern} ${fullpath} + ${output}= Execute Command grep ${pattern} ${fullpath} [Return] ${output} - + Grep File on Host - [Documentation] Grep the passed file name and return all of the lines that match the passed pattern using passed connection alias/host + [Documentation] Grep the passed file name and return all of the lines that match the passed pattern using passed connection alias/host [Arguments] ${host} ${pattern} ${fullpath} Switch Connection ${host} ${output}= Grep Local File ${pattern} ${fullpath} - @{lines}= Split To Lines ${output} + @{lines}= Split To Lines ${output} [Return] @{lines} Grep File on Hosts - [Documentation] Grep the passed file name and return all of the lines that match the passed pattern using passed list of connections - [Arguments] ${HOSTS} ${pattern} ${fullpath} + [Documentation] Grep the passed file name and return all of the lines that match the passed pattern using passed list of connections + [Arguments] ${HOSTS} ${pattern} ${fullpath} &{map}= Create Dictionary :FOR ${HOST} IN @{HOSTS} \ Log ${HOST} @@ -40,11 +40,11 @@ Grep File on Hosts [Return] &{map} Tail File on Host Until - [Documentation] Tail log file into grep which returns file lines containing the grep pattern. Will timeout after timeout= if expected pattern not received. + [Documentation] Tail log file into grep which returns file lines containing the grep pattern. Will timeout after timeout= if expected pattern not received. [Arguments] ${host} ${pattern} ${fullpath} ${expected} ${timeout}=60 ${options}=-c -0 Switch Connection ${host} - ${tailcommand}= Catenate tail ${options} -f ${fullpath} | grep --color=never ${pattern} + ${tailcommand}= Catenate tail ${options} -f ${fullpath} | grep --color=never ${pattern} Write ${tailcommand} - ${stdout}= Read Until Regexp ${expected} + ${stdout}= Read Until Regexp ${expected} @{lines}= Split To Lines ${stdout} [Return] @{lines} diff --git a/robot/resources/stack_validation/validate_vfw.robot b/robot/resources/stack_validation/validate_vfw.robot index 51f29b4a..052eaf1d 100644 --- a/robot/resources/stack_validation/validate_vfw.robot +++ b/robot/resources/stack_validation/validate_vfw.robot @@ -23,72 +23,71 @@ ${ASSETS} ${EXECDIR}/robot/assets/ *** Keywords *** Validate Firewall Stack [Documentation] Identifies the firewall servers in the VFW Stack in the GLOBAL_OPENSTACK_SERVICE_REGION - [Arguments] ${STACK_NAME} + [Arguments] ${STACK_NAME} Run Openstack Auth Request auth ${stack_info}= Wait for Stack to Be Deployed auth ${STACK_NAME} ${stack_id}= Get From Dictionary ${stack_info} id - ${server_list}= Get Openstack Servers auth + ${server_list}= Get Openstack Servers auth ${vpg_unprotected_ip}= Get From Dictionary ${stack_info} vpg_private_ip_0 ${vsn_protected_ip}= Get From Dictionary ${stack_info} vsn_private_ip_0 ${vpg_name_0}= Get From Dictionary ${stack_info} vpg_name_0 - ${vfw_public_ip}= Get Server Ip ${server_list} ${stack_info} vfw_name_0 network_name=public - ${vpg_public_ip}= Get Server Ip ${server_list} ${stack_info} vpg_name_0 network_name=public - ${vsn_public_ip}= Get Server Ip ${server_list} ${stack_info} vsn_name_0 network_name=public - + ${vfw_public_ip}= Get Server Ip ${server_list} ${stack_info} vfw_name_0 network_name=public + ${vpg_public_ip}= Get Server Ip ${server_list} ${stack_info} vpg_name_0 network_name=public + ${vsn_public_ip}= Get Server Ip ${server_list} ${stack_info} vsn_name_0 network_name=public + Wait For Server ${vfw_public_ip} Wait For Server ${vpg_public_ip} Wait For Server ${vsn_public_ip} Log Accessed all servers - Wait For Firewall ${vfw_public_ip} - Wait For Packet Generator ${vpg_public_ip} - Wait For Packet Sink ${vsn_public_ip} + Wait For Firewall ${vfw_public_ip} + Wait For Packet Generator ${vpg_public_ip} + Wait For Packet Sink ${vsn_public_ip} Log All server processes up ${appc}= Create Mount Point In APPC ${vpg_name_0} ${vpg_public_ip} # Following hack was implemented because the stack doesn't always come up clean # It was found that rebooting the servers at this point did not improve the - # chances of the packets flowing to the SNK + # chances of the packets flowing to the SNK #${status} ${data}= Run Keyword And Ignore Error Wait For Packets ${vpg_public_ip} ${vpg_unprotected_ip} ${vsn_protected_ip} ${vsn_public_ip} #Return From Keyword if '${status}' == 'PASS' #Close All Connections - #Find And Reboot The Server ${stack_info} ${server_list} vfw_name_0 - #Find And Reboot The Server ${stack_info} ${server_list} vpg_name_0 + #Find And Reboot The Server ${stack_info} ${server_list} vfw_name_0 + #Find And Reboot The Server ${stack_info} ${server_list} vpg_name_0 #Find And Reboot The Server ${stack_info} ${server_list} vsn_name_0 - ## Gives some time for servers to shutdown - #Sleep 10s + ## Gives some time for servers to shutdown + #Sleep 10s #Wait For Server ${vfw_public_ip} #Wait For Server ${vpg_public_ip} #Wait For Server ${vsn_public_ip} Wait For Packets ${vpg_public_ip} ${vpg_unprotected_ip} ${vsn_protected_ip} ${vsn_public_ip} - + Wait For Packets [Documentation] Final vfw validation that packets are flowing from the pgn VM to the snk VM - [Arguments] ${vpg_public_ip} ${vpg_unprotected_ip} ${vsn_protected_ip} ${vsn_public_ip} + [Arguments] ${vpg_public_ip} ${vpg_unprotected_ip} ${vsn_protected_ip} ${vsn_public_ip} ${resp}= Enable Stream ${vpg_public_ip} Should Be Equal As Strings ${resp.status_code} 200 - ${syslog_message}= Catenate UDP: short packet: From ${vpg_unprotected_ip}:.* to ${vsn_protected_ip}:.* + ${syslog_message}= Catenate UDP: short packet: From ${vpg_unprotected_ip}:.* to ${vsn_protected_ip}:.* Tail File on Host Until ${vsn_public_ip} UDP: /var/log/syslog ${syslog_message} timeout=120s - Disable All Streams ${vpg_public_ip} + Disable All Streams ${vpg_public_ip} Wait For Firewall [Documentation] Wait for the defined firewall processes to come up - [Arguments] ${ip} - Wait for Process on Host ./vpp_measurement_reporter ${ip} - Wait for Process on Host vpp -c /etc/vpp/startup.conf ${ip} + [Arguments] ${ip} + Wait for Process on Host ./vpp_measurement_reporter ${ip} + Wait for Process on Host vpp -c /etc/vpp/startup.conf ${ip} Wait For Packet Generator [Documentation] Wait for the defined packet generator processes to come up - [Arguments] ${ip} - Wait for Process on Host vpp -c /etc/vpp/startup.conf ${ip} - Wait for Process on Host java .* -jar /opt/honeycomb/Honeycomb/vpp-integration/minimal-distribution/target/vpp-integration-distribution-1.16.9-hc/vpp-integration-distribution-1.16.9/vpp-integration-distribution-1.16.9.jar ${ip} + [Arguments] ${ip} + Wait for Process on Host vpp -c /etc/vpp/startup.conf ${ip} Wait Until Keyword Succeeds 180s 5s Tail File on Host Until ${ip} Honeycomb /var/log/honeycomb/honeycomb.log - Honeycomb initialized options=-c +0 timeout=120s - Run Keyword And Ignore Error Wait for Process on Host run_traffic_fw_demo.sh ${ip} timeout=60s + Run Keyword And Ignore Error Wait for Process on Host run_traffic_fw_demo.sh ${ip} timeout=60s Pkill Process On Host "/bin/bash ./run_traffic_fw_demo.sh" ${ip} - + Wait For Packet Sink [Documentation] Wait for the defined packet sink processes to come up [Arguments] ${ip} - Log noting to check on ${ip} + Log noting to check on ${ip} |