VMware vSphere Integrated Containers provider (#206)

* Add Virtual Kubelet provider for VIC

Initial virtual kubelet provider for VMware VIC.  This provider currently
handles creating and starting of a pod VM via the VIC portlayer and persona
server.  Image store handling via the VIC persona server.  This provider
currently requires the feature/wolfpack branch of VIC.

* Added pod stop and delete.  Also added node capacity.

Added the ability to stop and delete pod VMs via VIC.  Also retrieve
node capacity information from the VCH.

* Cleanup and readme file

Some file clean up and added a Readme.md markdown file for the VIC
provider.

* Cleaned up errors, added function comments, moved operation code

1. Cleaned up error handling.  Set standard for creating errors.
2. Added method prototype comments for all interface functions.
3. Moved PodCreator, PodStarter, PodStopper, and PodDeleter to a new folder.

* Add mocking code and unit tests for podcache, podcreator, and podstarter

Used the unit test framework used in VIC to handle assertions in the provider's
unit test.  Mocking code generated using OSS project mockery, which is compatible
with the testify assertion framework.

* Vendored packages for the VIC provider

Requires feature/wolfpack branch of VIC and a few specific commit sha of
projects used within VIC.

* Implementation of POD Stopper and Deleter unit tests (#4)

* Updated files for initial PR
This commit is contained in:
Loc Nguyen
2018-06-04 15:41:32 -07:00
committed by Ria Bhatia
parent 98a111e8b7
commit 513cebe7b7
6296 changed files with 1123685 additions and 8 deletions

View File

@@ -0,0 +1,29 @@
Test 6-01 - Verify Help
=======
# Purpose:
Verify vic-machine delete help
# References:
* vic-machine-linux delete -h
# Environment:
Standalone test requires nothing but vic-machine to be built
# Test Cases
## Inspect help basic
1. Issue the `vic-machine-linux inspect -h` command
## Delete help basic
1. Issue the `vic-machine-linux delete -h` command
### Expected Outcome:
* Command should output the usage of vic-machine inspect -h:
```
vic-machine-linux inspect - Inspect VCH
```
* Command should output the usage of vic-machine delete -h:
```
vic-machine-linux delete - Delete VCH
```

View File

@@ -0,0 +1,27 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-01 - Verify Help
Resource ../../resources/Util.robot
Test Timeout 20 minutes
*** Test Cases ***
Inspect help basic
${ret}= Run bin/vic-machine-linux inspect -h
Should Contain ${ret} vic-machine-linux inspect - Inspect VCH
Delete help basic
${ret}= Run bin/vic-machine-linux delete -h
Should Contain ${ret} vic-machine-linux delete - Delete VCH

View File

@@ -0,0 +1,19 @@
Test 6-02 - Verify default parameters
=======
# Purpose:
Verify vic-machine delete default parameters of compute-resource and name
# References:
* vic-machine-linux delete -h
# Environment:
This test requires that a vSphere server is running and available
# Test Cases
## Delete with defaults
1. Delete VCH without compute-resource and name specified
### Expected Outcome:
* Command should fail for resource pool /Resources/virtual-container-host is not found

View File

@@ -0,0 +1,102 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-02 - Verify default parameters
Resource ../../resources/Util.robot
Suite Teardown Run Keyword And Ignore Error Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Should Not Have VMOMI Session
[Arguments] ${thumbprint}
${output}= Run govc session.ls | grep vic-machine | grep ${thumbprint} | wc -l
Should Be Equal As Integers ${output} 0
Get Thumbprint From Log
[Arguments] ${output}
${logline}= Get Lines Containing String ${output} Creating VMOMI session with thumbprint
Should Not Be Equal As Strings ${logline} ${EMPTY}
${match} ${msg}= Should Match Regexp ${logline} msg\="([^"]*)"
${rest} ${thumbprint}= Split String From Right ${msg} ${SPACE} 1
[Return] ${thumbprint}
*** Test Cases ***
Delete with defaults
Set Test Environment Variables
${ret}= Run bin/vic-machine-linux delete --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD}
Should Contain ${ret} vic-machine-linux delete failed: resource pool
Should Contain ${ret} /Resources/virtual-container-host' not found
Wrong Password No Panic
Set Test Environment Variables
${ret}= Run bin/vic-machine-linux create --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=INCORRECT
Should Contain ${ret} vic-machine-linux create failed
Should Not Contain ${ret} panic:
${ret}= Run bin/vic-machine-linux delete --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=INCORRECT
Should Contain ${ret} vic-machine-linux delete failed
Should Not Contain ${ret} panic:
${ret}= Run bin/vic-machine-linux inspect --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=INCORRECT
Should Contain ${ret} vic-machine-linux inspect failed
Should Not Contain ${ret} panic:
${ret}= Run bin/vic-machine-linux ls --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=INCORRECT
Should Contain ${ret} vic-machine-linux ls failed
Should Not Contain ${ret} panic:
${ret}= Run bin/vic-machine-linux upgrade --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=INCORRECT
Should Contain ${ret} vic-machine-linux upgrade failed
Should Not Contain ${ret} panic:
${ret}= Run bin/vic-machine-linux configure --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=INCORRECT
Should Contain ${ret} vic-machine-linux configure failed
Should Not Contain ${ret} panic:
Check That VMOMI Sessions Don't Leak From VIC Machine
Set Test Environment Variables
${output}= Run bin/vic-machine-linux ls --target %{TEST_URL} --debug=1 --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD}
Log ${output}
${thumbprint}= Get Thumbprint From Log ${output}
Should Not Have VMOMI Session ${thumbprint}
${output}= Install VIC Appliance To Test Server
Log ${output}
${thumbprint}= Get Thumbprint From Log ${output}
Should Not Have VMOMI Session ${thumbprint}
${output}= Run bin/vic-machine-linux inspect --target %{TEST_URL} --debug=1 --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --name=%{VCH-NAME}
Log ${output}
${thumbprint}= Get Thumbprint From Log ${output}
Should Not Have VMOMI Session ${thumbprint}
${output}= Run bin/vic-machine-linux upgrade --target %{TEST_URL} --debug=1 --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD}
# upgrade fails since but that's ok for this test -- it still creates a session before failing
Log ${output}
${thumbprint}= Get Thumbprint From Log ${output}
Should Not Have VMOMI Session ${thumbprint}
${output}= Run bin/vic-machine-linux configure --target %{TEST_URL} --debug=1 --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --name=%{VCH-NAME}
Log ${output}
${thumbprint}= Get Thumbprint From Log ${output}
Should Not Have VMOMI Session ${thumbprint}
${output}= Run bin/vic-machine-linux delete --target %{TEST_URL} --debug=1 --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --name=%{VCH-NAME}
Log ${output}
${thumbprint}= Get Thumbprint From Log ${output}
Should Not Have VMOMI Session ${thumbprint}
Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME}

View File

@@ -0,0 +1,75 @@
Test 6-03 - Verify delete clean up all resources
=======
# Purpose:
Verify vic-machine delete can delete vch installed by vic-machine create
# References:
* vic-machine-linux delete -h
# Environment:
This test requires that a vSphere server is running and available
# Test Cases
## Delete VCH and verify
1. Create VCH through vic-machine create
2. Create container
3. Make sure container VM is powered on
4. Delete VCH without --force, to get delete failure
5. Delete VCH with --force, to get delete success
6. Check vSphere through govc to make sure all resources are deleted correctly
### Expected Outcome:
* Step 4 should fail for VM is powered on
* Step 5 should success
* Step 6 should not find any resources created by vic-machine and VCH
## Attach Disks and Delete VM
1. Create VCH normally
2. Pull a moderately sized image (ubuntu)
3. Check to see that disk images exist via govc
4. Use govc to attach disk images to appliance VM directly
5. Delete the VCH
6. Ensure that VCH folder is entirely gone after delete via govc
### Expected Outcome:
1. All steps should succeed
2. govc should return 1 when not finding images in step 6
## Delete VCH with non-cVM in same RP
1. Create VCH though vic-machine create
2. Create VM in the VCH's resource pool
3. Delete VCH
4. Check vSphere through govc to make sure the VM was not deleted
5. Delete the VM and RP to cleanup
### Expected Outcome:
1. All steps should succeed
## Delete VCH moved from its RP
1. Create VCH though vic-machine create
2. Create VM in the VCH's resource pool
3. Create another RP
4. Move VCH to the new RP
5. Delete VCH
6. Check vSphere through govc to make sure the VM and containerVM were not deleted
7. Delete the VM, containerVM, and RP to cleanup
### Expected Outcome:
1. All steps should succeed
## Delete VCH moved to root RP and original RP deleted
1. Create VCH though vic-machine create
2. Create VM in the root RP
3. Move VCH to root RP
4. Delete the VCH created RP
5. Delete VCH
6. Check vSphere through govc to make sure the VM in the root RP was not deleted
7. Delete the VM to cleanup
### Expected Outcome:
1. All steps should succeed

View File

