7382d09a97eb845b056f5c6dd09bc1a952770a90
[integration/test.git] / csit / libraries / VpnOperations.robot
1 *** Settings ***
2 Documentation     Openstack library. This library is useful for tests to create network, subnet, router and vm instances
3 Library           SSHLibrary
4 Resource          Utils.robot
5 Resource          TemplatedRequests.robot
6 Resource          ../variables/Variables.robot
7 Library           Collections
8 Library           String
9 Library           OperatingSystem
10 Variables         ../variables/Variables.py
11
12 *** Variables ***
13 &{ITM_CREATE_DEFAULT}    tunneltype=vxlan    vlanid=0    prefix=1.1.1.1/24    gateway=0.0.0.0    dpnid1=1    portname1=BR1-eth1    ipaddress1=2.2.2.2
14 ...               dpnid2=2    portname2= BR2-eth1    ipaddress2=3.3.3.3
15 &{L3VPN_CREATE_DEFAULT}    vpnid=4ae8cd92-48ca-49b5-94e1-b2921a261111    name=vpn1    rd=["2200:1"]    exportrt=["2200:1","8800:1"]    importrt=["2200:1","8800:1"]    tenantid=6c53df3a-3456-11e5-a151-feff819cdc9f
16 ${VAR_BASE}       ${CURDIR}/../variables/vpnservice/
17
18 *** Keywords ***
19 VPN Create L3VPN
20     [Arguments]    &{Kwargs}
21     [Documentation]    Create an L3VPN using the Json using the list of optional arguments received.
22     &{L3vpn_create_actual_val} =    Collections.Copy_Dictionary    ${L3VPN_CREATE_DEFAULT}
23     Collections.Set_To_Dictionary    ${L3vpn_create_actual_val}    &{Kwargs}
24     TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/l3vpn_create    mapping=${L3vpn_create_actual_val}    session=session
25
26 VPN Get L3VPN
27     [Arguments]    &{Kwargs}
28     [Documentation]    Will return detailed list of the L3VPN_ID received
29     ${resp} =    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/get_l3vpn    mapping=${Kwargs}    session=session
30     Log    ${resp}
31     [Return]    ${resp}
32
33 Associate L3VPN To Network
34     [Arguments]    &{Kwargs}
35     [Documentation]    Associate the created L3VPN to a network-id received as dictionary argument
36     TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/assoc_l3vpn    mapping=${Kwargs}    session=session
37
38 Dissociate L3VPN From Networks
39     [Arguments]    &{Kwargs}
40     [Documentation]    Disssociate the already associated networks from L3VPN
41     TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/dissoc_l3vpn    mapping=${Kwargs}    session=session
42
43 Associate VPN to Router
44     [Arguments]    &{Kwargs}
45     [Documentation]    Associate the created L3VPN to a router-id received as argument
46     TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/assoc_router_l3vpn    mapping=${Kwargs}    session=session
47
48 Dissociate VPN to Router
49     [Arguments]    &{Kwargs}
50     [Documentation]    Dissociate the already associated routers from L3VPN
51     TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/dissoc_router_l3vpn    mapping=${Kwargs}    session=session
52
53 VPN Delete L3VPN
54     [Arguments]    &{Kwargs}
55     [Documentation]    Delete the created L3VPN
56     TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/l3vpn_delete    mapping=${Kwargs}    session=session
57
58 ITM Create Tunnel
59     [Arguments]    &{Kwargs}
60     [Documentation]    Creates Tunnel between the two DPNs received in the dictionary argument
61     &{Itm_actual_val} =    Collections.Copy_Dictionary    ${ITM_CREATE_DEFAULT}
62     Collections.Set_To_Dictionary    ${Itm_actual_val}    &{Kwargs}
63     TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/itm_create    mapping=${Itm_actual_val}    session=session
64
65 ITM Get Tunnels
66     [Documentation]    Get all Tunnels and return the contents
67     ${resp} =    RequestsLibrary.Get Request    session    ${CONFIG_API}/itm:transport-zones/
68     Log    ${resp.content}
69     Should Be Equal As Strings    ${resp.status_code}    200
70     [Return]    ${resp.content}
71
72 ITM Delete Tunnel
73     [Arguments]    ${zone-name}
74     [Documentation]    Delete Tunnels created under the transport-zone
75     ${resp} =    RequestsLibrary.Delete Request    session    ${CONFIG_API}/itm:transport-zones/transport-zone/${zone-name}/
76     Log    ${resp.content}
77     Should Be Equal As Strings    ${resp.status_code}    200
78     [Return]    ${resp.content}