Library SSHLibrary
Resource Netvirt.robot
Resource Utils.robot
-Variables ../variables/Variables.py
+Resource ../variables/Variables.robot
*** Keywords ***
Source Password
Log ${net_id}
[Return] ${net_id}
+Get Subnet Id
+ [Arguments] ${subnet_name} ${devstack_conn_id}
+ [Documentation] Retrieve the subnet id for the given subnet name
+ Switch Connection ${devstack_conn_id}
+ ${output}= Write Commands Until Prompt neutron subnet-list | grep "${subnet_name}" | awk '{print $2}' 30s
+ Log ${output}
+ ${splitted_output}= Split String ${output} ${EMPTY}
+ ${subnet_id}= Get from List ${splitted_output} 0
+ Log ${subnet_id}
+ [Return] ${subnet_id}
+
Get Port Id
[Arguments] ${port_name} ${devstack_conn_id}
[Documentation] Retrieve the port id for the given port name to attach specific vm instance to a particular port
Get Router Id
[Arguments] ${router1} ${devstack_conn_id}
- [Documentation] Retrieve the net id for the given network name to create specific vm instance
+ [Documentation] Retrieve the router id for the given router name
Switch Connection ${devstack_conn_id}
${output}= Write Commands Until Prompt neutron router-list | grep "${router1}" | awk '{print $2}' 30s
Log ${output}
${hostname_compute_node}= Run Command On Remote System ${compute_node} hostname
${output}= Write Commands Until Prompt nova boot --image ${image} --flavor ${flavor} --nic port-id=${port_id} ${vm_instance_name} --security-groups ${sg} --availability-zone nova:${hostname_compute_node} 30s
Log ${output}
- Wait Until Keyword Succeeds 25s 5s Verify VM Is ACTIVE ${vm_instance_name}
Verify VM Is ACTIVE
[Arguments] ${vm_name}
Close Connection
Should Contain ${output} Created a new router
+List Router
+ [Documentation] List Router and return output with neutron client.
+ ${devstack_conn_id}= Get ControlNode Connection
+ Switch Connection ${devstack_conn_id}
+ ${output}= Write Commands Until Prompt neutron router-list 30s
+ Close Connection
+ Log ${output}
+ [Return] ${output}
+
Add Router Interface
[Arguments] ${router_name} ${interface_name}
${devstack_conn_id}= Get ControlNode Connection
Close Connection
Should Contain ${output} Added interface
+Show Router Interface
+ [Arguments] ${router_name}
+ [Documentation] List Router interface associated with given Router and return output with neutron client.
+ ${devstack_conn_id}= Get ControlNode Connection
+ Switch Connection ${devstack_conn_id}
+ ${output}= Write Commands Until Prompt neutron router-port-list ${router_name} -f csv 30s
+ Close Connection
+ Log ${output}
+ [Return] ${output}
+
Add Router Gateway
[Arguments] ${router_name} ${network_name}
${devstack_conn_id}= Get ControlNode Connection
... integration bridges and vxlan tunnels.
Suite Setup BuiltIn.Run Keywords SetupUtils.Setup_Utils_For_Setup_And_Teardown
... AND DevstackUtils.Devstack Suite Setup
+... AND Enable ODL Karaf Log
Suite Teardown Close All Connections
Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-Test Teardown Get Test Teardown Debugs
+Test Teardown Run Keyword If Test Failed Get Test Teardown Debugs
Library OperatingSystem
Library RequestsLibrary
Resource ../../../libraries/Utils.robot
Resource ../../../libraries/VpnOperations.robot
Resource ../../../libraries/OVSDB.robot
Resource ../../../libraries/SetupUtils.robot
-Variables ../../../variables/Variables.py
+Resource ../../../variables/Variables.robot
*** Variables ***
@{NETWORKS} NET10 NET20
@{CREATE_EXPORT_RT} ["2200:2"] ["2300:2"] ["2400:2"]
@{CREATE_IMPORT_RT} ["2200:2"] ["2300:2"] ["2400:2"]
@{EXTRA_NW_IP} 40.1.1.2 50.1.1.2
+@{EXTRA_NW_SUBNET} 40.1.1.0/24 50.1.1.0/24
# Values passed for extra routes
${RT_OPTIONS} --routes type=dict list=true
${RT_CLEAR} --routes action=clear
Log ${NET_LIST}
Should Contain ${NET_LIST} ${NETWORKS[0]}
Should Contain ${NET_LIST} ${NETWORKS[1]}
+ Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${CONFIG_API}/neutron:neutron/networks/ ${NETWORKS}
Create Neutron Subnets
[Documentation] Create two subnets for previously created networks
Log ${SUB_LIST}
Should Contain ${SUB_LIST} ${SUBNETS[0]}
Should Contain ${SUB_LIST} ${SUBNETS[1]}
+ Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${CONFIG_API}/neutron:neutron/subnets/ ${SUBNETS}
Add Ssh Allow Rule
[Documentation] Allow all TCP/UDP/ICMP packets for this suite
Create Port ${NETWORKS[0]} ${PORT_LIST[1]} sg=sg-vpnservice
Create Port ${NETWORKS[1]} ${PORT_LIST[2]} sg=sg-vpnservice
Create Port ${NETWORKS[1]} ${PORT_LIST[3]} sg=sg-vpnservice
-
-Check OpenDaylight Neutron Ports
- [Documentation] Checking OpenDaylight Neutron API for known ports
- ${resp} RequestsLibrary.Get Request session ${NEUTRON_PORTS_API}
- Log ${resp.content}
- Should be Equal As Strings ${resp.status_code} 200
+ Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${CONFIG_API}/neutron:neutron/ports/ ${PORT_LIST}
Create Nova VMs
[Documentation] Create Vm instances on compute node with port
Create Vm Instance With Port On Compute Node ${PORT_LIST[1]} ${VM_INSTANCES_NET10[1]} ${OS_COMPUTE_2_IP} sg=sg-vpnservice
Create Vm Instance With Port On Compute Node ${PORT_LIST[2]} ${VM_INSTANCES_NET20[0]} ${OS_COMPUTE_1_IP} sg=sg-vpnservice
Create Vm Instance With Port On Compute Node ${PORT_LIST[3]} ${VM_INSTANCES_NET20[1]} ${OS_COMPUTE_2_IP} sg=sg-vpnservice
+ ${VM_INSTANCES} = Create List @{VM_INSTANCES_NET10} @{VM_INSTANCES_NET20}
+ : FOR ${VM} IN @{VM_INSTANCES}
+ \ Wait Until Keyword Succeeds 25s 5s Verify VM Is ACTIVE ${VM}
Log Check for routes
Wait Until Keyword Succeeds 30s 10s Wait For Routes To Propogate
${VM_IP_NET10} ${DHCP_IP1} Wait Until Keyword Succeeds 30s 10s Verify VMs Received DHCP Lease @{VM_INSTANCES_NET10}
Create Routers
[Documentation] Create Router
Create Router ${ROUTERS[0]}
+ ${router_output} = List Router
+ Log ${router_output}
+ Should Contain ${router_output} ${ROUTERS[0]}
+ ${router_list} = Create List ${ROUTERS[0]}
+ Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${CONFIG_API}/neutron:neutron/routers/ ${router_list}
Add Interfaces To Router
[Documentation] Add Interfaces
+ ${devstack_conn_id} = Get ControlNode Connection
: FOR ${INTERFACE} IN @{SUBNETS}
\ Add Router Interface ${ROUTERS[0]} ${INTERFACE}
+ ${interface_output} = show Router Interface ${ROUTERS[0]}
+ : FOR ${INTERFACE} IN @{SUBNETS}
+ \ ${subnet_id} = Get Subnet Id ${INTERFACE} ${devstack_conn_id}
+ \ Should Contain ${interface_output} ${subnet_id}
Check L3_Datapath Traffic Across Networks With Router
[Documentation] Datapath test across the networks using router for L3.
- ${dst_ip_list} = Create List ${VM_IP_NET10[1]} ${VM_IP_NET20[0]} ${VM_IP_NET20[1]}
+ Log Verification of FIB Entries and Flow
+ ${vm_instances} = Create List @{VM_IP_NET10} @{VM_IP_NET20}
+ Wait Until Keyword Succeeds 30s 5s Check For Elements At URI ${CONFIG_API}/odl-fib:fibEntries/ ${vm_instances}
+ Wait Until Keyword Succeeds 30s 5s Verify Flows Are Present For L3VPN ${OS_COMPUTE_1_IP} ${VM_IP_NET10}
+ Wait Until Keyword Succeeds 30s 5s Verify Flows Are Present For L3VPN ${OS_COMPUTE_1_IP} ${VM_IP_NET20}
+ Log L3 Datapath test across the networks using router
+ ${dst_ip_list} = Create List ${VM_IP_NET10[1]} @{VM_IP_NET20}
Log ${dst_ip_list}
Test Operations From Vm Instance ${NETWORKS[0]} ${VM_IP_NET10[1]} ${dst_ip_list}
- ${dst_ip_list} = Create List ${VM_IP_NET20[1]} ${VM_IP_NET10[0]} ${VM_IP_NET10[1]}
+ ${dst_ip_list} = Create List ${VM_IP_NET20[1]} @{VM_IP_NET10}
Log ${dst_ip_list}
Test Operations From Vm Instance ${NETWORKS[1]} ${VM_IP_NET20[0]} ${dst_ip_list}
${cmd} = Catenate ${RT_OPTIONS} ${EXT_RT1} ${EXT_RT2}
Update Router @{ROUTERS}[0] ${cmd}
Show Router @{ROUTERS}[0] -D
+ Log "Verify FIB table"
+ ${vm_instances} = Create List @{EXTRA_NW_SUBNET}
+ Wait Until Keyword Succeeds 30s 5s Check For Elements At URI ${CONFIG_API}/odl-fib:fibEntries/ ${vm_instances}
${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[1]} ping -c 3 @{EXTRA_NW_IP}[1]
Should Contain ${output} 64 bytes
${output} = Execute Command on VM Instance @{NETWORKS}[1] ${VM_IP_NET20[1]} ping -c 3 @{EXTRA_NW_IP}[1]
Update Router @{ROUTERS}[0] ${RT_CLEAR}
Show Router @{ROUTERS}[0] -D
-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
${devstack_conn_id} = Get ControlNode Connection
${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
Should Contain ${resp} ${router_id}
-Dissociate L3VPN To Routers
+Verify L3VPN Datapath With Router Association
+ [Documentation] Datapath test across the networks using L3VPN with router association.
+ Log Verify VPN interfaces, FIB entries and Flow table
+ ${vm_instances} = Create List @{VM_IP_NET10} @{VM_IP_NET20}
+ Wait Until Keyword Succeeds 30s 5s Check For Elements At URI ${CONFIG_API}/l3vpn:vpn-interfaces/ ${vm_instances}
+ ${RD} = Strip String ${CREATE_RD[0]} characters="[]
+ Log ${RD}
+ Wait Until Keyword Succeeds 60s 5s Check For Elements At URI ${CONFIG_API}/odl-fib:fibEntries/vrfTables/${RD}/ ${vm_instances}
+ Wait Until Keyword Succeeds 60s 5s Verify Flows Are Present For L3VPN ${OS_COMPUTE_1_IP} ${vm_instances}
+ Wait Until Keyword Succeeds 60s 5s Verify Flows Are Present For L3VPN ${OS_COMPUTE_2_IP} ${vm_instances}
+ Log Check datapath from network1 to network2
+ ${dst_ip_list} = Create List @{VM_IP_NET10}[1] @{VM_IP_NET20}
+ Log ${dst_ip_list}
+ Test Operations From Vm Instance ${NETWORKS[0]} @{VM_IP_NET10}[0] ${dst_ip_list}
+ Log Check datapath from network2 to network1
+ ${dst_ip_list} = Create List @{VM_IP_NET20}[1] @{VM_IP_NET10}
+ Log ${dst_ip_list}
+ Test Operations From Vm Instance ${NETWORKS[1]} @{VM_IP_NET20}[0] ${dst_ip_list}
+
+Dissociate L3VPN From Routers
[Documentation] Dissociating router from L3VPN
${devstack_conn_id}= Get ControlNode Connection
${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
Should Not Contain ${resp} ${router_id}
+Delete Router And Router Interfaces With L3VPN
+ [Documentation] Delete Router and Interface to the subnets with L3VPN assciate
+ # Asscoiate router with L3VPN
+ ${devstack_conn_id} = Get ControlNode Connection
+ ${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
+ Associate VPN to Router routerid=${router_id} vpnid=${VPN_INSTANCE_ID[0]}
+ ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
+ Should Contain ${resp} ${router_id}
+ #Delete Interface
+ : FOR ${INTERFACE} IN @{SUBNETS}
+ \ Remove Interface ${ROUTERS[0]} ${INTERFACE}
+ ${interface_output} = Show Router Interface ${ROUTERS[0]}
+ : FOR ${INTERFACE} IN @{SUBNETS}
+ \ ${subnet_id} = Get Subnet Id ${INTERFACE} ${devstack_conn_id}
+ \ Should Not Contain ${interface_output} ${subnet_id}
+ # Delete Router and Interface to the subnets.
+ Delete Router ${ROUTERS[0]}
+ ${router_output} = List Router
+ Log ${router_output}
+ Should Not Contain ${router_output} ${ROUTERS[0]}
+ ${router_list} = Create List ${ROUTERS[0]}
+ Wait Until Keyword Succeeds 3s 1s Check For Elements Not At URI ${CONFIG_API}/neutron:neutron/routers/ ${router_list}
+ # Verify Router Entry removed from L3VPN
+ ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
+ Should Not Contain ${resp} ${router_id}
+
+Delete Router With Unknown ID
+ [Documentation] Delete router with unknown ID
+ ${devstack_conn_id}= Get ControlNode Connection
+ Switch Connection ${devstack_conn_id}
+ ${output} = Write Commands Until Prompt neutron router-delete unknowRouter 30s
+ Close Connection
+ Should Contain ${output} Unable to find router with name or id
+
Associate L3VPN To Networks
[Documentation] Associates L3VPN to networks and verify
${devstack_conn_id} = Get ControlNode Connection
${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
Should Not Contain ${resp} ${network2_id}
-Delete Routers
- [Documentation] Delete Router and Interface to the subnets.
- Delete Router ${ROUTERS[0]}
-
Delete L3VPN
[Documentation] Delete L3VPN
VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[0]}
Delete Vm Instances
[Documentation] Delete Vm instances in the given Instance List
- @{VM_INSTANCES} Collections.Combine Lists @{VM_INSTANCES_NET10} @{VM_INSTANCES_NET20}
+ ${VM_INSTANCES} = Create List @{VM_INSTANCES_NET10} @{VM_INSTANCES_NET20}
: FOR ${VmInstance} IN @{VM_INSTANCES}
\ Delete Vm Instance ${VmInstance}
${net_id} = Get Net Id @{NETWORKS}[1] ${devstack_conn_id}
${output} = Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ip route ]>
Should Contain ${output} @{SUBNET_CIDR}[1]
+
+Enable ODL Karaf Log
+ [Documentation] Uses log:set TRACE org.opendaylight.netvirt to enable log
+ Log "Enabled ODL Karaf log for org.opendaylight.netvirt"
+ ${output}= Issue Command On Karaf Console log:set TRACE org.opendaylight.netvirt
+ Log ${output}