From a0cb97ae76e59432d59af1f14518d1400cbbf95d Mon Sep 17 00:00:00 2001 From: "suvitha.balu" Date: Tue, 7 Feb 2017 17:12:41 +0530 Subject: [PATCH] Basic Elanservice Test case Change-Id: If9fee3d7150ae830fe345457cab22ec66a53f646 Signed-off-by: suvitha.balu --- csit/libraries/OVSDB.robot | 8 + csit/libraries/OpenStackOperations.robot | 25 +++ .../netvirt/ElanService/ElanService.robot | 163 ++++++++++++++++++ csit/testplans/netvirt-1node-openstack.txt | 1 + csit/testplans/netvirt-3node-openstack.txt | 1 + 5 files changed, 198 insertions(+) create mode 100644 csit/suites/netvirt/ElanService/ElanService.robot diff --git a/csit/libraries/OVSDB.robot b/csit/libraries/OVSDB.robot index 40893e4d71..cdf23e71cd 100644 --- a/csit/libraries/OVSDB.robot +++ b/csit/libraries/OVSDB.robot @@ -114,6 +114,14 @@ Clean OVSDB Test Environment Utils.Run Command On Mininet ${tools_system} sudo rm -rf /etc/openvswitch/conf.db Utils.Run Command On Mininet ${tools_system} sudo /usr/share/openvswitch/scripts/ovs-ctl start +Restart OVSDB + [Arguments] ${ovs_ip} + [Documentation] Restart the OVS node without cleaning the current configuration. + ${output} = Utils.Run Command On Mininet ${ovs_ip} sudo /usr/share/openvswitch/scripts/ovs-ctl stop + Log ${output} + ${output} = Utils.Run Command On Mininet ${ovs_ip} sudo /usr/share/openvswitch/scripts/ovs-ctl start + Log ${output} + Set Controller In OVS Bridge [Arguments] ${tools_system} ${bridge} ${controller_opt} [Documentation] Sets controller for a given OVS ${bridge} using controller options in ${controller_opt} diff --git a/csit/libraries/OpenStackOperations.robot b/csit/libraries/OpenStackOperations.robot index 0f89dc8be1..aead4c2fcf 100644 --- a/csit/libraries/OpenStackOperations.robot +++ b/csit/libraries/OpenStackOperations.robot @@ -728,3 +728,28 @@ Create Neutron Port With Additional Params Log ${port_id} Close Connection [Return] ${OUTPUT} ${port_id} + +Get Ports MacAddr + [Arguments] ${portName_list} + [Documentation] Retrieve the port MacAddr for the given list of port name and return the MAC address list. + ${devstack_conn_id}= Get ControlNode Connection + Switch Connection ${devstack_conn_id} + ${MacAddr-list} Create List + : FOR ${portName} IN @{portName_list} + \ ${output} = Write Commands Until Prompt neutron port-list | grep "${portName}" | awk '{print $6}' 30s + \ Log ${output} + \ ${splitted_output}= Split String ${output} ${EMPTY} + \ ${macAddr}= Get from List ${splitted_output} 0 + \ Log ${macAddr} + \ Append To List ${MacAddr-list} ${macAddr} + [Return] ${MacAddr-list} + +Delete SecurityGroup + [Arguments] ${sg_name} + [Documentation] Delete Security group + ${devstack_conn_id}= Get ControlNode Connection + Switch Connection ${devstack_conn_id} + ${output}= Write Commands Until Prompt neutron security-group-delete ${sg_name} 40s + Log ${output} + Should Match Regexp ${output} Deleted security_group: ${sg_name}|Deleted security_group\\(s\\): ${sg_name} + Close Connection diff --git a/csit/suites/netvirt/ElanService/ElanService.robot b/csit/suites/netvirt/ElanService/ElanService.robot new file mode 100644 index 0000000000..5d3f4d162f --- /dev/null +++ b/csit/suites/netvirt/ElanService/ElanService.robot @@ -0,0 +1,163 @@ +*** Settings *** +Documentation Test suite to validate elan service functionality in ODL environment. +... The assumption of this suite is that the environment is already configured with the proper +... integration bridges and vxlan tunnels. +Suite Setup Elan SuiteSetup +Suite Teardown Elan SuiteTeardown +Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing +Test Teardown Get Test Teardown Debugs +Library OperatingSystem +Library RequestsLibrary +Resource ../../../libraries/Utils.robot +Resource ../../../libraries/OVSDB.robot +Resource ../../../libraries/OpenStackOperations.robot +Resource ../../../libraries/DevstackUtils.robot +Resource ../../../libraries/SetupUtils.robot +Resource ../../../variables/Variables.robot + +*** Variables *** +@{NETWORKS} ELAN1 +@{SUBNETS} ELANSUBNET1 +@{SUBNET_CIDR} 1.1.1.0/24 +@{ELAN1_PORT_LIST} ELANPORT11 ELANPORT12 +@{VM_INSTANCES_ELAN1} ELANVM11 ELANVM12 +${ELAN_SMACTABLE} 50 +${ELAN_DMACTABLE} 51 +${ELAN_UNKNOWNMACTABLE} 52 +${PING_PASS} , 0% packet loss + +*** Test Cases *** +Verify Datapath for Single ELAN with Multiple DPN + [Documentation] Verify Flow Table and Datapath + ${SRCMAC_CN1} = Create List ${VM_MACAddr_ELAN1[0]} + ${SRCMAC_CN2} = Create List ${VM_MACAddr_ELAN1[1]} + Wait Until Keyword Succeeds 30s 5s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_1_IP} ${SRCMAC_CN1} ${VM_MACAddr_ELAN1} + Wait Until Keyword Succeeds 30s 5s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_2_IP} ${SRCMAC_CN2} ${VM_MACAddr_ELAN1} + Log Verify Datapath Test + ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_ELAN1[0]} ping -c 3 ${VM_IP_ELAN1[1]} + Should Contain ${output} ${PING_PASS} + ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_ELAN1[1]} ping -c 3 ${VM_IP_ELAN1[0]} + Should Contain ${output} ${PING_PASS} + +Verify Datapath After OVS Restart + [Documentation] Verify datapath after OVS restart + Log Restarting OVS1 and OVS2 + Restart OVSDB ${OS_COMPUTE_1_IP} + Restart OVSDB ${OS_COMPUTE_2_IP} + Log Checking the OVS state and Flow table after restart + Wait Until Keyword Succeeds 30s 10s Verify OVS Reports Connected tools_system=${OS_COMPUTE_1_IP} + Wait Until Keyword Succeeds 30s 10s Verify OVS Reports Connected tools_system=${OS_COMPUTE_2_IP} + ${SRCMAC_CN1} = Create List ${VM_MACAddr_ELAN1[0]} + ${SRCMAC_CN2} = Create List ${VM_MACAddr_ELAN1[1]} + Wait Until Keyword Succeeds 30s 5s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_1_IP} ${SRCMAC_CN1} ${VM_MACAddr_ELAN1} + Wait Until Keyword Succeeds 30s 5s Verify Flows Are Present For ELAN Service ${OS_COMPUTE_2_IP} ${SRCMAC_CN2} ${VM_MACAddr_ELAN1} + Log Verify Data path test + ${output} = Execute Command on VM Instance ${NETWORKS[0]} ${VM_IP_ELAN1[0]} ping -c 3 ${VM_IP_ELAN1[1]} + Should Contain ${output} ${PING_PASS} + ${output} = Execute Command on VM Instance ${NETWORKS[0]} ${VM_IP_ELAN1[1]} ping -c 3 ${VM_IP_ELAN1[0]} + Should Contain ${output} ${PING_PASS} + +Delete All ELAN1 VM And Verify Flow Table Updated + [Documentation] Verify Flow table after all VM instance deleted + Log Delete VM instances + : FOR ${VmInstance} IN @{VM_INSTANCES_ELAN1} + \ Delete Vm Instance ${VmInstance} + Wait Until Keyword Succeeds 30s 5s Verify Flows Are Removed For ELAN Service ${OS_COMPUTE_1_IP} ${VM_MACAddr_ELAN1} + Wait Until Keyword Succeeds 30s 5s Verify Flows Are Removed For ELAN Service ${OS_COMPUTE_2_IP} ${VM_MACAddr_ELAN1} + +*** Keywords *** +Elan SuiteSetup + [Documentation] Elan suite setup + SetupUtils.Setup_Utils_For_Setup_And_Teardown + DevstackUtils.Devstack Suite Setup + SingleElan SuiteSetup + +Elan SuiteTeardown + [Documentation] Elan suite teardown + SingleElan SuiteTeardown + Close All Connections + +SingleElan SuiteTeardown + [Documentation] Delete network,subnet and port + Log Delete Neutron Ports, Subnet and network + : FOR ${Port} IN @{ELAN1_PORT_LIST} + \ Delete Port ${Port} + Delete SubNet ${SUBNETS[0]} + Delete Network ${NETWORKS[0]} + Delete SecurityGroup sg-elanservice + +SingleElan SuiteSetup + [Documentation] Create single ELAN with Multiple DPN + Log Create ELAN1 network, subnet , port and VM + Create SecurityGroup sg-elanservice + Create Network ${NETWORKS[0]} + Create SubNet ${NETWORKS[0]} ${SUBNETS[0]} ${SUBNET_CIDR[0]} + Create Port ${NETWORKS[0]} ${ELAN1_PORT_LIST[0]} sg=sg-elanservice + Create Port ${NETWORKS[0]} ${ELAN1_PORT_LIST[1]} sg=sg-elanservice + Create Vm Instance With Port On Compute Node ${ELAN1_PORT_LIST[0]} ${VM_INSTANCES_ELAN1[0]} ${OS_COMPUTE_1_IP} sg=sg-elanservice + Create Vm Instance With Port On Compute Node ${ELAN1_PORT_LIST[1]} ${VM_INSTANCES_ELAN1[1]} ${OS_COMPUTE_2_IP} sg=sg-elanservice + Log Verify ELAN1 VM active + : FOR ${VM} IN @{VM_INSTANCES_ELAN1} + \ Wait Until Keyword Succeeds 25s 5s Verify VM Is ACTIVE ${VM} + Log Get IP address for ELAN1 + ${VM_IP_ELAN1} Wait Until Keyword Succeeds 30s 10s Verify VMs received IP ${VM_INSTANCES_ELAN1} + Log ${VM_IP_ELAN1} + Set Suite Variable ${VM_IP_ELAN1} + Log Get MACAddr for ELAN1 + ${VM_MACAddr_ELAN1} Wait Until Keyword Succeeds 30s 10s Get Ports MacAddr ${ELAN1_PORT_LIST} + Log ${VM_MACAddr_ELAN1} + Set Suite Variable ${VM_MACAddr_ELAN1} + +Verify Flows Are Present For ELAN Service + [Arguments] ${ip} ${srcMacAddrs} ${destMacAddrs} + [Documentation] Verify Flows Are Present For ELAN service + ${flow_output} = Run Command On Remote System ${ip} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int + Log ${flow_output} + Should Contain ${flow_output} table=${ELAN_SMACTABLE} + ${sMac_output} = Get Lines Containing String ${flow_output} table=${ELAN_SMACTABLE} + Log ${sMac_output} + : FOR ${sMacAddr} IN @{srcMacAddrs} + \ ${resp}= Should Contain ${sMac_output} ${sMacAddr} + Should Contain ${flow_output} table=${ELAN_DMACTABLE} + ${dMac_output} = Get Lines Containing String ${flow_output} table=${ELAN_DMACTABLE} + Log ${dMac_output} + : FOR ${dMacAddr} IN @{destMacAddrs} + \ ${resp}= Should Contain ${dMac_output} ${dMacAddr} + Should Contain ${flow_output} table=${ELAN_UNKNOWNMACTABLE} + ${sMac_output} = Get Lines Containing String ${flow_output} table=${ELAN_UNKNOWNMACTABLE} + Log ${sMac_output} + +Verify Flows Are Removed For ELAN Service + [Arguments] ${ip} ${srcMacAddrs} + [Documentation] Verify Flows Are Removed For ELAN Service + ${flow_output} = Run Command On Remote System ${ip} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int + Log ${flow_output} + Should Contain ${flow_output} table=${ELAN_SMACTABLE} + ${sMac_output} = Get Lines Containing String ${flow_output} table=${ELAN_SMACTABLE} + Log ${sMac_output} + : FOR ${sMacAddr} IN @{srcMacAddrs} + \ ${resp}= Should Not Contain ${sMac_output} ${sMacAddr} + Should Contain ${flow_output} table=${ELAN_DMACTABLE} + ${dMac_output} = Get Lines Containing String ${flow_output} table=${ELAN_DMACTABLE} + Log ${dMac_output} + : FOR ${dMacAddr} IN @{srcMacAddrs} + \ ${resp}= Should Not Contain ${dMac_output} ${dMacAddr} + +Create SecurityGroup + [Arguments] ${sg_name} + [Documentation] Allow all TCP/UDP/ICMP packets for this suite + Neutron Security Group Create ${sg_name} + Neutron Security Group Rule Create ${sg_name} direction=ingress port_range_max=65535 port_range_min=1 protocol=tcp remote_ip_prefix=0.0.0.0/0 + Neutron Security Group Rule Create ${sg_name} direction=egress port_range_max=65535 port_range_min=1 protocol=tcp remote_ip_prefix=0.0.0.0/0 + Neutron Security Group Rule Create ${sg_name} direction=ingress protocol=icmp remote_ip_prefix=0.0.0.0/0 + Neutron Security Group Rule Create ${sg_name} direction=egress protocol=icmp remote_ip_prefix=0.0.0.0/0 + Neutron Security Group Rule Create ${sg_name} direction=ingress port_range_max=65535 port_range_min=1 protocol=udp remote_ip_prefix=0.0.0.0/0 + Neutron Security Group Rule Create ${sg_name} direction=egress port_range_max=65535 port_range_min=1 protocol=udp remote_ip_prefix=0.0.0.0/0 + +Verify VMs received IP + [Arguments] ${VM_INSTANCES} + [Documentation] Verify VM received IP + ${VM_IP} ${DHCP_IP} Verify VMs Received DHCP Lease @{VM_INSTANCES} + Log ${VM_IP} + Should Not Contain ${VM_IP} None + [Return] ${VM_IP} diff --git a/csit/testplans/netvirt-1node-openstack.txt b/csit/testplans/netvirt-1node-openstack.txt index 3405805634..59c554be68 100644 --- a/csit/testplans/netvirt-1node-openstack.txt +++ b/csit/testplans/netvirt-1node-openstack.txt @@ -2,3 +2,4 @@ integration/test/csit/suites/openstack/connectivity/ integration/test/csit/suites/openstack/tempest/ integration/test/csit/suites/openstack/NeutronSecurityGrp/ integration/test/csit/suites/netvirt/Netvirt_Vpnservice/ +integration/test/csit/suites/netvirt/ElanService/ diff --git a/csit/testplans/netvirt-3node-openstack.txt b/csit/testplans/netvirt-3node-openstack.txt index a08119ae40..8de8d26843 100644 --- a/csit/testplans/netvirt-3node-openstack.txt +++ b/csit/testplans/netvirt-3node-openstack.txt @@ -2,4 +2,5 @@ integration/test/csit/suites/openstack/connectivity/ integration/test/csit/suites/openstack/clustering/ integration/test/csit/suites/openstack/tempest/ integration/test/csit/suites/netvirt/Netvirt_Vpnservice/ +integration/test/csit/suites/netvirt/ElanService/ integration/test/csit/suites/integration/Create_JVM_Plots.robot -- 2.36.6