Add test for network templates
Change-Id: I9f274c4147a2ed996f2af0c217003cfd107f6845
This commit is contained in:
parent
63651c9f6e
commit
1fc0ce0e8c
@ -24,3 +24,9 @@ Detached plugins
|
|||||||
|
|
||||||
.. automodule:: stacklight_tests.toolchain.test_detached_plugins
|
.. automodule:: stacklight_tests.toolchain.test_detached_plugins
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
Network templates
|
||||||
|
=================
|
||||||
|
|
||||||
|
.. automodule:: stacklight_tests.toolchain.test_network_templates
|
||||||
|
:members:
|
||||||
|
180
fixtures/network_templates/monitoring.yaml
Normal file
180
fixtures/network_templates/monitoring.yaml
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
adv_net_template:
|
||||||
|
default:
|
||||||
|
network_assignments:
|
||||||
|
fuelweb_admin:
|
||||||
|
ep: br-fw-admin
|
||||||
|
management:
|
||||||
|
ep: br-mgmt
|
||||||
|
private:
|
||||||
|
ep: br-mesh
|
||||||
|
public:
|
||||||
|
ep: br-ex
|
||||||
|
storage:
|
||||||
|
ep: br-storage
|
||||||
|
monitoring:
|
||||||
|
ep: br-monitoring
|
||||||
|
network_scheme:
|
||||||
|
admin:
|
||||||
|
endpoints:
|
||||||
|
- br-fw-admin
|
||||||
|
roles:
|
||||||
|
admin/pxe: br-fw-admin
|
||||||
|
fw-admin: br-fw-admin
|
||||||
|
transformations:
|
||||||
|
- action: add-br
|
||||||
|
name: br-fw-admin
|
||||||
|
- action: add-port
|
||||||
|
bridge: br-fw-admin
|
||||||
|
name: <% if1 %>
|
||||||
|
mgmt:
|
||||||
|
endpoints:
|
||||||
|
- br-mgmt
|
||||||
|
roles:
|
||||||
|
ceilometer/api: br-mgmt
|
||||||
|
cinder/api: br-mgmt
|
||||||
|
glance/api: br-mgmt
|
||||||
|
heat/api: br-mgmt
|
||||||
|
horizon: br-mgmt
|
||||||
|
keystone/api: br-mgmt
|
||||||
|
management: br-mgmt
|
||||||
|
mgmt/api: br-mgmt
|
||||||
|
mgmt/corosync: br-mgmt
|
||||||
|
mgmt/database: br-mgmt
|
||||||
|
mgmt/memcache: br-mgmt
|
||||||
|
mgmt/messaging: br-mgmt
|
||||||
|
mgmt/vip: br-mgmt
|
||||||
|
mongo/db: br-mgmt
|
||||||
|
murano/api: br-mgmt
|
||||||
|
neutron/api: br-mgmt
|
||||||
|
neutron/private: br-mgmt
|
||||||
|
nova/api: br-mgmt
|
||||||
|
nova/migration: br-mgmt
|
||||||
|
rados_gw_management_vip: br-mgmt
|
||||||
|
sahara/api: br-mgmt
|
||||||
|
swift/api: br-mgmt
|
||||||
|
swift/replication: br-mgmt
|
||||||
|
transformations:
|
||||||
|
- action: add-br
|
||||||
|
name: br-mgmt
|
||||||
|
- action: add-port
|
||||||
|
bridge: br-mgmt
|
||||||
|
name: <% if3 %>.101
|
||||||
|
private:
|
||||||
|
endpoints:
|
||||||
|
- br-mesh
|
||||||
|
roles:
|
||||||
|
neutron/mesh: br-mesh
|
||||||
|
transformations:
|
||||||
|
- action: add-br
|
||||||
|
name: br-mesh
|
||||||
|
- action: add-port
|
||||||
|
bridge: br-mesh
|
||||||
|
name: <% if4 %>
|
||||||
|
public:
|
||||||
|
endpoints:
|
||||||
|
- br-mesh
|
||||||
|
- br-ex
|
||||||
|
roles:
|
||||||
|
ceph/radosgw: br-ex
|
||||||
|
cinder/api: br-ex
|
||||||
|
ex: br-ex
|
||||||
|
neutron/floating: br-floating
|
||||||
|
public/vip: br-ex
|
||||||
|
transformations:
|
||||||
|
- action: add-br
|
||||||
|
name: br-ex
|
||||||
|
- action: add-br
|
||||||
|
name: br-floating
|
||||||
|
provider: ovs
|
||||||
|
- action: add-patch
|
||||||
|
bridges:
|
||||||
|
- br-floating
|
||||||
|
- br-ex
|
||||||
|
mtu: 65000
|
||||||
|
provider: ovs
|
||||||
|
- action: add-port
|
||||||
|
bridge: br-ex
|
||||||
|
name: <% if2 %>
|
||||||
|
storage:
|
||||||
|
endpoints:
|
||||||
|
- br-storage
|
||||||
|
roles:
|
||||||
|
ceph/replication: br-storage
|
||||||
|
cinder/iscsi: br-storage
|
||||||
|
storage: br-storage
|
||||||
|
swift/replication: br-storage
|
||||||
|
transformations:
|
||||||
|
- action: add-br
|
||||||
|
name: br-storage
|
||||||
|
- action: add-port
|
||||||
|
bridge: br-storage
|
||||||
|
name: <% if5 %>
|
||||||
|
monitoring:
|
||||||
|
endpoints:
|
||||||
|
- br-monitoring
|
||||||
|
roles:
|
||||||
|
monitoring: br-monitoring
|
||||||
|
elasticsearch: br-monitoring
|
||||||
|
influxdb_vip: br-monitoring
|
||||||
|
infrastructure_alerting: br-monitoring
|
||||||
|
transformations:
|
||||||
|
- action: add-br
|
||||||
|
name: br-monitoring
|
||||||
|
- action: add-port
|
||||||
|
bridge: br-monitoring
|
||||||
|
name: <% if3 %>
|
||||||
|
nic_mapping:
|
||||||
|
default:
|
||||||
|
# fw-admin
|
||||||
|
if1: enp0s3
|
||||||
|
# public
|
||||||
|
if2: enp0s4
|
||||||
|
# management (VLAN: 101) + monitoring
|
||||||
|
if3: enp0s5
|
||||||
|
# private
|
||||||
|
if4: enp0s6
|
||||||
|
# storage
|
||||||
|
if5: enp0s7
|
||||||
|
templates_for_node_role:
|
||||||
|
# The following roles supports deployments using Neutron with tunneling segmentation
|
||||||
|
# and Cinder with LVM over iSCSI
|
||||||
|
cinder:
|
||||||
|
- admin
|
||||||
|
- monitoring
|
||||||
|
- mgmt
|
||||||
|
- private
|
||||||
|
- storage
|
||||||
|
compute:
|
||||||
|
- admin
|
||||||
|
- monitoring
|
||||||
|
- mgmt
|
||||||
|
- private
|
||||||
|
- storage
|
||||||
|
controller:
|
||||||
|
- admin
|
||||||
|
- monitoring
|
||||||
|
- mgmt
|
||||||
|
- public
|
||||||
|
- private
|
||||||
|
- storage
|
||||||
|
elasticsearch_kibana:
|
||||||
|
- admin
|
||||||
|
- monitoring
|
||||||
|
- mgmt
|
||||||
|
- public
|
||||||
|
- private
|
||||||
|
- storage
|
||||||
|
influxdb_grafana:
|
||||||
|
- admin
|
||||||
|
- monitoring
|
||||||
|
- mgmt
|
||||||
|
- public
|
||||||
|
- private
|
||||||
|
- storage
|
||||||
|
infrastructure_alerting:
|
||||||
|
- admin
|
||||||
|
- monitoring
|
||||||
|
- mgmt
|
||||||
|
- public
|
||||||
|
- private
|
||||||
|
- storage
|
@ -1,4 +1,5 @@
|
|||||||
git+git://github.com/openstack/fuel-devops.git@2.9.20
|
git+git://github.com/openstack/fuel-devops.git@2.9.20
|
||||||
|
PyYAML
|
||||||
requests
|
requests
|
||||||
selenium
|
selenium
|
||||||
six
|
six
|
||||||
|
@ -66,6 +66,7 @@ class PluginHelper(object):
|
|||||||
self.env = env
|
self.env = env
|
||||||
self.fuel_web = self.env.fuel_web
|
self.fuel_web = self.env.fuel_web
|
||||||
self._cluster_id = None
|
self._cluster_id = None
|
||||||
|
self.nailgun_client = self.fuel_web.client
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cluster_id(self):
|
def cluster_id(self):
|
||||||
@ -160,9 +161,24 @@ class PluginHelper(object):
|
|||||||
settings=settings,
|
settings=settings,
|
||||||
mode='ha_compact')
|
mode='ha_compact')
|
||||||
|
|
||||||
def deploy_cluster(self, nodes_roles):
|
def deploy_cluster(self, nodes_roles, verify_network=False,
|
||||||
"""Method to deploy cluster with provided node roles."""
|
update_interfaces=True):
|
||||||
self.fuel_web.update_nodes(self.cluster_id, nodes_roles)
|
"""Assign roles to nodes and deploy the cluster.
|
||||||
|
|
||||||
|
:param nodes_roles: nodes to roles mapping.
|
||||||
|
:type name: dict
|
||||||
|
:param verify_network: whether or not network verification should be
|
||||||
|
run before the deployment (default: False).
|
||||||
|
:type settings: boolean
|
||||||
|
:param update_interfaces: whether or not interfaces should be updated
|
||||||
|
before the deployment (default: True).
|
||||||
|
:type settings: boolean
|
||||||
|
:returns: None
|
||||||
|
"""
|
||||||
|
self.fuel_web.update_nodes(self.cluster_id, nodes_roles,
|
||||||
|
update_interfaces=update_interfaces)
|
||||||
|
if verify_network:
|
||||||
|
self.fuel_web.verify_network(self.cluster_id)
|
||||||
self.fuel_web.deploy_cluster_wait(self.cluster_id)
|
self.fuel_web.deploy_cluster_wait(self.cluster_id)
|
||||||
|
|
||||||
def run_ostf(self, *args, **kwargs):
|
def run_ostf(self, *args, **kwargs):
|
||||||
|
@ -53,6 +53,7 @@ def import_tests():
|
|||||||
from stacklight_tests.lma_infrastructure_alerting import ( # noqa
|
from stacklight_tests.lma_infrastructure_alerting import ( # noqa
|
||||||
test_system)
|
test_system)
|
||||||
from stacklight_tests.toolchain import test_detached_plugins # noqa
|
from stacklight_tests.toolchain import test_detached_plugins # noqa
|
||||||
|
from stacklight_tests.toolchain import test_network_templates # noqa
|
||||||
from stacklight_tests.toolchain import test_post_install # noqa
|
from stacklight_tests.toolchain import test_post_install # noqa
|
||||||
from stacklight_tests.toolchain import test_smoke_bvt # noqa
|
from stacklight_tests.toolchain import test_smoke_bvt # noqa
|
||||||
from stacklight_tests.toolchain import test_system # noqa
|
from stacklight_tests.toolchain import test_system # noqa
|
||||||
|
128
stacklight_tests/toolchain/test_network_templates.py
Normal file
128
stacklight_tests/toolchain/test_network_templates.py
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
# Copyright 2016 Mirantis, Inc.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
import copy
|
||||||
|
import os
|
||||||
|
|
||||||
|
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||||
|
from fuelweb_test import logger
|
||||||
|
from fuelweb_test.settings import NEUTRON_SEGMENT
|
||||||
|
from proboscis import asserts
|
||||||
|
from proboscis import test
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
from stacklight_tests.toolchain import api
|
||||||
|
|
||||||
|
|
||||||
|
@test(groups=["plugins"])
|
||||||
|
class TestToolchainNetworkTemplates(api.ToolchainApi):
|
||||||
|
"""Class for testing the LMA Toolchain plugins when using network
|
||||||
|
templates.
|
||||||
|
"""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_network_template(template_name):
|
||||||
|
template = os.path.join(
|
||||||
|
os.environ.get("WORKSPACE", "./"),
|
||||||
|
"fixtures/network_templates/",
|
||||||
|
"{}.yaml".format(template_name))
|
||||||
|
with open(template) as f:
|
||||||
|
return yaml.load(f)
|
||||||
|
|
||||||
|
@test(depends_on_groups=["prepare_slaves_3"],
|
||||||
|
groups=["deploy_toolchain_with_network_template", "deploy",
|
||||||
|
"toolchain", "network_templates"])
|
||||||
|
@log_snapshot_after_test
|
||||||
|
def deploy_toolchain_with_network_template(self):
|
||||||
|
"""Deploy a cluster with the LMA Toolchain plugins using network
|
||||||
|
templates.
|
||||||
|
|
||||||
|
Scenario:
|
||||||
|
1. Upload the LMA Toolchain plugins to the master node
|
||||||
|
2. Install the plugins
|
||||||
|
3. Create the cluster using VxLAN segmentation
|
||||||
|
4. Add 1 node with controller role
|
||||||
|
5. Add 1 node with compute and cinder roles
|
||||||
|
6. Add 1 node with plugin roles
|
||||||
|
7. Upload the custom network template
|
||||||
|
8. Modify the L3 configuration
|
||||||
|
9. Deploy the cluster
|
||||||
|
10. Check that LMA Toolchain plugins are running
|
||||||
|
11. Run OSTF
|
||||||
|
|
||||||
|
Duration 60m
|
||||||
|
Snapshot deploy_toolchain_with_network_template
|
||||||
|
"""
|
||||||
|
self.check_run("deploy_toolchain_with_network_template")
|
||||||
|
self.env.revert_snapshot("ready_with_3_slaves")
|
||||||
|
|
||||||
|
self.prepare_plugins()
|
||||||
|
|
||||||
|
self.helpers.create_cluster(
|
||||||
|
name="deploy_toolchain_with_network_template",
|
||||||
|
settings={
|
||||||
|
"net_provider": "neutron",
|
||||||
|
"net_segment_type": NEUTRON_SEGMENT["tun"]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
self.activate_plugins()
|
||||||
|
|
||||||
|
nailgun_client = self.helpers.nailgun_client
|
||||||
|
network_template = self.get_network_template("monitoring")
|
||||||
|
nailgun_client.upload_network_template(
|
||||||
|
cluster_id=self.helpers.cluster_id,
|
||||||
|
network_template=network_template)
|
||||||
|
logger.info("Network template: {0}".format(network_template))
|
||||||
|
|
||||||
|
networks = nailgun_client.get_network_groups()
|
||||||
|
logger.info("Network groups before update: {0}".format(networks))
|
||||||
|
|
||||||
|
# Hijack the management network's address space for the monitoring
|
||||||
|
# network
|
||||||
|
management_net = None
|
||||||
|
for n in networks:
|
||||||
|
if n["name"] == "management":
|
||||||
|
management_net = n
|
||||||
|
break
|
||||||
|
asserts.assert_is_not_none(
|
||||||
|
management_net, "Couldn't find management network")
|
||||||
|
monitoring_net = copy.deepcopy(management_net)
|
||||||
|
monitoring_net["name"] = "monitoring"
|
||||||
|
monitoring_net.pop("id")
|
||||||
|
nailgun_client.add_network_group(monitoring_net)
|
||||||
|
|
||||||
|
networks = nailgun_client.get_network_groups()
|
||||||
|
logger.info("Network groups after update: {0}".format(networks))
|
||||||
|
|
||||||
|
network_config = nailgun_client.get_networks(self.helpers.cluster_id)
|
||||||
|
for network in network_config["networks"]:
|
||||||
|
if network["name"] == "management":
|
||||||
|
network["cidr"] = "10.109.5.0/24"
|
||||||
|
network["ip_ranges"] = [["10.109.5.2", "10.109.5.254"]]
|
||||||
|
network["vlan_start"] = 101
|
||||||
|
nailgun_client.update_network(self.helpers.cluster_id,
|
||||||
|
networks=network_config["networks"])
|
||||||
|
|
||||||
|
# Don't update the interfaces when using network templates
|
||||||
|
self.helpers.deploy_cluster(self.settings.base_nodes,
|
||||||
|
verify_network=True,
|
||||||
|
update_interfaces=False)
|
||||||
|
|
||||||
|
self.check_plugins_online()
|
||||||
|
|
||||||
|
self.helpers.run_ostf()
|
||||||
|
|
||||||
|
self.env.make_snapshot("deploy_toolchain_with_network_template",
|
||||||
|
is_make=True)
|
Loading…
Reference in New Issue
Block a user