Add Mac Based L2L3 seggragation suite. 69/72769/31
authormpany <madhusmita.p@altencalsoftlabs.com>
Fri, 8 Jun 2018 00:20:54 +0000 (05:50 +0530)
committerSam Hague <shague@redhat.com>
Sat, 14 Jul 2018 17:42:42 +0000 (17:42 +0000)
Change-Id: If86415f0c0334faf543c7676bb660eca8ac1b7e3
Signed-off-by: mpany <madhusmita.p@altencalsoftlabs.com>
csit/libraries/OVSDB.robot
csit/libraries/OvsManager.robot
csit/suites/netvirt/l2l3_gatewaymac_arp.robot

index 2ee716650656d416c6e9637972a42ae5acbb0446..2922a02ea7aec2d5254e9393921d1ae39674cede 100644 (file)
@@ -437,3 +437,12 @@ Get Tunnel Id And Packet Count
     @{list} =    String.Split String    ${output}
     ${packet_count} =    Set Variable    @{list}[0]
     [Return]    ${tunnel_id}    ${packet_count}
+
+Verify Dump Flows For Specific Table
+    [Arguments]    ${compute_ip}    ${table_num}    ${flag}    ${additional_args}=${EMPTY}    @{matching_paras}
+    [Documentation]    To Verify flows are present for the corresponding table Number
+    ${flow_output} =    Utils.Run Command On Remote System    ${compute_ip}    ${DUMP_FLOWS}|grep table=${table_num} ${additional_args}
+    Log    ${flow_output}
+    : FOR    ${matching_str}    IN    @{matching_paras}
+    \    BuiltIn.Run Keyword If    ${flag}==True    BuiltIn.Should Contain    ${flow_output}    ${matching_str}
+    \    ...    ELSE    BuiltIn.Should Not Contain    ${flow_output}    ${matching_str}
index ccab7fdae3e8de86b833e6563b28527a886d7065..eb2c80cea3648f12591ac46ae4909eada8cf0405 100644 (file)
@@ -216,3 +216,13 @@ Get Dump Flows Count
     ${output} =    Utils.Write Commands Until Expected Prompt    ${cmd}    ${DEFAULT_LINUX_PROMPT_STRICT}
     @{list} =    String.Split String    ${output}
     [Return]    ${list[0]}
+
+Get Packet Count From Table
+    [Arguments]    ${system_ip}    ${br_name}    ${table_no}    ${addtioanal_args}=${EMPTY}
+    [Documentation]    Return packet count for the specific table no.
+    ${flow_output} =    Utils.Run Command On Remote System    ${system_ip}    sudo ovs-ofctl dump-flows -O Openflow13 ${br_name} | grep ${table_no} ${addtioanal_args}
+    @{output} =    String.Split String    ${flow_output}    \r\n
+    ${flow} =    Collections.Get From List    ${output}    0
+    ${packetcountlist} =    String.Get Regexp Matches    ${flow}    n_packets=([0-9]+),    1
+    ${packetcount} =    Collections.Get From List    ${packetcountlist}    0
+    [Return]    ${packetcount}
index 3ea183d28cc43dbbeae69cdd82561d72ef0b369b..4234e957b45683246f372adfb5b6de13d45d3545 100644 (file)
@@ -13,6 +13,7 @@ Resource          ../../libraries/DevstackUtils.robot
 Resource          ../../libraries/KarafKeywords.robot
 Resource          ../../libraries/OVSDB.robot
 Resource          ../../libraries/OpenStackOperations.robot
+Resource          ../../libraries/OvsManager.robot
 Resource          ../../libraries/SetupUtils.robot
 Resource          ../../libraries/Utils.robot
 Resource          ../../libraries/VpnOperations.robot
@@ -25,6 +26,7 @@ ${REQ_NUM_SUBNET}    2
 ${REQ_NUM_OF_PORTS}    4
 ${REQ_NUM_OF_VMS_PER_DPN}    2
 ${NUM_OF_PORTS_PER_HOST}    2
