Documentation Openstack library. This library is useful for tests to create network, subnet, router and vm instances
Library SSHLibrary
Resource Utils.robot
+Resource TemplatedRequests.robot
+Resource ../variables/Variables.robot
Library Collections
Library String
Library OperatingSystem
Variables ../variables/Variables.py
*** Variables ***
-${REST_CON} /restconf/config/
-${REST_CON_OP} /restconf/operations/
${VPN_INSTANCE_DELETE} vpn1_instance_delete.json
${GETL3VPN} GETL3vpn.json
${CREATE_RESP_CODE} 200
${itm_gateway-ip_def} "0.0.0.0"
${itm_tunnel-type_def} vxlan
${itm_zone-name_def} TZA
+${VAR_BASE} ${CURDIR}/../variables/vpnservice/
*** Keywords ***
VPN Create L3VPN
[Arguments] ${vpn_instance} &{Kwargs}
- [Documentation] Create L3VPN .
+ [Documentation] Create an L3VPN using the Json using the list of optional arguments received.
@{KeysList} Create List CREATE_ID CREATE_NAME CREATE_ROUTER_DISTINGUISHER CREATE_EXPORT_RT CREATE_IMPORT_RT
... CREATE_TENANT_ID
${body} = OperatingSystem.Get File ${VPN_CONFIG_DIR}/${vpn_instance}
Log TENANT_ID:${CREATE_TENANT_ID}
Set Global Variable ${GET_ID} ${CREATE_ID}
Log ${body}
- ${resp} = RequestsLibrary.Post Request session ${REST_CON_OP}neutronvpn:createL3VPN data=${body}
+ ${resp} = RequestsLibrary.Post Request session ${OPERATIONS_API}/neutronvpn:createL3VPN data=${body}
Log ${resp.content}
Should Be Equal As Strings ${resp.status_code} ${CREATE_RESP_CODE}
${body1} = OperatingSystem.Get File ${VPN_CONFIG_DIR}/${GETL3VPN}
${body1} = Replace String ${body1} ${CREATE_ID_DEFAULT} ${CREATE_ID}
- ${resp} = RequestsLibrary.Post Request session ${REST_CON_OP}neutronvpn:getL3VPN data=${body1}
+ ${resp} = RequestsLibrary.Post Request session ${OPERATIONS_API}/neutronvpn:getL3VPN data=${body1}
Log ${resp}
Should Be Equal As Strings ${resp.status_code} ${CREATE_RESP_CODE}
VPN Get L3VPN
[Arguments] ${GET_L3VPN_ID}
+ [Documentation] Will return detailed list of the L3VPN_ID received
${body1} = OperatingSystem.Get File ${VPN_CONFIG_DIR}/${GETL3VPN}
${body1} = Replace String ${body1} ${CREATE_ID_DEFAULT} ${GET_L3VPN_ID}
- ${resp} = RequestsLibrary.Post Request session ${REST_CON_OP}neutronvpn:getL3VPN data=${body1}
+ ${resp} = RequestsLibrary.Post Request session ${OPERATIONS_API}/neutronvpn:getL3VPN data=${body1}
Log ${resp}
Log BODY:${resp.content}
Should Be Equal As Strings ${resp.status_code} ${CREATE_RESP_CODE}
[Return] ${resp.content}
+Associate L3VPN To Network
+ [Arguments] &{Kwargs}
+ [Documentation] Associate the created L3VPN to a network-id received as dictionary argument
+ ${resp} = TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/assoc_l3vpn mapping=${Kwargs} session=session
+ Log ${resp}
+ Get L3VPN Association
+
+Dissociate L3VPN From Networks
+ [Arguments] &{Kwargs}
+ [Documentation] Disssociate the already associated networks from L3VPN
+ ${resp} = TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/dissoc_l3vpn mapping=${Kwargs} session=session
+ Log ${resp}
+ Get L3VPN Association
+
+Get L3VPN Association
+ [Documentation] Will return detailed list of L3VPN created and associated networks
+ ${resp} = TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/get_l3vpn mapping={"getid":${GET_ID}} session=session
+ Log ${resp}
+ [Return] ${resp}
+
Associate VPN to Router
[Arguments] ${ROUTER} ${VPN_INSTANCE_NAME}
- [Documentation] Associate VPN to Router
+ [Documentation] Associate the created L3VPN to a router-id received as argument
${body} = OperatingSystem.Get File ${VPN_CONFIG_DIR}/vpn_router.json
${body} = Replace String ${body} VPN_ID ${VPN_INSTANCE_NAME}
${body} = Replace String ${body} ROUTER_ID ${ROUTER}
- ${resp} = RequestsLibrary.Post Request session ${REST_CON_OP}neutronvpn:associateRouter data=${body}
+ ${resp} = RequestsLibrary.Post Request session ${OPERATIONS_API}/neutronvpn:associateRouter data=${body}
Log ${resp.content}
Should Be Equal As Strings ${resp.status_code} ${CREATE_RESP_CODE}
${body1} = OperatingSystem.Get File ${VPN_CONFIG_DIR}/${GETL3VPN}
${body1} = Replace String ${body1} ${CREATE_ID_DEFAULT} ${GET_ID}
- ${resp} = RequestsLibrary.Post Request session ${REST_CON_OP}neutronvpn:getL3VPN data=${body1}
+ ${resp} = RequestsLibrary.Post Request session ${OPERATIONS_API}/neutronvpn:getL3VPN data=${body1}
Log ${resp}
Should Be Equal As Strings ${resp.status_code} ${CREATE_RESP_CODE}
Dissociate VPN to Router
[Arguments] ${ROUTER} ${VPN_INSTANCE_NAME}
- [Documentation] Dissociate VPN to Router
+ [Documentation] Dissociate the already associated routers from L3VPN
${body} = OperatingSystem.Get File ${VPN_CONFIG_DIR}/vpn_router.json
${body} = Replace String ${body} VPN_ID ${VPN_INSTANCE_NAME}
${body} = Replace String ${body} ROUTER_ID ${ROUTER}
- ${resp} = RequestsLibrary.Post Request session ${REST_CON_OP}neutronvpn:dissociateRouter data=${body}
+ ${resp} = RequestsLibrary.Post Request session ${OPERATIONS_API}/neutronvpn:dissociateRouter data=${body}
Log ${resp.content}
Should Be Equal As Strings ${resp.status_code} ${CREATE_RESP_CODE}
${body1} = OperatingSystem.Get File ${VPN_CONFIG_DIR}/${GETL3VPN}
${body1} = Replace String ${body1} ${CREATE_ID_DEFAULT} ${GET_ID}
- ${resp} = RequestsLibrary.Post Request session ${REST_CON_OP}neutronvpn:getL3VPN data=${body1}
+ ${resp} = RequestsLibrary.Post Request session ${OPERATIONS_API}/neutronvpn:getL3VPN data=${body1}
Log ${resp}
Should Be Equal As Strings ${resp.status_code} ${CREATE_RESP_CODE}
VPN Delete L3VPN
[Arguments] ${DEL_L3VPN_ID}
+ [Documentation] Delete the created L3VPN
${body1} = OperatingSystem.Get File ${VPN_CONFIG_DIR}/${VPN_INSTANCE_DELETE}
Log ${body1}
${body1} = Replace String ${body1} ${CREATE_ID_DEFAULT} ${DEL_L3VPN_ID}
- ${resp} = RequestsLibrary.Post Request session ${REST_CON_OP}neutronvpn:deleteL3VPN ${body1}
+ ${resp} = RequestsLibrary.Post Request session ${OPERATIONS_API}/neutronvpn:deleteL3VPN ${body1}
Log ${resp.content}
Should Be Equal As Strings ${resp.status_code} ${CREATE_RESP_CODE}
ITM Create Tunnel
[Arguments] &{Kwargs}
- [Documentation] Creates Tunnel between the two DPNs
+ [Documentation] Creates Tunnel between the two DPNs received in the dictionary argument
@{KeysList} Create List prefix vlan-id dpn-id1 portname1 ip-address1
... dpn-id2 portname2 ip-address2 gateway-ip tunnel-type zone-name
Log Arguments Received:${Kwargs}
${zone-name} = Run Keyword If ${Kwargs} != None Pop From Dictionary ${Kwargs} ${KeysList[10]} default=${itm_zone-name_def}
${json_body} = Replace String ${json_body} \"zone-name\":\"${itm_zone-name_def} \"zone-name\":\"${zone-name}
Log ${json_body}
- ${resp} = RequestsLibrary.Post Request session ${REST_CON}/itm:transport-zones/ data=${json_body}
+ ${resp} = RequestsLibrary.Post Request session ${CONFIG_API}/itm:transport-zones/ data=${json_body}
Log ${resp.content}
Log ${resp.status_code}
Should Be Equal As Strings ${resp.status_code} 204
ITM Get Tunnels
[Documentation] Get all Tunnels and return the contents
- ${resp} = RequestsLibrary.Get Request session ${REST_CON}itm:transport-zones/
+ ${resp} = RequestsLibrary.Get Request session ${CONFIG_API}/itm:transport-zones/
Log ${resp.content}
Should Be Equal As Strings ${resp.status_code} 200
[Return] ${resp.content}
ITM Delete Tunnel
[Arguments] ${zone-name}
[Documentation] Delete Tunnels created under the transport-zone
- ${resp} = RequestsLibrary.Delete Request session ${REST_CON}/itm:transport-zones/transport-zone/${zone-name}/
+ ${resp} = RequestsLibrary.Delete Request session ${CONFIG_API}/itm:transport-zones/transport-zone/${zone-name}/
Log ${resp.content}
Should Be Equal As Strings ${resp.status_code} 200
[Return] ${resp.content}
Create Neutron Networks
[Documentation] Create two networks
- Create Network ${NETWORKS[0]} --provider:network_type local
- Create Network ${NETWORKS[1]} --provider:network_type local
+ Create Network ${NETWORKS[0]}
+ Create Network ${NETWORKS[1]}
${NET_LIST} List Networks
Log ${NET_LIST}
Should Contain ${NET_LIST} ${NETWORKS[0]}
[Tags] exclude
Log This test will be added in the next patch
+Delete Router Interfaces
+ [Documentation] Remove Interface to the subnets.
+ : FOR ${INTERFACE} IN @{SUBNETS}
+ \ Remove Interface ${ROUTERS[0]} ${INTERFACE}
+
Create L3VPN
[Documentation] Creates L3VPN and verify the same
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}
${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
Dissociate VPN to Router ${router_id} ${VPN_INSTANCE_NAME[1]}
-Delete Router Interfaces
- [Documentation] Remove Interface to the subnets.
- : FOR ${INTERFACE} IN @{SUBNETS}
- \ Remove Interface ${ROUTERS[0]} ${INTERFACE}
-
-Delete Routers
- [Documentation] Delete Router and Interface to the subnets.
- Delete Router ${ROUTERS[0]}
+Associate L3VPN To Networks
+ [Documentation] Associates L3VPN to networks and verify
+ ${devstack_conn_id} = Get ControlNode Connection
+ ${network1_id} = Get Net Id ${NETWORKS[0]} ${devstack_conn_id}
+ ${network2_id} = Get Net Id ${NETWORKS[1]} ${devstack_conn_id}
+ Associate L3VPN To Network networkid=${network1_id} vpnid=${VPN_INSTANCE_NAME[1]}
+ Associate L3VPN To Network networkid=${network2_id} vpnid=${VPN_INSTANCE_NAME[1]}
+
+Dissociate L3VPN From Networks
+ [Documentation] Dissociate L3VPN from networks
+ ${devstack_conn_id} = Get ControlNode Connection
+ ${network1_id} = Get Net Id ${NETWORKS[0]} ${devstack_conn_id}
+ ${network2_id} = Get Net Id ${NETWORKS[1]} ${devstack_conn_id}
+ Dissociate L3VPN From Networks networkid=${network1_id} vpnid=${VPN_INSTANCE_NAME[1]}
+ Dissociate L3VPN From Networks networkid=${network2_id} vpnid=${VPN_INSTANCE_NAME[1]}
Delete L3VPN
[Documentation] Delete L3VPN
VPN Delete L3VPN ${CREATE_ID[0]}
+Delete Routers
+ [Documentation] Delete Router and Interface to the subnets.
+ Delete Router ${ROUTERS[0]}
+
Create Multiple L3VPN
[Documentation] Creates three L3VPNs and then verify the same
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}