1# Copyright 2017 VMware, Inc. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License 14 15*** Settings *** 16Documentation Test 23-03 - VCH Create 17Resource ../../resources/Util.robot 18Resource ../../resources/Group23-VIC-Machine-Service-Util.robot 19Suite Setup Setup 20Suite Teardown Teardown 21Test Setup Cleanup Test Server 22Default Tags 23 24 25*** Keywords *** 26Setup 27 Start VIC Machine Server 28 Set Test Environment Variables 29 30 ${PUBLIC_NETWORK}= Remove String %{PUBLIC_NETWORK} ' 31 Set Suite Variable ${PUBLIC_NETWORK} 32 33 34Teardown 35 Stop VIC Machine Server 36 Run Keyword If %{DRONE_BUILD_NUMBER} != 0 Run Keyword And Ignore Error Cleanup VCH Bridge Network 37 Cleanup Test Server 38 39 40Cleanup Test Server 41 Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server 42 Run Keyword And Ignore Error Cleanup Datastore On Test Server 43 44 45Create VCH 46 [Arguments] ${data} 47 Post Path Under Target vch ${data} 48 49 50Create VCH Within Datacenter 51 [Arguments] ${data} 52 ${dcID}= Get Datacenter ID 53 Post Path Under Target datacenter/${dcID}/vch ${data} 54 55 56Inspect VCH Config ${name} 57 ${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} --compute-resource=%{TEST_RESOURCE} --name=${name} --format raw 58 Should Be Equal As Integers ${RC} 0 59 Set Test Variable ${OUTPUT} 60 61 62Get VCH ${name} 63 Get Path Under Target vch 64 ${id}= Run echo '${OUTPUT}' | jq -r '.vchs[] | select(.name=="${name}").id' 65 Set Test Variable ${id} 66 67 Get Path Under Target vch/${id} 68 69 70Pull Busy Box 71 [Arguments] ${docker_params} ${expected_rc} ${expected_output} 72 73 # Because this is used to verify the whitelist registry functionality, we can't use ${busybox}! 74 ${rc} ${output}= Run And Return Rc And Output docker -H ${docker_params} pull busybox 75 76 Should Be Equal As Integers ${rc} ${expected_rc} 77 Should Contain ${output} ${expected_output} 78 79 80# This keyword tries to get the docker host parameters in two different ways to help identify the cause of failure, should it occur. 81Get Docker Host Params 82 [Arguments] ${vch_name} 83 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 30x 10s Get Docker Params API ${vch_name} 84 Run Keyword If "${docker_host}" == "null" Run VIC Machine Inspect Command ${vch_name} 85 ${vch_params}= Get Environment Variable VCH-PARAMS ${EMPTY} 86 Run Keyword if "${vch_params}" != "${EMPTY}" Extract Docker IP And Port ${vch_params} 87 88 89Extract Docker IP And Port 90 [Arguments] ${vch_params} 91 Log To Console Get Docker Params API did not work, use Run VIC Machine Inspect Command instead for docker_host info 92 @{hostParts}= Split String ${vch_params} 93 ${docker_host}= Strip String @{hostParts}[1] 94 Set Test Variable ${docker_host} 95 96 97Get Cluster ID 98 [Arguments] ${name}=%{TEST_RESOURCE} 99 ${rc} ${output}= Run And Return Rc And Output govc ls --json=true "${name}" | jq -r '.elements[] | select(.Path | endswith("/Resources")).Object.Parent.Value' 100 Should Be Equal As Integers ${rc} 0 101 102 ${rc2} ${output2}= Run Keyword If '${output}' == '${EMPTY}' Run And Return Rc And Output govc ls --json=true "*/${name}" | jq -r '.elements[] | select(.Path | endswith("/Resources")).Object.Parent.Value' 103 Run Keyword If '${output}' == '${EMPTY}' Should Be Equal As Integers ${rc2} 0 104 ${return}= Set Variable If '${output}' == '${EMPTY}' ${output2} ${output} 105 106 [Return] ${return} 107 108 109*** Test Cases *** 110Create minimal VCH 111 Create VCH '{"name":"%{VCH-NAME}-api-test-minimal","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 112 113 Verify Return Code 114 Verify Status Created 115 116 117 Inspect VCH Config %{VCH-NAME}-api-test-minimal 118 119 Output Should Contain --image-store=ds://%{TEST_DATASTORE} 120 Output Should Contain --bridge-network=%{BRIDGE_NETWORK} 121 122 123 Get VCH %{VCH-NAME}-api-test-minimal 124 125 Property Should Be Equal .name %{VCH-NAME}-api-test-minimal 126 127 Property Should Not Be Equal .compute.resource.id null 128 129 Property Should Contain .storage.image_stores[0] %{TEST_DATASTORE} 130 Property Should Be Equal .storage.base_image_size.value 8000000 131 Property Should Be Equal .storage.base_image_size.units KB 132 133 Property Should Contain .auth.server.certificate.pem -----BEGIN CERTIFICATE----- 134 Property Should Be Equal .auth.server.private_key.pem null 135 136 Property Should Contain .network.bridge.ip_range 172.16.0.0/12 137 138 Property Should Contain .runtime.power_state poweredOn 139 Property Should Contain .runtime.upgrade_status Up to date 140 141 Get Docker Host Params %{VCH-NAME}-api-test-minimal 142 143 [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-api-test-minimal 144 145 146Create minimal VCH using compute resource ID 147 ${cluster}= Get Cluster ID 148 149 Create VCH '{"name":"%{VCH-NAME}-api-test-cr-id","compute":{"resource":{"id":"${cluster}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 150 151 Verify Return Code 152 Verify Status Created 153 154 155 Get VCH %{VCH-NAME}-api-test-cr-id 156 157 Property Should Be Equal .name %{VCH-NAME}-api-test-cr-id 158 159 [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-api-test-cr-id 160 161 162Create minimal VCH within datacenter 163 Create VCH Within Datacenter '{"name":"%{VCH-NAME}-api-test-dc","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 164 165 Verify Return Code 166 Verify Status Created 167 168 169 Inspect VCH Config %{VCH-NAME}-api-test-dc 170 171 Output Should Contain --image-store=ds://%{TEST_DATASTORE} 172 Output Should Contain --bridge-network=%{BRIDGE_NETWORK} 173 174 175 Get VCH %{VCH-NAME}-api-test-dc 176 177 Property Should Be Equal .name %{VCH-NAME}-api-test-dc 178 179 Property Should Not Be Equal .compute.resource.id null 180 181 Property Should Contain .storage.image_stores[0] %{TEST_DATASTORE} 182 Property Should Be Equal .storage.base_image_size.value 8000000 183 Property Should Be Equal .storage.base_image_size.units KB 184 185 Property Should Contain .auth.server.certificate.pem -----BEGIN CERTIFICATE----- 186 Property Should Be Equal .auth.server.private_key.pem null 187 188 Property Should Contain .network.bridge.ip_range 172.16.0.0/12 189 190 Property Should Contain .runtime.power_state poweredOn 191 Property Should Contain .runtime.upgrade_status Up to date 192 193 Get Docker Host Params %{VCH-NAME}-api-test-dc 194 195 196 [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-api-test-dc 197 198 199Create complex VCH 200 Create VCH '{"name":"%{VCH-NAME}-api-test-complex","debug":3,"compute":{"cpu":{"limit":{"units":"MHz","value":2345},"reservation":{"units":"GHz","value":2},"shares":{"level":"high"}},"memory":{"limit":{"units":"MiB","value":1200},"reservation":{"units":"MiB","value":501},"shares":{"number":81910}},"resource":{"name":"%{TEST_RESOURCE}"},"affinity":{"use_vm_group":true}},"endpoint":{"cpu":{"sockets":2},"memory":{"units":"MiB","value":3072}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"],"volume_stores":[{"datastore":"ds://%{TEST_DATASTORE}/test-volumes/foo","label":"foo"}],"base_image_size":{"units":"B","value":16000000}},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"container":[{"alias":"vic-containers","firewall":"outbound","nameservers":["8.8.8.8","8.8.4.4"],"port_group":{"name":"${PUBLIC_NETWORK}"},"gateway":{"address":"203.0.113.1","routing_destinations":["203.0.113.1/24"]},"ip_ranges":["203.0.113.8/31"]}],"public":{"port_group":{"name":"${PUBLIC_NETWORK}"},"static":"192.168.100.22/24","gateway":{"address":"192.168.100.1"},"nameservers":["192.168.110.10","192.168.1.1"]}},"registry":{"image_fetch_proxy":{"http":"http://example.com","https":"https://example.com"},"insecure":["https://insecure.example.com"],"whitelist":["10.0.0.0/8"]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}},"syslog_addr":"tcp://syslog.example.com:4444", "container": {"name_convention": "container-{id}"}}' 201 202 Verify Return Code 203 Verify Status Created 204 205 206 Inspect VCH Config %{VCH-NAME}-api-test-complex 207 208 Output Should Contain --debug=3 209 210 Output Should Contain --cpu=2345 211 Output Should Contain --cpu-reservation=2000 212 Output Should Contain --cpu-shares=high 213 Output Should Contain --memory=1200 214 Output Should Contain --memory-reservation=501 215 Output Should Contain --memory-shares=81910 216 217 Output Should Contain --affinity-vm-group=true 218 219 Output Should Contain --endpoint-cpu=2 220 Output Should Contain --endpoint-memory=3072 221 222 Output Should Contain --image-store=ds://%{TEST_DATASTORE} 223 Output Should Contain --volume-store=ds://%{TEST_DATASTORE}/test-volumes/foo:foo 224 Output Should Contain --base-image-size=16MB 225 226 Output Should Contain --bridge-network=%{BRIDGE_NETWORK} 227 Output Should Contain --container-network=${PUBLIC_NETWORK}:vic-containers 228 Output Should Contain --container-network-gateway=${PUBLIC_NETWORK}:203.0.113.1/24 229 Output Should Contain --container-network-ip-range=${PUBLIC_NETWORK}:203.0.113.8/31 230 Output Should Contain --container-network-dns=${PUBLIC_NETWORK}:8.8.8.8 231 Output Should Contain --container-network-dns=${PUBLIC_NETWORK}:8.8.4.4 232 Output Should Contain --container-network-firewall=${PUBLIC_NETWORK}:outbound 233 234 Output Should Contain --public-network-gateway=192.168.100.1 235 Output Should Contain --public-network-ip=192.168.100.22/24 236 Output Should Contain --dns-server=192.168.110.10 237 Output Should Contain --dns-server=192.168.1.1 238 239 Output Should Contain --insecure-registry=https://insecure.example.com 240 Output Should Contain --whitelist-registry=10.0.0.0/8 241 Output Should Contain --whitelist-registry=https://insecure.example.com 242 243 244 Get VCH %{VCH-NAME}-api-test-complex 245 246 Property Should Be Equal .name %{VCH-NAME}-api-test-complex 247 Property Should Be Equal .debug 3 248 Property Should Be Equal .syslog_addr tcp://syslog.example.com:4444 249 250 Property Should Not Be Equal .compute.resource.id null 251 Property Should Be Equal .compute.cpu.limit.value 2345 252 Property Should Be Equal .compute.cpu.limit.units MHz 253 Property Should Be Equal .compute.cpu.reservation.value 2000 254 Property Should Be Equal .compute.cpu.reservation.units MHz 255 Property Should Be Equal .compute.cpu.shares.level high 256 Property Should Be Equal .compute.memory.limit.value 1200 257 Property Should Be Equal .compute.memory.limit.units MiB 258 Property Should Be Equal .compute.memory.reservation.value 501 259 Property Should Be Equal .compute.memory.reservation.units MiB 260 Property Should Be Equal .compute.memory.shares.number 81910 261 Property Should Be Equal .compute.affinity.use_vm_group true 262 263 Property Should Be Equal .endpoint.cpu.sockets 2 264 Property Should Be Equal .endpoint.memory.value 3072 265 Property Should Be Equal .endpoint.memory.units MiB 266 267 Property Should Contain .storage.image_stores[0] %{TEST_DATASTORE} 268 Property Should Contain .storage.volume_stores[0].datastore %{TEST_DATASTORE}/test-volumes/foo 269 Property Should Contain .storage.volume_stores[0].label foo 270 Property Should Be Equal .storage.base_image_size.value 16000 271 Property Should Be Equal .storage.base_image_size.units KB 272 273 Property Should Be Equal .registry.image_fetch_proxy.http http://example.com 274 Property Should Be Equal .registry.image_fetch_proxy.https https://example.com 275 Property Should Contain .registry.insecure | join(" ") https://insecure.example.com 276 Property Should Contain .registry.whitelist | join(" ") https://insecure.example.com 277 Property Should Contain .registry.whitelist | join(" ") 10.0.0.0/8 278 279 Property Should Contain .auth.server.certificate.pem -----BEGIN CERTIFICATE----- 280 Property Should Be Equal .auth.server.private_key.pem null 281 282 Property Should Be Equal .network.bridge.ip_range 172.16.0.0/12 283 Property Should Be Equal .network.container[0].alias vic-containers 284 Property Should Be Equal .network.container[0].firewall outbound 285 Property Should Be Equal .network.container[0].ip_ranges[0] 203.0.113.8/31 286 287 Property Should Be Equal .network.container[0].nameservers[0] 8.8.8.8 288 Property Should Be Equal .network.container[0].nameservers[1] 8.8.4.4 289 Property Should Be Equal .network.container[0].gateway.address 203.0.113.1 290 Property Should Be Equal .network.container[0].gateway.routing_destinations[0] 203.0.113.1/24 291 292 Property Should Be Equal .network.public.gateway.address 192.168.100.1 293 Property Should Be Equal .network.public.nameservers[0] 192.168.110.10 294 Property Should Be Equal .network.public.nameservers[1] 192.168.1.1 295 296 Property Should Be Equal .runtime.power_state poweredOn 297 Property Should Be Equal .runtime.upgrade_status Up to date 298 299 Property Should Be Equal .container.name_convention container-{id} 300 301 302 [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-api-test-complex 303 304 305Fail to create VCH with invalid operations credentials 306 Create VCH '{"name":"%{VCH-NAME}-api-bad-ops","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"endpoint":{"operations_credentials":{"user":"invalid","password":"invalid"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 307 308 Verify Return Code 309 Verify Status Bad Request 310 311 Output Should Contain operations credentials 312 313 314Fail to create VCH with invalid datastore 315 Create VCH '{"name":"%{VCH-NAME}-api-bad-storage","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}-invalid"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 316 317 Verify Return Code 318 Verify Status Bad Request 319 320 Output Should Contain datastore 321 322 323Fail to create VCH with invalid compute 324 Create VCH '{"name":"%{VCH-NAME}-api-bad-compute","compute":{"resource":{"name":"%{TEST_RESOURCE}-invalid"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 325 326 Verify Return Code 327 Verify Status Bad Request 328 329 Output Should Contain compute resource 330 331 332Fail to create VCH without network 333 Create VCH '{"name":"%{VCH-NAME}-api-bad-network","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 334 335 Verify Return Code 336 Verify Status Bad Request 337 338 Output Should Contain network 339 340 341Fail to create VCH with gateway without static address 342 Create VCH '{"name":"%{VCH-NAME}-api-bad-gateway","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"},"gateway":{"address":"127.0.0.1","routing_destinations":[]}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 343 344 Verify Return Code 345 Verify Status Bad Request 346 347 Output Should Contain static 348 349Fail to create VCH with a name containing invalid characters 350 Create VCH '{"name":"%{VCH-NAME}_%x_invalid-character-in-name","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 351 352 Verify Return Code 353 Verify Status Bad Request 354 355 Output Should Contain unsupported character 356 357Fail to create VCH with a very long name (over 31 characters) 358 Create VCH '{"name":"%{VCH-NAME}-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 359 360 Verify Return Code 361 Verify Status Bad Request 362 363 Output Should Contain length exceeds 31 characters 364 365Fail to create VCH with a name that is already in use 366 ${there_can_only_be_one}= Set Variable %{VCH-NAME}-highlander 367 368 Create VCH '{"name":"${there_can_only_be_one}","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 369 370 Verify Return Code 371 Verify Status Created 372 373 Create VCH '{"name":"${there_can_only_be_one}","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 374 375 Verify Return Code 376 377 ${status}= Get State Of Github Issue 7749 378 Run Keyword If '${status}' == 'closed' Fail Test 23-03-VCH-Create.robot "Fail to create VCH with a name that is already in use" needs to be updated now that Issue #7749 has been resolved 379 # Issue 7749 should provide the correct return error 380 Verify Status Internal Server Error 381 382 Output Should Contain already exists 383 384 [Teardown] Run Secret VIC Machine Delete Command ${there_can_only_be_one} 385 386 387Fail to create a VCH with an invalid container name name convention 388 ${invalid_name_convention}= Set Variable 192.168.1.1-mycontainer 389 390 Create VCH '{"name":"%{VCH-NAME}-api-test-minimal","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}, "container":{"name_convention": "${invalid_name_convention}"}}' 391 392 Verify Return Code 393 Verify Status Unprocessable Entity 394 395 Output Should Contain container.name_convention in body should match 396 397 398Fail to create a VCH specifying an ID 399 ${status}= Get State Of Github Issue 7696 400 Run Keyword If '${status}' == 'closed' Fail Test 23-03-VCH-Create.robot "Fail to create a VCH specifying an ID" needs to be updated now that Issue #7696 has been resolved 401 # Issue 7696 should provide a better error message for the error or invalidate this test 402 403# ${new_vch}= Set Variable %{VCH-NAME}-produce_id 404# ${id_vch}= Set Variable %{VCH-NAME}-never_created 405# 406# Create VCH '{"name":"${new_vch}","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 407# 408# Verify Return Code 409# Verify Status Created 410# 411# Get VCH ${new_vch} 412# 413# Post Path Under Target vch '{"id":"${id}", "name":"${id_vch}","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 414# Verify Return Code 415# Verify Status Created 416# 417# Output Should Contain **Need updated error message here** 418# Delete Path Under Target vch/${id} 419# Get VCH ${id_vch} 420# Delete Path Under Target vch/${id} 421 422 423Fail to create VCH where whitelist contains an int and not string - registry settings 424 Create VCH '{"name":"%{VCH-NAME}-invalid_registry","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"registry":{"image_fetch_proxy":{"http":"http://example.com","https":"https://example.com"},"insecure":["https://insecure.example.com"],"whitelist":[100008]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 425 426 Verify Return Code 427 Verify Status Bad Request 428 429 Output Should Contain cannot unmarshal number into Go struct field VCHRegistry.whitelist of type string 430 431 432Fail to create VCH where whitelist contains invalid character - registry settings 433 Create VCH '{"name":"%{VCH-NAME}-invalid_registry","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"registry":{"image_fetch_proxy":{"http":"http://example.com","https":"https://example.com"},"insecure":["https://insecure.example.com"],"whitelist":[10.0.0./8]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 434 435 Verify Return Code 436 Verify Status Bad Request 437 438 Output Should Contain failed, because invalid character 439 440 441Create VCH where whitelist registry contains valid registry wildcard domain and validate 442 ${wildcard_registry}= Set Variable "*.docker.io" 443 444 Create VCH '{"name":"%{VCH-NAME}","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"registry":{"whitelist":[${wildcard_registry}]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 445 446 Verify Return Code 447 Verify Status Created 448 449 Get Docker Host Params %{VCH-NAME} 450 451 Wait Until Keyword Succeeds 10x 2s Pull Busy Box ${docker_host} --tls 0 Digest 452 453 [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME} 454 455 456Fail to validate created VCH where whitelist registry contains unauthorized registry wildcard domain - whitelist settings 457 ${invalid_wildcard_registry}= Set Variable "*.docker.gov" 458 459 Create VCH '{"name":"%{VCH-NAME}","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"registry":{"whitelist":[${invalid_wildcard_registry}]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 460 461 Verify Return Code 462 Verify Status Created 463 464 Get Docker Host Params %{VCH-NAME} 465 466 Wait Until Keyword Succeeds 10x 2s Pull Busy Box ${docker_host} --tls 1 Access denied to unauthorized registry 467 468 [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME} 469 470 471Fail to create VCH where insecure property contains invalid char - registry settings 472 Create VCH '{"name":"%{VCH-NAME}-invalid_registry","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"registry":{"image_fetch_proxy":{"http":"http://example.com","https":"https://example.com"},"insecure":[https://insecure.example.com],"whitelist":["10.0.0.0/8"]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 473 474 Verify Return Code 475 Verify Status Bad Request 476 477 Output Should Contain failed, because invalid character 478 479 480Fail to create VCH where insecure property contains an int in one of the string arrays - registry settings 481 Create VCH '{"name":"%{VCH-NAME}-invalid_registry","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"registry":{"image_fetch_proxy":{"http":"http://example.com","https":"https://example.com"},"insecure":["https://insecure.example.com", 101010101010, "https://insecure.example.com"],"whitelist":["10.0.0.0/8"]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 482 483 Verify Return Code 484 Verify Status Bad Request 485 486 Output Should Contain failed, because json: cannot unmarshal number into Go struct field 487 488 489Fail to create VCH where compute resource property contains invalid data - resource settings 490 Create VCH '{"name":"%{VCH-NAME}-invalid_registry","compute":{"resource":{"name":"TEST_RESOURCE"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"registry":{"image_fetch_proxy":{"http":"http://example.com","https":"https://example.com"},"insecure":["https://insecure.example.com"],"whitelist":["10.0.0.0/8"]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 491 492 Verify Return Code 493 Verify Status Bad Request 494 495 Output Should Contain not found 496 Output Should Contain TEST_RESOURCE 497 498 499Fail to create VCH where compute cpu limit property is very high - resource settings 500 Create VCH '{"name":"%{VCH-NAME}-invalid_resource","compute":{"cpu":{"limit":{"units":"GHz","value":6969696969696969},"reservation":{"units":"GHz","value":2969696969696969},"shares":{"level":"high"}},"memory":{"limit":{"units":"MiB","value":1200},"reservation":{"units":"MiB","value":501},"shares":{"number":81910}},"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 501 502 Verify Return Code 503 504 ${status}= Get State Of Github Issue 7750 505 Run Keyword If '${status}' == 'closed' Fail Test 23-03-VCH-Create.robot "Fail to create VCH where compute cpu limit property is very high - resource settings" needs to be updated now that Issue #7750 has been resolved 506 # Issue 7750 should provide the correct return error 507 Verify Status Internal Server Error 508 509 Output Should Contain The amount of CPU resource available in the parent resource pool is insufficient for the operation. 510 511 512Fail to create VCH where an invalid target path is specified - resource settings 513 Create VCH '{"name":"%{VCH-NAME}-invalid_resource","compute":{"resource":{"name":"%{TEST_RESOURCE}/GO/GO/GADGET"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' 514 515 Verify Return Code 516 Verify Status Bad Request 517 518 Output Should Contain failed to validate VCH 519 520 521Fail to create VCH where an invalid cname field is specified - security settings 522 Create VCH '{"name":"%{VCH-NAME}-security_settings","debug":3,"compute":{"cpu":{"limit":{"units":"MHz","value":2345},"reservation":{"units":"GHz","value":2},"shares":{"level":"high"}},"memory":{"limit":{"units":"MiB","value":1200},"reservation":{"units":"MiB","value":501},"shares":{"number":81910}},"resource":{"name":"%{TEST_RESOURCE}"}},"endpoint":{"cpu":{"sockets":2},"memory":{"units":"MiB","value":3072}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"],"volume_stores":[{"datastore":"ds://%{TEST_DATASTORE}/test-volumes/foo","label":"foo"}],"base_image_size":{"units":"B","value":16000000}},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"container":[{"alias":"vic-containers","firewall":"outbound","nameservers":["8.8.8.8","8.8.4.4"],"port_group":{"name":"${PUBLIC_NETWORK}"},"gateway":{"address":"203.0.113.1","routing_destinations":["203.0.113.1/24"]},"ip_ranges":["203.0.113.8/31"]}],"public":{"port_group":{"name":"${PUBLIC_NETWORK}"},"static":"192.168.100.22/24","gateway":{"address":"192.168.100.1"},"nameservers":["192.168.110.10","192.168.1.1"]}},"registry":{"image_fetch_proxy":{"http":"http://example.com","https":"https://example.com"},"insecure":["https://insecure.example.com"],"whitelist":["10.0.0.0/8"]},"auth":{"server":{"generate":{"cname":10,"organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}},"syslog_addr":"tcp://syslog.example.com:4444", "container": {"name_convention": "container-{id}"}}' 523 524 Verify Return Code 525 Verify Status Bad Request 526 527 Output Should Contain failed, because json: cannot unmarshal number into Go struct field 528 529 530Fail to create VCH where an invalid organization field is specified - security settings 531 Create VCH '{"name":"%{VCH-NAME}-security_settings","debug":3,"compute":{"cpu":{"limit":{"units":"MHz","value":2345},"reservation":{"units":"GHz","value":2},"shares":{"level":"high"}},"memory":{"limit":{"units":"MiB","value":1200},"reservation":{"units":"MiB","value":501},"shares":{"number":81910}},"resource":{"name":"%{TEST_RESOURCE}"}},"endpoint":{"cpu":{"sockets":2},"memory":{"units":"MiB","value":3072}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"],"volume_stores":[{"datastore":"ds://%{TEST_DATASTORE}/test-volumes/foo","label":"foo"}],"base_image_size":{"units":"B","value":16000000}},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"container":[{"alias":"vic-containers","firewall":"outbound","nameservers":["8.8.8.8","8.8.4.4"],"port_group":{"name":"${PUBLIC_NETWORK}"},"gateway":{"address":"203.0.113.1","routing_destinations":["203.0.113.1/24"]},"ip_ranges":["203.0.113.8/31"]}],"public":{"port_group":{"name":"${PUBLIC_NETWORK}"},"static":"192.168.100.22/24","gateway":{"address":"192.168.100.1"},"nameservers":["192.168.110.10","192.168.1.1"]}},"registry":{"image_fetch_proxy":{"http":"http://example.com","https":"https://example.com"},"insecure":["https://insecure.example.com"],"whitelist":["10.0.0.0/8"]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":[10],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}},"syslog_addr":"tcp://syslog.example.com:4444", "container": {"name_convention": "container-{id}"}}' 532 533 Verify Return Code 534 Verify Status Bad Request 535 536 Output Should Contain failed, because json: cannot unmarshal number into Go struct field 537 538 539# TODO: Review/Remove this test once Github ticket 7694 is resolved 540Create VCH setting tls to false and validate - security settings 541 ${status}= Get State Of Github Issue 7694 542 Run Keyword If '${status}' == 'closed' Fail Test 23-03-VCH-Create.robot "Create VCH setting tls to false and validate - security settings" needs to be updated/removed now that Issue #7694 has been resolved 543 # Issue 7694 should validate whether this test should be updated or removed 544 545 Create VCH '{"name":"%{VCH-NAME}","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"no_tls":false}}' 546 547 Verify Return Code 548 Verify Status Created 549 550 Get Docker Host Params %{VCH-NAME} 551 552 Wait Until Keyword Succeeds 10x 2s Pull Busy Box ${docker_host} 0 Digest 553 554 [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME} 555 556 557# TODO: Review/Remove this test once Github ticket 7694 is resolved 558Create VCH setting tls to true and validate - security settings 559 ${status}= Get State Of Github Issue 7694 560 Run Keyword If '${status}' == 'closed' Fail Test 23-03-VCH-Create.robot "Create VCH setting tls to true and validate - security settings" needs to be updated/removed now that Issue #7694 has been resolved 561 # Issue 7694 should validate whether this test should be updated or removed 562 563 Create VCH '{"name":"%{VCH-NAME}","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"no_tls":true}}' 564 565 Verify Return Code 566 Verify Status Created 567 568 Get Docker Host Params %{VCH-NAME} 569 570 Wait Until Keyword Succeeds 20x 5s Pull Busy Box ${docker_host} 0 Digest 571 572 [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME} 573 574 575Create VCH with no auth - security settings 576 Create VCH '{"name":"%{VCH-NAME}","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}}}' 577 578 Verify Return Code 579 Verify Status Created 580 581 Get Docker Host Params %{VCH-NAME} 582 583 Wait Until Keyword Succeeds 20x 5s Pull Busy Box ${docker_host} 0 Digest 584 585 [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME} 586 587 588Create VCH without specifying certs on client params - security settings 589 Create VCH '{"name":"%{VCH-NAME}","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": false}}}' 590 591 Verify Return Code 592 Verify Status Created 593 594 Get Docker Host Params %{VCH-NAME} 595 596 Wait Until Keyword Succeeds 20x 5s Pull Busy Box ${docker_host} --tlsverify 1 could not read CA certificate 597 598 [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME} 599 600 601 602Create VCH with invalid cert info on server params - security settings 603 Create VCH '{"name":"%{VCH-NAME}","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","network_width":16,"port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"${PUBLIC_NETWORK}"}}},"auth":{"server":{"certificate":{"pem":"-----BEGIN FAKE-----jfjfj39382vA==-----END FAKE-----"},"private_key":{"pem":"-----BEGIN FAKE-----jfFjfj39382vA==-----END FAKE-----"}}}}' 604 605 Verify Return Code 606 Verify Status Unprocessable Entity 607 608 Output Should Contain pem in body should match 609 610 [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME} 611