blob: a1ed3fa3cdb8edbb4a75e4bb9456080f099a41ce [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
20
21
22*** Variables ***
23${ASSETS} ${EXECDIR}/robot/assets/
24
25*** Keywords ***
26Policy 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
41Run 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
50Check 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
57Test 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
66Policy 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
84Get 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
91Start 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}