+${NEXTHOP}        0.0.0.0
 @{REQ_NETWORKS}    l2l3_gw_mac_arp_net1    l2l3_gw_mac_arp_net2
 @{VM_NAMES}       l2l3_gw_mac_arp_vm1    l2l3_gw_mac_arp_vm2    l2l3_gw_mac_arp_vm3    l2l3_gw_mac_arp_vm4
 @{NET_1_VMS}      l2l3_gw_mac_arp_vm1    l2l3_gw_mac_arp_vm2
@@ -37,20 +39,22 @@ ${REQ_ROUTER}     l2l3_gw_mac_arp_rtr1
 ${VPN_INSTANCE_ID}    4ae8cd92-48ca-49b5-94e1-b2921a261112
 ${VPN_NAME}       l2l3_gw_mac_arp_vpn1
 ${VPN_REST}       ${CONFIG_API}/odl-l3vpn:vpn-instance-to-vpn-id/
-${L3VPN_RD}       ["100:31"]
+${VRF_ID}         100:31
+${L3VPN_RD}       ["${VRF_ID}"]
 ${SECURITY_GROUP}    l2l3_gw_mac_arp_sg
-${TABLE_NO_0}     table=0
-${TABLE_NO_220}    table=220
+${TABLE_NO_0}     0
+${TABLE_NO_220}    220
 ${DUMP_FLOWS}     sudo ovs-ofctl -O OpenFlow13 dump-flows ${INTEGRATION_BRIDGE}
 ${GROUP_FLOWS}    sudo ovs-ofctl -O OpenFlow13 dump-groups ${INTEGRATION_BRIDGE}
 ${ARP_REQUEST_OPERATIONAL_CODE}    1
 ${ARP_RESPONSE_OPERATIONAL_CODE}    2
+${RESUBMIT_VALUE}    actions=resubmit\(,${DISPATCHER_TABLE}\)
+${PING_COUNT_VALUE}    0
 
 *** Test Cases ***
 Verify that table Miss entry for GWMAC table 19 points to table 17 dispatcher table
     [Documentation]    To Verify there should be an entry for table=17,in the table=19 DUMP_FLOWS
-    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${DUMP_FLOWS}|grep table=${GWMAC_TABLE}
-    BuiltIn.Should Contain    ${flow_output}    priority=0    actions=resubmit(,17)
+    OVSDB.Verify Dump Flows For Specific Table    ${OS_COMPUTE_1_IP}    ${GWMAC_TABLE}    True    ${EMPTY}    priority=0    actions=resubmit(,17)
 
 Verify the pipeline flow from dispatcher table 17 (L3VPN) to table 19
     [Documentation]    To Verify the end to end pipeline flow from table=17 to table=19 DUMP_FLOWS
@@ -58,20 +62,14 @@ Verify the pipeline flow from dispatcher table 17 (L3VPN) to table 19
     ${subport_id_2} =    OpenStackOperations.Get Sub Port Id    ${PORT_LIST[1]}
     ${port_num_1} =    OVSDB.Get Port Number    ${subport_id_1}    ${OS_COMPUTE_1_IP}
     ${port_num_2} =    OVSDB.Get Port Number    ${subport_id_2}    ${OS_COMPUTE_1_IP}
-    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${DUMP_FLOWS}|grep ${TABLE_NO_0}
-    BuiltIn.Should Contain    ${flow_output}    in_port=${port_num_1}    goto_table:${DISPATCHER_TABLE}
+    OVSDB.Verify Dump Flows For Specific Table    ${OS_COMPUTE_1_IP}    ${TABLE_NO_0}    True    ${EMPTY}    in_port=${port_num_1}    goto_table:${DISPATCHER_TABLE}
     ${metadata} =    OVSDB.Get Port Metadata    ${OS_COMPUTE_1_IP}    ${port_num_1}