@@ -0,0 +1,247 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-03 - Verify delete clean up all resources
Resource ../../resources/Util.robot
Test Setup Install VIC Appliance To Test Server
Test Teardown Run Keyword If Test Failed Cleanup Delete Tests
Test Timeout 20 minutes
*** Keywords ***
Initial load
# Create container VM first
Log To Console \nRunning docker pull ${busybox}...
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${name}= Generate Random String 15
${rc} ${container-id}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name ${name} ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Should Not Contain ${container-id} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container-id}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
Set Suite Variable ${containerName} ${name}
Cleanup Delete Tests
Cleanup VIC Appliance On Test Server
${rc} ${output}= Run Keyword If '${tempvm}'!='${EMPTY}' Run And Return Rc And Output govc vm.destroy ${tempvm}
Run Keyword If '${tempvm}'!='${EMPTY}' Log ${output}
Run Keyword If '${tempvm}'!='${EMPTY}' Should Be Equal As Integers ${rc} 0
*** Test Cases ***
Delete VCH and verify
Initial load
# Get VCH uuid and container VM uuid, to check if resources are removed correctly
Run Keyword And Ignore Error Gather Logs From Test Server
${uuid}= Run govc vm.info -json\=true %{VCH-NAME} | jq -r '.VirtualMachines[0].Config.Uuid'
${ret}= Run bin/vic-machine-linux delete --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --name %{VCH-NAME}
Should Contain ${ret} is powered on
# Delete with force
${ret}= Run bin/vic-machine-linux delete --target %{TEST_URL} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --name %{VCH-NAME} --force
Should Contain ${ret} Completed successfully
Should Not Contain ${ret} Operation failed: Error caused by file
Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME}
# Check VM is removed
${ret}= Run govc vm.info -json=true ${containerName}-*
Should Contain ${ret} {"VirtualMachines":null}
${ret}= Run govc vm.info -json=true %{VCH-NAME}
Should Contain ${ret} {"VirtualMachines":null}
# Check directories is removed
${ret}= Run govc datastore.ls VIC/${uuid}
Should Contain ${ret} was not found
${ret}= Run govc datastore.ls %{VCH-NAME}
Should Contain ${ret} was not found
${ret}= Run govc datastore.ls VIC/${containerName}-*
Should Contain ${ret} was not found
# Check resource pool is removed
${ret}= Run govc pool.info -json=true host/*/Resources/%{VCH-NAME}
Should Contain ${ret} {"ResourcePools":null}
Attach Disks and Delete VCH
# VCH should delete normally during commit/pull/cp/push operations
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${ubuntu}
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output govc datastore.ls %{VCH-NAME}/VIC/
Log ${output}
Should Be Equal As Integers ${rc} 0
# iterate through found images and attach them to the appliance VM
${vm-ip}= Run govc vm.ip %{VCH-NAME}
${imagedir}= Run govc datastore.ls %{VCH-NAME}/VIC/
${images}= Run govc datastore.ls %{VCH-NAME}/VIC/${imagedir}/images/ | tr '${\n}' ' '
${rc} ${output}= Run And Return Rc And Output (set -e; for x in ${images}; do echo $x; govc vm.disk.attach -disk=%{VCH-NAME}/VIC/${imagedir}/images/$x/$x.vmdk -vm.ip=${vm-ip}; done)
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux delete --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --name %{VCH-NAME}
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} Completed successfully
Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME}
${rc}= Run And Return Rc govc datastore.ls -dc=%{TEST_DATACENTER} %{VCH-NAME}/VIC/
Should Be Equal As Integers ${rc} 1
Delete VCH with non-cVM in same RP
${rand}= Generate Random String 15
${dummyvm}= Set Variable anothervm-${rand}
Set Suite Variable ${tempvm} ${dummyvm}
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Set Test Variable ${pool} "%{TEST_RESOURCE}/%{VCH-NAME}"
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Set Test Variable ${pool} "%{TEST_RESOURCE}/Resources/%{VCH-NAME}"
Log To Console Create VM ${dummyvm} in ${pool} net %{PUBLIC_NETWORK}
${rc} ${output}= Run And Return Rc And Output govc vm.create -pool=${pool} -net=%{PUBLIC_NETWORK} -on=false ${dummyvm}
Should Be Equal As Integers ${rc} 0
# Verify VM exists
${rc} ${output}= Run And Return Rc And Output govc ls vm/${dummyvm}
Log ${output}
Should Contain ${output} ${dummyvm}
# Delete with force
${ret} ${output}= Run And Return Rc And Output bin/vic-machine-linux delete --target %{TEST_URL} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --name %{VCH-NAME} --force
Log ${output}
Should Contain ${output} Completed successfully
# Verify VM exists
${rc} ${output}= Run And Return Rc And Output govc ls vm/${dummyvm}
Log ${output}
Should Contain ${output} ${dummyvm}
# Delete VM and RP
${rc} ${output}= Run And Return Rc And Output govc vm.destroy ${dummyvm}
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output govc pool.destroy "%{TEST_RESOURCE}/%{VCH-NAME}"
Log ${output}
Should Be Equal As Integers ${rc} 0
Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME}
Delete VCH moved from its RP
# Don't perform unconditional setup as we skip the test on ESX
[Setup] NONE
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Pass Execution Test skipped on ESX due to unable to move into RP
Install VIC Appliance To Test Server
Set Test Variable ${test-resource} "%{TEST_RESOURCE}/Resources"
${rand}= Generate Random String 15
${dummyvm}= Set Variable anothervm-${rand}
Set Suite Variable ${tempvm} ${dummyvm}
Log To Console Create VM ${dummyvm} in ${test-resource}/%{VCH-NAME} net %{PUBLIC_NETWORK}
${rc} ${output}= Run And Return Rc And Output govc vm.create -pool=${test-resource}/%{VCH-NAME} -net=%{PUBLIC_NETWORK} -on=false ${dummyvm}
Should Be Equal As Integers ${rc} 0
# Verify VM exists
${rc} ${output}= Run And Return Rc And Output govc ls vm/${dummyvm}
Log ${output}
Should Contain ${output} ${dummyvm}
# Create temp RP
${rc} ${output}= Run And Return Rc And Output govc pool.create "${test-resource}/rp-${rand}"
Should Be Equal As Integers ${rc} 0
# Move VCH to temp RP
${rc} ${output}= Run And Return Rc And Output govc vm.migrate -pool "${test-resource}/rp-${rand}" %{VCH-NAME}
Should Be Equal As Integers ${rc} 0
# Delete with force
${moid}= Get VM Moid %{VCH-NAME}
${ret} ${output}= Run And Return Rc And Output bin/vic-machine-linux delete --target %{TEST_URL} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --id ${moid} --force
Log ${output}
Should Contain ${output} Completed successfully
# Verify VM exists
${rc} ${output}= Run And Return Rc And Output govc ls vm/${dummyvm}
Log ${output}
Should Contain ${output} ${dummyvm}
# Delete VM and RP
${rc} ${output}= Run And Return Rc And Output govc vm.destroy ${dummyvm}
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output govc pool.destroy "${test-resource}/%{VCH-NAME}"
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output govc pool.destroy "${test-resource}/temp-%{VCH-NAME}"
Log ${output}
Should Be Equal As Integers ${rc} 0
Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME}
Delete VCH moved to root RP and original RP deleted
# Don't perform unconditional setup as we skip the test on ESX
[Setup] NONE
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Pass Execution Test skipped on ESX due to unable to move into RP
Install VIC Appliance To Test Server
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Pass Execution Test skipped on ESX due to unable to move into RP
${rand}= Generate Random String 15
${dummyvm}= Set Variable anothervm-${rand}
Set Suite Variable ${tempvm} ${dummyvm}
Log To Console Create VM ${dummyvm} in %{TEST_RESOURCE}/%{VCH-NAME} net %{PUBLIC_NETWORK}
${rc} ${output}= Run And Return Rc And Output govc vm.create -pool="%{TEST_RESOURCE}" -net=%{PUBLIC_NETWORK} -on=false ${dummyvm}
Should Be Equal As Integers ${rc} 0
# Verify VM exists
${rc} ${output}= Run And Return Rc And Output govc ls vm/${dummyvm}
Log ${output}
Should Contain ${output} ${dummyvm}
# Move VCH to root RP
${rc} ${output}= Run And Return Rc And Output govc vm.migrate -pool %{TEST_RESOURCE} %{VCH-NAME}
Should Be Equal As Integers ${rc} 0
# Delete with force
${moid}= Get VM Moid %{VCH-NAME}
${ret} ${output}= Run And Return Rc And Output bin/vic-machine-linux delete --target %{TEST_URL} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --id ${moid} --force
Log ${output}
Should Contain ${output} Completed successfully
# Verify VM exists
${rc} ${output}= Run And Return Rc And Output govc ls vm/${dummyvm}
Log ${output}
Should Contain ${output} ${dummyvm}
# Delete VM and RP
${rc} ${output}= Run And Return Rc And Output govc vm.destroy ${dummyvm}
Log ${output}
Should Be Equal As Integers ${rc} 0
Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME}

View File

@@ -0,0 +1,327 @@
Test 6-04 - Verify vic-machine create basic function
=======
# Purpose:
Verify vic-machine create basic connection variables, certificates, timeout, and all arguments after appliance-iso
# References:
* vic-machine-linux create -h
# Environment:
This test requires that a vSphere server is running and available
DNS Servers
=======
### Create VCH - supply DNS server
1. Create VCH while supplying the `--dns-server` option twice with values `1.1.1.1` and `2.2.2.2`
2. Enable SSH on the VCH using the `vic-machine debug` command
3. SSH into the VCH run `cat /etc/resolv.conf`
### Expected Outcome
* The top two lines of the output from `cat /etc/resolv.conf` should contain `1.1.1.1` and `2.2.2.2` in that order.
Image size
=======
## Create VCH - custom base disk
1. Issue the following command:
```
vic-machine-linux create --name=${vch-name} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --image-store=%{TEST_DATASTORE} --password=%{TEST_PASSWORD} --base-image-size=6GB ${vicmachinetls}
```
### Expected Outcome
* VCH is deployed successfully
* Container has correct disk size
* Regression tests pass
Connection
=======
## Create VCH - URL without user and password
1. Create with vSphere URL in --target parameter, without --user and --password
### Expected Outcome
* Command should fail for no user password available
## Create VCH - URL without password
1. Create with vSphere URL in --target parameter and --user provided, but without --password
### Expected Outcome
* Command should promote interactive password input
## Create VCH - target URL
1. Create with vSphere URL and user password encoded in the same --target parameter
```
vic-machine-linux create --name=<VCH_NAME> --target="<TEST_USERNAME>:<TEST_PASSWORD>@<TEST_URL>" \
--image-store=<TEST_DATASTORE>
```
2. Run regression tests
## Create VCH - operations user
1. Create with an operations user (the same as the administrative user used for deployment in this case)
```
vic-machine-linux create --ops-user="<TEST_USERNAME>" --ops-password="<TEST_PASSWORD>"
```
2. Run regression tests
### Expected Outcome
* Deployment succeed
* Regression test pass
## Create VCH - specified datacenter
1. Prepare test env with multiple DC exists
2. Create with vSphere URL with correct DC appended as <ip>/DC1
### Expected Outcome
* Verify deployed successfully
* Verify VCH is in correct DC through govc
vic-machine create Parameters
=======
## Create VCH - defaults
1. Issue the following command:
```
vic-machine create --name=<VCH_NAME> --target=<TEST_URL> \
--user=<TEST_USERNAME> --image-store=<TEST_DATASTORE> --password=<TEST_PASSWORD> \
--bridge-network=<NETWORK> --compute-resource=<TEST_RESOURCE>
```
2. Run regression tests
### Expected Outcome
* Deployment succeed
* Regression test pass
## Create VCH - full params
1. Issue the following command:
```
vic-machine-linux create --name=<VCH_NAME> --target=<TEST_URL> \
--user=<TEST_USERNAME> --image-store=<TEST_DATASTORE> \
--appliance-iso=bin/appliance.iso --bootstrap-iso=bin/bootstrap.iso \
--password=<TEST_PASSWORD> --force=true --bridge-network=network \
--compute-resource=<TEST_RESOURCE> --timeout <TEST_TIMEOUT> \
--volume-store=<TEST_DATASTORE>/test:default
```
2. Run regression tests
### Expected Outcome
* Deployment succeed
* Regression test pass
## Create VCH - using environment variables
1. Issue the following command:
```
vic-machine-linux create --name=<VCH_NAME> --image-store=<TEST_DATASTORE> \
--appliance-iso=bin/appliance.iso --bootstrap-iso=bin/bootstrap.iso \
--force=true --bridge-network=network --public-network=%{PUBLIC_NETWORK} \
--compute-resource=<TEST_RESOURCE> --timeout <TEST_TIMEOUT> \
--volume-store=<TEST_DATASTORE>/test:default
```
2. Run regression tests
### Expected Outcome
* Deployment succeed
* Regression test pass
## Create VCH - custom image store directory
1. Issue the following command:
```
vic-machine-linux create --name=${vch-name} --target=%{TEST_URL} \
--thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} \
--image-store %{TEST_DATASTORE}/vic-machine-test-images \
--appliance-iso=bin/appliance.iso --bootstrap-iso=bin/bootstrap.iso \
--password=%{TEST_PASSWORD} --force=true --bridge-network=%{BRIDGE_NETWORK} \
--public-network=%{PUBLIC_NETWORK} --compute-resource=%{TEST_RESOURCE} \
--timeout %{TEST_TIMEOUT} ${vicmachinetls}
```
2. Run regression tests
### Expected Outcome
* Deployment succeeds
* Regression tests pass
## Create VCH - long VCH name
1. Provide long name to create VCH, e.g. 100 characters
### Expected Outcome
* Command failed for name is too long
## Create VCH - Existing VCH name
1. Create with same name with existing VCH
### Expected Outcome
* Command failed for VCH is found
## Create VCH - Existing VM name
1. Create with existing VM name
2. Run regression tests
### Expected Outcome
* Deployment succeeds
* Regression tests pass
## Create VCH - Existing RP on ESX
1. Create resource pool on ESX
2. Create VCH with the same (already existing) name
### Expected Outcome
* Deployment succeeds
* Regression tests pass
Image files
=======
## Create VCH - wrong ISOs
1. Provide wrong iso files
### Expected Outcome
* Command failed for no iso files found
Creation log file
======
## Creation log file uploaded to datastore
1. Issue the following commands:
```
vic-machine create --name=<VCH_NAME> --target=<TEST_URL> \
--user=<TEST_USERNAME> --image-store=<TEST_DATASTORE> --password=<TEST_PASSWORD> \
--bridge-network=<NETWORK> --compute-resource=<TEST_RESOURCE>
```
2. Verified that the creation log file prefixed by `vic-machine-create` is uploaded to datastore folder
3. Verified that the creation log file is complete
## Expected Outcome
* Deployment succeeds
* The creation log file is uploaded to datastore folder
* The creation log file is complete
Timeout
=======
## Basic timeout
1. Specify short timeout to 2s
### Expected Outcome
* Command fail for timeout error #1557
Short time creation
===================
# Stop VCH creation immediately
=============================
1. Interrupt creation process after 2s,
2. Delete the VCH
### Expected Outcome
* Delete should succeed
Appliance size
=======
## Basic VCH resource config
1. Specify appliance size to 4cpu, 4096MB
### Expected Outcome
* Deployed successfully
* Appliance VM size is set correctly in vsphere
* Regression test pass
## Invalid VCH resource config
1. Specify appliance size to 1cpu, 256MB
### Expected Outcome
* Deployment failed for no enought resource
* Should have user-friendly error message
## Use resource pool
1. --use-rp=true
### Expected Outcome
* Deployed successfully
* VCH is created under resource pool against VC
* Regression test pass
## CPU reservation shares invalid
1. Specify VCH CPU size to reservation: 4, limit: 8, shares: wrong
### Expected Outcome
* Deployment failed for wrong shares format
## CPU reservation invalid
1. Specify VCH CPU size to reservation: 4, limit: 2, shares: normal
### Expected Outcome
* Deployment failed for user-friendly error message
## CPU reservation valid
1. Specify VCH CPU size to reservation: 4, limit: 8, shares: high
### Expected Outcome
* Deployed successfully
* Check rp resource settings are correct through govc
* Integration test passed
## Memory reservation shares invalid
1. Specify VCH Memory size to reservation: 4096, limit: 8192, shares: wrong
### Expected Outcome
* Deployment failed for wrong shares format
## Memory reservation invalid 1
1. Specify VCH Memory size to reservation: 4096, limit: 2048, shares: normal
### Expected Outcome
* Deployment failed for user-friendly error message
## Memory reservation invalid 2
1. Specify VCH Memory size to reservation: 256, limit: 256, shares: high
### Expected Outcome
* Deployment failed with user-friendly error message
## Memory reservation invalid 3
1. Specify VCH Memory size to reservation: 200, limit: 200, shares: high
### Expected Outcome
* Deployment failed with user-friendly error message
## Memory reservation valid
1. Specify VCH Memory size to reservation: 4096, limit: 8192, shares: high
### Expected Outcome
* Deployed successfully
* Check rp resource settings are correct through govc
* Integration test passed

View File

@@ -0,0 +1,323 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-04 - Verify vic-machine create basic use cases
Resource ../../resources/Util.robot
Test Teardown Run Keyword If Test Failed Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Create VCH - supply DNS server
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --image-store=%{TEST_DATASTORE} --password=%{TEST_PASSWORD} --no-tls --dns-server=1.1.1.1 --dns-server=2.2.2.2
Should Contain ${output} Installer completed successfully
${output}= Run bin/vic-machine-linux debug --target=%{TEST_URL} --name=%{VCH-NAME} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --enable-ssh --pw password --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} Completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Open Connection %{VCH-IP}
Login root password
${out}= Execute Command cat /etc/resolv.conf
Log ${out}
${first}= Get Line ${out} 0
Should Be Equal ${first} nameserver 1.1.1.1
${second}= Get Line ${out} 1
Should Be Equal ${second} nameserver 2.2.2.2
Cleanup VIC Appliance On Test Server
Create VCH - custom base disk
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
# Deploy vic-machine with debug enabled to attempt to cache #7047
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --debug=1 --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --image-store=%{TEST_DATASTORE} --password=%{TEST_PASSWORD} --base-image-size=6GB ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
${output}= Run docker %{VCH-PARAMS} logs $(docker %{VCH-PARAMS} start $(docker %{VCH-PARAMS} create --name customDiskContainer ${busybox} /bin/df -h) && sleep 10) | grep /dev/sda | awk '{print $2}'
# df shows GiB and vic-machine takes in GB so 6GB on cmd line == 5.5GB in df
Should Be Equal As Strings ${output} 5.5G
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f customDiskContainer
Should Be Equal As Integers ${rc} 0
Run Regression Tests
Cleanup VIC Appliance On Test Server
Create VCH - URL without user and password
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls}
Should Contain ${output} vSphere user must be specified
# Delete the portgroup added by env vars keyword
Cleanup VCH Bridge Network %{VCH-NAME}
Create VCH - target URL
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Create VCH - operations user
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --ops-user=%{TEST_USERNAME} --ops-password=%{TEST_PASSWORD} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Create VCH - specified datacenter
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Pass Execution Requires vCenter environment
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --compute-resource=%{TEST_DATACENTER} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Create VCH - defaults
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run Keyword If '%{HOST_TYPE}' == 'VC' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --password=%{TEST_PASSWORD} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Run Keyword If '%{HOST_TYPE}' == 'VC' Should Contain ${output} Installer completed successfully
Run Keyword If '%{HOST_TYPE}' == 'VC' Get Docker Params ${output} ${true}
${output}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --password=%{TEST_PASSWORD} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Should Contain ${output} Installer completed successfully
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Create VCH - full params
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --appliance-iso=bin/appliance.iso --bootstrap-iso=bin/bootstrap.iso --password=%{TEST_PASSWORD} --force=true --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} --volume-store=%{TEST_DATASTORE}/%{VCH-NAME}-VOL:default ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Create VCH - using environment variables
Set Test Environment Variables
Set Environment Variable VIC_MACHINE_TARGET %{TEST_URL}
Set Environment Variable VIC_MACHINE_USER %{TEST_USERNAME}
Set Environment Variable VIC_MACHINE_PASSWORD %{TEST_PASSWORD}
Set Environment Variable VIC_MACHINE_THUMBPRINT %{TEST_THUMBPRINT}
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --image-store=%{TEST_DATASTORE} --appliance-iso=bin/appliance.iso --bootstrap-iso=bin/bootstrap.iso --force=true --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} --volume-store=%{TEST_DATASTORE}/%{VCH-NAME}-VOL:default ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Remove Environment Variable VIC_MACHINE_TARGET
Remove Environment Variable VIC_MACHINE_USER
Remove Environment Variable VIC_MACHINE_PASSWORD
Remove Environment Variable VIC_MACHINE_THUMBPRINT
Create VCH - custom image store directory
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store %{TEST_DATASTORE}/vic-machine-test-images --appliance-iso=bin/appliance.iso --bootstrap-iso=bin/bootstrap.iso --password=%{TEST_PASSWORD} --force=true --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
${output}= Run GOVC_DATASTORE=%{TEST_DATASTORE} govc datastore.ls
Should Contain ${output} vic-machine-test-images
Run Regression Tests
Cleanup VIC Appliance On Test Server
${output}= Run GOVC_DATASTORE=%{TEST_DATASTORE} govc datastore.ls
Should Not Contain ${output} vic-machine-test-images
Create VCH - long VCH name
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME}-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls}
Should Contain ${output} exceeds the permitted 31 characters limit
# Delete the portgroup added by env vars keyword
Cleanup VCH Bridge Network %{VCH-NAME}
Create VCH - Existing VCH name
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --compute-resource=%{TEST_RESOURCE} ${vicmachinetls}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --compute-resource=%{TEST_RESOURCE} ${vicmachinetls}
Should Contain ${output} already exists. Please delete it before reinstalling.
Cleanup VIC Appliance On Test Server
Create VCH - Existing VM name
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
# Create dummy VM
${rc} ${output}= Run And Return Rc And Output govc vm.create -net=%{PUBLIC_NETWORK} %{VCH-NAME}
Should Be Equal As Integers ${rc} 0
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls}
Log ${output}
# VCH creation should succeed on ESXi
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Get Docker Params ${output} ${true}
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Should Contain ${output} Installer completed successfully
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Log To Console Installer completed successfully: %{VCH-NAME}
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run Keyword And Ignore Error Cleanup VIC Appliance On Test Server
# VCH creation should fail on VC
Run Keyword If '%{HOST_TYPE}' == 'VC' Should Contain ${output} The name '%{VCH-NAME}' already exists.
${rc} ${output}= Run And Return Rc And Output govc vm.destroy %{VCH-NAME}
Should Be Equal As Integers ${rc} 0
Cleanup VCH Bridge Network %{VCH-NAME}
Create VCH - Existing RP on ESX
Run Keyword If '%{HOST_TYPE}' == 'VC' Pass Execution Test skipped on VC
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
# Create dummy RP
${rc} ${output}= Run And Return Rc And Output govc pool.create %{TEST_RESOURCE}/%{VCH-NAME}
Should Be Equal As Integers ${rc} 0
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --compute-resource=%{TEST_RESOURCE}
Should Contain ${output} Installer completed successfully
Log Installer completed successfully: %{VCH-NAME}
Cleanup VIC Appliance On Test Server
${rc} ${output}= Run And Return Rc And Output govc pool.destroy %{TEST_RESOURCE}/%{VCH-NAME}
Should Be Equal As Integers ${rc} 0
Creation log file uploaded to datastore
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --appliance-iso=bin/appliance.iso --bootstrap-iso=bin/bootstrap.iso --password=%{TEST_PASSWORD} --force=true --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
${filename}= Run GOVC_DATASTORE=%{TEST_DATASTORE} govc datastore.ls %{VCH-NAME} | grep vic-machine_
Should Not Be Empty ${filename}
${output}= Run govc datastore.tail -n 1 "%{VCH-NAME}/${filename}"
Should Contain ${output} Installer completed successfully
Cleanup VIC Appliance On Test Server
Basic timeout
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --timeout 1s ${vicmachinetls}
Should Contain ${output} Creating VCH exceeded time limit
${ret}= Run bin/vic-machine-linux delete --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --compute-resource=%{TEST_RESOURCE} --name %{VCH-NAME}
Should Contain ${ret} Completed successfully
${out}= Run govc ls vm
Should Not Contain ${out} %{VCH-NAME}
Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME}
Basic VCH resource config
Pass execution Test not implemented
Invalid VCH resource config
Pass execution Test not implemented
CPU reservation shares invalid
Pass execution Test not implemented
CPU reservation invalid
Pass execution Test not implemented
CPU reservation valid
Pass execution Test not implemented
Memory reservation shares invalid
Pass execution Test not implemented
Memory reservation invalid 1
Pass execution Test not implemented
Memory reservation invalid 2
Pass execution Test not implemented
Memory reservation invalid 3
Pass execution Test not implemented
Memory reservation valid
Pass execution Test not implemented
Extension installation
Pass execution Test not implemented
Install existing extension
Pass execution Test not implemented

View File

@@ -0,0 +1,177 @@
Test 6-05 - Verify vic-machine create validation function
=======
# Purpose:
Verify vic-machine create validation functions, this does not include validation for network, datastore, and compute resources
# References:
* vic-machine-linux create -h
# Environment:
This test requires that a vSphere server is running and available
Test Cases: - suggest resources
======
## Invalid datacenter
1. Prepare vCenter environment with multiple datacenters
2. Create with --target specifying a datacenter that does not exist
### Expected Outcome:
* Output contains message indicating datacenter must be specified
* Output suggests available datacenter values
* Deployment fails
## Invalid target path
1. Prepare vCenter environment
2. Create with --target specifying a datacenter and resource pool
### Expected Outcome:
* Output contains message indicating that onlydatacenter must be specified in --target
* Output suggests available datacenter values
* Deployment fails
## Create VCH - target thumbprint verification
1. Issue the following command:
```
vic-machine-linux create --thumbprint=NOPE --name=${vch-name} \
--target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --image-store=ENOENT ${vicmachinetls}
```
### Expected Outcome:
* Output contains message that thumbprint does not match
## Resource pools
1. Create with wrong compute-resource: not exist resource pool, not existed vc cluster, not existed datacenter.
2. Create with wrong compute-resource format
### Expected Outcome:
* Verify resource suggestion successfully show available values
* Deployment fails
## Networks
1. Create with nonexistent bridge network
2. Create with nonexistent public network
### Expected Outcome:
* Verify resource suggestion successfully show available values
* Deployment fails
## Multiple datacenters
1. Prepare vCenter environment with multiple datacenters
2. Create with --target not specifying a datacenter
### Expected Outcome:
* Output contains message indicating datacenter must be specified
* Output suggests available datacenter values
* Deployment fails
Test Cases: - validate license
======
1. Prepare env with different license level
2. Verify license validation works for different license
### Expected Outcome:
* If license verification passed, deployment succeeds
Test Cases: - firewall
======
## Firewall disabled
1. Create with env with firewall disabled
### Expected Outcome:
* Warn firewall is not enabled with user-friendly message
* Deployment succeeds
## Firewall enabled
1. Create with env with firewall enabled, but tether port allowed
### Expected Outcome:
* Show firewall check passed
* Deployment succeeds
## Firewall misconfigured
1. Create env with firewall configured to block tether port
### Expected Outcome:
* Show error message that firewall is misconfigured
* Deployment fails
Test Cases: - drs
======
1. Prepare env with drs disabled
2. Verify deployment failed for drs disabled with user-friendly error message
Test Cases: - resource accessibility
======
1. Prepare env with datastore not connected to hosts
2. Verify deployment failed for host/datastore connectability with user-friendly error message
Test Cases: - networking
======
## vDS contains all hosts in cluster
1. Prepare vCenter environment with a vDS that is connected to all hosts in the cluster
2. Issue the following command:
```
vic-machine create --name=<VCH_NAME> --target=<TEST_URL> \
--user=<TEST_USERNAME> --image-store=<TEST_DATASTORE> --password=<TEST_PASSWORD> \
--bridge-network=<NETWORK> --compute-resource=<TEST_RESOURCE>
```
3. Run regression tests
### Expected Outcome:
* Output contains message indicating vDS configuration OK
* Deployment succeeds
* Regression tests pass
## vDS does not contain all hosts in cluster
1. Prepare vCenter environment with a vDS that is not connected to all hosts in the cluster
2. Issue the following command:
```
vic-machine create --name=<VCH_NAME> --target=<TEST_URL> \
--user=<TEST_USERNAME> --image-store=<TEST_DATASTORE> --password=<TEST_PASSWORD> \
--bridge-network=<NETWORK> --compute-resource=<TEST_RESOURCE>
```
### Expected Outcome:
* Output contains message indicating vDS configuration is incorrect with user-friendly error message
* Deployment fails
## Bridge network same as public network
1. Create with bridge network the same as public network
### Expected Outcome:
* Output contains message indicating invalid network configuration
* Deployment fails
Test Cases: - storage
======
## Default image datastore
1. Prepare env with one datastore
2. Issue `vic-machine create` without specifying `--image-store`
3. Run regression tests
### Expected Outcome:
* Deployment succeeds
* Regression tests pass
## Custom image datastore
1. Issue the following command:
```
vic-machine-linux create --name=${vch-name} --target=%{TEST_URL} \
--thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} \
--image-store=%{TEST_DATASTORE}/long/weird/path ${vicmachinetls}
```
2. Run regression tests
### Expected Outcome:
* Deployment succeeds
* Regression tests pass

View File

@@ -0,0 +1,160 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-05 - Verify vic-machine create validation function
Resource ../../resources/Util.robot
Test Teardown Run Keyword If Test Failed Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Suggest resources - Invalid datacenter
Log To Console \nRunning vic-machine create
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
Log To Console \nInstalling VCH to test server...
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL}/WOW --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --password=%{TEST_PASSWORD} ${vicmachinetls}
Should Contain ${output} Suggested datacenters:
Should Contain ${output} vic-machine-linux create failed:
Suggest resources - Invalid target path
Log To Console \nRunning vic-machine create
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
Log To Console \nInstalling VCH to test server...
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL}/MUCH/DATACENTER --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --password=%{TEST_PASSWORD} ${vicmachinetls}
Should Contain ${output} Suggested datacenters:
Should Contain ${output} vic-machine-linux create failed:
Create VCH - target thumbprint verification
Log To Console \nRunning vic-machine create - thumbprint verification
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --thumbprint=NOPE --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --image-store=ENOENT ${vicmachinetls}
Should Contain ${output} thumbprint does not match
Default image datastore
# This test case is dependent on the ESX environment having only one datastore
Log To Console \nRunning vic-machine create - default image datastore
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
Log To Console \nInstalling VCH to test server...
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Log ${output}
# VCH creation should succeed on ESXi with one datastore
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Should Contain ${output} Using default datastore
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Should Contain ${output} Installer completed successfully
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Get Docker Params ${output} ${true}
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Log To Console Installer completed successfully: %{VCH-NAME}...
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run Regression Tests
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Cleanup VIC Appliance On Test Server
# VCH creation should fail on VC
Run Keyword If '%{HOST_TYPE}' == 'VC' Should Contain ${output} Suggested values for --image-store
Run Keyword If '%{HOST_TYPE}' == 'VC' Should Contain ${output} vic-machine-linux create failed
Custom image datastore
# This test case is dependent on the ESX environment having only one datastore
Log To Console \nRunning vic-machine create - custom image datastore
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
Log To Console \nInstalling VCH to test server...
${output-esx}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --image-store=%{TEST_DATASTORE}/long/weird/path ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
${output-vc}= Run Keyword If '%{HOST_TYPE}' == 'VC' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --image-store=%{TEST_DATASTORE}/long/weird/path ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
${output}= Set Variable If '%{HOST_TYPE}' == 'ESXi' ${output-esx} ${output-vc}
Log ${output}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}...
Run Regression Tests
Cleanup VIC Appliance On Test Server
Trailing slash works as expected
Set Test Environment Variables
Log To Console \nInstalling VCH to test server...
${output-esx}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL}/ --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
${output-vc}= Run Keyword If '%{HOST_TYPE}' == 'VC' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL}/ --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
${output}= Set Variable If '%{HOST_TYPE}' == 'ESXi' ${output-esx} ${output-vc}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}...
Run Regression Tests
Cleanup VIC Appliance On Test Server
Whitelist registries - blocked registry wildcard domain
Set Test Environment Variables
Log To Console \nInstalling VCH to test server...
# *.docker.io
${output-esx}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL}/ --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} ${vicmachinetls} --whitelist-registry *.docker.io
${output-vc}= Run Keyword If '%{HOST_TYPE}' == 'VC' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL}/ --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --whitelist-registry *.docker.io
${output}= Set Variable If '%{HOST_TYPE}' == 'ESXi' ${output-esx} ${output-vc}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
# try a docker pull from docker.io; this should fail
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox
Should Not Be Equal As Integers ${rc} 0
Cleanup VIC Appliance On Test Server
Whitelist registries - blocked registry ip address of valid registry fqdn
Set Test Environment Variables
# ip address of docker.io
${output-esx}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL}/ --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} ${vicmachinetls} --whitelist-registry 52.200.132.201
${output-vc}= Run Keyword If '%{HOST_TYPE}' == 'VC' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL}/ --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --whitelist-registry 52.200.132.201
${output}= Set Variable If '%{HOST_TYPE}' == 'ESXi' ${output-esx} ${output-vc}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
# try a docker pull from docker.io; this should fail
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox
Should Not Be Equal As Integers ${rc} 0
Cleanup VIC Appliance On Test Server
Whitelist registries - allowed registry fqdn
Set Test Environment Variables
${output-esx}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL}/ --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} ${vicmachinetls} --whitelist-registry registry.hub.docker.com
${output-vc}= Run Keyword If '%{HOST_TYPE}' == 'VC' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL}/ --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --whitelist-registry registry.hub.docker.com
${output}= Set Variable If '%{HOST_TYPE}' == 'ESXi' ${output-esx} ${output-vc}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
# try a docker pull from docker.io; this should succeed
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox
Should Be Equal As Integers ${rc} 0
Cleanup VIC Appliance On Test Server
Whitelist registries - allowed registry wildcard domain
Set Test Environment Variables
${output-esx}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL}/ --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} ${vicmachinetls} --whitelist-registry *hub.docker.com
${output-vc}= Run Keyword If '%{HOST_TYPE}' == 'VC' Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL}/ --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --whitelist-registry *hub.docker.com
${output}= Set Variable If '%{HOST_TYPE}' == 'ESXi' ${output-esx} ${output-vc}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
# try a docker pull from docker.io; this should succeed
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox
Should Be Equal As Integers ${rc} 0
Cleanup VIC Appliance On Test Server

View File

@@ -0,0 +1,70 @@
Test 6-06 - Verify vic-machine create datastore function
=======
# Purpose:
Verify vic-machine create image store, volume store and container store functions
# References:
* vic-machine-linux create -h
# Environment:
This test requires that a vSphere server is running and available
# Test Cases: - image store
# Test Steps
1. create with wrong image store format, e.g. wrong separator, wrong schema
2. Create with not existed image store name
3. Verify deployment failed with user-friendly error message
# Test Steps
1. Create with not existed image store path with format: <image store name>:/some/path
2. Create with existed image store path with formt: <image store name>:/ds://some/path
3. Create without image store configured
3. Regression test
4. Verify deployment and regression test passed
5. Verify docker images are persisted in the specified path or default path if image store is not provided
# Test Cases: - image store not found
# Test steps
1. Delete VCH created image store through govc
2. Delete VCH
3. Verify VCH delete succeeds
# Test Cases: - image store delete
# Test steps
1. Delete above VCH deployed with image store path
2. Verify image store is deleted successfully
# Test Cases: - volume store
# Test Steps
1. create with wrong volume store format, e.g. wrong separator, wrong schema
2. Create with not existed volume store name
3. Verify deployment failed with user-friendly error message
# Test Steps
1. Create with not existed voume store path with format: <volume store name>:/some/path
2. Create with existed image store path with formt: <volume store name>:/ds://some/path
3. Create with multiple volume store path
4. Create without volume store parameters
4. Regression test
5. Test docker volume commands
6. Verify deployment and regression test passed
7. Verify volumes are persisted in the specified path
8. If volume store is not provided, verify docker volume commands does not work
# Test Cases: - volume store delete
# Test steps
1. Delete above VCH deployed with volume store path without --force
2. Verify delete is successful but volume store is not deleted through govc
3. Verify the configured volume stores are correctly listed in warning message during deletion
# Test steps
1. Delete VCH deployed with volume store path with --force
2. Verify volume store is deleted successfully through govc
# Test Cases: - container store
# FIXME: container store is not implemeted

View File

@@ -0,0 +1,39 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-06 - Verify vic-machine create image store, volume store and container store functions
Resource ../../resources/Util.robot
Test Teardown Run Keyword If Test Failed Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Image Store Delete - Image store not found
Log To Console \nRunning vic-machine create - custom image store path
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
Log To Console \nInstalling VCH to test server...
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target=%{TEST_URL} --user=%{TEST_USERNAME} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --image-store=%{TEST_DATASTORE}/images --password=%{TEST_PASSWORD} --force --kv
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}...
Log To Console \nDeleting image stores...
${out}= Run govc datastore.rm -ds=%{TEST_DATASTORE} images
Log To Console \nRunning vic-machine delete
Cleanup VIC Appliance On Test Server

View File

@@ -0,0 +1,246 @@
Test 6-07 - Verify vic-machine create network function
=======
# Purpose:
Verify vic-machine create public, management, bridge network and container networks functions
# References:
* vic-machine-linux create -h
# Environment:
This test requires that a vSphere server is running and available
# Public network
## Public network - default
1. Create without public network provided
2. Verify "VM Network" is connected in VCH VM
3. Integration test passed
## Public network - invalid
1. Create with wrong network name provided for public network
2. Verify create failed for network is not found
## Public network - invalid vCenter
1. Create with distribute virtual switch as public network name
2. Verify create failed for network type is wrong
## Public network - DHCP
1. Create with network name no DHCP availabile for public network
2. Verify VCH created but without ip address
3. Verify VCH can be deleted without anything wrong through vic-machine delete
## Public network - valid
1. Create with DPG as public network in VC and correct switch in ESXi
2. Verify create passed
3. Verify integration test passed
# Management network
## Management network - none
1. Create without management network provided, but public network correctly set
2. Verify warning message set for management network and client network sharing the same network
3. No multiple attachement in VM network to same vSphere virtual switch (or DPG)
4. Integration test passed
## Management network - invalid
1. Create with wrong network name provided for management network
2. Verify create failed for network is not found
## Management network - invalid vCenter
1. Create with distribute virtual switch as management network name
2. Verify create failed for network type is wrong
## Management network - unreachable
1. Create with network unreachable for vSphere or VC as management network
2. Verify VCH created but VC or vSphere is unreachable
3. Make sure vic-machine failed with user-friendly error message
## Management network - valid
1. Create with correct management network (switch for ESX, DPG for vCenter)
2. Verify create passed
3. Verify integration test passed
# Bridge network
## Bridge network - vCenter none
1. Create without bridge network provided in VC
2. Create failed for bridge network should be specified in VC
## Bridge network - ESX none
1. Create without bridge network provided in ESXi
2. Integration test pass
## Bridge network - create bridge network if it doesn't exist
1. Create with wrong network name provided for bridge network
2. Verify create failed for network is not found, create will succeed on ESXi
## Bridge network - invalid vCenter
3. Create with distribute virtual switch as bridge network name
4. Verify create failed for network type is wrong
## Bridge network - non-DPG
1. Create with standard network in VC as bridge network
2. vic-machine failed for DPG is required for bridge network
## Bridge network - valid
1. Create with DPG in VC and switch in ESXi
2. Verify create passed
3. Verify integration test passed
## Bridge network - reused port group
1. Create with same network for bridge and public network
2. Verify create failed for same network with public network
3. Same case with management network
4. Same case with container network
## Bridge network - invalid IP settings
1. Create with bridge network correctly set
2. Set bridge network IP range with wrong format
3. Verify create failed with user-friendly error message
## Bridge network - invalid bridge network range
1. Create with bridge network IP range smaller than /16
2. Verify create failed with user-friendly error message
## Bridge network - valid with IP range
1. Create with bridge network correctly set
2. Set bridge network ip range correctly
3. Verify create passed
4. Regression test passed
5. docker create container, with ip address correctly set in the above ip range
# Container network
## Container network - space in network name invalid
1. Create with container network <Net With Spaces> and <Net With Spaces>: and <Net With Spaces>:<Alias>s
2. Verify create failed with a network name must be supplied for <Net With Space>
## Container network - space in network name valid
1. Create with container network: <Net With Spaces>:vmnet
2. Verify create passed
3. Regression test passed
4. Verify docker network ls command to show net1 network
## Container network invalid 1
1. Create with invalid container network: <WrongNet>:alias
2. Verify create failed with WrongNet is not found
## Container network invalid 2
1. Create with container network: <standard switch network name>:alias in VC
2. Verify create failed with standard network is not supported
## Container network 1
1. Create with container network: <dpg name>:net1 in VC or <standard switch network name>:net1 in ESXi
2. Verify create passed
3. Regression test passed
4. Verify docker network ls command to show net1 network
## Container network 2
1. Create with container network: <dpg name> in VC or <standard switch network name> in ESXi
2. Verify create passed
3. Regression test passed
4. Verify docker network ls command to show the <vsphere network name> network
## Network mapping invalid
1. Create with two container network map to same alias
2. Verify create failed with two different vsphere network map to same docker network
## Network mapping gateway invalid
1. Create with container network mapping
2. Set container network gateway as <dpg name>:1.1.1.1/24
3. Set container network gateway as <dpg name>:192.168.1.0/24
4. Set container network gateway as <wrong name>:192.168.1.0/24
5. Verify create failed for wrong vsphere network name or gateway is not routable
## Network mapping IP invalid
1. Create with container network mapping
2. Set container ip range as <wrong name>:192.168.2.1-192.168.2.100
3. Set container network gateway as <dpg name>:192.168.1.1/24, and container ip range as <dpg name>:192.168.2.1-192.168.2.100
4. Verify create failed for wrong vsphere network name or ip range is wrong
## DNS format invalid
1. Create with container network mapping
2. Set container DNS as <wrong name>:8.8.8.8
3. Set container DNS as <dpg name>:abcdefg
4. Verify create failed for wrong vsphere name or wrong dns format
## Network mapping
1. Create with container network mapping <dpg name>:net1
2. Set container network gateway as <dpg name>:192.168.1.1/24
3. Set container ip range as <dpg name>:192.168.1.2-192.168.1.100
4. Set container DNS as <dpg name>:<correct dns>
5. Verify create passed
6. Integration test passed
7. Docker network ls show net1
8. Docker container created with network attached with net1, got ip address inside of network range
9. Docker create another container, and link to previous one, can talk to the the first container successfully
## Container Firewalls
1. Create an open container and verify another open container can connect to it on arbitrary ports.
2. a. Try to publish a port on a closed firewall and verify an error is received.
b. Create a closed container and verify an open container cannot connect to it on an arbitrary port.
c. Create a container connected to a bridge and a closed network. Verify that another container connected
to the same bridge can connect to the closed container.
3. a. Create an outbound container. Verify that an outbound container on the same external network cannot
connect to the first outbound container.
b. Verify that the outbound container can initiate a connection with an open network on an arbitrary port.
c. Verify that two outbound containers on the same external network and on the same bridge network can
talk to one another via hte bridge.
4. a. Create a published container that publishes port 1337. Verify that an outbound container can connect to port
1337 on the published container.
b. Verify that an outbound container cannot connect to any other arbitrary port on the published container.
5. a. Create a peer network `A` with ip range `10.10.10.0/24` and gateway `10.10.10.1/24`.
b. Create a peer network `B` with ip range `192.168.0.0/16` and gateway `192.168.0.1/16`.
c. Verify that a container on network `B` cannot connect to network `A` through an arbitrary port.
d. Verify that a new container on network `A` (a peer) can connect to another container on network `A`
on an arbitrary port.
6. Verify that a closed container can ping localhost
# VCH static IP
## VCH static IP - Static public
1. Create with static IP address for public network (client and management networks unspecified
default to same port group as public network)
2. Verify debug output shows specified static IP address correctly assigned and copied to client and
management networks
## VCH static IP - Static client
1. Create with static IP address for client network and specify client, public, and management
networks to be on same port group
2. Verify debug output shows specified static IP address correctly assigned and copied to public
and management networks
## VCH static IP - Static management
1. Create with static IP address for management network and specify client, public, and management
networks to be on the same port group
2. Verify debug output shows specified static IP address correctly assigned and copied to client
and public management networks
## VCH static IP - different port groups 1
1. Create with static IP address for public network and specify client and management networks to
be on different port group
2. Verify debug output shows specified static IP address correctly assigned
3. Verify debug output shows client and management networks set to DHCP
## VCH static IP - different port groups 2
1. Create with static IP address for public network on `public-network` port group and a static
IP address for client network on `client-network` port group
2. Verify debug output shows correct IP address assigned to each interface
## VCH static IP - same port group
1. Create with static IP address for each public network and client network and specify both to be
on the same port group
2. Verify output shows configuration error and install does not proceed
## VCH static IP - same subnet for multiple port groups
1. Create with static IP address for public network and a static IP address for client network.
Specify the addresses to be on the same subnet, but assign each network to a different port
group
2. Verify output shows warning that assigning the same subnet to different port groups is
unsupported

View File

@@ -0,0 +1,708 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-07 - Verify vic-machine create network function
Resource ../../resources/Util.robot
Test Teardown Run Keyword If Test Failed Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Cleanup Container Firewalls Test Networks
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove bridge
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove open-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove closed-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove published-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove outbound-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove peers-net-1
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove peers-net-2
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup bridge
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup open-net
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup closed-net
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup published-net
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup outbound-net
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup peers-net-1
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup peers-net-2
Cleanup Container Firewalls Test
Cleanup VIC Appliance On Test Server
Cleanup Container Firewalls Test Networks
*** Test Cases ***
Public network - default
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
${info}= Get VM Info %{VCH-NAME}
Should Contain ${info} VM Network
Run Regression Tests
Cleanup VIC Appliance On Test Server
Public network - invalid
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
# Guarantee port group doesn't already exist
Run govc host.portgroup.remove 'AAAAAAAAAA'
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove 'AAAAAAAAAA'
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup 'AAAAAAAAAA'
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --public-network=AAAAAAAAAA ${vicmachinetls}
Should Contain ${output} --public-network: network 'AAAAAAAAAA' not found
Should Contain ${output} vic-machine-linux create failed
Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME}
Public network - invalid vCenter
Pass execution Test not implemented
Public network - DHCP
Pass execution Test not implemented
Public network - valid
Pass execution Test not implemented
Management network - none
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
${status}= Run Keyword And Return Status Should Contain ${output} Network role \\"management\\" is sharing NIC with \\"public\\"
${status2}= Run Keyword And Return Status Should Contain ${output} Network role \\"public\\" is sharing NIC with \\"management\\"
${status3}= Run Keyword And Return Status Should Contain ${output} Network role \\"public\\" is sharing NIC with \\"client\\"
${status4}= Run Keyword And Return Status Should Contain ${output} Network role \\"management\\" is sharing NIC with \\"client\\"
Should Be True ${status} | ${status2} | ${status3} | ${status4}
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Management network - invalid
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
# Guarantee port group doesn't already exist
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove 'AAAAAAAAAA'
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup 'AAAAAAAAAA'
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --management-network=AAAAAAAAAA ${vicmachinetls}
Should Contain ${output} --management-network: network 'AAAAAAAAAA' not found
Should Contain ${output} vic-machine-linux create failed
Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME}
Management network - invalid vCenter
Pass execution Test not implemented
Management network - unreachable
Pass execution Test not implemented
Management network - valid
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --management-network=%{PUBLIC_NETWORK} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Connectivity Bridge to Public
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove bridge
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove vm-network
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup bridge
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup vm-network
Log To Console Create a public portgroup.
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN vm-network
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds vm-network
Log To Console Create a bridge portgroup.
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN bridge
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds bridge
${output}= Run bin/vic-machine-linux create --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --password=%{TEST_PASSWORD} --force=true --bridge-network=bridge --public-network=vm-network --compute-resource=%{TEST_RESOURCE} --container-network vm-network --container-network-firewall vm-network:published --no-tlsverify --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
# this container will listen on :8000 and we're passing the -p option to the VCH so it should be exposed
Log To Console Creating public container.
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=vm-network -p 8000 --name p1 ${busybox} nc -l -p 8000
Should Be Equal As Integers ${rc} 0
Log To Console Getting IP for public container
${ip}= Run docker %{VCH-PARAMS} inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress }}{{end}}' p1
Log To Console Connecting to container on external network from container bridged network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net bridge ${busybox} nc ${ip} 8000
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
# nc is listening, but since we didn't pass the -p flag to docker, the port should not be exposed.
Log To Console Creating public container with no ports exposed.
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=vm-network --name p2 ${busybox} nc -l -p 8000
Should Be Equal As Integers ${rc} 0
Log To Console Getting IP for public container
${ip}= Run docker %{VCH-PARAMS} inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress }}{{end}}' p2
# we expect this to fail since the port wasn't exposed
Log To Console Connecting to container on external network from container bridged network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net bridge ${busybox} nc ${ip} 8000
Should Not Be Equal As Integers ${rc} 0
Log To Console Port connection test from bridge to public networks succeeded.
Cleanup VIC Appliance On Test Server
Connectivity Bridge to Management
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove bridge
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove management
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup bridge
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup management
Log To Console Create a bridge portgroup.
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN bridge
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds bridge
Log To Console Create a management portgroup.
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN management
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds management
${output}= Run bin/vic-machine-linux create --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --password=%{TEST_PASSWORD} --force=true --bridge-network=bridge --compute-resource=%{TEST_RESOURCE} --container-network management --container-network vm-network --container-network-ip-range=management:10.10.10.0/24 --container-network-gateway=management:10.10.10.1/24 --no-tlsverify --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Log To Console Creating management container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=management --name m1 ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Log To Console Starting management container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start m1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
Log To Console Creating bridge container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=bridge --name b1 ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Log To Console Starting bridge container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start b1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
Log To Console Getting IP for management container
${ip}= Run docker %{VCH-PARAMS} inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress }}{{end}}' m1
Log To Console Pinging from bridge to management container.
${id}= Run docker %{VCH-PARAMS} run -d ${busybox} ping -c 30 ${ip}
Log To Console Attach to running container.
${out}= Run docker %{VCH-PARAMS} attach ${id}
Should Contain ${out} 100% packet loss
Log To Console Ping test succeeded.
Cleanup VIC Appliance On Test Server
Bridge network - vCenter none
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Pass Execution Test skipped on ESXi
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} ${vicmachinetls}
Should Contain ${output} error
Should Contain ${output} An existing distributed port group must be specified for bridge network on vCenter
# Delete the portgroup added by env vars keyword
Cleanup VCH Bridge Network %{VCH-NAME}
Bridge network - ESX none
Run Keyword If '%{HOST_TYPE}' == 'VC' Pass Execution Test skipped on VC
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Bridge network - create bridge network if it doesn't exist
Run Keyword If '%{HOST_TYPE}' == 'VC' Pass Execution Test not applicable on vCenter
# ESX should automatically create the bridge switch & port group AAAAAAAAAA, but vCenter would fail with unknown network error
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
# Guarantee port group doesn't already exist
Run govc host.portgroup.remove 'AAAAAAAAAA'
Run govc host.vswitch.remove 'AAAAAAAAAA'
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=AAAAAAAAAA ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Run govc host.portgroup.remove 'AAAAAAAAAA'
Run govc host.vswitch.remove 'AAAAAAAAAA'
Bridge network - invalid vCenter
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Pass Execution Test skipped on ESXi
Pass execution Test not implemented
Bridge network - non-DPG
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Pass Execution Test skipped on ESXi
Pass execution Test not implemented
Bridge network - valid
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Bridge network - reused port group
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{BRIDGE_NETWORK} ${vicmachinetls}
Should Contain ${output} the bridge network must not be shared with another network role
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --management-network=%{BRIDGE_NETWORK} ${vicmachinetls}
Should Contain ${output} the bridge network must not be shared with another network role
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --client-network=%{BRIDGE_NETWORK} ${vicmachinetls}
Should Contain ${output} the bridge network must not be shared with another network role
# Delete the portgroup added by env vars keyword
Cleanup VCH Bridge Network %{VCH-NAME}
Bridge network - invalid IP settings
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --bridge-network-range 1.1.1.1 ${vicmachinetls}
Should Contain ${output} Error parsing bridge network ip range
# Delete the portgroup added by env vars keyword
Cleanup VCH Bridge Network %{VCH-NAME}
Bridge network - invalid bridge network range
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --bridge-network-range 1.1.1.1/17 ${vicmachinetls}
Should Contain ${output} --bridge-network-range must be /16 or larger network
# Delete the portgroup added by env vars keyword
Cleanup VCH Bridge Network %{VCH-NAME}
Bridge network - valid with IP range
Pass execution Test not implemented
Container network - space in network name invalid
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=bridge --container-network 'VM Network With Spaces' ${vicmachinetls}
Should Contain ${output} A network alias must be supplied when network name \\"VM Network With Spaces\\" contains spaces.
Should Contain ${output} vic-machine-linux create failed
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=bridge --container-network 'VM Network With Spaces': ${vicmachinetls}
Should Contain ${output} A network alias must be supplied when network name \\"VM Network With Spaces:\\" contains spaces.
Should Contain ${output} vic-machine-linux create failed
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=bridge --container-network 'vm-network':'vm network' ${vicmachinetls}
Should Contain ${output} The network alias supplied in \\"vm-network:vm network\\" cannot contain spaces.
Should Contain ${output} vic-machine-linux create failed
# Delete the portgroup added by env vars keyword
Cleanup VCH Bridge Network %{VCH-NAME}
Container network - space in network name valid
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
Log To Console Create a portgroup with a space in its name
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN 'VM Network With Spaces'
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds 'VM Network With Spaces'
Log To Console Create a bridge portgroup.
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN bridge
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds bridge
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=bridge --container-network 'VM Network With Spaces':vmnet --insecure-registry wdc-harbor-ci.eng.vmware.com ${vicmachinetls}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
${output}= Run docker %{VCH-PARAMS} network ls
Should Contain ${output} vmnet
# Clean up port groups
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove 'VM Network With Spaces'
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove bridge
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup 'VM Network With Spaces'
Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup bridge
# Delete the portgroup added by env vars keyword
Cleanup VCH Bridge Network %{VCH-NAME}
Cleanup VIC Appliance On Test Server
Container Firewalls
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
# Set the only teardown for this test to cleanup both portgroups and VCH, regardless of test outcome.
[Teardown] Cleanup Container Firewalls Test
Cleanup Container Firewalls Test Networks
Log To Console Create port groups
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN bridge
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN open-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN closed-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN published-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN outbound-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN peers-net-1
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN peers-net-2
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds bridge
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds open-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds closed-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds published-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds outbound-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds peers-net-1
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds peers-net-2
${createcommand}= catenate SEPARATOR=\ \
... bin/vic-machine-linux create --debug 1 --name=%{VCH-NAME}
... --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT}
... --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --password=%{TEST_PASSWORD}
... --force=true --bridge-network=bridge --compute-resource=%{TEST_RESOURCE} --no-tlsverify
... --insecure-registry wdc-harbor-ci.eng.vmware.com
... --container-network open-net --container-network-firewall open-net:open
... --container-network closed-net --container-network-firewall closed-net:closed
... --container-network outbound-net --container-network-firewall outbound-net:outbound
... --container-network published-net --container-network-firewall published-net:published
... --container-network peers-net-1 --container-network-firewall peers-net-1:peers
... --container-network-ip-range peers-net-1:10.10.10.0/24 --container-network-gateway peers-net-1:10.10.10.1/24
... --container-network peers-net-2 --container-network-firewall peers-net-2:peers
... --container-network-ip-range peers-net-2:192.168.0.0/16 --container-network-gateway peers-net-2:192.168.0.1/16
${output}= Run ${createcommand}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
### OPEN FIREWALL ###
Log To Console Checking Open Firewall
# Create an open container listening on port 1234
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=open-net --name p1 ${busybox} nc -l -p 1234
Should Be Equal As Integers ${rc} 0
${ip}= Run docker %{VCH-PARAMS} inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress }}{{end}}' p1
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net bridge ${busybox} nc ${ip} 1234
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
### CLOSED FIREWALL ###
Log To Console Checking Closed Firewall
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=closed-net --name shouldfail -p 123 ${busybox} nc -l -p 1234
Should Contain ${output} ports cannot be published via
Should Not Be Equal As Integers ${rc} 0
# Create a closed container listening on port 1234.
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=closed-net --name p2 ${busybox} nc -l -p 1234
Should Be Equal As Integers ${rc} 0
${ip}= Run docker %{VCH-PARAMS} inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress }}{{end}}' p2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net=bridge ${busybox} nc ${ip} 1234
Should Not Be Equal As Integers ${rc} 0
# Create a container on a bridge and closed network listening on port 1234.
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --net=bridge --name closedbridge ${busybox} nc -l -p 1234
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network connect closed-net closedbridge
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start closedbridge
Should Be Equal As Integers ${rc} 0
${ip}= Run docker %{VCH-PARAMS} inspect --format '{{.NetworkSettings.Networks.bridge.IPAddress}}' closedbridge
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net=bridge ${busybox} nc ${ip} 1234
Should Be Equal As Integers ${rc} 0
### OUTBOUND FIREWALL ###
Log To Console Checking Outbound Firewall
# Create an outbound-only container listening on port 1234.
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=outbound-net --name p3 ${busybox} nc -l -p 1234
Should Be Equal As Integers ${rc} 0
${ip}= Run docker %{VCH-PARAMS} inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress }}{{end}}' p3
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net=outbound ${busybox} nc ${ip} 1234
Should Not Be Equal As Integers ${rc} 0
# The connection should not be established. However, an outbound network should be able to connect to an open network.
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=open-net --name p4 ${busybox} nc -l -p 1234
Should Be Equal As Integers ${rc} 0
${ip}= Run docker %{VCH-PARAMS} inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress }}{{end}}' p4
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net=outbound-net ${busybox} nc ${ip} 1234
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --net=bridge --name out1 ${busybox} nc -l -p 1234
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network connect outbound-net out1
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start out1
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --net=bridge --name out2 ${busybox} nc out1 1234
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network connect outbound-net out2
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start out2
### PUBLISHED FIREWALL ###
Log To Console Checking Published Firewall
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=published-net -p 1337 --name p5 ${busybox} nc -l -p 1337
Should Be Equal As Integers ${rc} 0
${ip}= Run docker %{VCH-PARAMS} inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress }}{{end}}' p5
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net=outbound-net ${busybox} nc ${ip} 1337
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
# Connection should be established on the open port. Let's try a closed one now...
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=published-net -p 1337 --name p6 ${busybox} nc -l -p 1337
Should Be Equal As Integers ${rc} 0
${ip}= Run docker %{VCH-PARAMS} inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress }}{{end}}' p6
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net=outbound-net ${busybox} nc ${ip} 404
Should Not Be Equal As Integers ${rc} 0
### PEERS FIREWALL ###
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=peers-net-1 --name shouldfail -p 123 ${busybox} nc -l -p 1234
Should Contain ${output} ports published via container network peers-net-1 must specify a mapping
Should Not Be Equal As Integers ${rc} 0
Log To Console Checking Peers Firewall
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=peers-net-1 --name p7 ${busybox} nc -l -p 1234
Should Be Equal As Integers ${rc} 0
${ip}= Run docker %{VCH-PARAMS} inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress }}{{end}}' p7
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net=peers-net-1 ${busybox} nc ${ip} 1234
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
# Connection should be established on the peer network. Let's try a non-peer now...
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=peers-net-1 --name p8 ${busybox} nc -l -p 1234
Should Be Equal As Integers ${rc} 0
${ip}= Run docker %{VCH-PARAMS} inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress }}{{end}}' p8
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net=peers-net-2 ${busybox} nc ${ip} 1234
Should Not Be Equal As Integers ${rc} 0
### Ping localhost ###
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name localping --network=closed-net ${busybox} ping -c1 localhost
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow localping
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 1 packets transmitted, 1 packets received
Container network invalid 1
Pass execution Test not implemented
Container network invalid 2
Pass execution Test not implemented
Reset VCH doesn't cause unintentionally exposed ports from container network
Set Test Environment Variables
# Attempt to cleanup old/canceled tests
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
# Create bridge portgroup on VC
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds bridge
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=bridge --container-network %{PUBLIC_NETWORK}:vmnet ${vicmachinetls}
Log ${output}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
${output}= Run docker %{VCH-PARAMS} network ls
Should Contain ${output} vmnet
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull nginx
Should Be Equal As Integers ${rc} 0
Log ${output}
${rc} ${cid}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net=vmnet -p 80 nginx
Log ${cid}
Should Be Equal As Integers ${rc} 0
# get the containerVM direct IP address
${rc} ${ipaddr}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${cid}
Should Be Equal As Integers ${rc} 0
Should Not Contain %{VCH-IP} ${ipaddr}
# ensure that we're reporting the containerVM IP in the ps output
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -f id=${cid}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} ${ipaddr}:80->80/tcp
${rc} ${output}= Run And Return Rc And Output govc vm.power -reset=true %{VCH-NAME}
Log To Console ${output}
Should Be Equal As Integers 0 ${rc}
Reboot VM %{VCH-NAME}
Log To Console Getting VCH IP ...
${new-vch-ip}= Get VM IP %{VCH-NAME}
Log To Console New VCH IP is ${new-vch-ip}
Replace String %{VCH-PARAMS} %{VCH-IP} ${new-vch-ip}
# wait for docker info to succeed
Wait Until Keyword Succeeds 20x 5 seconds Run Docker Info %{VCH-PARAMS}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -f id=${cid}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} %{VCH-IP}:80->80/tcp
# Delete the portgroup added by env vars keyword
Cleanup VIC Appliance On Test Server
Container network 2
Pass execution Test not implemented
Network mapping invalid
Pass execution Test not implemented
Network mapping gateway invalid
Pass execution Test not implemented
Network mapping IP invalid
Pass execution Test not implemented
DNS format invalid
Pass execution Test not implemented
Network mapping
Pass execution Test not implemented
VCH static IP - Static public
Pass execution Test not implemented
VCH static IP - Static client
Pass execution Test not implemented
VCH static IP - Static management
Pass execution Test not implemented
VCH static IP - different port groups 1
Pass execution Test not implemented
VCH static IP - different port groups 2
Pass execution Test not implemented
VCH static IP - same port group
Pass execution Test not implemented
VCH static IP - same subnet for multiple port groups
Pass execution Test not implemented

View File

@@ -0,0 +1,58 @@
Test 6-08 - Verify vic-machine create compute-resource verification
=======
# Purpose:
Verify vic-machine create compute resource parsing
# References:
* vic-machine-linux create -h
# Environment:
This test requires that a vSphere server is running and available
# Wrong absolute path
# Test Steps
1. Create with compute resource set wrongDC:malformat
2. Create with compute resource set to /WrongDC/cluster/
3. Create with compute resource set to /DC/cluster/host/rp
4. Verify creation failed correctly
# Correct absolute path
# Test Steps
1. Create with compute resource set to /DC/host/cluster/Resources/rp
2. Verify creation passed successfully
3. Verify VCH is created in the correct place though govc
# Wrong relative path
# Test Steps
1. Prepare env with multiple VC clusters and multiple available resource pools
2. Create with compute resource set to wrongRP1 (wrongRP1 does not exist)
3. Create with compute resource set to wrongCluster (wrongCluster does not exist)
4. Create with compute resource set to RP1 (RP1 exists in one cluster)
5. Create with compute resource set to Cluster1 (Cluster1 exists)
6. Verify creation failed correctly
# Correct relative path with single VC cluster
# Test Steps
1. Prepare env single VC cluster
2. Create with compute resource set to <cluster name> (real cluster name here)
3. Create with compute resource set to RP1 (RP1 exists in cluster)
4. Create with compute resource not set
5. Verify deployed successfully
6. Verify VCH is created in the correct place though govc
# Correct relative path with ESXi
# Test Steps
1. Test in ESXi
2. Create with compute resource set to RP1 (RP1 exists in cluster)
3. Create with compute resource not set
4. Verify deployed successfully
5. Verify VCH is created in the correct place though govc
# Correct relative path in multiple VC cluster
# Test Steps
1. Prepare env with multiple VC clusters and multiple available resource pools
2. Create with compute resource set to Cluster (Cluster exists)
3. Create with compute resource set to Cluster/RP1 (Cluster/RP1 exists in cluster)
4. Verify deployed successfully
5. Verify VCH is created in the correct place though govc

View File

@@ -0,0 +1,56 @@
Test 6-09 - Verify vic-machine inspect
=======
# Purpose:
Verify vic-machine inspect functionality
# References:
* vic-machine-linux inspect -h
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Install VCH
2. Issue a basic vic-machine inspect command
3. Issue vic-machine inspect config command
4. Issue vic-machine inspect config --format raw command
5. Create a VCH with custom resource settings
6. Issue vic-machine inspect config command
7. Issue vic-machine inspect config --format raw command
8. Create a VCH with some container-network options
9. Issue vic-machine inspect config --format raw command
10. Create a VCH with tlsverify
11. Inspect the VCH without specifying --tls-cert-path
12. Inspect the VCH with a valid --tls-cert-path
13. Inspect the VCH with an invalid --tls-cert-path
14. Create a VCH with --no-tls
15. Inspect the VCH without specifying --tls-cert-path
16. Create a VCH with --no-tlsverify
17. Inspect the VCH without specifying --tls-cert-path
18. Create a VCH with some container-network options
# Expected Outcome:
* Step 1 should succeed
* Step 2 should succeed and the output should contain the following:
* VCH ID
* VCH upgrade information
* VCH Admin address
* Address of published ports
* The docker info command for the VCH
* Steps 3-9 should succeed
* Output from steps 3 and 4 should contain expected flags & values
* Output from steps 6 and 7 should contain the expected resource flags and values
* Output from step 9 should contain the expected container network flags and values
* Steps 10-18 should complete successfully, however, step 12 should show a warning in the output (see below)
* The output of steps 11 and 12 should contain the correct `DOCKER_CERT_PATH`
* The output of step 13 should not contain a `DOCKER_CERT_PATH` and should contain:
```
Unable to find valid client certs
DOCKER_CERT_PATH must be provided in environment or certificates specified individually via CLI arguments
```
* The outputs of steps 15 and 17 should not contain a `DOCKER_CERT_PATH` and should not contain:
```
Unable to find valid client certs
DOCKER_CERT_PATH must be provided in environment or certificates specified individually via CLI arguments
```

View File

@@ -0,0 +1,199 @@
# Copyright 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*** Settings ***
Documentation Test 6-09 - Verify vic-machine inspect functions
Resource ../../resources/Util.robot
Test Teardown Run Keyword If Test Failed Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Cleanup Container Network Test Networks
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove published-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove peers-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup published-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Remove VC Distributed Portgroup peers-net
Cleanup Container Network Test
Cleanup VIC Appliance On Test Server
Cleanup Container Network Test Networks
*** Test Cases ***
Inspect VCH Basic
Install VIC Appliance To Test Server
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --name=%{VCH-NAME}
Should Be Equal As Integers 0 ${rc}
Should Contain ${output} VCH ID
Should Contain ${output} Installer version
Should Contain ${output} VCH version
Should Contain ${output} VCH upgrade status
Should Contain ${output} Installer has same version as VCH
Should Contain ${output} No upgrade available with this installer version
Should Contain ${output} VCH Admin Portal
Should Contain ${output} Published ports can be reached at
Should Contain ${output} Connect to docker
Inspect VCH Configuration
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect config --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --name=%{VCH-NAME}
Should Contain ${output} --debug=1
Should Contain ${output} --name=%{VCH-NAME}
Should Contain ${output} --target=https://%{TEST_URL}
Should Contain ${output} --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --image-store=ds://%{TEST_DATASTORE}
Should Contain ${output} --compute-resource=%{TEST_RESOURCE}
Should Contain ${output} --volume-store=ds://%{TEST_DATASTORE}
Should Contain ${output} --bridge-network=%{BRIDGE_NETWORK}
Should Not Contain ${output} --cpu
Should Not Contain ${output} --cpu-shares
Should Not Contain ${output} --memory
Should Not Contain ${output} --memory-shares
Should Not Contain ${output} --base-image-size
Should Not Contain ${output} --bridge-network-range
Should Be Equal As Integers 0 ${rc}
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect config --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --name=%{VCH-NAME} --format raw
Should Contain ${output} --debug=1
Should Contain ${output} --name=%{VCH-NAME}
Should Contain ${output} --target=https://%{TEST_URL}
Should Contain ${output} --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --image-store=ds://%{TEST_DATASTORE}
Should Contain ${output} --compute-resource=%{TEST_RESOURCE}
Should Contain ${output} --volume-store=ds://%{TEST_DATASTORE}
Should Contain ${output} --bridge-network=%{BRIDGE_NETWORK}
Should Not Contain ${output} --cpu
Should Not Contain ${output} --cpu-shares
Should Not Contain ${output} --memory
Should Not Contain ${output} --memory-shares
Should Not Contain ${output} --base-image-size
Should Not Contain ${output} --bridge-network-range
Should Not Contain ${output} INFO
Should Not Contain ${output} WARN
Should Be Equal As Integers 0 ${rc}
Cleanup VIC Appliance On Test Server
Inspect VCH Configuration with Resource Limitation
Install VIC Appliance To Test Server additional-args=--memory 8000 --memory-reservation 512 --memory-shares 6000 --cpu 10000 --cpu-reservation 512 --cpu-shares high --endpoint-cpu 2 --endpoint-memory 4096
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect config --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --name=%{VCH-NAME}
Should Contain ${output} --debug=1
Should Contain ${output} --name=%{VCH-NAME}
Should Contain ${output} --target=https://%{TEST_URL}
Should Contain ${output} --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --image-store=ds://%{TEST_DATASTORE}
Should Contain ${output} --compute-resource=%{TEST_RESOURCE}
Should Contain ${output} --volume-store=ds://%{TEST_DATASTORE}
Should Contain ${output} --bridge-network=%{BRIDGE_NETWORK}
Should Contain ${output} --memory-shares=6000
Should Contain ${output} --memory-reservation=512
Should Contain ${output} --memory=8000
Should Contain ${output} --cpu=10000
Should Contain ${output} --cpu-reservation=512
Should Contain ${output} --cpu-shares=high
Should Contain ${output} --endpoint-memory=4096
Should Contain ${output} --endpoint-cpu=2
Should Be Equal As Integers 0 ${rc}
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect config --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --name=%{VCH-NAME} --format raw
Should Contain ${output} --debug=1
Should Contain ${output} --name=%{VCH-NAME}
Should Contain ${output} --target=https://%{TEST_URL}
Should Contain ${output} --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --image-store=ds://%{TEST_DATASTORE}
Should Contain ${output} --compute-resource=%{TEST_RESOURCE}
Should Contain ${output} --volume-store=ds://%{TEST_DATASTORE}
Should Contain ${output} --bridge-network=%{BRIDGE_NETWORK}
Should Contain ${output} --memory-shares=6000
Should Contain ${output} --memory-reservation=512
Should Contain ${output} --memory=8000
Should Contain ${output} --cpu=10000
Should Contain ${output} --cpu-reservation=512
Should Contain ${output} --cpu-shares=high
Should Contain ${output} --endpoint-memory=4096
Should Contain ${output} --endpoint-cpu=2
Should Not Contain ${output} INFO
Should Not Contain ${output} WARN
Should Be Equal As Integers 0 ${rc}
Cleanup VIC Appliance On Test Server
Inspect VCH Configuration with Container Networks
# Set the only teardown for this test to cleanup both portgroups and VCH, regardless of test outcome.
[Teardown] Cleanup Container Network Test
Cleanup Container Network Test Networks
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN published-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vswitch vSwitchLAN peers-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds published-net
${out}= Run Keyword If '%{HOST_TYPE}' == 'VC' Add VC Distributed Portgroup test-ds peers-net
Install VIC Appliance To Test Server additional-args=-container-network published-net -container-network peers-net -cnf peers-net:peers --container-network-ip-range peers-net:10.10.10.0/24 -cng peers-net:10.10.10.1/24
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect config --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --name=%{VCH-NAME} --format raw
Should Contain ${output} --container-network=published-net:published-net
Should Not Contain ${output} --container-network-firewall=published-net:published
Should Contain ${output} --container-network=peers-net:peers-net
Should Contain ${output} --container-network-gateway=peers-net:10.10.10.1/24
Should Contain ${output} --container-network-ip-range=peers-net:10.10.10.0/24
Should Contain ${output} --container-network-firewall=peers-net:peers
Should Be Equal As Integers 0 ${rc}
Verify inspect output for a full tls VCH
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If '${domain}' == '' Pass Execution Skipping test - domain not set, won't generate keys
Install VIC Appliance To Test Server
${output}= Run bin/vic-machine-linux inspect --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} DOCKER_CERT_PATH=${EXECDIR}/%{VCH-NAME}
${output}= Run bin/vic-machine-linux inspect --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --tls-cert-path=%{VCH-NAME}
Should Contain ${output} DOCKER_CERT_PATH=${EXECDIR}/%{VCH-NAME}
${output}= Run bin/vic-machine-linux inspect --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --tls-cert-path=fakeDir
Should Not Contain ${output} DOCKER_CERT_PATH=${EXECDIR}/%{VCH-NAME}
Should Contain ${output} Unable to find valid client certs
Should Contain ${output} DOCKER_CERT_PATH must be provided in environment or certificates specified individually via CLI arguments
Cleanup VIC Appliance On Test Server
Verify inspect output for a --no-tls VCH
Set Test Environment Variables
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --no-tls
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
${output}= Run bin/vic-machine-linux inspect --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT}
Should Not Contain ${output} DOCKER_CERT_PATH=${EXECDIR}/%{VCH-NAME}
Should Not Contain ${output} Unable to find valid client certs
Should Not Contain ${output} DOCKER_CERT_PATH must be provided in environment or certificates specified individually via CLI arguments
Cleanup VIC Appliance On Test Server
Verify inspect output for a --no-tlsverify VCH
Set Test Environment Variables
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --no-tlsverify
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
${output}= Run bin/vic-machine-linux inspect --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT}
Should Not Contain ${output} DOCKER_CERT_PATH=${EXECDIR}/%{VCH-NAME}
Should Not Contain ${output} Unable to find valid client certs
Should Not Contain ${output} DOCKER_CERT_PATH must be provided in environment or certificates specified individually via CLI arguments
Cleanup VIC Appliance On Test Server

View File

@@ -0,0 +1,23 @@
Test 6-10 - Verify vic-machine ls
=======
# Purpose:
Verify vic-machine ls functions
# References:
* vic-machine-linux ls -h
# Environment:
This test requires that a vSphere server is running and available
# Test Steps
1. Create VCH
3. Run ls to query out VCH
4. Run inspect to verify VCH id is correct
5. Run inspect to verify VCH compute path and name are correct
6. Run inspect to verify VCH with a trailing slash in the target
7. Run inspect with an invalid compute resource
# Expected Results
* Steps 1-6 should succeed and correctly list any VCHs present in the system
* Step 7 should fail and suggest a valid compute resource

View File

@@ -0,0 +1,76 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-10 - Verify ls list all VCHs
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Verify Listed Machines
[Arguments] ${list}
Should Contain ${list} ID
Should Contain ${list} PATH
Should Contain ${list} NAME
Should Not Contain ${list} Error
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux version
Should Be Equal As Integers ${rc} 0
@{version}= Split String ${output}
${machines}= Get Lines Containing String ${list} %{VCH-NAME}
@{lines}= Split To Lines ${machines}
Length Should Be ${lines} 1
# Get VCH ID, PATH and NAME
@{vch}= Split String @{lines}[-1]
${vch-id}= Strip String @{vch}[0]
${vch-path}= Strip String @{vch}[1]
${vch-name}= Strip String @{vch}[2]
${vch-version}= Strip String @{vch}[3]
Should Be Equal As Strings @{version}[-1] ${vch-version}
# Run vic-machine inspect
${ret}= Run bin/vic-machine-linux inspect --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --id ${vch-id}
Should Contain ${ret} Completed successfully
${ret}= Run bin/vic-machine-linux inspect --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource ${vch-path} --name ${vch-name}
Should Contain ${ret} Completed successfully
*** Test Cases ***
List all VCHs
${ret}= Run bin/vic-machine-linux ls --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD}
Verify Listed Machines ${ret}
List with compute-resource
${ret}= Run bin/vic-machine-linux ls --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource %{TEST_RESOURCE}
Verify Listed Machines ${ret}
List with trailing slash
${ret}= Run bin/vic-machine-linux ls --target %{TEST_URL}/ --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource %{TEST_RESOURCE}
Verify Listed Machines ${ret}
List suggest compute resource
${ret}= Run bin/vic-machine-linux ls --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource fakeComputeResource
Should Contain ${ret} Suggested values for --compute-resource:
List suggest valid datacenter
${ret}= Run bin/vic-machine-linux ls --target %{TEST_URL}/fakeDatacenter --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource %{TEST_RESOURCE}
Should Contain ${ret} Suggesting valid values for datacenter in --target
List with valid datacenter
${orig}= Get Environment Variable TEST_DATACENTER
${dc}= Run Keyword If '%{TEST_DATACENTER}' == '${SPACE}' Get Datacenter Name
Run Keyword If '%{TEST_DATACENTER}' == '${SPACE}' Set Environment Variable TEST_DATACENTER ${dc}
${ret}= Run bin/vic-machine-linux ls --target %{TEST_URL}/%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD}
Set Environment Variable TEST_DATACENTER ${orig}
Verify Listed Machines ${ret}

View File

@@ -0,0 +1,38 @@
Test 6-11 - Verify vic-machine debug
=======
# Purpose:
Verify vic-machine debug functions
# References:
* vic-machine-linux debug -h
# Environment:
This test requires that a vSphere server is running and available
# Test Cases
======
# Enable SSH
1. Create VCH
2. Generate ssh keypair with ssh-keygen
3. Run vic-machine debug to enable SSH, supplying public key for authorized_keys file
4. ssh to endpointVM and run `/bin/true`, asserting success via exit status
# Expected Results
* All steps should succeed
# Password Change When Expired
1. Create VCH
2. Generate ssh keypair with ssh-keygen
3. Run vic-machine debug to enable SSH, supplying public key for authorized_keys file
4. ssh to endpointVM using private key and run `/bin/true`, asserting success via exit status
5. Change date to +6 years on current time - this is past the support window
6. ssh to endpointVM using private key and run `/bin/true`, asserting failure via exit status
7. Run vic-machine debug to enable SSH, supplying a dictionary password that would be rejected by cracklib if change were interactive
8. ssh to endpointVM using password and run `/bin/true`, asserting success via exit status
# Expected Results
* Step 6 should fail due to expired password
* All other steps should succeed

View File

@@ -0,0 +1,75 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-11 - Verify enable of ssh in the appliance
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Enable SSH and verify
# generate a key to use for the Test
${rc}= Run And Return Rc ssh-keygen -t rsa -N "" -f %{VCH-NAME}.key
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc chmod 600 %{VCH-NAME}.key
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc bin/vic-machine-linux debug --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --name %{VCH-NAME} --enable-ssh --authorized-key=%{VCH-NAME}.key.pub
Should Be Equal As Integers ${rc} 0
# check the ssh
${rc}= Run And Return Rc ssh -vv -o StrictHostKeyChecking=no -i %{VCH-NAME}.key root@%{VCH-IP} /bin/true
Should Be Equal As Integers ${rc} 0
# delete the keys
Remove Files %{VCH-NAME}.key %{VCH-NAME}.key.pub
Check Password Change When Expired
# generate a key to use for the Test
${rc}= Run And Return Rc ssh-keygen -t rsa -N "" -f %{VCH-NAME}.key
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc chmod 600 %{VCH-NAME}.key
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc bin/vic-machine-linux debug --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --name %{VCH-NAME} --enable-ssh --authorized-key=%{VCH-NAME}.key.pub
Should Be Equal As Integers ${rc} 0
# push the date forward, past the suport duration
${rc} ${output}= Run And Return Rc And Output ssh -o StrictHostKeyChecking=no -i %{VCH-NAME}.key root@%{VCH-IP} 'date -s " +6 year"'
Should Be Equal As Integers ${rc} 0
# command should fail with expired password
${rc}= Run And Return Rc ssh -vv -o StrictHostKeyChecking=no -i %{VCH-NAME}.key root@%{VCH-IP} /bin/true
Should Not Be Equal As Integers ${rc} 0
# Set the password to a dictionary word - this should not be rejected via this path
${rc}= Run And Return Rc bin/vic-machine-linux debug --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --name %{VCH-NAME} --enable-ssh --rootpw=dictionary
Should Be Equal As Integers ${rc} 0
# check we can now log in cleanly - log in via password
${rc}= Run And Return Rc sshpass -p dictionary ssh -o StrictHostKeyChecking=no root@%{VCH-IP} /bin/true
Should Be Equal As Integers ${rc} 0
# delete the keys
Remove Files %{VCH-NAME}.key %{VCH-NAME}.key.pub
Check Error From Incorrect ID
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux debug --target %{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --id=wrong
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Failed to get Virtual Container Host
Should Contain ${output} id \\"wrong\\" could not be found

View File

@@ -0,0 +1,15 @@
Test 6-12 - Verify vic-machine version
=======
# Purpose:
Verify vic-machine version functions
# References:
* vic-machine-linux version -h
# Environment:
This test requires that a vSphere server is running and available
# Test Steps
1. Get drone build ID and commit hash
2. Verify version command show the ID and hash correctly

View File

@@ -0,0 +1,38 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-12 - Verify vic-machine version command
Resource ../../resources/Util.robot
Test Timeout 20 minutes
*** Test Cases ***
VIC-machine - Version check
Set Test Environment Variables
${output}= Run bin/vic-machine-linux version
@{gotVersion}= Split String ${output} ${SPACE}
${version}= Remove String @{gotVersion}[2]
Log To Console VIC machine version: ${version}
${result}= Run git rev-parse HEAD
@{gotVersion}= Split String ${result} ${SPACE}
${commithash}= Remove String @{gotVersion}[0]
Log To Console Last commit hash from git: ${commithash}
${hash_result} = Fetch From Right ${version} -
Log To Console Commit Hash from vic-machine version: ${hash_result}
Should Contain ${commithash} ${hash_result}

View File

@@ -0,0 +1,141 @@
Test 6-13 - Verify vic-machine create TLS function
=======
# Purpose:
Verify vic-machine create certificates
# References:
* vic-machine-linux create -h
# Environment:
This test requires that a vSphere server is running and available
TLS Auth
=======
## Create VCH - defaults with --no-tls
1. Issue the following command:
```
vic-machine-linux create --name=${vch-name} --target=%{TEST_URL} \
--user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --appliance-iso=bin/appliance.iso \
--bootstrap-iso=bin/bootstrap.iso --password=%{TEST_PASSWORD} --no-tls --force=true \
--bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} \
--compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} \
--volume-store=%{TEST_DATASTORE}/test:${vol}
```
2. Run regression tests
### Expected Outcome
* Deployment succeeds
* Regression tests pass
## Create VCH - use custom --tls-cert-path
1. Issue the following command:
```
vic-machine-linux create\
${vicmachinetls}\
--name=%{VCH-NAME}\
--target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}"\
--thumbprint=%{TEST_THUMBPRINT}\
--image-store=%{TEST_DATASTORE}\
--bridge-network=%{BRIDGE_NETWORK}\
--public-network=%{PUBLIC_NETWORK}\
--tls-cert-path=${EXECDIR}/foo-bar-certs/
```
### Expected Outcome
* Certs are generated and stored in `foo-bar-cert`
* Environment file in `foo-bar-certs/${VCH-NAME}` contains correct `DOCKER_CERT_PATH` variable definition
## Create VCH - force accept target thumbprint
1. Issue the following command:
```
vic-machine-linux create --name=${vch-name} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" \
--force --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} \
--public-network=%{PUBLIC_NETWORK} ${vicmachinetls}
```
2. Run regression tests
### Expected Outcome
* Deployment succeed
* Regression test pass
## Create VCH - Specified keys
1. Generate key/cert files
2. Specify key, cert files during creation
### Expected Outcome
* Command should succeed,
* Docker is accessed through tls connection, and the key/cert previous generated can be used to access docker
* Regression test pass
## Create VCH - Server certificate with multiple blocks
1. Generate key/cert files with server-cert.pem containing a block other than CERTIFICATE as the
first PEM block
2. Specify key, cert files during creation
### Expected Outcome
* vic-machine warns about failure to load x509 leaf
* Deployment succeeds
## Create VCH - Invalid keys
1. Specify key, cert files with mal-format files
### Expected Outcome
* Command fail for wrong key/cert file
## Create VCH - Reuse keys
1. Create VCH
2. Destroy VCH
3. Create VCH using keys and certificates from previous deployment
### Expected Outcome
* Deployment succeeds
## Create VCH - Server cert with untrusted CA
1. Generate CA and wildcard server cert for DOMAIN
2. Issue the following command to create the VCH with server cert and key
```
bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --tls-server-key "bundle/*.${domain}.key.pem" --tls-server-cert "bundle/*.${domain}.cert.pem" --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --debug 1
```
### Expected Outcome
* Client authentication is done with vic-machine generated CA
* Certificate does not validate
* Provided certificate is presented on vic-admin interface
## Create VCH - Server cert with trusted CA
0. Generate CA and wildcard server cert for DOMAIN
1. Add root certificate to the system root CA store
2. Issue the following command to create the VCH with a static IP, specified hostname, server cert, and key
```
bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --tls-server-key "bundle/*.${domain}.key.pem" --tls-server-cert "bundle/*.${domain}.cert.pem" --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --debug 1
```
### Expected Outcome
* Client authentication is done with vic-machine generated CA
* Certificate validates
* Deployment succeeds
* Provided certificate is presented on vic-admin interface
## Create VCH - Server cert with intermediate CA
0. Generate root CA, intermediate CA, and wildcard server cert for DOMAIN
1. Add root certificate to the system root CA store
2. Issue the following command to create the VCH with a static IP, specified hostname, server cert chain including intermediate CA cert, and server key
```
bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --tls-server-key "bundle/*.${domain}.key.pem" --tls-server-cert "bundle/*.${domain}.cert.pem" --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --debug 1
```
### Expected Outcome
* Client authentication is done with vic-machine generated CA
* Certificate validates
* Deployment succeeds
* Provided certificate is presented on vic-admin interface

View File

@@ -0,0 +1,245 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-13 - Verify vic-machine create with TLS
Resource ../../resources/Util.robot
Test Teardown Run Keyword If Test Failed Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Create VCH - defaults with --no-tls
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --no-tls --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Create VCH - defaults custom cert path
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If '${domain}' == '' Pass Execution Skipping test - domain not set, won't generate keys
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create ${vicmachinetls} --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --tls-cert-path=${EXECDIR}/foo-bar-certs/ --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} --tlscacert=\\"${EXECDIR}/foo-bar-certs/ca.pem\\" --tlscert=\\"${EXECDIR}/foo-bar-certs/cert.pem\\" --tlskey=\\"${EXECDIR}/foo-bar-certs/key.pem\\"
Should Contain ${output} Generating CA certificate/key pair - private key in ${EXECDIR}/foo-bar-certs/ca-key.pem
Should Contain ${output} Generating server certificate/key pair - private key in ${EXECDIR}/foo-bar-certs/server-key.pem
Should Contain ${output} Generating client certificate/key pair - private key in ${EXECDIR}/foo-bar-certs/key.pem
Should Contain ${output} Generated browser friendly PFX client certificate - certificate in ${EXECDIR}/foo-bar-certs/cert.pfx
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
${save_env}= Run cat ${EXECDIR}/foo-bar-certs/%{VCH-NAME}.env
Should Contain ${save_env} DOCKER_CERT_PATH=${EXECDIR}/foo-bar-certs
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Create VCH - force accept target thumbprint
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
# Test that --force without --thumbprint accepts the --target thumbprint
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --force --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --insecure-registry wdc-harbor-ci.eng.vmware.com
Log ${output}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
Cleanup VIC Appliance On Test Server
Create VCH - Specified keys
Pass execution Test not implemented until vic-machine can poll status correctly
Create VCH - Server certificate with multiple blocks
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
# Install first to generate certificates
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
# Remove the installed VCH
${ret}= Run bin/vic-machine-linux delete --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --name=%{VCH-NAME} --force
Should Contain ${ret} Completed successfully
# Update server-cert.pem with a junk block in the beginning
Run echo "-----BEGIN RSA PRIVATE KEY-----\nJUNK\n-----END RSA PRIVATE KEY-----" | cat - ./%{VCH-NAME}/server-cert.pem > /tmp/%{VCH-NAME}-server-cert.pem && mv /tmp/%{VCH-NAME}-server-cert.pem ./%{VCH-NAME}/server-cert.pem
# Install VCH
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --no-tlsverify
Should Contain ${output} Failed to load x509 leaf
Should Contain ${output} Loaded server certificate
Should Contain ${output} Installer completed successfully
Cleanup VIC Appliance On Test Server
Create VCH - Invalid keys
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If '${domain}' == '' Pass Execution Skipping test - domain not set, won't generate keys
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls}
# Invalid server key
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --tls-ca="./%{VCH-NAME}/ca.pem" --tls-server-cert="./%{VCH-NAME}/server-cert.pem" --tls-server-key="./%{VCH-NAME}/ca.pem"
Should Contain ${output} found a certificate rather than a key in the PEM for the private key
# Invalid server cert
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --tls-ca="./%{VCH-NAME}/ca.pem" --tls-server-cert="./%{VCH-NAME}/server-key.pem" --tls-server-key="./%{VCH-NAME}/server-key.pem"
Should Contain ${output} did find a private key; PEM inputs may have been switched
# Invalid CA
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --tls-ca="./%{VCH-NAME}/key.pem" --tls-server-cert="./%{VCH-NAME}/server-cert.pem" --tls-server-key="./%{VCH-NAME}/server-key.pem"
Should Contain ${output} Unable to load certificate authority data
Cleanup VIC Appliance On Test Server
Create VCH - Reuse keys
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If '${domain}' == '' Pass Execution Skipping test - domain not set, won't generate keys
Set Test Environment Variables
# use one install to generate certificates
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
# remove the initial deployment
${ret}= Run bin/vic-machine-linux delete --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --name=%{VCH-NAME} --force
Should Contain ${ret} Completed successfully
# deploy using the same name - should reuse certificates
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls}
Should Contain ${output} Installer completed successfully
Should Contain ${output} Loaded server certificate
Should Contain ${output} Loaded CA with default name from certificate path
Should Contain ${output} Loaded client certificate with default name from certificate path
Cleanup VIC Appliance On Test Server
Create VCH - Server cert with untrusted CA
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If '${domain}' == '' Pass Execution Skipping test - domain not set, won't generate keys
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
# Generate CA and wildcard cert for *.<DOMAIN>
Generate Certificate Authority
Generate Wildcard Server Certificate
${out}= Run cp /root/ca/cert-bundle.tgz .; tar xvf cert-bundle.tgz
Log ${out}
# Run vic-machine install, supply server cert and key
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --tls-server-key "bundle/*.${domain}.key.pem" --tls-server-cert "bundle/*.${domain}.cert.pem" --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --debug 1
Log ${output}
Should Contain ${output} Loaded server certificate bundle
Should Contain ${output} Unable to locate existing CA in cert path
Should Contain ${output} Failed to find a viable address for Docker API from certificates
Should Contain ${output} Server certificate hostname doesn't match
Should Contain ${output} Installer completed successfully
# Verify that the supplied certificate is presented on web interface
Get Docker Params ${output} ${true}
${output}= Run openssl s_client -showcerts -connect %{VCH-IP}:2378
Log ${output}
Should Contain ${output} issuer=/C=US/ST=California/L=Los Angeles/O=Stark Enterprises/OU=Stark Enterprises Certificate Authority/CN=Stark Enterprises Global CA
Run rm -rf bundle
Run rm -f cert-bundle.tgz
Run rm -rf /root/ca
Run Keyword And Ignore Error Cleanup VIC Appliance On Test Server
Create VCH - Server cert with trusted CA
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If '${domain}' == '' Pass Execution Skipping test - domain not set, won't generate keys
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
# Generate CA and wildcard cert for *.<DOMAIN>, install CA into root store
Generate Certificate Authority
Generate Wildcard Server Certificate
Trust Certificate Authority
${out}= Run cp /root/ca/cert-bundle.tgz .; tar xvf cert-bundle.tgz
Log ${out}
# Run vic-machine install, supply server cert and key
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --tls-server-key "bundle/*.%{DOMAIN}.key.pem" --tls-server-cert "bundle/*.%{DOMAIN}.cert.pem" --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} ${vicmachinetls} --debug 1
Log ${output}
Should Contain ${output} Loaded server certificate bundle
Should Contain ${output} Unable to locate existing CA in cert path
Should Contain ${output} Installer completed successfully
# Verify that the supplied certificate is presented on web interface
Get Docker Params ${output} ${true}
${output}= Run openssl s_client -showcerts -connect %{VCH-IP}:2378
Log ${output}
Should Contain ${output} issuer=/C=US/ST=California/L=Los Angeles/O=Stark Enterprises/OU=Stark Enterprises Certificate Authority/CN=Stark Enterprises Global CA
Run rm -rf bundle
Run rm -f cert-bundle.tgz
Run rm -rf /root/ca
Reload Default Certificate Authorities
Run Keyword And Ignore Error Cleanup VIC Appliance On Test Server
Create VCH - Server cert with intermediate CA
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If '${domain}' == '' Pass Execution Skipping test - domain not set, won't generate keys
Pass execution Test not implemented

View File

@@ -0,0 +1,54 @@
Test 6-14 - Verify vic-machine update firewall function
=======
# Purpose:
Verify vic-machine update firewall
# References:
* vic-machine-linux update firewall -h
# Environment:
This test requires that a vSphere server is running and available
Update
=======
## Enable and disable VIC firewall rule
1. Get state of host firewall
2. Enable host firewall
3. Verify host firewall enabled
4. Enable VIC firewall rule by issuing the following command:
```
bin/vic-machine-linux update firewall --target %{TEST_URL} \
--user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} \
--compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} \
--allow
```
5. Verify state of rule by issuing the following command:
```
govc host.esxcli network firewall ruleset list --ruleset-id=vSPC
```
6. Create VCH
7. Run regression tests
8. Disable VIC firewall rule by issuing the following command:
```
bin/vic-machine-linux update firewall --target %{TEST_URL} \
--user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} \
--compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} \
--deny
```
9. Verify state of rule by issuing the following command:
```
govc host.esxcli network firewall ruleset list --ruleset-id=vSPC
```
10. Revert state of host firewall
### Expected Outcome
* Firewall rule state changes as expected
* Regression tests pass

View File

@@ -0,0 +1,61 @@
# Copyright 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-14 - Verify vic-machine update firewall function
Resource ../../resources/Util.robot
Test Teardown Run Keyword If '%{HOST_TYPE}' == 'ESXi' Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Enable and disable VIC firewall rule
Set Test Environment Variables
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
Pass Execution If '%{HOST_TYPE}' == 'VC' This test is not applicable to VC
# Save firewall state
${fwSetState}= Get Host Firewall Enabled
Enable Host Firewall
${fwstatus}= Get Host Firewall Enabled
Should Be True ${fwstatus}
${output}= Run bin/vic-machine-linux update firewall --target %{TEST_URL} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} --thumbprint=%{TEST_THUMBPRINT} --allow
Should Contain ${output} enabled on host
Should Contain ${output} Firewall changes complete
${output}= Run govc host.esxcli network firewall ruleset list --ruleset-id=vSPC
Should Contain ${output} true
${output}= Run bin/vic-machine-linux create --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --no-tls --insecure-registry wdc-harbor-ci.eng.vmware.com
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
Log To Console Installer completed successfully: %{VCH-NAME}
Run Regression Tests
${output}= Run bin/vic-machine-linux update firewall --target %{TEST_URL} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} --thumbprint=%{TEST_THUMBPRINT} --deny
Should Contain ${output} disabled on host
Should Contain ${output} Firewall changes complete
${output}= Run govc host.esxcli network firewall ruleset list --ruleset-id=vSPC
Should Contain ${output} false
# Restore firewall state
Run Keyword If ${fwSetState} Enable Host Firewall
Run Keyword Unless ${fwSetState} Disable Host Firewall

View File

@@ -0,0 +1,31 @@
Test 6-15 - Verify vic-machine syslog-address
=======
# Purpose:
Verify remote syslog for VCH
# References:
* vic-machine-linux create -h
# Environment:
This test requires that a vSphere server is running and available
This test requires that a syslog server is running and available
# Test Steps
1. Deploy VIC appliance with debug logs enabled, and syslog server specified
2. Enable SSH on VIC appliance
3. Open SSH connection to VIC appliance
4. Get PIDs of running VIC daemons on VIC appliance
5. Open SSH connection to syslog server
6. Get contents of syslog file from syslog server
7. Verify syslog messages from all daemons exist on the syslog server
8. Run docker ps -a
9. Get contents of syslog file from syslog server
10. Verify messages generated by docker ps -a are on the syslog server
11. Run a variety of docker commands
12. Get contents of syslog file from syslog server
# Expected Outcome
* Step 6 output should have messages of the form <proc-name>[<proc-pid>] for docker-engine-server, port-layer-server, vic-init, and vicadmin
* Step 9 output should contain output of the form docker-engine-server[<docker-engine-server-pid>]: Calling GET /v1.25/containers/json?all=1
* Step 12 output should contain the output of the variety of docker commands

View File

@@ -0,0 +1,103 @@
# Copyright 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-15 - Verify remote syslog
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server additional-args=--syslog-address tcp://%{SYSLOG_SERVER}:514 --debug 1
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Variables ***
${SYSLOG_FILE} /var/log/syslog
*** Keywords ***
Get Remote PID
[Arguments] ${proc}
${pid}= Execute Command ps -C ${proc} -o pid=
${pid}= Strip String ${pid}
[Return] ${pid}
*** Test Cases ***
Verify VCH remote syslog
# enable ssh
${output}= Run bin/vic-machine-linux debug --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD}
Should Contain ${output} Completed successfully
# make sure we use ip address, and not fqdn
${ip}= Run dig +short %{VCH-IP}
${vch-ip}= Set Variable If '${ip}' == '' %{VCH-IP} ${ip}
@{procs}= Create List port-layer-server docker-engine-server vic-init vicadmin
&{proc-pids}= Create Dictionary
&{proc-hosts}= Create Dictionary
${vch-conn}= Open Connection ${vch-ip}
Login root password
:FOR ${proc} IN @{procs}
\ ${pid}= Get Remote PID ${proc}
\ Set To Dictionary ${proc-pids} ${proc} ${pid}
\ Set To Dictionary ${proc-hosts} ${proc} ${vch-ip}
Close Connection
Set To Dictionary ${proc-hosts} vic-init Photon
${rc}= Run And Return Rc docker %{VCH-PARAMS} ps -a
Should Be Equal As Integers ${rc} 0
Run Regression Tests
${pull}= Run docker %{VCH-PARAMS} pull ${busybox}
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} ls /
Should Be Equal As Integers ${rc} 0
${shortID}= Get container shortID ${id}
Wait Until Container Stops ${id} 5
${syslog-conn}= Open Connection %{SYSLOG_SERVER}
Login %{SYSLOG_USER} %{SYSLOG_PASSWD}
${out}= Wait Until Keyword Succeeds 10x 3s Execute Command cat ${SYSLOG_FILE}
Close Connection
Log ${out}
${keys}= Get Dictionary Keys ${proc-pids}
:FOR ${proc} IN @{keys}
\ ${pid}= Get From Dictionary ${proc-pids} ${proc}
\ ${host}= Get From Dictionary ${proc-hosts} ${proc}
\ Should Contain ${out} ${host} ${proc}[${pid}]:
${pid}= Get From Dictionary ${proc-pids} docker-engine-server
${port-layer-pid}= Get From Dictionary ${proc-pids} port-layer-server
${vic-admin-pid}= Get From Dictionary ${proc-pids} vicadmin
Should Match Regexp ${out} ${vch-ip} docker-engine-server\\[${pid}\\]: Calling GET /v\\d.\\d{2}/containers/json\\?all\\=1
Should Match Regexp ${out} ${vch-ip} docker-engine-server\\[${pid}\\]: Calling POST /v\\d.\\d{2}/containers/create
Should Match Regexp ${out} ${vch-ip} docker-engine-server\\[${pid}\\]: Calling POST /v\\d.\\d{2}/images/create\\?fromImage\\=(\\S+)*busybox\\&tag\\=latest
Should Match Regexp ${out} ${vch-ip} docker-engine-server\\[${pid}\\]: Calling POST /v\\d.\\d{2}/containers/\\w{64}/start
Should Match Regexp ${out} ${vch-ip} docker-engine-server\\[${pid}\\]: Calling POST /v\\d.\\d{2}/containers/\\w{64}/stop
Should Match Regexp ${out} ${vch-ip} docker-engine-server\\[${pid}\\]: Calling GET /v\\d.\\d{2}/images/json
Should Match Regexp ${out} ${vch-ip} docker-engine-server\\[${pid}\\]: Calling GET /v\\d.\\d{2}/containers/json
Should Match Regexp ${out} ${vch-ip} docker-engine-server\\[${pid}\\]: Calling GET /info
Should Match Regexp ${out} ${vch-ip} docker-engine-server\\[${pid}\\]: Calling DELETE /v\\d.\\d{2}/containers/\\w{64}
Should Match Regexp ${out} ${vch-ip} docker-engine-server\\[${pid}\\]: Calling DELETE /v\\d.\\d{2}/images/(\\S+)*busybox
# Check trace logger for docker-engine and port-layer
Should Match Regexp ${out} ${vch-ip} docker-engine-server\\[${pid}\\]: op=${pid}.\\d+: Commit container \\w{64}
Should Match Regexp ${out} ${vch-ip} port-layer-server\\[${port-layer-pid}\\]: op=${port-layer-pid}.\\d+: Creating base file structure on disk
Should Match Regexp ${out} ${vch-ip} vicadmin\\[${vic-admin-pid}\\]: op=${vic-admin-pid}.\\d+: vSphere resource cache populating...
Should Match Regexp ${out} ${shortID} ${shortID}\\[1\\]: bin
Should Match Regexp ${out} ${shortID} ${shortID}\\[1\\]: home
Should Match Regexp ${out} ${shortID} ${shortID}\\[1\\]: var

View File

@@ -0,0 +1,70 @@
Test 6-16 - Verify vic-machine configure
=======
# Purpose:
Verify vic-machine configure
# References:
* vic-machine-linux create -h
# Environment:
This test requires that a vSphere server is running and available
# Test Steps
1. Deploy VCH
2. Configure VCH
3. Check the debug state of the VCH
4. Check the debug state of an existing containerVM
5. Configure the VCH by setting the debug state to 0
6. Check the debug state of the VCH
7. Check the debug state of the existing containerVM
8. Create a new container and check the debug state of it
9. Configure the debug state of the VCH again and check whether there is only a single snapshot left
10. check whether the output of vic-machine inspect contains the desired debug state
11. Configure the VCH by adding a container network
12. Run docker network ls
13. Run vic-machine inspect config
14. Run a container with the new container network
15. Configure the VCH by adding a new container network without specifying the previous network
16. Configure the VCH by adding a new container network while specifying the previous network
17. Run docker network ls
18. Run vic-machine inspect config
19. Run a container with the new container network
20. Configure the VCH by attempting to change an existing container network
21. Configure VCH http proxy
22. Verify http proxy is set correctly through govc
23. Configure the VCH's operations user credentials
24. Run vic-machine inspect config
26. Reset VCH http proxy using VCH ID
26. Verify http proxy is reset correctly through govc
27. Run vic-machine inspect config
28. Configure VCH dns server to 10.118.81.1 and 10.118.81.2
29. Run vic-machine inspect config
30. Reset VCH dns server to default
31. Run vic-machine inspect config
32. Configure VCH resources
33. Verify VCH configuration through vic-machine inspect
34. Configure VCH resources with too small values
35. Verify VCH configuration is rollback to old value
35. Configure the VCH by adding a new volume store
36. Run vic-machine inspect config
37. Run docker info
38. Create a volume on the default volume store
39. Create a volume on the new volume store
40. Run docker volume ls
41. Configure the volume stores without specifying an existing volume store
42. Configure the volume stores by attempting to change an existing volume store
43. Configure the VCH by adding a new volume store with a URL scheme
44. Run vic-machine inspect config
45. Verify configure is in vic-machine dialog
# Expected Outcome
* Step 15 should fail with an error message saying that the existing container network must be specified
* Step 20 should fail with an error message saying that changes to existing container networks are not supported
* Step 24's output should contain the operations user's name and the host thumbprint
* Step 36 and 37's output should contain both volume stores
* Step 40's output should contain both volumes
* Step 41 should fail with an error message saying that existing volume stores must be specified
* Step 42 should fail with an error message saying that changes to existing volume stores are not supported
* Step 44's output should contain all three volume stores
* All other steps should succeed

View File

@@ -0,0 +1,244 @@
# Copyright 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-16 - Verify vic-machine configure
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Configure VCH debug state
${output}= Run bin/vic-machine-linux configure --help
Should Contain ${output} --debug
${output}= Check VM Guestinfo %{VCH-NAME} guestinfo.vice./init/diagnostics/debug
Should Contain ${output} 1
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${id1}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd ${busybox}
Should Be Equal As Integers ${rc} 0
${vm1}= Get VM display name ${id1}
${output}= Check VM Guestinfo ${vm1} guestinfo.vice./diagnostics/debug
Should Contain ${output} 1
${output}= Run bin/vic-machine-linux configure --debug 0 --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT}
Should Contain ${output} Completed successfully
${output}= Check VM Guestinfo %{VCH-NAME} guestinfo.vice./init/diagnostics/debug
Should Contain ${output} 0
${output}= Check VM Guestinfo ${vm1} guestinfo.vice./diagnostics/debug
Should Contain ${output} 1
${rc} ${id2}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd ${busybox}
Should Be Equal As Integers ${rc} 0
${vm2}= Get VM display name ${id2}
${output}= Check VM Guestinfo ${vm2} guestinfo.vice./diagnostics/debug
Should Contain ${output} 0
${output}= Run bin/vic-machine-linux configure --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT}
Should Contain ${output} Completed successfully
${rc} ${output}= Run And Return Rc And Output govc snapshot.tree -vm %{VCH-NAME} | grep reconfigure
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
Length Should Be ${output} 1
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect config --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT}
Should Be Equal As Integers 0 ${rc}
Should Contain ${output} --debug=1
Configure VCH Container Networks
${out}= Run govc host.portgroup.remove vm-network
${out}= Run govc host.portgroup.add -vswitch vSwitchLAN vm-network
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --container-network=%{PUBLIC_NETWORK}:public --container-network vm-network:vmnet
Should Contain ${output} Completed successfully
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls
Should Be Equal As Integers ${rc} 0
Should Contain ${output} vmnet
${output}= Run bin/vic-machine-linux inspect config --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --container-network=vm-network:vmnet
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -dit --net=vmnet ${busybox}
Should Be Equal As Integers ${rc} 0
# Test that configure fails if an existing container-network is not specified
${out}= Run govc host.portgroup.remove management
${out}= Run govc host.portgroup.add -vswitch vSwitchLAN management
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --container-network=%{PUBLIC_NETWORK}:public --container-network management:mgmt --container-network-ip-range=management:10.10.10.0/24 --container-network-gateway=management:10.10.10.1/24
Should Contain ${output} all existing container networks must also be specified
Should Not Contain ${output} Completed successfully
# Add another container network while specifying the existing one
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --container-network=%{PUBLIC_NETWORK}:public --container-network vm-network:vmnet --container-network management:mgmt --container-network-ip-range=management:10.10.10.0/24 --container-network-gateway=management:10.10.10.1/24 --container-network-firewall=management:open
Should Contain ${output} Completed successfully
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls
Should Be Equal As Integers ${rc} 0
Should Contain ${output} vmnet
Should Contain ${output} mgmt
${stripped}= Remove String %{PUBLIC_NETWORK} '
${output}= Run bin/vic-machine-linux inspect config --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --container-network=${stripped}:public
Should Contain ${output} --container-network=vm-network:vmnet
Should Contain ${output} --container-network=management:mgmt
Should Contain ${output} --container-network-ip-range=management:10.10.10.0/24
Should Contain ${output} --container-network-gateway=management:10.10.10.1/24
Should Contain ${output} --container-network-firewall=management:open
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -dit --net=mgmt ${busybox}
Should Be Equal As Integers ${rc} 0
# Test that changes to existing networks are not supported
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --container-network=%{PUBLIC_NETWORK}:public --container-network vm-network:vmnet --container-network management:mgmt --container-network-ip-range=management:10.10.10.0/24 --container-network-gateway=management:10.10.10.2/24
Should Contain ${output} changes to existing container networks are not supported
Should Not Contain ${output} Completed successfully
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --container-network=%{PUBLIC_NETWORK}:public --container-network vm-network:vmnet --container-network management:mgmt --container-network-ip-range=management:10.10.10.0/16 --container-network-gateway=management:10.10.10.1/24
Should Contain ${output} changes to existing container networks are not supported
Should Not Contain ${output} Completed successfully
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --container-network=%{PUBLIC_NETWORK}:public --container-network vm-network:vmnet --container-network management:mgmt
Should Contain ${output} changes to existing container networks are not supported
Should Not Contain ${output} Completed successfully
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --container-network=%{PUBLIC_NETWORK}:public --container-network vm-network:vmnet --container-network management:mgmt --container-network-firewall=management:closed
Should Contain ${output} changes to existing container networks are not supported
Should Not Contain ${output} Completed successfully
# Clean up portgroups
${out}= Run govc host.portgroup.remove vm-network
${out}= Run govc host.portgroup.remove management
Configure VCH https-proxy
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --http-proxy http://proxy.vmware.com:3128
Should Contain ${output} Completed successfully
${rc} ${output}= Run And Return Rc And Output govc vm.info -e %{VCH-NAME} | grep HTTP_PROXY
Should Be Equal As Integers ${rc} 0
Should Contain ${output} http://proxy.vmware.com:3128
${rc} ${output}= Run And Return Rc And Output govc vm.info -e %{VCH-NAME} | grep HTTPS_PROXY
Should Be Equal As Integers ${rc} 1
Should Not Contain ${output} proxy.vmware.com:3128
${output}= Run bin/vic-machine-linux inspect config --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --http-proxy=http://proxy.vmware.com:3128
Should Not Contain ${output} --https-proxy
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --https-proxy https://proxy.vmware.com:3128
Should Contain ${output} Completed successfully
${rc} ${output}= Run And Return Rc And Output govc vm.info -e %{VCH-NAME} | grep HTTPS_PROXY
Should Be Equal As Integers ${rc} 0
Should Contain ${output} https://proxy.vmware.com:3128
${rc} ${output}= Run And Return Rc And Output govc vm.info -e %{VCH-NAME} | grep HTTP_PROXY
Should Be Equal As Integers ${rc} 1
Should Not Contain ${output} proxy.vmware.com:3128
${output}= Run bin/vic-machine-linux inspect config --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --https-proxy=https://proxy.vmware.com:3128
Should Not Contain ${output} --http-proxy
Configure VCH ops user credentials and thumbprint
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --ops-user=%{TEST_USERNAME} --ops-password=%{TEST_PASSWORD}
Should Contain ${output} Completed successfully
${output}= Run bin/vic-machine-linux inspect config --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --ops-user=%{TEST_USERNAME}
Should Contain ${output} --thumbprint=%{TEST_THUMBPRINT}
Configure VCH https-proxy through vch id
${vch-id}= Get VCH ID %{VCH-NAME}
${output}= Run bin/vic-machine-linux configure --id=${vch-id} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --https-proxy ""
Should Contain ${output} Completed successfully
${rc} ${output}= Run And Return Rc And Output govc vm.info -e %{VCH-NAME} | grep HTTPS_PROXY
Should Be Equal As Integers ${rc} 1
Should Not Contain ${output} proxy.vmware.com:3128
Configure VCH DNS server
${output}= Run bin/vic-machine-linux inspect config --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT}
Should Not Contain ${output} --dns-server
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --dns-server 10.118.81.1 --dns-server 10.118.81.2
Should Contain ${output} Completed successfully
${output}= Run bin/vic-machine-linux inspect config --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT}
Should Contain ${output} --dns-server=10.118.81.1
Should Contain ${output} --dns-server=10.118.81.2
${rc} ${output}= Run And Return Rc And Output govc vm.info -e %{VCH-NAME} | grep dns
Should Be Equal As Integers ${rc} 0
Should Contain ${output} network/dns
Should Not Contain ${output} assigned.dns
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --dns-server ""
Should Contain ${output} Completed successfully
Should Not Contain ${output} --dns-server
${rc} ${output}= Run And Return Rc And Output govc vm.info -e %{VCH-NAME} | grep dns
Should Be Equal As Integers ${rc} 0
Should Contain ${output} assigned.dns
Should Not Contain ${output} network/dns
Configure VCH resources
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --cpu 5129 --cpu-reservation 10 --cpu-shares 8000 --memory 4096 --memory-reservation 10 --memory-shares 163840
Should Contain ${output} Completed successfully
${output}= Run bin/vic-machine-linux inspect config --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --cpu=5129
Should Contain ${output} --cpu-reservation=10
Should Contain ${output} --cpu-shares=8000
Should Contain ${output} --memory=4096
Should Contain ${output} --memory-reservation=10
Should Contain ${output} --memory-shares=163840
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --cpu 1 --cpu-shares 1000 --memory 1 --memory-shares 1000
Should Not Contain ${output} Completed successfully
${output}= Run bin/vic-machine-linux inspect config --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --cpu=5129
Should Contain ${output} --cpu-reservation=10
Should Contain ${output} --cpu-shares=8000
Should Contain ${output} --memory=4096
Should Contain ${output} --memory-reservation=10
Should Contain ${output} --memory-shares=163840
Configure VCH volume stores
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --volume-store=%{TEST_DATASTORE}/%{VCH-NAME}-VOL:default --volume-store=%{TEST_DATASTORE}/%{VCH-NAME}-conf:configure
Should Contain ${output} Completed successfully
${output}= Run bin/vic-machine-linux inspect config --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --volume-store=ds://%{TEST_DATASTORE}/%{VCH-NAME}-VOL:default
Should Contain ${output} --volume-store=ds://%{TEST_DATASTORE}/%{VCH-NAME}-conf:configure
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} info
Should Be Equal As Integers ${rc} 0
${volstores}= Get Lines Containing String ${output} VolumeStores:
Should Contain ${volstores} default
Should Contain ${volstores} configure
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create defaultVol
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create confVol --opt VolumeStore=configure
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls
Should Be Equal As Integers ${rc} 0
Should Contain ${output} defaultVol
Should Contain ${output} confVol
# Test that configure fails if an existing volume store is not specified
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --volume-store=%{TEST_DATASTORE}/%{VCH-NAME}-conf:configure
Should Contain ${output} all existing volume stores must also be specified
Should Not Contain ${output} Completed successfully
# Test that changes to existing volume stores are not supported
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --volume-store=%{TEST_DATASTORE}/%{VCH-NAME}-VOL:default --volume-store=%{TEST_DATASTORE}/%{VCH-NAME}-badpath:configure
Should Contain ${output} changes to existing volume stores are not supported
Should Not Contain ${output} Completed successfully
# Add a new volume store while specifying the URL scheme
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --timeout %{TEST_TIMEOUT} --volume-store=%{TEST_DATASTORE}/%{VCH-NAME}-VOL:default --volume-store=%{TEST_DATASTORE}/%{VCH-NAME}-conf:configure --volume-store=ds://%{TEST_DATASTORE}/%{VCH-NAME}-scheme:scheme
Should Contain ${output} Completed successfully
${output}= Run bin/vic-machine-linux inspect config --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT}
Should Contain ${output} --volume-store=ds://%{TEST_DATASTORE}/%{VCH-NAME}-VOL:default
Should Contain ${output} --volume-store=ds://%{TEST_DATASTORE}/%{VCH-NAME}-conf:configure
Should Contain ${output} --volume-store=ds://%{TEST_DATASTORE}/%{VCH-NAME}-scheme:scheme
Configure Present in vic-machine
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux
Should Contain ${output} configure

View File

@@ -0,0 +1,38 @@
Test 6-17 - Verify vic-machine configure TLS function
=======
# Purpose:
Verify vic-machine configure certificates
# References:
* vic-machine-linux configure -h
# Environment:
This test requires that a vSphere server is running and available. One VCH is created for the suite and used throughout by each test so that we don't have to call create & configure in each test (which would duplicate the work of 6-13-TLS).
Configure VCH w/ own CA
===
Performs a similar test to the one in create.
1) Generates a CA, self-signed
2) Runs vic-machine configure against the VCH set up in pre-test
3) Makes sure the installed certificate is the correct one
Configure VCH w/ trusted CA
===
1) Generates a CA, adds it to trust pool, just like the test in Create
2) Runs vic-machine to replace the previous cert with this one
3) Uses openssl tool to verify correct trusted certificate is in place
Configure VCH - Run Configure Without Cert Options & Ensure Certs are Unchanged
===
1) Generates a CA, installs it, verifies it's installed, as in the last test
2) Calls configure again with *no* TLS options
3) Check to make sure the installed cert from 1) is still presented
Configure VCH - Replace certificates with self-signed certificate using --no-tlsverify
===
1) Calls configure against the existing VCH with --no-tlsverify and an empty --tls-cert-path
2) Checks that a self-signed certificate is generated
3) Checks that the installed certificate is the self-signed one that we just generated

View File

@@ -0,0 +1,157 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-17 - Verify vic-machine configure TLS options
Resource ../../resources/Util.robot
Suite Teardown Run Keyword Cleanup VIC Appliance On Test Server
Suite Setup Run Keyword Setup Test Environment
Test Teardown Run Keyword Test Cleanup
Test Timeout 20 minutes
*** Keywords ***
Setup Test Environment
Set Test Environment Variables
Run Keyword And Ignore Error Test Cleanup
Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword And Ignore Error Cleanup Datastore On Test Server
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If '${domain}' == '' Pass Execution Skipping test - domain not set, won't generate keys
${output}= Run bin/vic-machine-linux create ${vicmachinetls} --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --image-store=%{TEST_DATASTORE} --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --tls-cert-path=${EXECDIR}/foo-bar-certs/
Should Contain ${output} --tlscacert=\\"${EXECDIR}/foo-bar-certs/ca.pem\\" --tlscert=\\"${EXECDIR}/foo-bar-certs/cert.pem\\" --tlskey=\\"${EXECDIR}/foo-bar-certs/key.pem\\"
Should Contain ${output} Generating CA certificate/key pair - private key in ${EXECDIR}/foo-bar-certs/ca-key.pem
Should Contain ${output} Generating server certificate/key pair - private key in ${EXECDIR}/foo-bar-certs/server-key.pem
Should Contain ${output} Generating client certificate/key pair - private key in ${EXECDIR}/foo-bar-certs/key.pem
Should Contain ${output} Generated browser friendly PFX client certificate - certificate in ${EXECDIR}/foo-bar-certs/cert.pfx
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${true}
${save_env}= Run cat ${EXECDIR}/foo-bar-certs/%{VCH-NAME}.env
Should Contain ${save_env} DOCKER_CERT_PATH=${EXECDIR}/foo-bar-certs
Log To Console Installer completed successfully: %{VCH-NAME}
Test Cleanup
Run rm -rf bundle cert-bundle.tgz out-bundle /root/ca ${EXECDIR}/foo-bar-certs
*** Test Cases ***
Configure VCH - Server cert with untrusted CA
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If '${domain}' == '' Pass Execution Skipping test - domain not set, won't generate keys
# Generate CA and wildcard cert for *.<DOMAIN>
Generate Certificate Authority
Generate Wildcard Server Certificate
${out}= Run cp /root/ca/cert-bundle.tgz .; tar xvf cert-bundle.tgz
Log ${out}
# Run vic-machine configure, supply server cert and key
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --tls-server-key "bundle/*.${domain}.key.pem" --tls-server-cert "bundle/*.${domain}.cert.pem" ${vicmachinetls} --tls-cert-path "out-bundle" --debug 1
Log ${output}
Should Contain ${output} Completed successfully
# Verify that the supplied certificate is presented on web interface
${output}= Run openssl s_client -showcerts -connect %{VCH-IP}:2378
Log ${output}
Should Contain ${output} issuer=/C=US/ST=California/L=Los Angeles/O=Stark Enterprises/OU=Stark Enterprises Certificate Authority/CN=Stark Enterprises Global CA
Configure VCH - Server cert with trusted CA
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If '${domain}' == '' Pass Execution Skipping test - domain not set, won't generate keys
# Generate CA and wildcard cert for *.<DOMAIN>, install CA into root store
Generate Certificate Authority
Generate Wildcard Server Certificate
Trust Certificate Authority
${out}= Run cp /root/ca/cert-bundle.tgz .; tar xvf cert-bundle.tgz
Log ${out}
# Run vic-machine install, supply server cert and key
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --tls-server-key "bundle/*.%{DOMAIN}.key.pem" --tls-server-cert "bundle/*.%{DOMAIN}.cert.pem" ${vicmachinetls} --debug 1
Log ${output}
Should Contain ${output} Loaded server certificate bundle
Should Contain ${output} Unable to locate existing CA in cert path
Should Contain ${output} Completed successfully
${output}= Run openssl s_client -showcerts -connect %{VCH-IP}:2378
Log ${output}
Should Contain ${output} issuer=/C=US/ST=California/L=Los Angeles/O=Stark Enterprises/OU=Stark Enterprises Certificate Authority/CN=Stark Enterprises Global CA
Reload Default Certificate Authorities
Configure VCH - Run Configure Without Cert Options & Ensure Certs Are Unchanged
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If '${domain}' == '' Pass Execution Skipping test - domain not set, won't generate keys
# Generate CA and wildcard cert for *.<DOMAIN>, install CA into root store
Generate Certificate Authority
Generate Wildcard Server Certificate
Trust Certificate Authority
${out}= Run cp /root/ca/cert-bundle.tgz .; tar xvf cert-bundle.tgz
Log ${out}
Run rm -rf foo-bar-certs
# Run vic-machine configure, supply server cert and key
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} --tls-server-key "bundle/*.%{DOMAIN}.key.pem" --tls-server-cert "bundle/*.%{DOMAIN}.cert.pem" ${vicmachinetls} --tls-cert-path=foo-bar-certs --debug 1
Log ${output}
Should Contain ${output} Loaded server certificate bundle
Should Contain ${output} Unable to locate existing CA in cert path
Should Contain ${output} Completed successfully
${output}= Run openssl s_client -showcerts -connect %{VCH-IP}:2378
Log ${output}
Should Contain ${output} issuer=/C=US/ST=California/L=Los Angeles/O=Stark Enterprises/OU=Stark Enterprises Certificate Authority/CN=Stark Enterprises Global CA
Run rm -rf bundle
Run rm -f cert-bundle.tgz
Run rm -rf /root/ca
Reload Default Certificate Authorities
# Run vic-machine configure, supply server cert and key
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} ${vicmachinetls} --debug 1
Log ${output}
Should Contain ${output} No certificate regeneration requested. No new certificates provided. Certificates left unchanged
${output}= Run openssl s_client -showcerts -connect %{VCH-IP}:2378
Log ${output}
Should Contain ${output} issuer=/C=US/ST=California/L=Los Angeles/O=Stark Enterprises/OU=Stark Enterprises Certificate Authority/CN=Stark Enterprises Global CA
Reload Default Certificate Authorities
Configure VCH - Replace certificates with self-signed certificate using --no-tlsverify
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If '${domain}' == '' Pass Execution Skipping test - domain not set, won't generate keys
Run rm -rf foo-bar-certs
${output}= Run bin/vic-machine-linux configure --name=%{VCH-NAME} --target="%{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}" --thumbprint=%{TEST_THUMBPRINT} ${vicmachinetls} --tls-cert-path "foo-bar-certs" --debug 1 --no-tlsverify
Should Contain ${output} Generating self-signed certificate/key pair - private key in foo-bar-certs/server-key.pem
Should Contain ${output} Completed successfully
${output}= Run openssl s_client -showcerts -connect %{VCH-IP}:2378
Log ${output}
Should Contain ${output} Verify return code: 21 (unable to verify the first certificate)
Should Contain ${output} verify error:num=20:unable to get local issuer certificate
Should Not Contain ${output} issuer=/C=US/ST=California/L=Los Angeles/O=Stark Enterprises/OU=Stark Enterprises Certificate Authority/CN=Stark Enterprises Global CA

View File

@@ -0,0 +1,23 @@
Test 6-18 - Verify vic-machine create --container-name-convention
=======
# Purpose:
Verify vic-machine create --container-name-convention functions
# References:
* vic-machine-linux create -x
# Environment:
This test requires that a vSphere server is running and available
# Test Steps
1. Create a new VCH using the --container-name-convention as 192.168.1.1-{id}
2. Create a container and verify that the container works and vSphere name is according to the convention
3. Run a variety of docker operations
4. Create a new VCH using the --container-name-convention as 192.168.1.1-{name}
5. Create a container and verify that the container works and vSphere name is according to the convention
6. Run a variety of docker operations
7. Create a new VCH using the --container-name-convention as 192.168.1.1-mycontainer
# Expected Results
* All steps should succeed as expected, except step should fail with an error indicating that {name} or {id} must be included

View File

@@ -0,0 +1,59 @@
# Copyright 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 6-18 - Container Name Convention
Resource ../../resources/Util.robot
Test Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Container name convention with id
Set Test Environment Variables
Install VIC Appliance To Test Server With Current Environment Variables additional-args=--container-name-convention %{VCH-NAME}-{id}
Run docker %{VCH-PARAMS} pull ${busybox}
${containerID}= Run docker %{VCH-PARAMS} run -d ${busybox}
${shortId}= Get container shortID ${containerID}
${output}= Run govc ls vm
Should Contain ${output} %{VCH-NAME}-${shortID}
Run docker %{VCH-PARAMS} rename ${containerID} renamed-container
${output}= Run govc ls vm
# confirm that the cnc is still in force
Should Contain ${output} %{VCH-NAME}-${shortID}
Run docker %{VCH-PARAMS} rm -f ${containerID}
Run Regression Tests
Container name convention with name
Set Test Environment Variables
Install VIC Appliance To Test Server With Current Environment Variables additional-args=--container-name-convention %{VCH-NAME}-{name}
Run docker %{VCH-PARAMS} pull ${busybox}
${containerID}= Run docker %{VCH-PARAMS} run -d ${busybox}
${name}= Get container name ${containerID}
${output}= Run govc ls vm
Should Contain ${output} %{VCH-NAME}-${name}
Run docker %{VCH-PARAMS} rename ${containerID} renamed-container
${output}= Run govc ls vm
# confirm that the cnc is still in force but updated for new container name
Should Contain ${output} %{VCH-NAME}-renamed-container
Run docker %{VCH-PARAMS} rm -f ${containerID}
Run Regression Tests
Container name convention with invalid argument
${rc} ${output}= Run Keyword And Ignore Error Install VIC Appliance To Test Server additional-args=--container-name-convention 192.168.1.1-mycontainer
Should Contain ${output} Container name convention must include {id} or {name} token
[Teardown] Log To Console Test passed no need to run cleanup

View File

@@ -0,0 +1,36 @@
Group 6 - VIC Machine
=======
[Test 6-01 - vic-machine delete --help](6-01-Help.md)
-
[Test 6-02 - vic-machine delete default value](6-02-Default.md)
-
[Test 6-03 - vic-machine delete force](6-03-Delete.md)
-
[Test 6-04 - vic-machine create basic](6-04-Create-Basic.md)
-
[Test 6-05 - vic-machine create validation](6-05-Create-Validation.md)
-
[Test 6-06 - vic-machine create datastore](6-06-Create-Datastore.md)
-
[Test 6-07 - vic-machine create network](6-07-Create-Network.md)
-
[Test 6-08 - vic-machine create compute](6-08-Create-Compute.md)
-
[Test 6-09 - vic-machine inspect](6-09-Inspect.md)
-
[Test 6-10 - vic-machine ls](6-10-List.md)
-
[Test 6-11 - vic-machine debug](6-11-Debug.md)
-
[Test 6-12 - vic-machine version](6-12-Version.md)
-
[Test 6-13 - vic-machine tls](6-13-TLS.md)
-
[Test 6-14 - vic-machine update firewall](6-14-Update-Firewall.md)
-
[Test 6-15 - vic-machine syslog-address](6-15-Syslog.md)
-
[Test 6-16 - vic-machine configure](6-16-Config.md)
-