DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame^] | 1 | *** Settings *** |
| 2 | Documentation Testing openstack. |
| 3 | Library OperatingSystem |
| 4 | Library Process |
| 5 | Library SSHLibrary |
| 6 | Library RequestsLibrary |
| 7 | Library JSONUtils |
| 8 | Library OpenstackLibrary |
| 9 | Library HEATUtils |
| 10 | Library Collections |
| 11 | LIbrary String |
| 12 | Resource ../../resources/openstack/keystone_interface.robot |
| 13 | Resource ../../resources/openstack/nova_interface.robot |
| 14 | Resource ../../resources/openstack/heat_interface.robot |
| 15 | Resource ../../resources/ssh/files.robot |
| 16 | Resource ../../resources/ssh/processes.robot |
| 17 | Resource packet_generator_interface.robot |
| 18 | Resource darkstat_interface.robot |
| 19 | Resource validate_common.robot |
| 20 | |
| 21 | |
| 22 | *** Variables *** |
| 23 | ${ASSETS} ${EXECDIR}/robot/assets/ |
| 24 | |
| 25 | *** Keywords *** |
| 26 | Policy Check Firewall Stack |
| 27 | [Documentation] Identifies the firewall servers in the VFW Stack in the GLOBAL_OPENSTACK_SERVICE_REGION |
| 28 | [Arguments] ${stack_name} ${policy_rate} |
| 29 | Run Openstack Auth Request auth |
| 30 | ${stack_info}= Wait for Stack to Be Deployed auth ${stack_name} |
| 31 | ${stack_id}= Get From Dictionary ${stack_info} id |
| 32 | ${server_list}= Get Openstack Servers auth |
| 33 | Log ${server_list} |
| 34 | ${vpg_unprotected_ip}= Get From Dictionary ${stack_info} vpg_private_ip_0 |
| 35 | ${vsn_protected_ip}= Get From Dictionary ${stack_info} vsn_private_ip_0 |
| 36 | ${vpg_public_ip}= Get Server Ip ${server_list} ${stack_info} vpg_name_0 network_name=public |
| 37 | ${vsn_public_ip}= Get Server Ip ${server_list} ${stack_info} vsn_name_0 network_name=public |
| 38 | ${upper_bound}= Evaluate ${policy_rate}*2 |
| 39 | Wait Until Keyword Succeeds 300s 1s Run VFW Policy Check ${vpg_public_ip} ${policy_rate} ${upper_bound} 1 |
| 40 | |
| 41 | Run VFW Policy Check |
| 42 | [Documentation] Push traffic above upper bound, wait for policy to fix it, push traffic to lower bound, wait for policy to fix it, |
| 43 | [Arguments] ${vpg_public_ip} ${policy_rate} ${upper_bound} ${lower_bound} |
| 44 | # Force traffic above threshold |
| 45 | Check For Policy Enforcement ${vpg_public_ip} ${policy_rate} ${upper_bound} |
| 46 | # Force traffic below threshold |
| 47 | Check For Policy Enforcement ${vpg_public_ip} ${policy_rate} ${lower_bound} |
| 48 | |
| 49 | |
| 50 | Check For Policy Enforcement |
| 51 | [Documentation] Push traffic above upper bound, wait for policy to fix it, push traffic to lower bound, wait for policy to fix it, |
| 52 | [Arguments] ${vpg_public_ip} ${policy_rate} ${forced_rate} |
| 53 | Enable Streams ${vpg_public_ip} ${forced_rate} |
| 54 | Wait Until Keyword Succeeds 20s 5s Test For Expected Rate ${vpg_public_ip} ${forced_rate} |
| 55 | Wait Until Keyword Succeeds 280s 5s Test For Expected Rate ${vpg_public_ip} ${policy_rate} |
| 56 | |
| 57 | Test For Expected Rate |
| 58 | [Documentation] Ge the number of pg-streams from the PGN, and test to see if it is what we expect. |
| 59 | [Arguments] ${vpg_public_ip} ${number_of_streams} |
| 60 | ${list}= Get List Of Enabled Streams ${vpg_public_ip} |
| 61 | ${list}= Evaluate ${list['sample-plugin']}['pg-streams']['pg-stream'] |
| 62 | Length Should Be ${list} ${number_of_streams} |
| 63 | |
| 64 | |
| 65 | |
| 66 | Policy Check vLB Stack |
| 67 | [Documentation] Identifies the firewall servers in the VFW Stack in the GLOBAL_OPENSTACK_SERVICE_REGION |
| 68 | [Arguments] ${stack_name} ${policy_rate} |
| 69 | Run Openstack Auth Request auth |
| 70 | ${stack_info}= Wait for Stack to Be Deployed auth ${stack_name} |
| 71 | ${stack_id}= Get From Dictionary ${stack_info} id |
| 72 | ${server_list}= Get Openstack Servers auth |
| 73 | ${vlb_public_ip}= Get Server Ip ${server_list} ${stack_info} vlb_name_0 network_name=public |
| 74 | ${upper_bound}= Evaluate ${policy_rate}*2 |
| 75 | Start DNS Traffic ${vlb_public_ip} ${upper_bound} |
| 76 | |
| 77 | # Now wiat for the dnsscaling stack to be deployed |
| 78 | ${prefix}= Get DNSScaling Prefix |
| 79 | ${dnsscaling}= Replace String Using Regexp ${stack_name} ^Vfmodule_ ${prefix} |
| 80 | ${dnsscaling_info}= Wait for Stack to Be Deployed auth ${dnsscaling} |
| 81 | # TO DO: Log into vLB and cehck that traffic is flowing to the new DNS |
| 82 | [Return] ${dnsscaling} |
| 83 | |
| 84 | Get DNSScaling Prefix |
| 85 | ${mapping}= Get From Dictionary ${GLOBAL_SERVICE_TEMPLATE_MAPPING} vLB |
| 86 | :for ${dict} in @{mapping} |
| 87 | \ Return From Keyword If '${dict['isBase']}' == 'false' ${dict['prefix']} |
| 88 | [Return] None |
| 89 | |
| 90 | |
| 91 | Start DNS Traffic |
| 92 | [Documentation] Run nslookups at rate per second. Run for 10 minutes or until it is called by the terminate process |
| 93 | [Arguments] ${vlb_public_ip} ${rate} |
| 94 | ${pid}= Start Process ./dnstraffic.sh ${vlb_public_ip} ${rate} ${GLOBAL_DNS_TRAFFIC_DURATION} |
| 95 | [Return] ${pid} |