2 Documentation Test Suite for ACL Service Recovery:
3 ... The Service Recovery Manager provides
4 ... common interface to recover services in ODL.
5 ... This feature will register ACL service for recovery
6 ... and implement the mechanism to recover ACL service.
8 Library OperatingSystem
9 Library RequestsLibrary
11 Resource ../../../libraries/DevstackUtils.robot
12 Resource ../../../libraries/KarafKeywords.robot
13 Resource ../../../libraries/OVSDB.robot
14 Resource ../../../libraries/OvsManager.robot
15 Resource ../../../libraries/OpenStackOperations.robot
16 Resource ../../../libraries/SetupUtils.robot
17 Resource ../../../libraries/Utils.robot
18 Resource ../../../variables/netvirt/Variables.robot
19 Resource ../../../variables/Variables.robot
21 Suite Setup Suite Setup
22 Suite Teardown Run Keywords OpenStackOperations.OpenStack Suite Teardown
23 ... AND SetupUtils.Setup_Logging_For_Debug_Purposes_On_List_Or_All INFO ${TEST_LOG_COMPONENTS}
24 Test Setup Run Keywords SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
25 ... AND OpenStackOperations.Get DumpFlows And Ovsconfig ${OS_CMP1_CONN_ID}
26 Test Teardown OpenStackOperations.Get Test Teardown Debugs
30 ${acl_sr_security_group} acl_sr_sg
31 @{acl_sr_networks} acl_sr_net_1 acl_sr_net_2 acl_sr_net_3
32 @{acl_sr_subnets} acl_sr_sub_1 acl_sr_sub_2 acl_sr_sub_3
33 @{acl_sr_subnet_cidrs} 81.1.1.0/24 82.1.1.0/24 83.1.1.0/24
34 @{acl_sr_net_1_ports} acl_sr_net_1_port_1 acl_sr_net_1_port_2
35 @{acl_sr_net_1_vms} acl_sr_net_1_vm_1 acl_sr_net_1_vm_2
36 ${TEST_LOG_LEVEL} trace
37 @{TEST_LOG_COMPONENTS}
38 ... org.opendaylight.netvirt.aclservice
42 ACL Service Recovery CLI
43 [Documentation] This test case covers ACL service recovery.
44 ${count_before} = OvsManager.Get Dump Flows Count ${OS_CMP1_CONN_ID} ${INGRESS_ACL_REMOTE_ACL_TABLE}
45 ${node_id} = OVSDB.Get DPID ${OS_CMP1_IP}
46 ${resp} = RequestsLibrary.Delete Request
48 ... ${CONFIG_NODES_API}/node/openflow:${node_id}/flow-node-inventory:table/${INGRESS_ACL_REMOTE_ACL_TABLE}
49 BuiltIn.Should Be Equal As Strings ${resp.status_code} 200
50 OpenStackOperations.Ping From DHCP Should Not Succeed ${acl_sr_networks}[0] ${ACL_SR_NET_1_VM_IPS}[0]
51 ${flow_after_delete} = OvsManager.Get Dump Flows Count ${OS_CMP1_CONN_ID} ${INGRESS_ACL_REMOTE_ACL_TABLE}
52 BuiltIn.Should Be Equal As Strings ${flow_after_delete} 0
53 ${output} = Issue_Command_On_Karaf_Console srm:recover service acl
54 BuiltIn.Should Contain ${output} RPC call to recover was successful
55 OpenStackOperations.Ping Vm From DHCP Namespace ${acl_sr_networks}[0] ${ACL_SR_NET_1_VM_IPS}[0]
56 BuiltIn.Wait Until Keyword Succeeds
59 ... Verify Flow Counts Are Same
61 ... ${INGRESS_ACL_REMOTE_ACL_TABLE}
63 ACL Instance Recovery CLI
64 [Documentation] This test case covers ACL instance recovery.
65 ${count_before} = OvsManager.Get Dump Flows Count ${OS_CMP1_CONN_ID} ${EGRESS_LEARN_ACL_FILTER_TABLE}
66 ${node_id} = OVSDB.Get DPID ${OS_CMP1_IP}
67 Write Commands Until Expected Prompt
68 ... sudo ovs-ofctl del-flows br-int -OOpenflow13 "table=${EGRESS_LEARN_ACL_FILTER_TABLE},icmp"
69 ... ${DEFAULT_LINUX_PROMPT_STRICT}
70 Wait Until Keyword Succeeds
73 ... OVSDB.Verify Dump Flows For Specific Table
75 ... ${EGRESS_LEARN_ACL_FILTER_TABLE}
78 OpenStackOperations.Ping From DHCP Should Not Succeed ${acl_sr_networks}[0] ${ACL_SR_NET_1_VM_IPS}[0]
79 ${output} = OpenStack CLI openstack security group show ${acl_sr_security_group} | awk '/ id / {print $4}'
80 ${splitted_output} = String.Split String ${output} ${EMPTY}
81 ${instance_id} = Collections.Get from List ${splitted_output} 0
82 ${output} = Issue_Command_On_Karaf_Console srm:recover instance acl-instance ${instance_id}
83 BuiltIn.Should Contain ${output} RPC call to recover was successful
84 OpenStackOperations.Ping Vm From DHCP Namespace ${acl_sr_networks}[0] ${ACL_SR_NET_1_VM_IPS}[0]
85 Wait Until Keyword Succeeds
88 ... OVSDB.Verify Dump Flows For Specific Table
90 ... ${EGRESS_LEARN_ACL_FILTER_TABLE}
94 Wait Until Keyword Succeeds
97 ... Verify Flow Counts Are Same
99 ... ${EGRESS_LEARN_ACL_FILTER_TABLE}
101 ACL Interface Recovery CLI
102 [Documentation] This test case covers ACL interface recovery.
103 ${output} = OpenStack CLI openstack port show ${acl_sr_net_1_ports[0]} |awk '/ mac_address / {print$4}'
104 @{list} = Split String ${output}
105 ${port_mac} = Set Variable ${list[0]}
106 ${count_before} = OvsManager.Get Dump Flows Count
107 ... ${OS_CMP1_CONN_ID}
108 ... ${EGRESS_ACL_TABLE}
109 ... port_mac=${port_mac}
110 ${node_id} = OVSDB.Get DPID ${OS_CMP1_IP}
111 Write Commands Until Expected Prompt
112 ... sudo ovs-ofctl del-flows br-int -OOpenflow13 "table=${EGRESS_ACL_TABLE},dl_dst=${port_mac}"
113 ... ${DEFAULT_LINUX_PROMPT_STRICT}
114 OpenStackOperations.Ping From DHCP Should Not Succeed ${acl_sr_networks}[0] ${ACL_SR_NET_1_VM_IPS}[0]
115 Wait Until Keyword Succeeds
118 ... OVSDB.Verify Dump Flows For Specific Table
120 ... ${EGRESS_LEARN_ACL_FILTER_TABLE}
122 ... |grep ${port_mac}
123 ${output} = OpenStack CLI openstack port show ${acl_sr_net_1_ports[0]} |awk '/ id / {print$4}'
124 ${splitted_output} = String.Split String ${output} ${EMPTY}
125 ${interface_id} = Collections.Get from List ${splitted_output} 0
126 ${output} = Issue_Command_On_Karaf_Console srm:recover instance acl-interface ${interface_id}
127 BuiltIn.Should Contain ${output} RPC call to recover was successful
128 OpenStackOperations.Ping Vm From DHCP Namespace ${acl_sr_networks}[0] ${ACL_SR_NET_1_VM_IPS}[0]
129 Wait Until Keyword Succeeds
132 ... OVSDB.Verify Dump Flows For Specific Table
134 ... ${EGRESS_ACL_TABLE}
138 Wait Until Keyword Succeeds
141 ... Verify Flow Counts Are Same
143 ... ${EGRESS_ACL_TABLE}
144 ... port_mac=${port_mac}
148 Verify Flow Counts Are Same
149 [Documentation] Verify flows count should be same as before and after for a table id with a given port mac.
150 [Arguments] ${count_before} ${table_id} ${port_mac}=""
151 ${count_after} = OvsManager.Get Dump Flows Count ${OS_CMP1_CONN_ID} ${table_id} port_mac=${port_mac}
152 BuiltIn.Should Be Equal As Numbers ${count_before} ${count_after}
155 [Documentation] Create Basic setup for the feature. Creates single network, subnet, two ports and two VMs.
156 OpenStackOperations.OpenStack Suite Setup
157 SetupUtils.Setup_Logging_For_Debug_Purposes_On_List_Or_All ${TEST_LOG_LEVEL} ${TEST_LOG_COMPONENTS}
158 OpenStackOperations.Create Allow All SecurityGroup ${acl_sr_security_group}
159 OpenStackOperations.Create Network ${acl_sr_networks}[0]
160 OpenStackOperations.Create SubNet ${acl_sr_networks}[0] ${acl_sr_subnets}[0] ${acl_sr_subnet_cidrs[0]}
161 OpenStackOperations.Create Port ${acl_sr_networks}[0] ${acl_sr_net_1_ports[0]} sg=${acl_sr_security_group}
162 OpenStackOperations.Create Port ${acl_sr_networks}[0] ${acl_sr_net_1_ports[1]} sg=${acl_sr_security_group}
163 BuiltIn.Wait Until Keyword Succeeds
166 ... Utils.Check For Elements At URI
168 ... ${acl_sr_net_1_ports}
169 OpenStackOperations.Create Vm Instance With Port On Compute Node
170 ... ${acl_sr_net_1_ports[0]}
171 ... ${acl_sr_net_1_vms[0]}
172 ... ${OS_CMP1_HOSTNAME}
173 ... sg=${acl_sr_security_group}
174 OpenStackOperations.Create Vm Instance With Port On Compute Node
175 ... ${acl_sr_net_1_ports[1]}
176 ... ${acl_sr_net_1_vms[1]}
177 ... ${OS_CMP2_HOSTNAME}
178 ... sg=${acl_sr_security_group}
179 @{ACL_SR_NET_1_VM_IPS} ${net1_dhcp_ip} = OpenStackOperations.Get VM IPs @{acl_sr_net_1_vms}
180 BuiltIn.Set Suite Variable @{ACL_SR_NET_1_VM_IPS}
181 BuiltIn.Should Not Contain ${ACL_SR_NET_1_VM_IPS} None
182 BuiltIn.Should Not Contain ${net1_dhcp_ip} None
183 OpenStackOperations.Ping Vm From DHCP Namespace ${acl_sr_networks}[0] ${ACL_SR_NET_1_VM_IPS}[0]
184 OpenStackOperations.Ping Vm From DHCP Namespace ${acl_sr_networks}[0] ${ACL_SR_NET_1_VM_IPS}[1]