Append 3 more punt path protection TCs 94/79594/3
authorshahid_calsoft <mohammad.shahid@altencalsoftlabs.com>
Thu, 17 Jan 2019 14:09:33 +0000 (19:39 +0530)
committerJamo Luhrsen <jluhrsen@redhat.com>
Mon, 21 Jan 2019 20:22:04 +0000 (20:22 +0000)
Change-Id: I3d9d0c201ad20f7f79e261bcebe47356dc12eede
Signed-off-by: shahid_calsoft <mohammad.shahid@altencalsoftlabs.com>
csit/suites/netvirt/ofpunt_path/openflow_punt_path_protection.robot

index 336ab88d0352a003631ab97933bb678b72779d81..2a3de3c2cf9073510e484b21a51249dc880ca04e 100644 (file)
@@ -6,6 +6,7 @@ Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
 Test Teardown     OpenStackOperations.Get Test Teardown Debugs
 Resource          ../../../libraries/ClusterManagement.robot
 Resource          ../../../libraries/OpenStackOperations.robot
+Resource          ../../../libraries/OvsManager.robot
 Resource          ../../../libraries/OVSDB.robot
 Resource          ../../../libraries/Utils.robot
 Resource          ../../../libraries/VpnOperations.robot
@@ -40,6 +41,11 @@ ${ARP_ORIGINAL_TIMEOUT}    5
 @{ORIGINAL_TIMEOUTS}    ${L3_ORIGINAL_TIMEOUT}    ${SNAT_ORIGINAL_TIMEOUT}    ${ARP_ORIGINAL_TIMEOUT}
 @{OF_PUNT_TABLES}    ${L3_PUNT_TABLE}    ${SNAT_PUNT_TABLE}    ${ARP_PUNT_TABLE}    ${ARP_LEARN_TABLE}
 @{VALID_TIMEOUTS}    20    30    100    1000    10000
+${TCP_PORT}       80
+${UDP_PORT}       33435
+${TELNET_PORT}    23
+${ARP_REG}        0x1
+${GARP_REG}       0x101
 
 *** Test Cases ***
 Verify default punt timeout values and flows