-    ${RD} =    String.Get Regexp Matches    ${L3VPN_RD}    ([0-9]+:[0-9]+)
-    ${VRF_ID} =    Collections.Get From List    ${RD}    0
     ${vpn_id} =    VpnOperations.VPN Get L3VPN ID    ${VRF_ID}
-    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${DUMP_FLOWS}|grep table=${DISPATCHER_TABLE} | grep ${vpn_id}
-    BuiltIn.Should Contain    ${flow_output}    ${vpn_id}    goto_table:${GWMAC_TABLE}
+    OVSDB.Verify Dump Flows For Specific Table    ${OS_COMPUTE_1_IP}    ${DISPATCHER_TABLE}    True    |grep ${vpn_id}    ${vpn_id}    goto_table:${GWMAC_TABLE}
     ${gw_mac_addr} =    OpenStackOperations.Get Port Mac Address From Ip    ${DEFAULT_GATEWAY_IPS[0]}
-    Verify Flows Are Present For ARP    ${ARP_REQUEST_OPERATIONAL_CODE}    | grep ${metadata}
-    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${DUMP_FLOWS}|grep table=${ARP_RESPONSE_TABLE}
-    BuiltIn.Should Contain    ${flow_output}    set_field:${gw_mac_addr}    resubmit(,220)
-    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${DUMP_FLOWS}|grep ${TABLE_NO_220}
-    BuiltIn.Should Contain    ${flow_output}    output:${port_num_2}
+    Verify Flows Are Present For ARP    ${ARP_REQUEST_OPERATIONAL_CODE}    |grep ${metadata}
+    OVSDB.Verify Dump Flows For Specific Table    ${OS_COMPUTE_1_IP}    ${ARP_RESPONSE_TABLE}    True    ${EMPTY}    set_field:${gw_mac_addr}    resubmit(,220)
+    OVSDB.Verify Dump Flows For Specific Table    ${OS_COMPUTE_1_IP}    ${TABLE_NO_220}    True    ${EMPTY}    output:${port_num_2}
 
 Verify that ARP requests and ARP response received on GWMAC table are punted to controller for learning ,resubmitted to table 17,sent to ARP responder
     [Documentation]    To verify the ARP Request and ARP response entry should be there after the dump_groups and dispatcher table should point to ARP responder
@@ -80,8 +78,52 @@ Verify that ARP requests and ARP response received on GWMAC table are punted to
 
 Verify that table miss entry for table 17 should not point to table 81 arp table
     [Documentation]    To Verify there should not be an entry for the arp_responder_table in table=17
