Add ping test in aclrecovery suite 21/81021/13
authorJayaPr <jaya.priyadarshini@ericsson.com>
Wed, 20 Mar 2019 16:58:10 +0000 (22:28 +0530)
committerFaseela K <faseela.k@ericsson.com>
Mon, 22 Apr 2019 06:09:32 +0000 (06:09 +0000)
Add ping test in aclrecovery suite.
The previous suite was checking for flows table,
Modified it to check for ping.

Change-Id: I9eb4756506963f58207d0b575a78ba68d16c31d9
Signed-off-by: JayaPr <jaya.priyadarshini@ericsson.com>
csit/suites/netvirt/aclservicerecovery/aclservicerecovery.robot
csit/testplans/netvirt-1node-openstack.txt
csit/testplans/netvirt-1node-tdd-wip-openstack.txt

index 1ffafa3c1c8592e54659a6d1d99dc2fdb87336b2..ef6bf620d5a1611448444c3bfe10d11e5d6150d7 100644 (file)
@@ -16,7 +16,6 @@ Library           String
 Resource          ../../../libraries/DevstackUtils.robot
 Resource          ../../../libraries/Genius.robot
 Resource          ../../../libraries/KarafKeywords.robot
 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
 Resource          ../../../libraries/OVSDB.robot
 Resource          ../../../libraries/OvsManager.robot
 Resource          ../../../libraries/OpenStackOperations.robot
@@ -41,24 +40,31 @@ ACL Service Recovery CLI
     ${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}
     ${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
     ${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}
 
 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}
     ${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
     Wait Until Keyword Succeeds    30s    5s    Verify Flow Counts Are Same    ${count_before}    ${EGRESS_LEARN_ACL_FILTER_TABLE}
 
 ACL Interface Recovery CLI
@@ -69,13 +75,17 @@ 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}
     ${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}
     ${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 ***
     Wait Until Keyword Succeeds    30s    5s    Verify Flow Counts Are Same    ${count_before}    ${EGRESS_ACL_TABLE}    port_mac=${port_mac}
 
 *** Keywords ***
@@ -83,23 +93,7 @@ Verify Flow Counts Are Same
     [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}
     [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.
 
 Suite Setup
     [Documentation]    Create Basic setup for the feature. Creates single network, subnet, two ports and two VMs.
@@ -113,3 +107,9 @@ Suite Setup
     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}
     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]
index 1436e308fc3d42e586217764b135a2fca46e3623..2cc937078bb9995ef24980af847477d5e9bb732b 100644 (file)
@@ -6,6 +6,7 @@ integration/test/csit/suites/openstack/connectivity/live_migration.robot
 integration/test/csit/suites/openstack/securitygroup/neutron_security_group.robot
 integration/test/csit/suites/openstack/securitygroup/security_group_l3bcast.robot
 integration/test/csit/suites/openstack/securitygroup/acl.robot
 integration/test/csit/suites/openstack/securitygroup/neutron_security_group.robot
 integration/test/csit/suites/openstack/securitygroup/security_group_l3bcast.robot
 integration/test/csit/suites/openstack/securitygroup/acl.robot
+integration/test/csit/suites/netvirt/aclservicerecovery/aclservicerecovery.robot
 integration/test/csit/suites/netvirt/vpnservice/vpn_basic.robot
 integration/test/csit/suites/netvirt/vpnservice/vpn_basic_ipv6.robot
 integration/test/csit/suites/netvirt/elan/elan.robot
 integration/test/csit/suites/netvirt/vpnservice/vpn_basic.robot
 integration/test/csit/suites/netvirt/vpnservice/vpn_basic_ipv6.robot
 integration/test/csit/suites/netvirt/elan/elan.robot
index 68270326faabf88213ffdb847429fba5a0b42e48..3a7e6b223bcf6003a8c1f64a80321a2abae8e4c4 100644 (file)
@@ -4,7 +4,6 @@
 integration/test/csit/suites/netvirt/vpnservice/vpn_basic_dualstack_one_router.robot
 integration/test/csit/suites/netvirt/vpnservice/vpn_basic_dualstack_subnet_routing.robot
 integration/test/csit/suites/netvirt/host_route/host_route_handling.robot
 integration/test/csit/suites/netvirt/vpnservice/vpn_basic_dualstack_one_router.robot
 integration/test/csit/suites/netvirt/vpnservice/vpn_basic_dualstack_subnet_routing.robot
 integration/test/csit/suites/netvirt/host_route/host_route_handling.robot
-integration/test/csit/suites/netvirt/aclservicerecovery/aclservicerecovery.robot
 integration/test/csit/suites/netvirt/snatdnat/snat_dnat.robot
 integration/test/csit/suites/netvirt/bgpmultipath/l3vpn_bgp_multipath.robot
 integration/test/csit/suites/netvirt/multibgpvpn/multi_vpn_bgp.robot
 integration/test/csit/suites/netvirt/snatdnat/snat_dnat.robot
 integration/test/csit/suites/netvirt/bgpmultipath/l3vpn_bgp_multipath.robot
 integration/test/csit/suites/netvirt/multibgpvpn/multi_vpn_bgp.robot