Update remaining tests for combos
[integration/test.git] / csit / suites / netvirt / vnibasedl2switching / vnibasedl2switching.robot
1 *** Settings ***
2 Documentation     Test Suite for vni-based-l2-l3-nat:
3 ...               This feature attempts to realize the use of VxLAN VNI
4 ...               (Virtual Network Identifier) for VxLAN tenant traffic
5 ...               flowing on the cloud data-network. This is applicable
6 ...               to L2 switching, L3 forwarding and NATing for all VxLAN
7 ...               based provider networks. In doing so, it eliminates the
8 ...               presence of LPort tags, ELAN tags and MPLS labels on the
9 ...               wire and instead, replaces them with VNIs supplied by the
10 ...               tenant’s OpenStack.
11 Suite Setup       Start Suite
12 Suite Teardown    Stop Suite
13 Test Setup        VpnOperations.VNI Test Setup
14 Test Teardown     VpnOperations.VNI Test Teardown
15 Library           OperatingSystem
16 Library           RequestsLibrary
17 Library           String
18 Resource          ../../../libraries/DevstackUtils.robot
19 Resource          ../../../libraries/KarafKeywords.robot
20 Resource          ../../../variables/netvirt/Variables.robot
21 Resource          ../../../libraries/OpenStackOperations.robot
22 Resource          ../../../libraries/OVSDB.robot
23 Resource          ../../../libraries/SetupUtils.robot
24 Resource          ../../../libraries/Utils.robot
25 Resource          ../../../libraries/VpnOperations.robot
26 Resource          ../../../variables/netvirt/Variables.robot
27 Resource          ../../../variables/Variables.robot
28
29 *** Variables ***
30 ${EGRESS}         Egress
31 ${INGRESS}        Ingress
32 ${VNI_SECURITY_GROUP}    vni_l2_sg
33 @{VNI_NETWORKS}    vni_l2_net_1
34 @{VNI_SUBNETS}    vni_l2_sub_1    vni_l2_sub_2    vni_l2_sub_3
35 @{VNI_SUBNET_CIDRS}    71.1.1.0/24    72.1.1.0/24    73.1.1.0/24
36 @{VNI_NET_1_PORTS}    vni_l2_net_1_port_1    vni_l2_net_1_port_2
37 @{VNI_NET_1_VMS}    vni_l2_net_1_vm_1    vni_l2_net_1_vm_2
38
39 *** Test Cases ***
40 VNI Based L2 Switching
41     [Documentation]    verify VNI id for L2 Unicast frames exchanged over OVS datapaths that are on different hypervisors
42     BuiltIn.Pass Execution If    "${OS_DEPLOY}" == "1cmb-0ctl-0cmp"    "Test is not supported for combo node"
43     ${port_mac1} =    OpenStackOperations.Get Port Mac    @{VNI_NET_1_PORTS}[0]
44     ${port_mac2} =    OpenStackOperations.Get Port Mac    @{VNI_NET_1_PORTS}[1]
45     ${segmentation_id} =    OpenStackOperations.Get Network Segmentation Id    @{VNI_NETWORKS}[0]
46     ${output} =    OpenStackOperations.Execute Command on VM Instance    @{VNI_NETWORKS}[0]    @{VNI_NET_1_VM_IPS}[0]    ping -c ${DEFAULT_PING_COUNT} @{VNI_NET_1_VM_IPS}[1]
47     ${egress_tun_id}    ${before_count_egress_port1} =    OVSDB.Get Tunnel Id And Packet Count    ${OS_CMP1_CONN_ID}    ${ELAN_DMACTABLE}    direction=${EGRESS}    tun_id=${segmentation_id}
48     ...    dst_mac=${port_mac2}
49     BuiltIn.Should Be Equal As Numbers    ${segmentation_id}    ${egress_tun_id}
50     ${egress_tun_id}    ${before_count_egress_port2} =    OVSDB.Get Tunnel Id And Packet Count    ${OS_CMP2_CONN_ID}    ${ELAN_DMACTABLE}    direction=${EGRESS}    tun_id=${segmentation_id}
51     ...    dst_mac=${port_mac1}
52     BuiltIn.Should Be Equal As Numbers    ${segmentation_id}    ${egress_tun_id}
53     ${ingress_tun_id}    ${before_count_ingress_port1} =    OVSDB.Get Tunnel Id And Packet Count    ${OS_CMP1_CONN_ID}    ${INTERNAL_TUNNEL_TABLE}    direction=${INGRESS}    tun_id=${segmentation_id}
54     BuiltIn.Should Be Equal As Numbers    ${segmentation_id}    ${ingress_tun_id}
55     ${ingress_tun_id}    ${before_count_ingress_port2} =    OVSDB.Get Tunnel Id And Packet Count    ${OS_CMP2_CONN_ID}    ${INTERNAL_TUNNEL_TABLE}    direction=${INGRESS}    tun_id=${segmentation_id}
56     BuiltIn.Should Be Equal As Numbers    ${segmentation_id}    ${ingress_tun_id}
57     ${output} =    OpenStackOperations.Execute Command on VM Instance    @{VNI_NETWORKS}[0]    @{VNI_NET_1_VM_IPS}[0]    ping -c ${DEFAULT_PING_COUNT} @{VNI_NET_1_VM_IPS}[1]
58     BuiltIn.Should Contain    ${output}    64 bytes
59     ${tun_id}    ${after_count_egress_port1} =    OVSDB.Get Tunnel Id And Packet Count    ${OS_CMP1_CONN_ID}    ${ELAN_DMACTABLE}    direction=${EGRESS}    tun_id=${segmentation_id}
60     ...    dst_mac=${port_mac2}
61     ${tun_id}    ${after_count_ingress_port1} =    OVSDB.Get Tunnel Id And Packet Count    ${OS_CMP1_CONN_ID}    ${INTERNAL_TUNNEL_TABLE}    direction=${INGRESS}    tun_id=${segmentation_id}
62     ${tun_id}    ${after_count_egress_port2} =    OVSDB.Get Tunnel Id And Packet Count    ${OS_CMP2_CONN_ID}    ${ELAN_DMACTABLE}    direction=${EGRESS}    tun_id=${segmentation_id}
63     ...    dst_mac=${port_mac1}
64     ${tun_id}    ${after_count_ingress_port2} =    OVSDB.Get Tunnel Id And Packet Count    ${OS_CMP2_CONN_ID}    ${INTERNAL_TUNNEL_TABLE}    direction=${INGRESS}    tun_id=${segmentation_id}
65     ${diff_count_egress_port1} =    BuiltIn.Evaluate    ${after_count_egress_port1} - ${before_count_egress_port1}
66     ${diff_count_ingress_port1} =    BuiltIn.Evaluate    ${after_count_ingress_port1} - ${before_count_ingress_port1}
67     ${diff_count_egress_port2} =    BuiltIn.Evaluate    ${after_count_egress_port2} - ${before_count_egress_port2}
68     ${diff_count_ingress_port2} =    BuiltIn.Evaluate    ${after_count_ingress_port2} - ${before_count_ingress_port2}
69     BuiltIn.Should Be True    ${diff_count_egress_port1} >= ${DEFAULT_PING_COUNT}
70     BuiltIn.Should Be True    ${diff_count_ingress_port1} >= ${DEFAULT_PING_COUNT}
71     BuiltIn.Should Be True    ${diff_count_egress_port2} >= ${DEFAULT_PING_COUNT}
72     BuiltIn.Should Be True    ${diff_count_ingress_port2} >= ${DEFAULT_PING_COUNT}
73
74 *** Keywords ***
75 Start Suite
76     [Documentation]    Create Basic setup for the feature. Creates single network, subnet, two ports and two VMs.
77     BuiltIn.Return From Keyword If    "${OS_DEPLOY}" == "1cmb-0ctl-0cmp"
78     VpnOperations.Basic Suite Setup
79     OpenStackOperations.Create Allow All SecurityGroup    ${VNI_SECURITY_GROUP}
80     OpenStackOperations.Create Network    @{VNI_NETWORKS}[0]
81     OpenStackOperations.Create SubNet    @{VNI_NETWORKS}[0]    @{VNI_SUBNETS}[0]    @{VNI_SUBNET_CIDRS}[0]
82     OpenStackOperations.Create Port    @{VNI_NETWORKS}[0]    @{VNI_NET_1_PORTS}[0]    sg=${VNI_SECURITY_GROUP}
83     OpenStackOperations.Create Port    @{VNI_NETWORKS}[0]    @{VNI_NET_1_PORTS}[1]    sg=${VNI_SECURITY_GROUP}
84     BuiltIn.Wait Until Keyword Succeeds    3s    1s    Utils.Check For Elements At URI    ${PORT_URL}    ${VNI_NET_1_PORTS}
85     OpenStackOperations.Create Vm Instance With Port On Compute Node    @{VNI_NET_1_PORTS}[0]    @{VNI_NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${VNI_SECURITY_GROUP}
86     OpenStackOperations.Create Vm Instance With Port On Compute Node    @{VNI_NET_1_PORTS}[1]    @{VNI_NET_1_VMS}[1]    ${OS_CMP2_HOSTNAME}    sg=${VNI_SECURITY_GROUP}
87     @{VNI_NET_1_VM_IPS}    ${vni_net_1_dhcp_ip} =    OpenStackOperations.Get VM IPs    @{VNI_NET_1_VMS}
88     BuiltIn.Set Suite Variable    @{VNI_NET_1_VM_IPS}
89     BuiltIn.Should Not Contain    ${VNI_NET_1_VM_IPS}    None
90     BuiltIn.Should Not Contain    ${vni_net_1_dhcp_ip}    None
91     Get OvsDebugInfo
92
93 Stop Suite
94     BuiltIn.Return From Keyword If    "${OS_DEPLOY}" == "1cmb-0ctl-0cmp"
95     OpenStackOperations.OpenStack Suite Teardown