Test cases for L3VPN creation,association and deletion are added
[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        Log Testcase Start To Controller Karaf
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 Variables         ../../../variables/Variables.py
16
17 *** Variables ***
18 @{NETWORKS}       NET10    NET20
19 @{SUBNETS}        SUBNET1    SUBNET2
20 @{SUBNET_CIDR}    10.1.1.0/24    20.1.1.0/24
21 @{PORT_LIST}      PORT11    PORT21    PORT12    PORT22
22 @{VM_INSTANCES}    VM11    VM21    VM12    VM22
23 @{ROUTERS}        ROUTER_1    ROUTER_2
24 # Values passed by the calling method to API
25 ${CREATE_ID}      "4ae8cd92-48ca-49b5-94e1-b2921a261111"
26 ${CREATE_NAME}    "vpn2"
27 ${CREATE_ROUTER_DISTINGUISHER}    ["2200:2"]
28 ${CREATE_EXPORT_RT}    ["3300:2","8800:2"]
29 ${CREATE_IMPORT_RT}    ["3300:2","8800:2"]
30 ${CREATE_TENANT_ID}    "6c53df3a-3456-11e5-a151-feff819c1111"
31 @{VPN_INSTANCE}    vpn_instance_template.json
32 @{VPN_INSTANCE_NAME}    4ae8cd92-48ca-49b5-94e1-b2921a2661c7    4ae8cd92-48ca-49b5-94e1-b2921a261111
33
34 *** Test Cases ***
35 Verify Tunnel Creation
36     [Documentation]    Checks that vxlan tunnels have been created properly.
37     [Tags]    exclude
38     Log    This test case is currently a noop, but work can be added here to validate if needed.    However, as the    suite Documentation notes, it's already assumed that the environment has been configured properly.    If    we do add work in this test case, we need to remove the "exclude" tag for it to run.    In fact, if this
39     ...    test case is critical to run, and if it fails we would be dead in the water for the rest of the suite,    we should move it to Suite Setup so that nothing else will run and waste time in a broken environment.
40
41 Create Neutron Networks
42     [Documentation]    Create two networks
43     Create Network    ${NETWORKS[0]}    --provider:network_type local
44     Create Network    ${NETWORKS[1]}    --provider:network_type local
45     ${NET_LIST}    List Networks
46     Log    ${NET_LIST}
47     Should Contain    ${NET_LIST}    ${NETWORKS[0]}
48     Should Contain    ${NET_LIST}    ${NETWORKS[1]}
49
50 Create Neutron Subnets
51     [Documentation]    Create two subnets for previously created networks
52     Create SubNet    ${NETWORKS[0]}    ${SUBNETS[0]}    ${SUBNET_CIDR[0]}
53     Create SubNet    ${NETWORKS[1]}    ${SUBNETS[1]}    ${SUBNET_CIDR[1]}
54     ${SUB_LIST}    List Subnets
55     Log    ${SUB_LIST}
56     Should Contain    ${SUB_LIST}    ${SUBNETS[0]}
57     Should Contain    ${SUB_LIST}    ${SUBNETS[1]}
58
59 Create Neutron Ports
60     [Documentation]    Create four ports under previously created subnets
61     Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}
62     Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}
63     Create Port    ${NETWORKS[1]}    ${PORT_LIST[2]}
64     Create Port    ${NETWORKS[1]}    ${PORT_LIST[3]}
65
66 Check OpenDaylight Neutron Ports
67     [Documentation]    Checking OpenDaylight Neutron API for known ports
68     ${resp}    RequestsLibrary.Get Request    session    ${NEUTRON_PORTS_API}
69     Log    ${resp.content}
70     Should be Equal As Strings    ${resp.status_code}    200
71
72 Create Nova VMs
73     [Documentation]    Create Vm instances on compute node with port
74     Create Vm Instance With Port On Compute Node    ${PORT_LIST[0]}    ${VM_INSTANCES[0]}    ${OS_COMPUTE_1_IP}
75     Create Vm Instance With Port On Compute Node    ${PORT_LIST[1]}    ${VM_INSTANCES[1]}    ${OS_COMPUTE_2_IP}
76     Create Vm Instance With Port On Compute Node    ${PORT_LIST[2]}    ${VM_INSTANCES[2]}    ${OS_COMPUTE_1_IP}
77     Create Vm Instance With Port On Compute Node    ${PORT_LIST[3]}    ${VM_INSTANCES[3]}    ${OS_COMPUTE_2_IP}
78
79 Check ELAN Datapath Traffic Within The Networks
80     [Documentation]    Checks datapath within the same network with different vlans.
81     [Tags]    exclude
82     Log    This test will be added in the next patch
83
84 Create Routers
85     [Documentation]    Create Router
86     Create Router    ${ROUTERS[0]}
87
88 Add Interfaces To Router
89     [Documentation]    Add Interfaces
90     : FOR    ${INTERFACE}    IN    @{SUBNETS}
91     \    Add Router Interface    ${ROUTERS[0]}    ${INTERFACE}
92
93 Check L3_Datapath Traffic Across Networks With Router
94     [Documentation]    Datapath Test Across the networks using Router for L3.
95     [Tags]    exclude
96     Log    This test will be added in the next patch
97
98 Create L3VPN
99     [Documentation]    Creates L3VPN and verify the same
100     VPN Create L3VPN    ${VPN_INSTANCE[0]}    CREATE_ID=${CREATE_ID}    CREATE_EXPORT_RT=${CREATE_EXPORT_RT}    CREATE_IMPORT_RT=${CREATE_IMPORT_RT}    CREATE_TENANT_ID=${CREATE_TENANT_ID}
101     VPN Get L3VPN    ${CREATE_ID}
102
103 Associate L3VPN to Routers
104     [Documentation]    Associating router to L3VPN
105     [Tags]    Associate
106     ${devstack_conn_id}=    Get ControlNode Connection
107     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
108     Associate VPN to Router    ${router_id}    ${VPN_INSTANCE_NAME[1]}
109
110 Dissociate L3VPN to Routers
111     [Documentation]    Dissociating router to L3VPN
112     [Tags]    Dissociate
113     ${devstack_conn_id}=    Get ControlNode Connection
114     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
115     Dissociate VPN to Router    ${router_id}    ${VPN_INSTANCE_NAME[1]}
116
117 Delete Router Interfaces
118     [Documentation]    Remove Interface to the subnets.
119     : FOR    ${INTERFACE}    IN    @{SUBNETS}
120     \    Remove Interface    ${ROUTERS[0]}    ${INTERFACE}
121
122 Delete Routers
123     [Documentation]    Delete Router and Interface to the subnets.
124     Delete Router    ${ROUTERS[0]}
125
126 Delete L3VPN
127     [Documentation]    Delete L3VPN
128     VPN Delete L3VPN    ${CREATE_ID}
129
130 Check Datapath Traffic Across Networks With L3VPN
131     [Documentation]    Datapath Test Across the networks with VPN.
132     [Tags]    exclude
133     Log    This test will be added in the next patch
134
135 Delete Vm Instances
136     [Documentation]    Delete Vm instances in the given Instance List
137     : FOR    ${VmInstance}    IN    @{VM_INSTANCES}
138     \    Delete Vm Instance    ${VmInstance}
139
140 Delete Neutron Ports
141     [Documentation]    Delete Neutron Ports in the given Port List.
142     : FOR    ${Port}    IN    @{PORT_LIST}
143     \    Delete Port    ${Port}
144
145 Delete Sub Networks
146     [Documentation]    Delete Sub Nets in the given Subnet List.
147     : FOR    ${Subnet}    IN    @{SUBNETS}
148     \    Delete SubNet    ${Subnet}
149
150 Delete Networks
151     [Documentation]    Delete Networks in the given Net List
152     : FOR    ${Network}    IN    @{NETWORKS}
153     \    Delete Network    ${Network}
154
155 *** Keywords ***
156 Basic Vpnservice Suite Setup
157     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
158
159 Basic Vpnservice Suite Teardown
160     Delete All Sessions