diff --git a/demos/compose/elk-app/docker-compose-elk.yml b/demos/compose/elk-app/docker-compose-elk.yml new file mode 100644 index 0000000000..4d4d03f43b --- /dev/null +++ b/demos/compose/elk-app/docker-compose-elk.yml @@ -0,0 +1,165 @@ +version: '2' +services: + vic-elasticsearch-1: + image: elasticsearch:6.4.2 + container_name: elastic1 + command: | + sh -c 'sysctl -w vm.max_map_count=262144 && /usr/local/bin/docker-entrypoint.sh eswrapper' + environment: + - cluster.name=vic-cluster + - node.name=vic-elasticsearch-1 + - discovery.type=zen + - "discovery.zen.ping.unicast.hosts=vic-elasticsearch-2,vic-elasticsearch-3" + - discovery.zen.minimum_master_nodes=2 + - "ES_JAVA_OPTS=-Xms1g -Xmx1g" + - ELASTIC_PASSWORD=changeme + - ALLOW_INSECURE_DEFAULT_TLS_CERT="true" + volumes: + - esdata1:/usr/share/elasticsearch/data + ports: + - 9200:9200 + - 9300:9300 + networks: + - es--net + + vic-elasticsearch-2: + image: elasticsearch:6.4.2 + container_name: elastic2 + command: | + sh -c 'sysctl -w vm.max_map_count=262144 && /usr/local/bin/docker-entrypoint.sh eswrapper' + environment: + - cluster.name=vic-cluster + - node.name=vic-elasticsearch-2 + - discovery.type=zen + - "discovery.zen.ping.unicast.hosts=vic-elasticsearch-1,vic-elasticsearch-3" + - discovery.zen.minimum_master_nodes=2 + - "ES_JAVA_OPTS=-Xms1g -Xmx1g" + - ELASTIC_PASSWORD=changeme + - ALLOW_INSECURE_DEFAULT_TLS_CERT="true" + volumes: + - esdata2:/usr/share/elasticsearch/data + ports: + - 9201:9200 + - 9301:9300 + networks: + - es--net + + vic-elasticsearch-3: + image: elasticsearch:6.4.2 + container_name: elastic3 + command: | + sh -c 'sysctl -w vm.max_map_count=262144 && /usr/local/bin/docker-entrypoint.sh eswrapper' + environment: + - cluster.name=vic-cluster + - node.name=vic-elasticsearch-3 + - discovery.type=zen + - "discovery.zen.ping.unicast.hosts=vic-elasticsearch-1,vic-elasticsearch-2" + - discovery.zen.minimum_master_nodes=2 + - "ES_JAVA_OPTS=-Xms1g -Xmx1g" + - ELASTIC_PASSWORD=changeme + - ALLOW_INSECURE_DEFAULT_TLS_CERT="true" + volumes: + - esdata3:/usr/share/elasticsearch/data + ports: + - 9202:9200 + - 9302:9300 + networks: + - es--net + + logstash-1: + image: logstash:6.4.2 + container_name: logstash1 + ports: + - 5000:5000 + - 5044:5044 + - 9600:9600 + environment: + - "LS_JAVA_OPTS=-Xms1g -Xmx1g" + - "NODE_NAME=logstash-1" + - XPACK_MONITORING_ELASTICSEARCH_URL=[ "vic-elasticsearch-1", "vic-elasticsearch-2","vic-elasticsearch-3"] +# - "LOG_LEVEL=debug" +# - "XPACK_MONITORING_ENABLED" +# https://www.elastic.co/guide/en/logstash/current/logstash-settings-file.html +# All environement variables can be found in the link above +# Replace . with _ in the options and convert alphabets to all caps for environment variable name +# These environment variables are written in all capitals, with underscores as word separators + networks: + - es--net + depends_on: + - vic-elasticsearch-1 + - vic-elasticsearch-2 + - vic-elasticsearch-3 + + logstash-2: + image: logstash:6.4.2 + container_name: logstash2 + ports: + - 5001:5000 + - 5045:5044 + - 9601:9600 + environment: + - "LS_JAVA_OPTS=-Xms1g -Xmx1g" + - "NODE_NAME=logstash-2" + - XPACK_MONITORING_ELASTICSEARCH_URL=[ "vic-elasticsearch-1", "vic-elasticsearch-2","vic-elasticsearch-3"] + networks: + - es--net + depends_on: + - vic-elasticsearch-1 + - vic-elasticsearch-2 + - vic-elasticsearch-3 + + kibana-1: + image: kibana:6.4.2 + container_name: kibana1 + ports: + - 5601:5601 + environment: +# Kibana doesn't support talking directly to multiple elasticsearch nodes now + - ELASTICSEARCH_URL="http://vic-elasticsearch-1:9200" + - XPACK_SECURITY_ENCRYPTIONKEY="something_at_least_32_characters" +# https://www.elastic.co/guide/en/kibana/current/settings.html +# All environment variable for Kibana can be found in the link above +# These environment variables are written in all capitals, with underscores as word separators + networks: + - es--net + depends_on: + - vic-elasticsearch-1 + - vic-elasticsearch-2 + - vic-elasticsearch-3 + - logstash-1 + - logstash-2 + + kibana-2: + image: kibana:6.4.2 + container_name: kibana2 + ports: + - 5602:5601 + environment: +# Kibana doesn't support talking directly to multiple elasticsearch nodes now + - ELASTICSEARCH_URL="http://vic-elasticsearch-2:9200" + - XPACK_SECURITY_ENCRYPTIONKEY="something_at_least_32_characters" + networks: + - es--net + depends_on: + - vic-elasticsearch-1 + - vic-elasticsearch-2 + - vic-elasticsearch-3 + - logstash-1 + - logstash-2 + +volumes: + esdata1: + driver: vsphere + driver_opts: + capacity: 10GB + esdata2: + driver: vsphere + driver_opts: + capacity: 10GB + esdata3: + driver: vsphere + driver_opts: + capacity: 10GB + +networks: + es--net: diff --git a/tests/manual-test-cases/Group5-Functional-Tests/5-30-Docker-Compose-ELK.md b/tests/manual-test-cases/Group5-Functional-Tests/5-30-Docker-Compose-ELK.md new file mode 100644 index 0000000000..94fff16e7a --- /dev/null +++ b/tests/manual-test-cases/Group5-Functional-Tests/5-30-Docker-Compose-ELK.md @@ -0,0 +1,25 @@ +Test 5-30 - Docker Compose ELK +======= + +# Purpose: +To verify that VIC appliance can work when deploying the docker ELK services + +# References: +[1 - Docker Compose Overview](https://docs.docker.com/compose/overview/) +[2 - Docker compose ELK](https://blogs.vmware.com/cloudnative/2018/07/19/getting-started-with-elastic-stack-on-vsphere-integrated-containers/) + +# Environment: +This test requires access to VMWare Nimbus cluster for dynamic ESXi and vCenter creation + +# Test Steps: +1. Deploy a new vCenter with 2 ESXi hosts in a cluster +2. Deploy VIC appliance to the vSphere server +3. Issue the following command in the docker elk app folder: +```cd demos/compose/elk-app; COMPOSE_HTTP_TIMEOUT=300 DOCKER_HOST= docker-compose up``` + +# Expected Outcome: +Docker compose should return with success and all containers in the compose yaml file are up and running. +Docker inspect data should show networks, alias, and IP address for the container. + +# Possible Problems: +None diff --git a/tests/manual-test-cases/Group5-Functional-Tests/5-30-Docker-Compose-ELK.robot b/tests/manual-test-cases/Group5-Functional-Tests/5-30-Docker-Compose-ELK.robot new file mode 100644 index 0000000000..e9e645275c --- /dev/null +++ b/tests/manual-test-cases/Group5-Functional-Tests/5-30-Docker-Compose-ELK.robot @@ -0,0 +1,109 @@ +# Copyright 2016-2019 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 5-30 - docker compose ELK +Resource ../../resources/Util.robot +Suite Setup Deploy Environment +Suite Teardown Run Keyword And Ignore Error Nimbus Cleanup ${list} + +*** Variables *** +${NIMBUS_LOCATION} sc +${NIMBUS_LOCATION_FULL} NIMBUS_LOCATION=${NIMBUS_LOCATION} + +*** Keywords *** +Deploy Environment + [Timeout] 110 minutes + Run Keyword And Ignore Error Nimbus Cleanup ${list} ${false} + ${name}= Evaluate 'vic-iscsi-' + str(random.randint(1000,9999)) modules=random + ${out}= Deploy Nimbus Testbed %{NIMBUS_USER} %{NIMBUS_PASSWORD} spec=vic-cluster-2esxi-iscsi.rb args= --plugin testng --noSupportBundles --vcvaBuild ${VC_VERSION} --esxBuild ${ESX_VERSION} --testbedName vic-cluster-iscsi --runName ${name} + Set Suite Variable @{list} %{NIMBUS_PERSONAL_USER}-${name}.vc.0 %{NIMBUS_PERSONAL_USER}-${name}.esx.0 %{NIMBUS_PERSONAL_USER}-${name}.esx.1 %{NIMBUS_PERSONAL_USER}-${name}.iscsi.0 + Should Contain ${out} "deployment_result"=>"PASS" + + ${out}= Execute Command ${NIMBUS_LOCATION_FULL} USER=%{NIMBUS_PERSONAL_USER} nimbus-ctl ip %{NIMBUS_PERSONAL_USER}-${name}.vc.0 | grep %{NIMBUS_PERSONAL_USER}-${name}.vc.0 + ${vc-ip}= Fetch From Right ${out} ${SPACE} + + ${out}= Execute Command ${NIMBUS_LOCATION_FULL} USER=%{NIMBUS_PERSONAL_USER} nimbus-ctl ip %{NIMBUS_PERSONAL_USER}-${name}.esx.0 | grep %{NIMBUS_PERSONAL_USER}-${name}.esx.0 + ${esx0-ip}= Fetch From Right ${out} ${SPACE} + + ${out}= Execute Command ${NIMBUS_LOCATION_FULL} USER=%{NIMBUS_PERSONAL_USER} nimbus-ctl ip %{NIMBUS_PERSONAL_USER}-${name}.esx.1 | grep %{NIMBUS_PERSONAL_USER}-${name}.esx.1 + ${esx1-ip}= Fetch From Right ${out} ${SPACE} + + Set Environment Variable GOVC_URL ${esx0-ip} + Set Environment Variable GOVC_USERNAME root + Set Environment Variable GOVC_PASSWORD e2eFunctionalTest + Run govc host.esxcli network firewall set -e false + Set Environment Variable GOVC_URL ${esx1-ip} + Run govc host.esxcli network firewall set -e false + + Log To Console Set environment variables up for GOVC + Set Environment Variable GOVC_URL ${vc-ip} + Set Environment Variable GOVC_USERNAME Administrator@vsphere.local + Set Environment Variable GOVC_PASSWORD Admin\!23 + + Log To Console Deploy VIC to the VC cluster + Set Environment Variable TEST_URL_ARRAY ${vc-ip} + Set Environment Variable TEST_USERNAME Administrator@vsphere.local + Set Environment Variable TEST_PASSWORD Admin\!23 + Set Environment Variable BRIDGE_NETWORK bridge + Set Environment Variable PUBLIC_NETWORK vm-network + Remove Environment Variable TEST_DATACENTER + Set Environment Variable TEST_DATASTORE sharedVmfs-0 + Set Environment Variable TEST_RESOURCE cls + Set Environment Variable TEST_TIMEOUT 30m + +Check Service State + [Arguments] ${containerName} + ${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f {{.State.Running}} ${containerName} + Log ${out} + Should Contain ${out} true + Should Be Equal As Integers ${rc} 0 + + ${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{range $key, $value := .NetworkSettings.Networks}}{{$key}}{{end}}' ${containerName} + Log ${out} + Should Not Be Empty ${out} + Should Be Equal As Integers ${rc} 0 + +*** Test Cases *** +Compose ELK Test + Install VIC Appliance To Test Server certs=${true} vol=default additional-args=--cpu-reservation 1 --cpu-shares normal --memory-reservation 1 --memory-shares normal --endpoint-cpu 1 --endpoint-memory 2048 --base-image-size 8GB --bridge-network-range 172.17.0.0/12 --container-network-firewall vm-network:published --certificate-key-size 2048 + + ${rc} ${out}= Run And Return Rc And Output docker-compose %{COMPOSE-PARAMS} --skip-hostname-check -f ${CURDIR}/../../../demos/compose/elk-app/docker-compose-elk.yml up -d + Log ${out} + Should Be Equal As Integers ${rc} 0 + + Check Service State elastic1 + Check Service State elastic2 + Check Service State elastic3 + Check Service State logstash1 + Check Service State logstash2 + Check Service State kibana1 + Check Service State kibana2 + + + Sleep 10m + Check Service State elastic1 + Check Service State elastic2 + Check Service State elastic3 + Check Service State logstash1 + Check Service State logstash2 + Check Service State kibana1 + Check Service State kibana2 + + ${rc} ${out}= Run And Return Rc And Output docker-compose %{COMPOSE-PARAMS} --skip-hostname-check -f ${CURDIR}/../../../demos/compose/elk-app/docker-compose-elk.yml down + Log ${out} + Should Be Equal As Integers ${rc} 0 + + Cleanup VIC Appliance On Test Server + diff --git a/tests/manual-test-cases/Group5-Functional-Tests/TestCases.md b/tests/manual-test-cases/Group5-Functional-Tests/TestCases.md index 66cfa3a767..72817d9993 100644 --- a/tests/manual-test-cases/Group5-Functional-Tests/TestCases.md +++ b/tests/manual-test-cases/Group5-Functional-Tests/TestCases.md @@ -53,3 +53,10 @@ Group 5 - Functional Tests [Test 5-27 - Selenium Grid](5-27-Selenium-Grid.md) - [Test 5-28 - VICAdmin Isolated](5-28-VICAdmin-Isolated.md) +- +[Test 5-29 - Opaque Network](5-29-Opaque-Network.md) +- +[Test 5-30 - Docker Compose ELK](5-30-Docker-Compose-ELK.md) + + + diff --git a/tests/resources/nimbus-testbeds/vic-cluster-2esxi-iscsi.rb b/tests/resources/nimbus-testbeds/vic-cluster-2esxi-iscsi.rb new file mode 100644 index 0000000000..02b0c1c198 --- /dev/null +++ b/tests/resources/nimbus-testbeds/vic-cluster-2esxi-iscsi.rb @@ -0,0 +1,123 @@ +oneGB = 1 * 1000 * 1000 # in KB + +$testbed = Proc.new do + { + "name" => "vic-iscsi-cluster", + "version" => 3, + "esx" => (0..1).map do | idx | + { + "name" => "esx.#{idx}", + "vc" => "vc.0", + 'cpus' => 8, + 'cpuReservation' => 2400, + "style" => "fullInstall", + "desiredPassword" => "e2eFunctionalTest", + "memory" => 16384, # 2x default + 'memoryReservation' => 4096, + "disk" => [ 30 * oneGB], + "nics" => 2, + "iScsi" => ["iscsi.0"], + "clusterName" => "cls", + } + end, + + "iscsi" => [ + { + "name" => "iscsi.0", + "luns" => [200], + "iqnRandom" => "nimbus1" + } + ], + + "vcs" => [ + { + "name" => "vc.0", + "type" => "vcva", + 'cpuReservation' => 2400, + 'memoryReservation' => 4096, + "dcName" => "dc1", + "clusters" => [{"name" => "cls", "vsan" => false, "enableDrs" => true, "enableHA" => true}], + "addHosts" => "allInSameCluster", + } + ], + + "postBoot" => Proc.new do |runId, testbedSpec, vmList, catApi, logDir| + esxList = vmList['esx'] + esxList.each do |host| + host.ssh do |ssh| + ssh.exec!("esxcli network firewall set -e false") + end + end + vc = vmList['vc'][0] + vim = VIM.connect vc.rbvmomiConnectSpec + datacenters = vim.serviceInstance.content.rootFolder.childEntity.grep(RbVmomi::VIM::Datacenter) + raise "Couldn't find a Datacenter precreated" if datacenters.length == 0 + datacenter = datacenters.first + Log.info "Found a datacenter successfully in the system, name: #{datacenter.name}" + clusters = datacenter.hostFolder.children + raise "Couldn't find a cluster precreated" if clusters.length == 0 + cluster = clusters.first + Log.info "Found a cluster successfully in the system, name: #{cluster.name}" + + dvs = datacenter.networkFolder.CreateDVS_Task( + :spec => { + :configSpec => { + :name => "test-ds" + }, + } + ).wait_for_completion + Log.info "Vds DSwitch created" + + dvpg1 = dvs.AddDVPortgroup_Task( + :spec => [ + { + :name => "management", + :type => :earlyBinding, + :numPorts => 12, + } + ] + ).wait_for_completion + Log.info "management DPG created" + + dvpg2 = dvs.AddDVPortgroup_Task( + :spec => [ + { + :name => "vm-network", + :type => :earlyBinding, + :numPorts => 12, + } + ] + ).wait_for_completion + Log.info "vm-network DPG created" + + dvpg3 = dvs.AddDVPortgroup_Task( + :spec => [ + { + :name => "bridge", + :type => :earlyBinding, + :numPorts => 12, + } + ] + ).wait_for_completion + Log.info "bridge DPG created" + + Log.info "Add hosts to the DVS" + onecluster_pnic_spec = [ VIM::DistributedVirtualSwitchHostMemberPnicSpec({:pnicDevice => 'vmnic1'}) ] + dvs_config = VIM::DVSConfigSpec({ + :configVersion => dvs.config.configVersion, + :host => cluster.host.map do |host| + { + :operation => :add, + :host => host, + :backing => VIM::DistributedVirtualSwitchHostMemberPnicBacking({ + :pnicSpec => onecluster_pnic_spec + }) + } + end + }) + dvs.ReconfigureDvs_Task(:spec => dvs_config).wait_for_completion + Log.info "Hosts added to DVS successfully" + end + } +end +