-    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${DUMP_FLOWS} | grep table=${DISPATCHER_TABLE} |grep priority=0
-    BuiltIn.Should Not Contain    ${flow_output}    goto_table:${ARP_RESPONSE_TABLE}
+    OVSDB.Verify Dump Flows For Specific Table    ${OS_COMPUTE_1_IP}    ${DISPATCHER_TABLE}    False    |grep priority=0    goto_table:${ARP_RESPONSE_TABLE}
+
+Verify that Multiple GWMAC entries in GWMAC table points to FIB table 21 (L3VPN pipeline)
+    [Documentation]    To Verify the one or more default gateway mac enteries on the table=19 flows that points to FIB table 21
+    ${gw_mac_addr_1} =    OpenStackOperations.Get Port Mac Address From Ip    ${DEFAULT_GATEWAY_IPS[0]}
+    ${gw_mac_addr_2} =    OpenStackOperations.Get Port Mac Address From Ip    ${DEFAULT_GATEWAY_IPS[1]}
+    OVSDB.Verify Dump Flows For Specific Table    ${OS_COMPUTE_1_IP}    ${GWMAC_TABLE}    True    ${EMPTY}    dl_dst=${gw_mac_addr_1}    actions=goto_table:${L3_TABLE}
+    ${pkt_count_before_ping} =    OvsManager.Get Packet Count From Table    ${OS_COMPUTE_1_IP}    ${INTEGRATION_BRIDGE}    table=${GWMAC_TABLE} | grep dl_dst=${gw_mac_addr_1}
+    ${output} =    OpenStackOperations.Execute Command on VM Instance    @{REQ_NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ping -c 8 @{NET_2_VM_IPS}[1]
+    BuiltIn.Should Contain    ${output}    64 bytes
+    ${pkt_count_after_ping} =    OvsManager.Get Packet Count From Table    ${OS_COMPUTE_1_IP}    ${INTEGRATION_BRIDGE}    table=${GWMAC_TABLE} | grep dl_dst=${gw_mac_addr_1}
+    ${pkt_diff} =    Evaluate    int(${pkt_count_after_ping})-int(${pkt_count_before_ping})
+    BuiltIn.Should Be True    ${pkt_diff} > ${PING_COUNT_VALUE}
+    ${pkt_count_before_ping} =    OvsManager.Get Packet Count From Table    ${OS_COMPUTE_2_IP}    ${INTEGRATION_BRIDGE}    table=${GWMAC_TABLE} | grep dl_dst=${gw_mac_addr_1}
+    ${output} =    OpenStackOperations.Execute Command on VM Instance    @{REQ_NETWORKS}[0]    @{NET_2_VM_IPS}[0]    ping -c 8 @{NET_1_VM_IPS}[1]
+    BuiltIn.Should Contain    ${output}    64 bytes
+    ${pkt_count_after_ping} =    OvsManager.Get Packet Count From Table    ${OS_COMPUTE_2_IP}    ${INTEGRATION_BRIDGE}    table=${GWMAC_TABLE} | grep dl_dst=${gw_mac_addr_1}
+    ${pkt_diff} =    Evaluate    int(${pkt_count_after_ping})-int(${pkt_count_before_ping})
+    BuiltIn.Should Be True    ${pkt_diff} > ${PING_COUNT_VALUE}
+
+Verify table miss entry of ARP responder table points to drop actions
+    [Documentation]    To Verify the default flow entry of table=81 drops when openflow controller connected to compute node
+    OVSDB.Verify Dump Flows For Specific Table    ${OS_COMPUTE_1_IP}    ${ARP_RESPONSE_TABLE}    True    |grep priority=0    actions=drop
+
+Verify ARP eth_type entries and actions for ARP request and ARP response are populated on GWMAC table
+    [Documentation]    To Verify the entry of ARP request(arp=1) and ARP response(arp=2) in table=19
+    OVSDB.Verify Dump Flows For Specific Table    ${OS_COMPUTE_1_IP}    ${GWMAC_TABLE}    True    ${EMPTY}    arp_op=${ARP_REQUEST_OPERATIONAL_CODE}    ${RESUBMIT_VALUE}
+
+Verify GWMAC entires are populated with Neutron Router MAC address per network in GWMAC table
+    [Documentation]    To Verify gateway mac entires are populated with neutron router mac address for network with vpn dissociation from router
+    VpnOperations.Dissociate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID}
+    ${gw_mac_addr} =    OpenStackOperations.Get Port Mac Address From Ip    ${DEFAULT_GATEWAY_IPS[1]}
+    BuiltIn.Wait Until Keyword Succeeds    60s    15s    OVSDB.Verify Dump Flows For Specific Table    ${OS_COMPUTE_1_IP}    ${GWMAC_TABLE}    True
+    ...    ${EMPTY}    dl_dst=${gw_mac_addr}    actions=goto_table:${L3_TABLE}
+    ${output} =    VpnOperations.Get Fib Entries    session
+    BuiltIn.Should Match Regexp    ${output}    .*@{DEFAULT_GATEWAY_IPS}[1]/32.*${NEXTHOP}
+
+Verify GWMAC entires are populated with port MAC address for network with vpn association to router in GWMAC table
+    [Documentation]    To Verify gateway mac entires are populated with port MAC address for network with vpn association to router
+    VpnOperations.Associate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID}
+    ${gw_mac_addr} =    OpenStackOperations.Get Port Mac Address From Ip    ${DEFAULT_GATEWAY_IPS[1]}
+    BuiltIn.Wait Until Keyword Succeeds    60s    15s    OVSDB.Verify Dump Flows For Specific Table    ${OS_COMPUTE_1_IP}    ${GWMAC_TABLE}    True
+    ...    ${EMPTY}    dl_dst=${gw_mac_addr}    actions=goto_table:${L3_TABLE}
+    ${output} =    VpnOperations.Get Fib Entries    session
+    BuiltIn.Should Match Regexp    ${output}    .*${VRF_ID}.*${REQ_SUBNET_CIDR[0]}
+    BuiltIn.Should Match Regexp    ${output}    .*${VRF_ID}.*${REQ_SUBNET_CIDR[1]}
 
 *** Keywords ***
 Start Suite
