blob: b3c225aa5e038faa821fe6b2d80790b40a92e866 [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
DR695H910097e2019-05-08 13:55:32 -040011Library String
DR695Hfcb0ee82019-05-22 17:21:38 -040012Library ONAPLibrary.ServiceMapping
13
DR695H910097e2019-05-08 13:55:32 -040014Resource ../openstack/keystone_interface.robot
15Resource ../openstack/nova_interface.robot
16Resource ../openstack/heat_interface.robot
17Resource ../ssh/files.robot
18Resource ../ssh/processes.robot
19Resource ../demo_preload.robot
DR695Hccff30b2017-02-17 18:44:24 -050020Resource packet_generator_interface.robot
DR695Hccff30b2017-02-17 18:44:24 -050021Resource validate_common.robot
DR695H910097e2019-05-08 13:55:32 -040022Resource ../test_templates/vnf_orchestration_test_template.robot
DR695Hccff30b2017-02-17 18:44:24 -050023
24
25*** Variables ***
DR695Hccff30b2017-02-17 18:44:24 -050026
27*** Keywords ***
Gary Wu76bc74f2018-03-22 13:25:49 -070028Policy Check FirewallCL Stack
jf986099c63292017-03-09 15:28:42 -050029 [Documentation] Executes the vFW policy closed loop test.
Gary Wu76bc74f2018-03-22 13:25:49 -070030 [Arguments] ${stacknamemap} ${policy_rate}
DR695Hccff30b2017-02-17 18:44:24 -050031 Run Openstack Auth Request auth
Gary Wu76bc74f2018-03-22 13:25:49 -070032 ${vsnk_stack_name}= Get From Dictionary ${stacknamemap} vFWSNK
33 ${vpkg_stack_name}= Get From Dictionary ${stacknamemap} vPKG
34 ${vsnk_stack_info}= Wait for Stack to Be Deployed auth ${vsnk_stack_name}
35 ${vpkg_stack_info}= Wait for Stack to Be Deployed auth ${vpkg_stack_name}
jf986099c63292017-03-09 15:28:42 -050036 ${server_list}= Get Openstack Servers auth
DR695Hccff30b2017-02-17 18:44:24 -050037 Log ${server_list}
Gary Wu76bc74f2018-03-22 13:25:49 -070038 ${vpkg_id}= Get From Dictionary ${vpkg_stack_info} vnf_id
39 ${status} ${generic_vnf}= Run Keyword And Ignore Error Get Generic VNF By ID ${vpkg_id}
40 Run Keyword If '${status}' == 'FAIL' FAIL VNF ID: ${vpkg_id} is not found.
41 ${invariantUUID} Get From Dictionary ${generic_vnf} persona-model-id
42 Update vVFWCL Policy ${invariantUUID}
43
Brian Freemanee02b312019-02-04 20:36:08 -050044 ${vpg_unprotected_ip}= Get From Dictionary ${vpkg_stack_info} vpg_int_unprotected_private_ip_0
45 ${vsn_protected_ip}= Get From Dictionary ${vsnk_stack_info} vsn_int_protected_private_ip_0
Gary Wu76bc74f2018-03-22 13:25:49 -070046 ${vpg_public_ip}= Get Server Ip ${server_list} ${vpkg_stack_info} vpg_name_0 network_name=public
47 ${vsn_public_ip}= Get Server Ip ${server_list} ${vsnk_stack_info} vsn_name_0 network_name=public
DR695Hccff30b2017-02-17 18:44:24 -050048 ${upper_bound}= Evaluate ${policy_rate}*2
Gary Wu76bc74f2018-03-22 13:25:49 -070049 Wait Until Keyword Succeeds 30m 2s Run VFW Policy Check ${vpg_public_ip} ${policy_rate} ${upper_bound} 1
DR695Hccff30b2017-02-17 18:44:24 -050050
51Run VFW Policy Check
jf986099c63292017-03-09 15:28:42 -050052 [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 -050053 [Arguments] ${vpg_public_ip} ${policy_rate} ${upper_bound} ${lower_bound}
54 # Force traffic above threshold
55 Check For Policy Enforcement ${vpg_public_ip} ${policy_rate} ${upper_bound}
56 # Force traffic below threshold
57 Check For Policy Enforcement ${vpg_public_ip} ${policy_rate} ${lower_bound}
58
jf986099c63292017-03-09 15:28:42 -050059
DR695Hccff30b2017-02-17 18:44:24 -050060Check For Policy Enforcement
jf986099c63292017-03-09 15:28:42 -050061 [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 -050062 [Arguments] ${vpg_public_ip} ${policy_rate} ${forced_rate}
63 Enable Streams ${vpg_public_ip} ${forced_rate}
Gary Wu76bc74f2018-03-22 13:25:49 -070064 Wait Until Keyword Succeeds 20s 2s Test For Expected Rate ${vpg_public_ip} ${forced_rate}
65 Wait Until Keyword Succeeds 10m 2s Test For Expected Rate ${vpg_public_ip} ${policy_rate}
DR695Hccff30b2017-02-17 18:44:24 -050066
67Test For Expected Rate
jf986099c63292017-03-09 15:28:42 -050068 [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 -050069 [Arguments] ${vpg_public_ip} ${number_of_streams}
70 ${list}= Get List Of Enabled Streams ${vpg_public_ip}
71 ${list}= Evaluate ${list['sample-plugin']}['pg-streams']['pg-stream']
jf986099c63292017-03-09 15:28:42 -050072 Length Should Be ${list} ${number_of_streams}
DR695Hccff30b2017-02-17 18:44:24 -050073
74
75
76Policy Check vLB Stack
jf986099c63292017-03-09 15:28:42 -050077 [Documentation] Executes the vLB policy closed loop test
78 [Arguments] ${stack_name} ${policy_rate}
DR695Hccff30b2017-02-17 18:44:24 -050079 Run Openstack Auth Request auth
80 ${stack_info}= Wait for Stack to Be Deployed auth ${stack_name}
81 ${stack_id}= Get From Dictionary ${stack_info} id
jf986099c63292017-03-09 15:28:42 -050082 ${server_list}= Get Openstack Servers auth
83 ${vlb_public_ip}= Get Server Ip ${server_list} ${stack_info} vlb_name_0 network_name=public
DR695Hccff30b2017-02-17 18:44:24 -050084 ${upper_bound}= Evaluate ${policy_rate}*2
jf986099c63292017-03-09 15:28:42 -050085 Start DNS Traffic ${vlb_public_ip} ${upper_bound}
DR695Hccff30b2017-02-17 18:44:24 -050086
87 # Now wiat for the dnsscaling stack to be deployed
88 ${prefix}= Get DNSScaling Prefix
jf986099c63292017-03-09 15:28:42 -050089 ${dnsscaling}= Replace String Using Regexp ${stack_name} ^Vfmodule_ ${prefix}
DR695Hccff30b2017-02-17 18:44:24 -050090 ${dnsscaling_info}= Wait for Stack to Be Deployed auth ${dnsscaling}
jf9860de6a6e22017-03-04 13:14:09 -050091 VLB Closed Loop Hack Update ${dnsscaling}
DR695Hccff30b2017-02-17 18:44:24 -050092 # TO DO: Log into vLB and cehck that traffic is flowing to the new DNS
jf986099c63292017-03-09 15:28:42 -050093 [Return] ${dnsscaling}
DR695Hccff30b2017-02-17 18:44:24 -050094
95Get DNSScaling Prefix
DR695Hfcb0ee82019-05-22 17:21:38 -040096 Set Directory default ./demo/service_mapping
97 ${mapping}= Get Service Template Mapping default vLB vLB
DR695H910097e2019-05-08 13:55:32 -040098 :FOR ${dict} IN @{mapping}
DR695Hccff30b2017-02-17 18:44:24 -050099 \ Return From Keyword If '${dict['isBase']}' == 'false' ${dict['prefix']}
100 [Return] None
jf986099c63292017-03-09 15:28:42 -0500101
DR695Hccff30b2017-02-17 18:44:24 -0500102
103Start DNS Traffic
104 [Documentation] Run nslookups at rate per second. Run for 10 minutes or until it is called by the terminate process
105 [Arguments] ${vlb_public_ip} ${rate}
106 ${pid}= Start Process ./dnstraffic.sh ${vlb_public_ip} ${rate} ${GLOBAL_DNS_TRAFFIC_DURATION}
Gary Wu76bc74f2018-03-22 13:25:49 -0700107 [Return] ${pid}