@@ -89,6 +95,62 @@ Set punt timeout to combination of valid ranges and verfiy flows
     \    ...    True    ${EMPTY}    learn(table=${SNAT_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[${index}]
     Set Original TimeOut In Xml    @{VALID_TIMEOUTS}[4]
 
+Verify learnt flow for subnet route flow table
+    [Documentation]    Get default subnet table packet count before sending traffic to unkwon destination.
+    ...    Send subnet route traffic using Ping with packet count 5.
+    ...    Punt the first packet to controller and add new rule to stop pipeline processing.
+    ...    Check packet count before and after traffic for both(defualt and learnt tables).
+    : FOR    ${index}    IN RANGE    0    3
+    \    Change Hard Timeout Value In XML File    @{FILES_PATH}[${index}]    @{ORIGINAL_TIMEOUTS}[${index}]    @{VALID_TIMEOUTS}[0]
+    \    Verify Punt Values In XML File    @{FILES_PATH}[${index}]    @{VALID_TIMEOUTS}[0]
+    ClusterManagement.Stop_Members_From_List_Or_All
+    ClusterManagement.Start_Members_From_List_Or_All
+    BuiltIn.Wait Until Keyword Succeeds    120s    20s    OVSDB.Check OVS OpenFlow Connections    ${OS_CMP1_IP}    2
+    ${count_before_traffic} =    OvsManager.Get Packet Count From Table    ${OS_CMP1_IP}    ${INTEGRATION_BRIDGE}    table=${L3_PUNT_TABLE},    |grep "ip actions=CONTROLLER:65535,learn(table=${L3_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]"
+    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[0]    @{VM_IPS}[0]    sudo ping -c 5 @{EXTRA_NW_IP}[1]
+    OVSDB.Verify Dump Flows For Specific Table    ${OS_CMP1_IP}    ${L3_PUNT_TABLE}    True    ${EMPTY}    nw_dst=@{EXTRA_NW_IP}[1] actions=drop
+    ${learnt_packet_count}    OvsManager.Get Packet Count From Table    ${OS_CMP1_IP}    ${INTEGRATION_BRIDGE}    table=${L3_PUNT_TABLE},    |grep "nw_dst=@{EXTRA_NW_IP}[1] actions=drop"
+    BuiltIn.Should be true    ${learnt_packet_count} > 1
+    ${count_after_traffic}    OvsManager.Get Packet Count From Table    ${OS_CMP1_IP}    ${INTEGRATION_BRIDGE}    table=${L3_PUNT_TABLE},    |grep "ip actions=CONTROLLER:65535,learn(table=${L3_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]"
+    ${count_before_traffic} =    BuiltIn.Evaluate    ${count_before_traffic} + 1
+    BuiltIn.Should be true    ${count_after_traffic} == ${count_before_traffic}
+
+Verify learnt flow for UDP in SNAT flow table
+    [Documentation]    Get default SNAT table packet count before sending traffic to unkwon destination.
+    ...    Send UDP traffic using traceroute with packet count 4.
+    ...    Punt the first packet to controller and add new rule to stop pipeline processing.
+    ...    Check packet count before and after traffic for both(defualt and learnt tables).
+    ${compute_ip}    Get NAPT Switch IP From DPID    @{ROUTERS}[1]
+    OVSDB.Verify Dump Flows For Specific Table    ${compute_ip}    ${SNAT_PUNT_TABLE}    @{VALID_TIMEOUTS}[0]
+    ${count_before_traffic} =    OvsManager.Get Packet Count From Table    ${compute_ip}    ${INTEGRATION_BRIDGE}    table=${SNAT_PUNT_TABLE}    |grep "table=46.*n_packets=[\0-9+].*udp.*learn(table=46"
+    BuiltIn.Should be true    ${count_before_traffic} == 0
+    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[2]    @{VM_IPS}[4]    traceroute @{EXTRA_NW_IP}[2] -w 1 -q 1 -m 4
+    OVSDB.Verify Dump Flows For Specific Table    ${compute_ip}    ${SNAT_PUNT_TABLE}    True    ${EMPTY}    tp_dst=${UDP_PORT} actions=drop
+    ${count_after_traffic} =    OvsManager.Get Packet Count From Table    ${compute_ip}    ${INTEGRATION_BRIDGE}    table=${SNAT_PUNT_TABLE}    |grep "table=46.*n_packets=[\0-9+].*udp.*learn(table=46"
+    ${count_before_traffic} =    BuiltIn.Evaluate    ${count_before_traffic} + 1
+    BuiltIn.Should be true    ${count_after_traffic} == ${count_before_traffic}
+    OVSDB.Verify Dump Flows For Specific Table    ${compute_ip}    ${SNAT_PUNT_TABLE}    True    ${EMPTY}    actions=set_field:${EXT_SUBNETS_FIXED_IP}->ip_src
+    ${controller_packet_count} =    OvsManager.Get Packet Count From Table    ${compute_ip}    ${INTEGRATION_BRIDGE}    table=${SNAT_PUNT_TABLE}    |grep "table=46.*n_packets=[\0-9+].*udp.*nw_src=@{VM_IPS}[4].*actions=set_field:${EXT_SUBNETS_FIXED_IP}.*goto_table:47"
+    BuiltIn.Should be true    ${controller_packet_count} > 1
+
+Verify learnt flow for TCP in SNAT flow table
+    [Documentation]    Get default SNAT table packet count before sending traffic to unkwon destination.
+    ...    Send TCP traffic using wget.
+    ...    Punt the first packet to controller and add new rule to stop pipeline processing.
+    ...    Check packet count before and after traffic for both(defualt and learnt tables).
+    ${compute_ip}    Get NAPT Switch IP From DPID    @{ROUTERS}[1]
+    OVSDB.Verify Dump Flows For Specific Table    ${compute_ip}    ${SNAT_PUNT_TABLE}    @{VALID_TIMEOUTS}[0]
+    ${count_before_traffic} =    OvsManager.Get Packet Count From Table    ${compute_ip}    ${INTEGRATION_BRIDGE}    table=${SNAT_PUNT_TABLE}    |grep "table=46.*n_packets=[\0-9+].*tcp.*learn(table=46"
+    BuiltIn.Should be true    ${count_before_traffic} == 0
+    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[2]    @{VM_IPS}[4]    wget -qc http://@{EXTRA_NW_IP}[2]/ &
+    OVSDB.Verify Dump Flows For Specific Table    ${compute_ip}    ${SNAT_PUNT_TABLE}    True    ${EMPTY}    tp_dst=${TCP_PORT} actions=drop
+    ${count_after_traffic} =    OvsManager.Get Packet Count From Table    ${compute_ip}    ${INTEGRATION_BRIDGE}    table=${SNAT_PUNT_TABLE}    |grep "table=46.*n_packets=[\0-9+].*tcp.*learn(table=46"
+    ${count_before_traffic} =    BuiltIn.Evaluate    ${count_before_traffic} + 1
+    BuiltIn.Should be true    ${count_after_traffic} == ${count_before_traffic}
+    OVSDB.Verify Dump Flows For Specific Table    ${compute_ip}    ${SNAT_PUNT_TABLE}    True    ${EMPTY}    actions=set_field:${EXT_SUBNETS_FIXED_IP}->ip_src
+    ${controller_packet_count} =    OvsManager.Get Packet Count From Table    ${compute_ip}    ${INTEGRATION_BRIDGE}    table=${SNAT_PUNT_TABLE}    |grep "table=46.*n_packets=[\0-9+].*tcp.*nw_src=@{VM_IPS}[4].*actions=set_field:${EXT_SUBNETS_FIXED_IP}.*goto_table:47"
+    BuiltIn.Should be true    ${controller_packet_count} > 1
+
 *** Keywords ***
 Suite Setup
     [Documentation]    Create common setup related to openflow punt path protection