@@ -121,6 +163,8 @@ Create Nova VMs
     \    OpenStackOperations.Create Vm Instance With Port On Compute Node    ${PORT_LIST[${index}]}    ${VM_NAMES[${index}]}    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
     @{NET_1_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
     @{NET_2_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
+    BuiltIn.Set Suite Variable    @{NET_1_VM_IPS}
+    BuiltIn.Set Suite Variable    @{NET_2_VM_IPS}
     BuiltIn.Should Not Contain    @{NET_1_VM_IPS}    None
     BuiltIn.Should Not Contain    @{NET_2_VM_IPS}    None
     BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
@@ -137,8 +181,9 @@ Create Setup
     Add Interfaces To Routers
     Create Nova VMs    ${REQ_NUM_OF_VMS_PER_DPN}
     ${router_id} =    OpenStackOperations.Get Router Id    ${REQ_ROUTER}
+    Builtin.Set Suite Variable    ${router_id}
     VpnOperations.VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID}    name=${VPN_NAME}    rd=${L3VPN_RD}    exportrt=${L3VPN_RD}    importrt=${L3VPN_RD}
-    Associate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID}
+    VpnOperations.Associate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID}
     ${resp} =    VpnOperations.VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID}
 
 Add Interfaces To Routers
@@ -153,12 +198,12 @@ Add Interfaces To Routers
 Verify Flows Are Present For ARP
     [Arguments]    ${arp_op_code}    ${additional_args}=${EMPTY}
     [Documentation]    Verify Flows Are Present For ARP entry
-    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${DUMP_FLOWS}|grep table=${GWMAC_TABLE}
-    BuiltIn.Should Contain    ${flow_output}    arp,arp_op=${arp_op_code} actions=resubmit(,17)
-    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${DUMP_FLOWS}|grep table=${DISPATCHER_TABLE} ${additional_args}
+    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${DUMP_FLOWS} | grep table=${GWMAC_TABLE}
+    BuiltIn.Should Contain    ${flow_output}    arp,arp_op=${arp_op_code} ${RESUBMIT_VALUE}
+    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${DUMP_FLOWS} | grep table=${DISPATCHER_TABLE} ${additional_args}
     BuiltIn.Should Contain    ${flow_output}    goto_table:${ARP_CHECK_TABLE}
-    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${DUMP_FLOWS}|grep table=${ARP_CHECK_TABLE}
+    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${DUMP_FLOWS} | grep table=${ARP_CHECK_TABLE}
     @{group_id} =    String.Get Regexp Matches    ${flow_output}    group:(\\d+)    1
     BuiltIn.Should Contain    ${flow_output}    arp,arp_op=1 actions=group:${group_id[0]}
-    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${GROUP_FLOWS}|grep group_id=${group_id[0]}
+    ${flow_output} =    Utils.Run Command On Remote System    ${OS_COMPUTE_1_IP}    ${GROUP_FLOWS} | grep group_id=${group_id[0]}
     BuiltIn.Should Contain    ${flow_output}    bucket=actions=resubmit(,81)