KarafKeywords-logging in karaf console extended to cluster
[integration/test.git] / csit / suites / openstack / vpnservice / basic_vpnservice.robot
1 *** Settings ***
2 Documentation     Test suite to validate vpnservice functionality in an openstack integrated environment.
3 ...               The assumption of this suite is that the environment is already configured with the proper
4 ...               integration bridges and vxlan tunnels.
5 Suite Setup       Basic Vpnservice Suite Setup
6 Suite Teardown    Basic Vpnservice Suite Teardown
7 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
8 Library           SSHLibrary
9 Library           OperatingSystem
10 Library           RequestsLibrary
11 Resource          ../../../libraries/Utils.robot
12 Resource          ../../../libraries/OpenStackOperations.robot
13 Resource          ../../../libraries/DevstackUtils.robot
14 Resource          ../../../libraries/VpnOperations.robot
15 Resource          ../../../libraries/OVSDB.robot
16 Resource          ../../../libraries/SetupUtils.robot
17 Variables         ../../../variables/Variables.py
18
19 *** Variables ***
20 @{NETWORKS}       NET10    NET20
21 @{SUBNETS}        SUBNET1    SUBNET2
22 @{SUBNET_CIDR}    10.1.1.0/24    20.1.1.0/24
23 @{PORT_LIST}      PORT11    PORT21    PORT12    PORT22
24 @{VM_INSTANCES}    VM11    VM21    VM12    VM22
25 @{ROUTERS}        ROUTER_1    ROUTER_2
26 # Values passed by the calling method to API
27 @{CREATE_ID}      "4ae8cd92-48ca-49b5-94e1-b2921a261111"    "4ae8cd92-48ca-49b5-94e1-b2921a261112"    "4ae8cd92-48ca-49b5-94e1-b2921a261113"
28 @{CREATE_NAME}    "vpn1"    "vpn2"    "vpn3"
29 ${CREATE_ROUTER_DISTINGUISHER}    ["2200:2"]
30 ${CREATE_EXPORT_RT}    ["3300:2","8800:2"]
31 ${CREATE_IMPORT_RT}    ["3300:2","8800:2"]
32 ${CREATE_TENANT_ID}    "6c53df3a-3456-11e5-a151-feff819c1111"
33 @{VPN_INSTANCE}    vpn_instance_template.json
34 @{VPN_INSTANCE_NAME}    4ae8cd92-48ca-49b5-94e1-b2921a2661c7    4ae8cd92-48ca-49b5-94e1-b2921a261111
35
36 *** Test Cases ***
37 Create ITM Tunnel
38     [Documentation]    Checks that vxlan tunnels are created successfully. The proc expects that the two DPNs are in the same network and populates the gateway accordingly.
39     ${node_1_dpid} =    Get DPID    ${OS_COMPUTE_1_IP}
40     ${node_2_dpid} =    Get DPID    ${OS_COMPUTE_2_IP}
41     ${node_1_adapter} =    Get Ethernet Adapter    ${OS_COMPUTE_1_IP}
42     ${node_2_adapter} =    Get Ethernet Adapter    ${OS_COMPUTE_2_IP}
43     ${first_two_octets}    ${third_octet}    ${last_octet}=    Split String From Right    ${OS_COMPUTE_1_IP}    .    2
44     ${subnet} =    Set Variable    ${first_two_octets}.0.0/16
45     ${gateway} =    Get Default Gateway    ${OS_COMPUTE_1_IP}
46     ITM Create Tunnel    tunnel-type=vxlan    vlan-id=0    ip-address1="${OS_COMPUTE_1_IP}"    dpn-id1=${node_1_dpid}    portname1="${node_1_adapter}"    ip-address2="${OS_COMPUTE_2_IP}"
47     ...    dpn-id2=${node_2_dpid}    portname2="${node_2_adapter}"    prefix="${subnet}"    gateway-ip="${gateway}"
48     ${output}=    Run Command On Remote System    ${OS_COMPUTE_1_IP}    sudo ovs-vsctl show
49     Log    ${output}
50     ${output}=    Run Command On Remote System    ${OS_COMPUTE_2_IP}    sudo ovs-vsctl show
51     Log    ${output}
52     ${output} =    ITM Get Tunnels
53     Log    ${output}
54
55 Create Neutron Networks
56     [Documentation]    Create two networks
57     Create Network    ${NETWORKS[0]}
58     Create Network    ${NETWORKS[1]}
59     ${NET_LIST}    List Networks
60     Log    ${NET_LIST}
61     Should Contain    ${NET_LIST}    ${NETWORKS[0]}
62     Should Contain    ${NET_LIST}    ${NETWORKS[1]}
63
64 Create Neutron Subnets
65     [Documentation]    Create two subnets for previously created networks
66     Create SubNet    ${NETWORKS[0]}    ${SUBNETS[0]}    ${SUBNET_CIDR[0]}
67     Create SubNet    ${NETWORKS[1]}    ${SUBNETS[1]}    ${SUBNET_CIDR[1]}
68     ${SUB_LIST}    List Subnets
69     Log    ${SUB_LIST}
70     Should Contain    ${SUB_LIST}    ${SUBNETS[0]}
71     Should Contain    ${SUB_LIST}    ${SUBNETS[1]}
72
73 Create Neutron Ports
74     [Documentation]    Create four ports under previously created subnets
75     Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}
76     Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}
77     Create Port    ${NETWORKS[1]}    ${PORT_LIST[2]}
78     Create Port    ${NETWORKS[1]}    ${PORT_LIST[3]}
79
80 Check OpenDaylight Neutron Ports
81     [Documentation]    Checking OpenDaylight Neutron API for known ports
82     ${resp}    RequestsLibrary.Get Request    session    ${NEUTRON_PORTS_API}
83     Log    ${resp.content}
84     Should be Equal As Strings    ${resp.status_code}    200
85
86 Create Nova VMs
87     [Documentation]    Create Vm instances on compute node with port
88     Create Vm Instance With Port On Compute Node    ${PORT_LIST[0]}    ${VM_INSTANCES[0]}    ${OS_COMPUTE_1_IP}
89     Create Vm Instance With Port On Compute Node    ${PORT_LIST[1]}    ${VM_INSTANCES[1]}    ${OS_COMPUTE_2_IP}
90     Create Vm Instance With Port On Compute Node    ${PORT_LIST[2]}    ${VM_INSTANCES[2]}    ${OS_COMPUTE_1_IP}
91     Create Vm Instance With Port On Compute Node    ${PORT_LIST[3]}    ${VM_INSTANCES[3]}    ${OS_COMPUTE_2_IP}
92
93 Check ELAN Datapath Traffic Within The Networks
94     [Documentation]    Checks datapath within the same network with different vlans.
95     [Tags]    exclude
96     Log    This test will be added in the next patch
97
98 Create Routers
99     [Documentation]    Create Router
100     Create Router    ${ROUTERS[0]}
101
102 Add Interfaces To Router
103     [Documentation]    Add Interfaces
104     : FOR    ${INTERFACE}    IN    @{SUBNETS}
105     \    Add Router Interface    ${ROUTERS[0]}    ${INTERFACE}
106
107 Check L3_Datapath Traffic Across Networks With Router
108     [Documentation]    Datapath Test Across the networks using Router for L3.
109     [Tags]    exclude
110     Log    This test will be added in the next patch
111
112 Delete Router Interfaces
113     [Documentation]    Remove Interface to the subnets.
114     : FOR    ${INTERFACE}    IN    @{SUBNETS}
115     \    Remove Interface    ${ROUTERS[0]}    ${INTERFACE}
116
117 Create L3VPN
118     [Documentation]    Creates L3VPN and verify the same
119     VPN Create L3VPN    ${VPN_INSTANCE[0]}    CREATE_ID=${CREATE_ID[0]}    CREATE_EXPORT_RT=${CREATE_EXPORT_RT}    CREATE_IMPORT_RT=${CREATE_IMPORT_RT}    CREATE_TENANT_ID=${CREATE_TENANT_ID}
120     VPN Get L3VPN    ${CREATE_ID[0]}
121
122 Associate L3VPN to Routers
123     [Documentation]    Associating router to L3VPN
124     [Tags]    Associate
125     ${devstack_conn_id}=    Get ControlNode Connection
126     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
127     Associate VPN to Router    ${router_id}    ${VPN_INSTANCE_NAME[1]}
128
129 Dissociate L3VPN to Routers
130     [Documentation]    Dissociating router to L3VPN
131     [Tags]    Dissociate
132     ${devstack_conn_id}=    Get ControlNode Connection
133     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
134     Dissociate VPN to Router    ${router_id}    ${VPN_INSTANCE_NAME[1]}
135
136 Associate L3VPN To Networks
137     [Documentation]    Associates L3VPN to networks and verify
138     ${devstack_conn_id} =    Get ControlNode Connection
139     ${network1_id} =    Get Net Id    ${NETWORKS[0]}    ${devstack_conn_id}
140     ${network2_id} =    Get Net Id    ${NETWORKS[1]}    ${devstack_conn_id}
141     Associate L3VPN To Network    networkid=${network1_id}    vpnid=${VPN_INSTANCE_NAME[1]}
142     Associate L3VPN To Network    networkid=${network2_id}    vpnid=${VPN_INSTANCE_NAME[1]}
143
144 Dissociate L3VPN From Networks
145     [Documentation]    Dissociate L3VPN from networks
146     ${devstack_conn_id} =    Get ControlNode Connection
147     ${network1_id} =    Get Net Id    ${NETWORKS[0]}    ${devstack_conn_id}
148     ${network2_id} =    Get Net Id    ${NETWORKS[1]}    ${devstack_conn_id}
149     Dissociate L3VPN From Networks    networkid=${network1_id}    vpnid=${VPN_INSTANCE_NAME[1]}
150     Dissociate L3VPN From Networks    networkid=${network2_id}    vpnid=${VPN_INSTANCE_NAME[1]}
151
152 Delete L3VPN
153     [Documentation]    Delete L3VPN
154     VPN Delete L3VPN    ${CREATE_ID[0]}
155
156 Delete Routers
157     [Documentation]    Delete Router and Interface to the subnets.
158     Delete Router    ${ROUTERS[0]}
159
160 Create Multiple L3VPN
161     [Documentation]    Creates three L3VPNs and then verify the same
162     VPN Create L3VPN    ${VPN_INSTANCE[0]}    CREATE_ID=${CREATE_ID[0]}    CREATE_EXPORT_RT=${CREATE_EXPORT_RT}    CREATE_IMPORT_RT=${CREATE_IMPORT_RT}    CREATE_TENANT_ID=${CREATE_TENANT_ID}
163     VPN Create L3VPN    ${VPN_INSTANCE[0]}    CREATE_ID=${CREATE_ID[1]}    CREATE_EXPORT_RT=${CREATE_EXPORT_RT}    CREATE_IMPORT_RT=${CREATE_IMPORT_RT}    CREATE_TENANT_ID=${CREATE_TENANT_ID}
164     VPN Create L3VPN    ${VPN_INSTANCE[0]}    CREATE_ID=${CREATE_ID[2]}    CREATE_EXPORT_RT=${CREATE_EXPORT_RT}    CREATE_IMPORT_RT=${CREATE_IMPORT_RT}    CREATE_TENANT_ID=${CREATE_TENANT_ID}
165     VPN Get L3VPN    ${CREATE_ID[0]}
166     VPN Get L3VPN    ${CREATE_ID[1]}
167     VPN Get L3VPN    ${CREATE_ID[2]}
168
169 Delete Multiple L3VPN
170     [Documentation]    Delete three L3VPNs
171     VPN Delete L3VPN    ${CREATE_ID[0]}
172     VPN Delete L3VPN    ${CREATE_ID[1]}
173     VPN Delete L3VPN    ${CREATE_ID[2]}
174
175 Check Datapath Traffic Across Networks With L3VPN
176     [Documentation]    Datapath Test Across the networks with VPN.
177     [Tags]    exclude
178     Log    This test will be added in the next patch
179
180 Delete Vm Instances
181     [Documentation]    Delete Vm instances in the given Instance List
182     : FOR    ${VmInstance}    IN    @{VM_INSTANCES}
183     \    Delete Vm Instance    ${VmInstance}
184
185 Delete Neutron Ports
186     [Documentation]    Delete Neutron Ports in the given Port List.
187     : FOR    ${Port}    IN    @{PORT_LIST}
188     \    Delete Port    ${Port}
189
190 Delete Sub Networks
191     [Documentation]    Delete Sub Nets in the given Subnet List.
192     : FOR    ${Subnet}    IN    @{SUBNETS}
193     \    Delete SubNet    ${Subnet}
194
195 Delete Networks
196     [Documentation]    Delete Networks in the given Net List
197     : FOR    ${Network}    IN    @{NETWORKS}
198     \    Delete Network    ${Network}
199
200 Delete ITM Tunnel
201     [Documentation]    Delete tunnels with specific transport-zone.
202     ITM Delete Tunnel    TZA
203
204 *** Keywords ***
205 Basic Vpnservice Suite Setup
206     [Documentation]    Initialize SetupUtils, create session
207     SetupUtils.Setup_Utils_For_Setup_And_Teardown
208     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
209
210 Basic Vpnservice Suite Teardown
211     Delete All Sessions