Resource ../../../libraries/DevstackUtils.robot
Resource ../../../libraries/Genius.robot
Resource ../../../libraries/KarafKeywords.robot
-Resource ../../../variables/netvirt/Variables.robot
Resource ../../../libraries/OVSDB.robot
Resource ../../../libraries/OvsManager.robot
Resource ../../../libraries/OpenStackOperations.robot
${count_before} = OvsManager.Get Dump Flows Count ${OS_CMP1_CONN_ID} ${INGRESS_ACL_REMOTE_ACL_TABLE}
${node_id} = OVSDB.Get DPID ${OS_CMP1_IP}
${resp} = RequestsLibrary.Delete Request session ${CONFIG_NODES_API}/node/openflow:${node_id}/flow-node-inventory:table/${INGRESS_ACL_REMOTE_ACL_TABLE}
- Should Be Equal As Strings ${resp.status_code} 200
- Wait Until Keyword Succeeds 30s 5s Verify ACL Flows Should Not Contain ${OS_CMP1_CONN_ID} ${INGRESS_ACL_REMOTE_ACL_TABLE}
+ BuiltIn.Should Be Equal As Strings ${resp.status_code} 200
+ OpenStackOperations.Ping From DHCP Should Not Succeed @{acl_sr_networks}[0] @{ACL_SR_NET_1_VM_IPS}[0]
+ ${flow_after_delete} = OvsManager.Get Dump Flows Count ${OS_CMP1_CONN_ID} ${INGRESS_ACL_REMOTE_ACL_TABLE}
+ BuiltIn.Should Be Equal As Strings ${flow_after_delete} 0
${output} = Issue_Command_On_Karaf_Console srm:recover service acl
- Should Contain ${output} RPC call to recover was successful
- Wait Until Keyword Succeeds 30s 5s Verify Flow Counts Are Same ${count_before} ${INGRESS_ACL_REMOTE_ACL_TABLE}
+ BuiltIn.Should Contain ${output} RPC call to recover was successful
+ OpenStackOperations.Ping Vm From DHCP Namespace @{acl_sr_networks}[0] @{ACL_SR_NET_1_VM_IPS}[0]
+ BuiltIn.Wait Until Keyword Succeeds 30s 5s Verify Flow Counts Are Same ${count_before} ${INGRESS_ACL_REMOTE_ACL_TABLE}
ACL Instance Recovery CLI
[Documentation] This test case covers ACL instance recovery.
${count_before} = OvsManager.Get Dump Flows Count ${OS_CMP1_CONN_ID} ${EGRESS_LEARN_ACL_FILTER_TABLE}
${node_id} = OVSDB.Get DPID ${OS_CMP1_IP}
Write Commands Until Expected Prompt sudo ovs-ofctl del-flows br-int -OOpenflow13 "table=${EGRESS_LEARN_ACL_FILTER_TABLE},icmp" ${DEFAULT_LINUX_PROMPT_STRICT}
- Wait Until Keyword Succeeds 30s 5s Verify ACL Flows Should Not Contain ${OS_CMP1_CONN_ID} ${EGRESS_LEARN_ACL_FILTER_TABLE} icmp
+ Wait Until Keyword Succeeds 30s 5s OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${EGRESS_LEARN_ACL_FILTER_TABLE} False
+ ... |grep icmp
+ OpenStackOperations.Ping From DHCP Should Not Succeed @{acl_sr_networks}[0] @{ACL_SR_NET_1_VM_IPS}[0]
${output} = OpenStack CLI openstack security group show ${acl_sr_security_group} | awk '/ id / {print $4}'
${splitted_output} = String.Split String ${output} ${EMPTY}
${instance_id} = Collections.Get from List ${splitted_output} 0
${output} = Issue_Command_On_Karaf_Console srm:recover instance acl-instance ${instance_id}
- Should Contain ${output} RPC call to recover was successful
- Wait Until Keyword Succeeds 30s 5s Verify ACL Flows Should Contain ${OS_CMP1_CONN_ID} ${EGRESS_LEARN_ACL_FILTER_TABLE} icmp
+ BuiltIn.Should Contain ${output} RPC call to recover was successful
+ OpenStackOperations.Ping Vm From DHCP Namespace @{acl_sr_networks}[0] @{ACL_SR_NET_1_VM_IPS}[0]
+ Wait Until Keyword Succeeds 30s 5s OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${EGRESS_LEARN_ACL_FILTER_TABLE} True
+ ... ${EMPTY} icmp
Wait Until Keyword Succeeds 30s 5s Verify Flow Counts Are Same ${count_before} ${EGRESS_LEARN_ACL_FILTER_TABLE}
ACL Interface Recovery CLI
${count_before} = OvsManager.Get Dump Flows Count ${OS_CMP1_CONN_ID} ${EGRESS_ACL_TABLE} port_mac=${port_mac}
${node_id} OVSDB.Get DPID ${OS_CMP1_IP}
Write Commands Until Expected Prompt sudo ovs-ofctl del-flows br-int -OOpenflow13 "table=${EGRESS_ACL_TABLE},dl_dst=${port_mac}" ${DEFAULT_LINUX_PROMPT_STRICT}
- Wait Until Keyword Succeeds 30s 5s Verify ACL Flows Should Not Contain ${OS_CMP1_CONN_ID} ${EGRESS_ACL_TABLE} ${port_mac}
+ OpenStackOperations.Ping From DHCP Should Not Succeed @{acl_sr_networks}[0] @{ACL_SR_NET_1_VM_IPS}[0]
+ Wait Until Keyword Succeeds 30s 5s OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${EGRESS_LEARN_ACL_FILTER_TABLE} False
+ ... |grep ${port_mac}
${output} = OpenStack CLI openstack port show ${acl_sr_net_1_ports[0]} |awk '/ id / {print$4}'
${splitted_output} = String.Split String ${output} ${EMPTY}
${interface_id} = Collections.Get from List ${splitted_output} 0
${output} = Issue_Command_On_Karaf_Console srm:recover instance acl-interface ${interface_id}
- Should Contain ${output} RPC call to recover was successful
- Wait Until Keyword Succeeds 30s 5s Verify ACL Flows Should Contain ${OS_CMP1_CONN_ID} ${EGRESS_ACL_TABLE} ${port_mac}
+ BuiltIn.Should Contain ${output} RPC call to recover was successful
+ OpenStackOperations.Ping Vm From DHCP Namespace @{acl_sr_networks}[0] @{ACL_SR_NET_1_VM_IPS}[0]
+ Wait Until Keyword Succeeds 30s 5s OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${EGRESS_ACL_TABLE} True
+ ... ${EMPTY} ${port_mac}
Wait Until Keyword Succeeds 30s 5s Verify Flow Counts Are Same ${count_before} ${EGRESS_ACL_TABLE} port_mac=${port_mac}
*** Keywords ***
[Arguments] ${count_before} ${table_id} ${port_mac}=""
[Documentation] Verify flows count should be same as before and after for a table id with a given port mac.
${count_after} = OvsManager.Get Dump Flows Count ${OS_CMP1_CONN_ID} ${table_id} port_mac=${port_mac}
- Should Be Equal As Numbers ${count_before} ${count_after}
-
-Verify ACL Flows Should Not Contain
- [Arguments] ${conn_id} ${table_id} ${acl_var}=${None}
- [Documentation] Verify dump flows should not be having the table id.
- SSHLibrary.Switch Connection ${conn_id}
- ${output} = Write Commands Until Expected Prompt sudo ovs-ofctl dump-flows br-int -OOpenFlow13 | grep table=${table_id} ${DEFAULT_LINUX_PROMPT_STRICT}
- BuiltIn.Run Keyword If '${acl_var}'=='None' Should Not Contain ${output} table=${table_id}
- ... ELSE Should Not Contain ${output} ${acl_var}
-
-Verify ACL Flows Should Contain
- [Arguments] ${conn_id} ${table_id} ${acl_var}=${None}
- [Documentation] Verify dump flows should be having the table id.
- SSHLibrary.Switch Connection ${conn_id}
- ${output} = Write Commands Until Expected Prompt sudo ovs-ofctl dump-flows br-int -OOpenFlow13 | grep table=${table_id} ${DEFAULT_LINUX_PROMPT_STRICT}
- BuiltIn.Run Keyword If '${acl_var}'=='None' Should Contain ${output} table=${table_id}
- ... ELSE Should Contain ${output} ${acl_var}
+ BuiltIn.Should Be Equal As Numbers ${count_before} ${count_after}
Suite Setup
[Documentation] Create Basic setup for the feature. Creates single network, subnet, two ports and two VMs.
BuiltIn.Wait Until Keyword Succeeds 3s 1s Utils.Check For Elements At URI ${PORT_URL} ${acl_sr_net_1_ports}
OpenStackOperations.Create Vm Instance With Port On Compute Node ${acl_sr_net_1_ports[0]} ${acl_sr_net_1_vms[0]} ${OS_CMP1_HOSTNAME} sg=${acl_sr_security_group}
OpenStackOperations.Create Vm Instance With Port On Compute Node ${acl_sr_net_1_ports[1]} ${acl_sr_net_1_vms[1]} ${OS_CMP2_HOSTNAME} sg=${acl_sr_security_group}
+ @{ACL_SR_NET_1_VM_IPS} ${net1_dhcp_ip} = OpenStackOperations.Get VM IPs @{acl_sr_net_1_vms}
+ BuiltIn.Set Suite Variable @{ACL_SR_NET_1_VM_IPS}
+ BuiltIn.Should Not Contain ${ACL_SR_NET_1_VM_IPS} None
+ BuiltIn.Should Not Contain ${net1_dhcp_ip} None
+ OpenStackOperations.Ping Vm From DHCP Namespace @{acl_sr_networks}[0] @{ACL_SR_NET_1_VM_IPS}[0]
+ OpenStackOperations.Ping Vm From DHCP Namespace @{acl_sr_networks}[0] @{ACL_SR_NET_1_VM_IPS}[1]