From 8af427b93b577fc8db22b5501c630aa5e474db30 Mon Sep 17 00:00:00 2001 From: luwang-vmware Date: Thu, 20 Dec 2018 10:55:49 +0800 Subject: [PATCH] Integrate Selenium-Grid into NSXT env --- .../5-29-Opaque-Network.md | 20 ++- .../5-29-Opaque-Network.robot | 170 ++++++++++++++---- .../nimbus-testbeds/vic-vdnet-nsxt.json | 14 +- 3 files changed, 163 insertions(+), 41 deletions(-) diff --git a/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.md b/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.md index bd79eeb2d1..db97bfd5da 100644 --- a/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.md +++ b/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.md @@ -9,17 +9,25 @@ To verify the VIC appliance works with NSXT Logical Switches # Environment: This test requires to use VDNET 3.0 for vCenter, ESXi and NSX-T creation and customization - -# Test Steps: 1. Deploy a new topology which includes vCenter and NSXT in Nimbus using VDNET 3.0 ```A new vCenter``` ```A new NSXT Manager, NSXT Controller and NSXT Edge``` ```Three ESXi Hosts and put two of them into os-computer-cluster-1 cluster and one of them into management cluster``` ```Create an overlay transport zone in NSXT``` -2. Create two overlay logical switches for bridge and container network -3. Install VIC appliance and deploy a VCH -4. Run a variety of docker commands on the VCH appliance -5. Destroy testbeds + +# Case 1 Test Steps: +1. Create two overlay logical switches for bridge and container network +2. Install VIC appliance and deploy a VCH +3. Run a variety of docker commands on the VCH appliance +4. Destroy the created VIC appliance and VCH + +# Case 2 Test Steps: +1. Create a new logical switches for bridge and container network +2. Install VIC appliance and deploy 2 VCHs +3. Deploy a selenium grid hub and 8 selenium node in each VCH +4. Verify each of the workers are deployed properly and connect to the hub +5. Delete VCH + # Expected Outcome: The VCH appliance should deploy without error and each of the docker commands executed against it should return without error diff --git a/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.robot b/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.robot index 7b5bdcbb67..1bba90513c 100644 --- a/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.robot +++ b/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.robot @@ -15,13 +15,15 @@ *** Settings *** Documentation Test 5-29 - Opaque Network Resource ../../resources/Util.robot -Suite Setup Vdnet NSXT Topology Setup -Suite Teardown Vdnet NSXT Topology Cleanup ${NIMBUS_POD} ${testrunid} +#Suite Setup Vdnet NSXT Topology Setup +#Suite Teardown Vdnet NSXT Topology Cleanup ${NIMBUS_POD} ${testrunid} +Suite Setup Debug Setup *** Variables *** ${NIMBUS_LOCATION} sc ${NIMBUS_LOCATION_FULL} NIMBUS_LOCATION=${NIMBUS_LOCATION} -${VDNET_LAUNCHER_HOST} 10.160.201.180 +${VDNET_LAUNCHER_HOST} 10.193.10.33 +${NFS} 10.192.93.207 ${USE_LOCAL_TOOLCHAIN} 0 ${VDNET_MC_SETUP} 0 ${NIMBUS_BASE} /mts/git @@ -38,17 +40,37 @@ ${NIMBUS_NSXT_PASSWORD} Q2D6EEi8k7hcWL2xj99 ${nimbus_personal_user_cache} %{NIMBUS_PERSONAL_USER} *** Keywords *** +Debug Setup + Log To Console Set environment variables up for GOVC + Set Environment Variable TEST_URL_ARRAY 10.92.197.30 + Set Environment Variable TEST_URL 10.92.197.30 + Set Environment Variable TEST_USERNAME Administrator@vsphere.local + Set Environment Variable TEST_PASSWORD Admin\!23 + Set Environment Variable TEST_DATASTORE vdnetSharedStorage + Set Environment Variable TEST_DATACENTER /os-test-dc + Set Environment Variable TEST_RESOURCE os-compute-cluster-1 + Set Environment Variable TEST_TIMEOUT 40m + + Set Environment Variable GOVC_INSECURE 1 + Set Environment Variable GOVC_URL 10.92.197.30 + Set Environment Variable GOVC_USERNAME Administrator@vsphere.local + Set Environment Variable GOVC_PASSWORD Admin\!23 + + Set Environment Variable NSXT_MANAGER_URI 10.92.218.146 + + Vdnet NSXT Topology Setup - [Timeout] 180 minutes + [Timeout] 120 minutes + Run Keyword If "${NIMBUS_LOCATION}" == "wdc" Set Suite Variable ${NFS} 10.92.98.149 + # Unset NIMBUS_PERSONAL_USER, replace value to NSXT user so that all nimbus commands executed by NSXT user + #Remove Environment Variable NIMBUS_PERSONAL_USER + Set Environment Variable NIMBUS_PERSONAL_USER ${NIMBUS_NSXT_USER} + ${TESTRUNID}= Evaluate 'NSXT' + str(random.randint(1000,9999)) modules=random ${json}= OperatingSystem.Get File tests/resources/nimbus-testbeds/vic-vdnet-nsxt.json ${file}= Replace Variables ${json} Create File /tmp/vic-vdnet-nsxt.json ${file} - # Unset NIMBUS_PERSONAL_USER, replace value to NSXT user so that all nimbus commands executed by NSXT user - Remove Environment Variable NIMBUS_PERSONAL_USER - Set Environment Variable NIMBUS_PERSONAL_USER ${NIMBUS_NSXT_USER} - Open Connection ${VDNET_LAUNCHER_HOST} #Login account must be the value of variable in this test suit, otherwise other pulic accounts will have no right to perform on 10.160.201.180. Wait Until Keyword Succeeds 2 min 30 sec Login ${NIMBUS_NSXT_USER} ${NIMBUS_NSXT_PASSWORD} @@ -79,7 +101,7 @@ Vdnet NSXT Topology Setup Set Environment Variable TEST_DATASTORE vdnetSharedStorage Set Environment Variable TEST_DATACENTER /os-test-dc Set Environment Variable TEST_RESOURCE os-compute-cluster-1 - Set Environment Variable TEST_TIMEOUT 30m + Set Environment Variable TEST_TIMEOUT 45m Set Environment Variable GOVC_INSECURE 1 Set Environment Variable GOVC_URL ${vc-ip} @@ -93,7 +115,7 @@ Vdnet NSXT Topology Setup OperatingSystem.Remove File /tmp/vic-vdnet-nsxt.json Vdnet NSXT Topology Cleanup - [Timeout] 180 minutes + [Timeout] 30 minutes [Arguments] ${pod_name} ${testrunid} #Reset NIMBUS_PERSONAL_USER value to the initial value @@ -106,31 +128,117 @@ Vdnet NSXT Topology Cleanup Execute Command ${NIMBUS_LOCATION_FULL} USER=%{NIMBUS_PERSONAL_USER} nimbus-ctl --nimbus=${pod_name} kill *isolated-06-gw Close Connection +Wait Until Selenium Hub Is Ready + [Arguments] ${hub-name} + :FOR ${idx} IN RANGE 1 60 + \ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${hub-name} + \ ${status}= Run Keyword And Return Status Should Contain ${output} Selenium Grid hub is up and running + \ Return From Keyword If ${status} + \ Sleep 3 + Fail Selenium Hub failed to start properly + +Wait Until Selenium Node Is Ready + [Arguments] ${node-name} + :FOR ${idx} IN RANGE 1 60 + \ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${node-name} + \ ${status}= Run Keyword And Return Status Should Contain ${output} The node is registered to the hub and ready to use + \ Return From Keyword If ${status} + \ Sleep 3 + Fail Selenium node ${node-name} failed to start properly + +Install VIC Appliance and Run Selenium Grid Test + [Arguments] ${name} ${certs}=${false} ${cleanup}=${true} + Install VIC Appliance To Test Server certs=${certs} cleanup=${cleanup} --bridge-network-range 200.1.1.0/16 + + ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create grid + Should Be Equal As Integers ${rc} 0 + ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d -p 4444:4444 --net grid --name selenium-hub selenium/hub:3.9.1 + Should Be Equal As Integers ${rc} 0 + Wait Until Selenium Hub Is Ready selenium-hub + + :FOR ${idx} IN RANGE 1 4 + \ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --cpus 1 --memory 1G --net grid -e HOME=/home/seluser -e HUB_HOST=selenium-hub --name chrome-${idx} selenium/node-chrome:3.9.1 + \ Should Be Equal As Integers ${rc} 0 + + :FOR ${idx} IN RANGE 1 4 + \ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --cpus 1 --memory 1G --net grid -e HOME=/home/seluser -e HUB_HOST=selenium-hub --name firefox-${idx} selenium/node-firefox:3.9.1 + \ Should Be Equal As Integers ${rc} 0 + + :FOR ${idx} IN RANGE 1 4 + \ Wait Until Selenium Node Is Ready chrome-${idx} + + :FOR ${idx} IN RANGE 1 4 + \ Wait Until Selenium Node Is Ready firefox-${idx} + *** Test Cases *** -Basic VIC Tests with NSXT Topology - Log To Console \nStarting test... - ${bridge_ls_name}= Evaluate 'vic-bridge-ls' - ${result}= Create Nsxt Logical Switch %{NSXT_MANAGER_URI} ${nsxt_username} ${nsxt_password} ${bridge_ls_name} - Should Not Be Equal ${result} null +#Basic VIC Tests with NSXT Topology +# [Timeout] 60 minutes +# Log To Console \nStarting test... +# ${bridge_ls_name}= Evaluate 'vic-bridge-ls' +# ${result}= Create Nsxt Logical Switch %{NSXT_MANAGER_URI} ${nsxt_username} ${nsxt_password} ${bridge_ls_name} +# Should Not Be Equal ${result} null +# ${container_ls_name}= Evaluate 'vic-container-ls' +# ${result}= Create Nsxt Logical Switch %{NSXT_MANAGER_URI} ${nsxt_username} ${nsxt_password} ${container_ls_name} +# Should Not Be Equal ${result} null +# Set Environment Variable BRIDGE_NETWORK ${bridge_ls_name} +# Set Environment Variable CONTAINER_NETWORK ${container_ls_name} +# #Wait for 5 mins to make sure the logical switches is synchronized with vCenter +# Sleep 300 +# +# Install VIC Appliance To Test Server additional-args=--container-network-firewall=%{CONTAINER_NETWORK}:open --container-network-ip-range %{CONTAINER_NETWORK}:50.0.9.100-50.0.9.200 --container-network-gateway %{CONTAINER_NETWORK}:50.0.9.1/24 +# Run Regression Tests +# +# #Validate containers' connection when using container network +# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -it -d --net=public --name first ${busybox} +# Should Be Equal As Integers ${rc} 0 +# Should Not Contain ${output} Error +# +# ${ip}= Get Container IP %{VCH-PARAMS} first public +# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net=public ${debian} ping -c1 ${ip} +# Should Be Equal As Integers ${rc} 0 +# Should Not Contain ${output} Error +# +# Run Keyword And Continue On Failure Cleanup VIC Appliance On Test Server + +Selenium Grid Test in NSXT + [Timeout] 90 minutes + Log To Console Starting Selenium Grid test in NSXT... + ${bridge_ls_name_1}= Evaluate 'vic-selenium-bridge-ls-1' + + ${result}= Create Nsxt Logical Switch %{NSXT_MANAGER_URI} ${nsxt_username} ${nsxt_password} ${bridge_ls_name_1} + Should Not Be Equal ${result} null + + ${bridge_ls_name_2}= Evaluate 'vic-selenium-bridge-ls-2' + ${result}= Create Nsxt Logical Switch %{NSXT_MANAGER_URI} ${nsxt_username} ${nsxt_password} ${bridge_ls_name_2} + Should Not Be Equal ${result} null + ${container_ls_name}= Evaluate 'vic-container-ls' ${result}= Create Nsxt Logical Switch %{NSXT_MANAGER_URI} ${nsxt_username} ${nsxt_password} ${container_ls_name} Should Not Be Equal ${result} null - Set Environment Variable BRIDGE_NETWORK ${bridge_ls_name} Set Environment Variable CONTAINER_NETWORK ${container_ls_name} + #Wait for 5 mins to make sure the logical switches is synchronized with vCenter Sleep 300 - - Install VIC Appliance To Test Server additional-args=--container-network-firewall=%{CONTAINER_NETWORK}:open --container-network-ip-range %{CONTAINER_NETWORK}:50.0.9.100-50.0.9.200 --container-network-gateway %{CONTAINER_NETWORK}:50.0.9.1/24 - Run Regression Tests - - #Validate containers' connection when using container network - ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -it -d --net=public --name first ${busybox} - Should Be Equal As Integers ${rc} 0 - Should Not Contain ${output} Error - - ${ip}= Get Container IP %{VCH-PARAMS} first public - ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net=public ${debian} ping -c1 ${ip} - Should Be Equal As Integers ${rc} 0 - Should Not Contain ${output} Error - - Run Keyword And Continue On Failure Cleanup VIC Appliance On Test Server + + Set Environment Variable BRIDGE_NETWORK ${bridge_ls_name_1} + Install VIC Appliance and Run Selenium Grid Test Grid1 + ${status}= Get State Of Github Issue 8435 + Run Keyword If '${status}' == 'closed' Fail this case now that Issue #8435 has been resolved + +# uncoment the followings when #8435 is resolved +# Set Suite Variable ${vch_params_1} %{VCH-PARAMS} +# Set Suite Variable ${vch_name_1} %{VCH-NAME} +# Set Suite Variable ${vic_admin_1} %{VIC-ADMIN} +# +# Set Environment Variable BRIDGE_NETWORK ${bridge_ls_name_2} +# Install VIC Appliance and Run Selenium Grid Test Grid2 cleanup=${false} +# +# Sleep 300 +# Run Keyword And Continue On Failure Cleanup VIC Appliance On Test Server +# +# Set Environment Variable VCH-NAME ${vch_name_1} +# Set Environment Variable BRIDGE_NETWORK ${bridge_ls_name_1} +# Set Environment Variable VCH-PARAMS ${vch_params_1} +# Set Environment Variable VIC-ADMIN ${vic_admin_1} +# + Run Keyword And Continue On Failure Cleanup VIC Appliance On Test Server diff --git a/tests/resources/nimbus-testbeds/vic-vdnet-nsxt.json b/tests/resources/nimbus-testbeds/vic-vdnet-nsxt.json index cbd4685f7b..9ee1eaa934 100644 --- a/tests/resources/nimbus-testbeds/vic-vdnet-nsxt.json +++ b/tests/resources/nimbus-testbeds/vic-vdnet-nsxt.json @@ -1,6 +1,8 @@ { "options": { "collectlogs": 1, + "sharedstorage": "${NFS}:/vdnet-sharedStore", + "vmrepos": "10.92.98.149:/vdnet-vmrepos", "product": { "nsxt": { "feature_switch": { @@ -103,12 +105,14 @@ } }, "cpus": { - "cores": 8 + "cores": 8, + "reservation": 50 }, "installtype": "linkedclone", "build": "${ESX_VERSION}", "memory": { - "size": 32000 + "size": 32768, + "reservation": 70 }, "disk": { "[1]": { @@ -124,7 +128,8 @@ } }, "cpus": { - "cores": 2 + "cores": 8, + "reservation": 50 }, "installtype": "linkedclone", "configure_package": { @@ -138,7 +143,8 @@ }, "build": "${ESX_VERSION}", "memory": { - "size": 32000 + "size": 32768, + "reservation": 70 }, "disk": { "[1]": {