Resource Utils.robot
Library Collections
Library String
+Library OperatingSystem
Variables ../variables/Variables.py
*** Variables ***
${CREATE_IMPORT_RT_DEFAULT} ["3300:1","8800:1"]
${CREATE_TENANT_ID_DEFAULT} "6c53df3a-3456-11e5-a151-feff819cdc9f"
${VPN_CONFIG_DIR} ${CURDIR}/../variables/vpnservice
+${ITM_CREATE_JSON} itm_tunnel_create.json
+${itm_prefix_def} "1.1.1.1/24"
+${itm_vlan-id_def} 0
+${itm_dpn-id1_def} 1
+${itm_portname1_def} "BR1-eth1"
+${itm_ip-address1_def} "2.2.2.2"
+${itm_dpn-id2_def} 2
+${itm_portname2_def} "BR2-eth1"
+${itm_ip-address2_def} "3.3.3.3"
+${itm_gateway-ip_def} "0.0.0.0"
+${itm_tunnel-type_def} vxlan
+${itm_zone-name_def} TZA
*** Keywords ***
VPN Create L3VPN
${resp} = RequestsLibrary.Post Request session ${REST_CON_OP}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
+ @{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}
+ ${json_body} = OperatingSystem.Get File ${VPN_CONFIG_DIR}/${ITM_CREATE_JSON}
+ Run Keyword If ${Kwargs} Log ${Kwargs}
+ Log json_body:${json_body}
+ ${prefix} = Run Keyword If ${Kwargs} != None Pop From Dictionary ${Kwargs} ${KeysList[0]} default=${itm_prefix_def}
+ ${json_body} = Replace String ${json_body} prefix\"\:${itm_prefix_def} prefix\"\:${prefix}
+ ${vlan-id} = Run Keyword If ${Kwargs} != None Pop From Dictionary ${Kwargs} ${KeysList[1]} default=${itm_vlan-id_def}
+ ${json_body} = Replace String ${json_body} vlan-id\"\:${itm_vlan-id_def} vlan-id\"\:${vlan-id}
+ ${dpn-id1} = Run Keyword If ${Kwargs} != None Pop From Dictionary ${Kwargs} ${KeysList[2]} default=${itm_dpn-id1_def}
+ ${json_body} = Replace String ${json_body} dpn-id\"\:${itm_dpn-id1_def}, dpn-id\"\:${dpn-id1},
+ ${portname1} = Run Keyword If ${Kwargs} != None Pop From Dictionary ${Kwargs} ${KeysList[3]} default=${itm_portname1_def}
+ ${json_body} = Replace String ${json_body} portname\"\:${itm_portname1_def} portname\"\:${portname1}
+ ${ip-address1} = Run Keyword If ${Kwargs} != None Pop From Dictionary ${Kwargs} ${KeysList[4]} default=${itm_ip-address1_def}
+ ${json_body} = Replace String ${json_body} ip-address\"\:${itm_ip-address1_def} ip-address\"\:${ip-address1}
+ ${dpn-id2} = Run Keyword If ${Kwargs} != None Pop From Dictionary ${Kwargs} ${KeysList[5]} default=${itm_dpn-id2_def}
+ ${json_body} = Replace String ${json_body} dpn-id\"\:${itm_dpn-id2_def}, dpn-id\"\:${dpn-id2},
+ ${portname2} = Run Keyword If ${Kwargs} != None Pop From Dictionary ${Kwargs} ${KeysList[6]} default=${itm_portname2_def}
+ ${json_body} = Replace String ${json_body} portname\"\:${itm_portname2_def} portname\"\:${portname2}
+ ${ip-address2} = Run Keyword If ${Kwargs} != None Pop From Dictionary ${Kwargs} ${KeysList[7]} default=${itm_ip-address2_def}
+ ${json_body} = Replace String ${json_body} ip-address\"\:${itm_ip-address2_def} ip-address\"\:${ip-address2}
+ ${gateway-ip} = Run Keyword If ${Kwargs} != None Pop From Dictionary ${Kwargs} ${KeysList[8]} default=${itm_gateway-ip_def}
+ ${json_body} = Replace String ${json_body} gateway-ip\"\:${itm_gateway-ip_def} gateway-ip\"\:${gateway-ip}
+ ${tunnel-type} = Run Keyword If ${Kwargs} != None Pop From Dictionary ${Kwargs} ${KeysList[9]} default=${itm_tunnel-type_def}
+ ${json_body} = Replace String ${json_body} \:tunnel-type-${itm_tunnel-type_def} \:tunnel-type-${tunnel-type}
+ ${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}
+ 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/
+ 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}/
+ Log ${resp.content}
+ Should Be Equal As Strings ${resp.status_code} 200
+ [Return] ${resp.content}
Resource ../../../libraries/OpenStackOperations.robot
Resource ../../../libraries/DevstackUtils.robot
Resource ../../../libraries/VpnOperations.robot
+Resource ../../../libraries/OVSDB.robot
Variables ../../../variables/Variables.py
*** Variables ***
@{VPN_INSTANCE_NAME} 4ae8cd92-48ca-49b5-94e1-b2921a2661c7 4ae8cd92-48ca-49b5-94e1-b2921a261111
*** Test Cases ***
-Verify Tunnel Creation
- [Documentation] Checks that vxlan tunnels have been created properly.
- [Tags] exclude
- 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
- ... 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.
+Create ITM Tunnel
+ [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.
+ ${node_1_dpid} = Get DPID ${OS_COMPUTE_1_IP}
+ ${node_2_dpid} = Get DPID ${OS_COMPUTE_2_IP}
+ ${node_1_adapter} = Get Ethernet Adapter ${OS_COMPUTE_1_IP}
+ ${node_2_adapter} = Get Ethernet Adapter ${OS_COMPUTE_2_IP}
+ ${first_two_octets} ${third_octet} ${last_octet}= Split String From Right ${OS_COMPUTE_1_IP} . 2
+ ${subnet} = Set Variable ${first_two_octets}.0.0/16
+ ${gateway} = Get Default Gateway ${OS_COMPUTE_1_IP}
+ 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}"
+ ... dpn-id2=${node_2_dpid} portname2="${node_2_adapter}" prefix="${subnet}" gateway-ip="${gateway}"
+ ${output}= Run Command On Remote System ${OS_COMPUTE_1_IP} sudo ovs-vsctl show
+ Log ${output}
+ ${output}= Run Command On Remote System ${OS_COMPUTE_2_IP} sudo ovs-vsctl show
+ Log ${output}
+ ${output} = ITM Get Tunnels
+ Log ${output}
Create Neutron Networks
[Documentation] Create two networks
: FOR ${Network} IN @{NETWORKS}
\ Delete Network ${Network}
+Delete ITM Tunnel
+ [Documentation] Delete tunnels with specific transport-zone.
+ ITM Delete Tunnel TZA
+
*** Keywords ***
Basic Vpnservice Suite Setup
Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}