blob: a4c343eb1f6f9f697cbee15c97618cc78fe67602 [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
2Documentation Testing openstack.
3Library OperatingSystem
4Library Process
5Library SSHLibrary
6Library RequestsLibrary
7Library JSONUtils
8Library OpenstackLibrary
9Library HEATUtils
10Library Collections
11LIbrary String
12Resource ../../resources/openstack/keystone_interface.robot
13Resource ../../resources/openstack/nova_interface.robot
14Resource ../../resources/openstack/heat_interface.robot
15Resource ../../resources/ssh/files.robot
16Resource ../../resources/ssh/processes.robot
17Resource packet_generator_interface.robot
18Resource darkstat_interface.robot
19Resource validate_common.robot
jf9860de6a6e22017-03-04 13:14:09 -050020Resource ../../resources/test_templates/vnf_orchestration_test_template.robot
DR695Hccff30b2017-02-17 18:44:24 -050021
22
23*** Variables ***
DR695Hccff30b2017-02-17 18:44:24 -050024
25*** Keywords ***
Gary Wu76bc74f2018-03-22 13:25:49 -070026Policy Check FirewallCL Stack
jf986099c63292017-03-09 15:28:42 -050027 [Documentation] Executes the vFW policy closed loop test.
Gary Wu76bc74f2018-03-22 13:25:49 -070028 [Arguments] ${stacknamemap} ${policy_rate}
DR695Hccff30b2017-02-17 18:44:24 -050029 Run Openstack Auth Request auth
Gary Wu76bc74f2018-03-22 13:25:49 -070030 ${vsnk_stack_name}= Get From Dictionary ${stacknamemap} vFWSNK
31 ${vpkg_stack_name}= Get From Dictionary ${stacknamemap} vPKG
32 ${vsnk_stack_info}= Wait for Stack to Be Deployed auth ${vsnk_stack_name}
33 ${vpkg_stack_info}= Wait for Stack to Be Deployed auth ${vpkg_stack_name}
jf986099c63292017-03-09 15:28:42 -050034 ${server_list}= Get Openstack Servers auth
DR695Hccff30b2017-02-17 18:44:24 -050035 Log ${server_list}
Gary Wu76bc74f2018-03-22 13:25:49 -070036 ${vpkg_id}= Get From Dictionary ${vpkg_stack_info} vnf_id
37 ${status} ${generic_vnf}= Run Keyword And Ignore Error Get Generic VNF By ID ${vpkg_id}
38 Run Keyword If '${status}' == 'FAIL' FAIL VNF ID: ${vpkg_id} is not found.
39 ${invariantUUID} Get From Dictionary ${generic_vnf} persona-model-id
40 Update vVFWCL Policy ${invariantUUID}
41
42 ${vpg_unprotected_ip}= Get From Dictionary ${vpkg_stack_info} vpg_private_ip_0
43 ${vsn_protected_ip}= Get From Dictionary ${vsnk_stack_info} vsn_private_ip_0
44 ${vpg_public_ip}= Get Server Ip ${server_list} ${vpkg_stack_info} vpg_name_0 network_name=public
45 ${vsn_public_ip}= Get Server Ip ${server_list} ${vsnk_stack_info} vsn_name_0 network_name=public
DR695Hccff30b2017-02-17 18:44:24 -050046 ${upper_bound}= Evaluate ${policy_rate}*2
Gary Wu76bc74f2018-03-22 13:25:49 -070047 Wait Until Keyword Succeeds 30m 2s Run VFW Policy Check ${vpg_public_ip} ${policy_rate} ${upper_bound} 1
DR695Hccff30b2017-02-17 18:44:24 -050048
49Run VFW Policy Check
jf986099c63292017-03-09 15:28:42 -050050 [Documentation] Push traffic above upper bound, wait for policy to fix it, push traffic to lower bound, wait for policy to fix it,
DR695Hccff30b2017-02-17 18:44:24 -050051 [Arguments] ${vpg_public_ip} ${policy_rate} ${upper_bound} ${lower_bound}
52 # Force traffic above threshold
53 Check For Policy Enforcement ${vpg_public_ip} ${policy_rate} ${upper_bound}
54 # Force traffic below threshold
55 Check For Policy Enforcement ${vpg_public_ip} ${policy_rate} ${lower_bound}
56
jf986099c63292017-03-09 15:28:42 -050057
DR695Hccff30b2017-02-17 18:44:24 -050058Check For Policy Enforcement
jf986099c63292017-03-09 15:28:42 -050059 [Documentation] Push traffic above upper bound, wait for policy to fix it, push traffic to lower bound, wait for policy to fix it,
DR695Hccff30b2017-02-17 18:44:24 -050060 [Arguments] ${vpg_public_ip} ${policy_rate} ${forced_rate}
61 Enable Streams ${vpg_public_ip} ${forced_rate}
Gary Wu76bc74f2018-03-22 13:25:49 -070062 Wait Until Keyword Succeeds 20s 2s Test For Expected Rate ${vpg_public_ip} ${forced_rate}
63 Wait Until Keyword Succeeds 10m 2s Test For Expected Rate ${vpg_public_ip} ${policy_rate}
DR695Hccff30b2017-02-17 18:44:24 -050064
65Test For Expected Rate
jf986099c63292017-03-09 15:28:42 -050066 [Documentation] Ge the number of pg-streams from the PGN, and test to see if it is what we expect.
DR695Hccff30b2017-02-17 18:44:24 -050067 [Arguments] ${vpg_public_ip} ${number_of_streams}
68 ${list}= Get List Of Enabled Streams ${vpg_public_ip}
69 ${list}= Evaluate ${list['sample-plugin']}['pg-streams']['pg-stream']
jf986099c63292017-03-09 15:28:42 -050070 Length Should Be ${list} ${number_of_streams}
DR695Hccff30b2017-02-17 18:44:24 -050071
72
73
74Policy Check vLB Stack
jf986099c63292017-03-09 15:28:42 -050075 [Documentation] Executes the vLB policy closed loop test
76 [Arguments] ${stack_name} ${policy_rate}
DR695Hccff30b2017-02-17 18:44:24 -050077 Run Openstack Auth Request auth
78 ${stack_info}= Wait for Stack to Be Deployed auth ${stack_name}
79 ${stack_id}= Get From Dictionary ${stack_info} id
jf986099c63292017-03-09 15:28:42 -050080 ${server_list}= Get Openstack Servers auth
81 ${vlb_public_ip}= Get Server Ip ${server_list} ${stack_info} vlb_name_0 network_name=public
DR695Hccff30b2017-02-17 18:44:24 -050082 ${upper_bound}= Evaluate ${policy_rate}*2
jf986099c63292017-03-09 15:28:42 -050083 Start DNS Traffic ${vlb_public_ip} ${upper_bound}
DR695Hccff30b2017-02-17 18:44:24 -050084
85 # Now wiat for the dnsscaling stack to be deployed
86 ${prefix}= Get DNSScaling Prefix
jf986099c63292017-03-09 15:28:42 -050087 ${dnsscaling}= Replace String Using Regexp ${stack_name} ^Vfmodule_ ${prefix}
DR695Hccff30b2017-02-17 18:44:24 -050088 ${dnsscaling_info}= Wait for Stack to Be Deployed auth ${dnsscaling}
jf9860de6a6e22017-03-04 13:14:09 -050089 VLB Closed Loop Hack Update ${dnsscaling}
DR695Hccff30b2017-02-17 18:44:24 -050090 # TO DO: Log into vLB and cehck that traffic is flowing to the new DNS
jf986099c63292017-03-09 15:28:42 -050091 [Return] ${dnsscaling}
DR695Hccff30b2017-02-17 18:44:24 -050092
93Get DNSScaling Prefix
94 ${mapping}= Get From Dictionary ${GLOBAL_SERVICE_TEMPLATE_MAPPING} vLB
95 :for ${dict} in @{mapping}
96 \ Return From Keyword If '${dict['isBase']}' == 'false' ${dict['prefix']}
97 [Return] None
jf986099c63292017-03-09 15:28:42 -050098
DR695Hccff30b2017-02-17 18:44:24 -050099
100Start DNS Traffic
101 [Documentation] Run nslookups at rate per second. Run for 10 minutes or until it is called by the terminate process
102 [Arguments] ${vlb_public_ip} ${rate}
103 ${pid}= Start Process ./dnstraffic.sh ${vlb_public_ip} ${rate} ${GLOBAL_DNS_TRAFFIC_DURATION}
Gary Wu76bc74f2018-03-22 13:25:49 -0700104 [Return] ${pid}