Update Robot Framework format - step 11
[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
12 Library             OperatingSystem
13 Library             RequestsLibrary
14 Library             String
15 Resource            ../../../libraries/DevstackUtils.robot
16 Resource            ../../../libraries/KarafKeywords.robot
17 Resource            ../../../variables/netvirt/Variables.robot
18 Resource            ../../../libraries/OpenStackOperations.robot
19 Resource            ../../../libraries/OVSDB.robot
20 Resource            ../../../libraries/SetupUtils.robot
21 Resource            ../../../libraries/Utils.robot
22 Resource            ../../../libraries/VpnOperations.robot
23 Resource            ../../../variables/netvirt/Variables.robot
24 Resource            ../../../variables/Variables.robot
25
26 Suite Setup         Suite Setup
27 Suite Teardown      Suite Teardown
28 Test Setup          VpnOperations.VNI Test Setup
29 Test Teardown       VpnOperations.VNI Test Teardown
30
31
32 *** Variables ***
33 ${VNI_SECURITY_GROUP}       vni_l2_sg
34 @{VNI_NETWORKS}             vni_l2_net_1
35 @{VNI_SUBNETS}              vni_l2_sub_1    vni_l2_sub_2    vni_l2_sub_3
36 @{VNI_SUBNET_CIDRS}         71.1.1.0/24    72.1.1.0/24    73.1.1.0/24
37 @{VNI_NET_1_PORTS}          vni_l2_net_1_port_1    vni_l2_net_1_port_2
38 @{VNI_NET_1_VMS}            vni_l2_net_1_vm_1    vni_l2_net_1_vm_2
39
40
41 *** Test Cases ***
42 VNI Based L2 Switching
43     [Documentation]    verify VNI id for L2 Unicast frames exchanged over OVS datapaths that are on different hypervisors
44     BuiltIn.Pass Execution If    "${OPENSTACK_TOPO}" == "1cmb-0ctl-0cmp"    "Test is not supported for combo node"
45     ${port_mac1} =    OpenStackOperations.Get Port Mac    ${VNI_NET_1_PORTS}[0]
46     ${port_mac2} =    OpenStackOperations.Get Port Mac    ${VNI_NET_1_PORTS}[1]
47     ${segmentation_id} =    OpenStackOperations.Get Network Segmentation Id    ${VNI_NETWORKS}[0]
48     ${output} =    OpenStackOperations.Execute Command on VM Instance
49     ...    ${VNI_NETWORKS}[0]
50     ...    ${VNI_NET_1_VM_IPS}[0]
51     ...    ping -c ${DEFAULT_PING_COUNT} ${VNI_NET_1_VM_IPS}[1]
52     ${egress_tun_id}    ${before_count_egress_port1} =    OVSDB.Get Tunnel Id And Packet Count
53     ...    ${OS_CMP1_CONN_ID}
54     ...    ${ELAN_DMACTABLE}
55     ...    tun_id=${segmentation_id}
56     ...    mac=${port_mac2}
57     BuiltIn.Should Be Equal As Numbers    ${segmentation_id}    ${egress_tun_id}
58     ${egress_tun_id}    ${before_count_egress_port2} =    OVSDB.Get Tunnel Id And Packet Count
59     ...    ${OS_CMP2_CONN_ID}
60     ...    ${ELAN_DMACTABLE}
61     ...    tun_id=${segmentation_id}
62     ...    mac=${port_mac1}
63     BuiltIn.Should Be Equal As Numbers    ${segmentation_id}    ${egress_tun_id}
64     ${ingress_tun_id}    ${before_count_ingress_port1} =    OVSDB.Get Tunnel Id And Packet Count
65     ...    ${OS_CMP1_CONN_ID}
66     ...    ${INTERNAL_TUNNEL_TABLE}
67     ...    tun_id=${segmentation_id}
68     ...    mac=""
69     BuiltIn.Should Be Equal As Numbers    ${segmentation_id}    ${ingress_tun_id}
70     ${ingress_tun_id}    ${before_count_ingress_port2} =    OVSDB.Get Tunnel Id And Packet Count
71     ...    ${OS_CMP2_CONN_ID}
72     ...    ${INTERNAL_TUNNEL_TABLE}
73     ...    tun_id=${segmentation_id}
74     ...    mac=""
75     BuiltIn.Should Be Equal As Numbers    ${segmentation_id}    ${ingress_tun_id}
76     ${output} =    OpenStackOperations.Execute Command on VM Instance
77     ...    ${VNI_NETWORKS}[0]
78     ...    ${VNI_NET_1_VM_IPS}[0]
79     ...    ping -c ${DEFAULT_PING_COUNT} ${VNI_NET_1_VM_IPS}[1]
80     BuiltIn.Should Contain    ${output}    64 bytes
81     ${tun_id}    ${after_count_egress_port1} =    OVSDB.Get Tunnel Id And Packet Count
82     ...    ${OS_CMP1_CONN_ID}
83     ...    ${ELAN_DMACTABLE}
84     ...    tun_id=${segmentation_id}
85     ...    mac=${port_mac2}
86     ${tun_id}    ${after_count_ingress_port1} =    OVSDB.Get Tunnel Id And Packet Count
87     ...    ${OS_CMP1_CONN_ID}
88     ...    ${INTERNAL_TUNNEL_TABLE}
89     ...    tun_id=${segmentation_id}
90     ...    mac=""
91     ${tun_id}    ${after_count_egress_port2} =    OVSDB.Get Tunnel Id And Packet Count
92     ...    ${OS_CMP2_CONN_ID}
93     ...    ${ELAN_DMACTABLE}
94     ...    tun_id=${segmentation_id}
95     ...    mac=${port_mac1}
96     ${tun_id}    ${after_count_ingress_port2} =    OVSDB.Get Tunnel Id And Packet Count
97     ...    ${OS_CMP2_CONN_ID}
98     ...    ${INTERNAL_TUNNEL_TABLE}
99     ...    tun_id=${segmentation_id}
100     ...    mac=""
101     ${diff_count_egress_port1} =    BuiltIn.Evaluate    ${after_count_egress_port1} - ${before_count_egress_port1}
102     ${diff_count_ingress_port1} =    BuiltIn.Evaluate    ${after_count_ingress_port1} - ${before_count_ingress_port1}
103     ${diff_count_egress_port2} =    BuiltIn.Evaluate    ${after_count_egress_port2} - ${before_count_egress_port2}
104     ${diff_count_ingress_port2} =    BuiltIn.Evaluate    ${after_count_ingress_port2} - ${before_count_ingress_port2}
105     BuiltIn.Should Be True    ${diff_count_egress_port1} >= ${DEFAULT_PING_COUNT}
106     BuiltIn.Should Be True    ${diff_count_ingress_port1} >= ${DEFAULT_PING_COUNT}
107     BuiltIn.Should Be True    ${diff_count_egress_port2} >= ${DEFAULT_PING_COUNT}
108     BuiltIn.Should Be True    ${diff_count_ingress_port2} >= ${DEFAULT_PING_COUNT}
109
110
111 *** Keywords ***
112 Suite Setup
113     [Documentation]    Create Basic setup for the feature. Creates single network, subnet, two ports and two VMs.
114     IF    "${OPENSTACK_TOPO}" == "1cmb-0ctl-0cmp"    RETURN
115     VpnOperations.Basic Suite Setup
116     OpenStackOperations.Create Allow All SecurityGroup    ${VNI_SECURITY_GROUP}
117     OpenStackOperations.Create Network    ${VNI_NETWORKS}[0]
118     OpenStackOperations.Create SubNet    ${VNI_NETWORKS}[0]    ${VNI_SUBNETS}[0]    ${VNI_SUBNET_CIDRS}[0]
119     OpenStackOperations.Create Port    ${VNI_NETWORKS}[0]    ${VNI_NET_1_PORTS}[0]    sg=${VNI_SECURITY_GROUP}
120     OpenStackOperations.Create Port    ${VNI_NETWORKS}[0]    ${VNI_NET_1_PORTS}[1]    sg=${VNI_SECURITY_GROUP}
121     BuiltIn.Wait Until Keyword Succeeds
122     ...    3s
123     ...    1s
124     ...    Utils.Check For Elements At URI
125     ...    ${PORT_URL}
126     ...    ${VNI_NET_1_PORTS}
127     OpenStackOperations.Create Vm Instance With Port On Compute Node
128     ...    ${VNI_NET_1_PORTS}[0]
129     ...    ${VNI_NET_1_VMS}[0]
130     ...    ${OS_CMP1_HOSTNAME}
131     ...    sg=${VNI_SECURITY_GROUP}
132     OpenStackOperations.Create Vm Instance With Port On Compute Node
133     ...    ${VNI_NET_1_PORTS}[1]
134     ...    ${VNI_NET_1_VMS}[1]
135     ...    ${OS_CMP2_HOSTNAME}
136     ...    sg=${VNI_SECURITY_GROUP}
137     @{VNI_NET_1_VM_IPS}    ${vni_net_1_dhcp_ip} =    OpenStackOperations.Get VM IPs    @{VNI_NET_1_VMS}
138     BuiltIn.Set Suite Variable    @{VNI_NET_1_VM_IPS}
139     BuiltIn.Should Not Contain    ${VNI_NET_1_VM_IPS}    None
140     BuiltIn.Should Not Contain    ${vni_net_1_dhcp_ip}    None
141     OpenStackOperations.Show Debugs    @{VNI_NET_1_VMS}
142     OpenStackOperations.Get Suite Debugs
143
144 Suite Teardown
145     IF    "${OPENSTACK_TOPO}" == "1cmb-0ctl-0cmp"    RETURN
146     OpenStackOperations.OpenStack Suite Teardown