Fixes for MK

Change-Id: I013b92dfcc169aa033bd4435c07e1832c8a4aa7b
This commit is contained in:
Georgy Dyuldin 2017-02-10 16:20:40 +03:00
parent 505e6b0204
commit 6d20703df1
5 changed files with 36 additions and 19 deletions

View File

@ -11,3 +11,6 @@
# - node-1.test.domain.local
# contrail-compute:
# - node-4.test.domain.local
# contrail-ui: // This is optional role
# - node-2.test.domain.local
# - node-3.test.domain.local

View File

@ -67,14 +67,14 @@ class ResourceManager(object):
security_group, stepler_config.SECURITY_GROUP_SSH_PING_RULES)
return security_group
def _create_server(self, image, flavor, compute_hostname, network, ip,
def _create_server(self, image, flavor, nova_host, network, ip,
security_group):
# Create server
server_steps = self.get_server_steps()
server = server_steps.create_servers(
image=image,
flavor=flavor,
availability_zone='nova:{}'.format(compute_hostname),
availability_zone='nova:{}'.format(nova_host),
nics=[{
'net-id': network['id'],
'v4-fixed-ip': ip
@ -92,7 +92,7 @@ class ResourceManager(object):
self._add_fin(self.get_floating_ip_steps, 'delete', floating_ip)
return floating_ip
def create(self, subnet_cidr, server_ip, image, flavor, compute_hostname):
def create(self, subnet_cidr, server_ip, image, flavor, nova_host):
try:
network = self._create_network()
self._create_subnet(network, subnet_cidr)
@ -100,7 +100,7 @@ class ResourceManager(object):
server = self._create_server(
image=image,
flavor=flavor,
compute_hostname=compute_hostname,
nova_host=nova_host,
network=network,
ip=server_ip,
security_group=security_group)
@ -139,7 +139,8 @@ def different_tenants_resources(
project_2, credentials, create_user_with_project, cirros_image,
sorted_hypervisors, get_network_steps, get_subnet_steps,
get_server_steps, port_steps, get_floating_ip_steps, public_flavor,
public_network, get_security_group_steps):
public_network, get_security_group_steps,
nova_availability_zone_hosts):
"""Fixture to create network, subnet and server on each of 2 projects.
Created subnets has same CIDR.
@ -149,6 +150,11 @@ def different_tenants_resources(
list: list of AttrDict with created resources
"""
hypervisor = sorted_hypervisors[0]
host = next(
host for host in nova_availability_zone_hosts
if hypervisor.hypervisor_hostname.startswith(host))
subnet_cidr = '10.0.0.0/24'
base_name = next(utils.generate_ids())
@ -162,16 +168,14 @@ def different_tenants_resources(
projects_resources = []
project_resources = mrg.create(subnet_cidr, '10.0.0.10', cirros_image,
public_flavor,
hypervisor.hypervisor_hostname)
public_flavor, host)
projects_resources.append(project_resources)
with credentials.change(project_2):
project_resources = mrg.create(subnet_cidr, '10.0.0.20',
cirros_image, public_flavor,
hypervisor.hypervisor_hostname)
cirros_image, public_flavor, host)
projects_resources.append(project_resources)

View File

@ -52,12 +52,12 @@ ROLE_CONTRAIL_ANALYTICS = 'contrail-analytics'
ROLE_CONTRAIL_DB = 'contrail-db'
ROLE_CONTRAIL_COMPUTE = 'contrail-compute'
ROLE_CONTRAIL_CONFIG = 'contrail-config'
ROLE_CONTRAIL_UI = 'contrail-ui'
CONTRAIL_ROLES_SERVICES_MAPPING = {
ROLE_CONTRAIL_CONFIG: (
'supervisor-config',
'contrail-config-nodemgr',
),
'contrail-config-nodemgr', ),
ROLE_CONTRAIL_CONTROLLER: (
'supervisor-control',
'contrail-control',
@ -69,15 +69,10 @@ CONTRAIL_ROLES_SERVICES_MAPPING = {
'contrail-discovery',
'contrail-schema',
'contrail-svc-monitor',
'ifmap',
'supervisor-webui',
'contrail-webui',
'contrail-webui-middleware',
'contrail-database',
'supervisor-database',
'contrail-database-nodemgr',
'kafka',
'supervisor-support-service', ),
'kafka', ),
ROLE_CONTRAIL_ANALYTICS: (
'supervisor-analytics',
'contrail-alarm-gen',
@ -95,7 +90,12 @@ CONTRAIL_ROLES_SERVICES_MAPPING = {
ROLE_CONTRAIL_COMPUTE: (
'contrail-vrouter-agent',
'supervisor-vrouter',
'contrail-vrouter-nodemgr', )
'contrail-vrouter-nodemgr', ),
ROLE_CONTRAIL_UI: (
'supervisor-webui',
'contrail-webui',
'contrail-webui-middleware',
'supervisor-support-service', ),
}
CONTRAIL_ROLES_DISTRIBUTION_YAML = os.environ.get(
@ -159,3 +159,5 @@ ZOOKEEPER_NODES = ["api-server",
"controller",
"schema-transformer",
"brokers"]
SERVER_ATTR_HYPERVISOR_HOSTNAME = 'OS-EXT-SRV-ATTR:hypervisor_hostname'

View File

@ -41,6 +41,14 @@ def test_contrail_service_distribution(os_faults_steps, role):
collector.check(services, is_superset_of(expected_services))
def test_ifmap_service(os_faults_steps):
"""Verify ifmap service."""
fqdns = settings.CONTRAIL_ROLES_DISTRIBUTION[
settings.ROLE_CONTRAIL_CONTROLLER]
nodes = os_faults_steps.get_nodes(fqdns)
os_faults_steps.execute_cmd(nodes, 'ifmap-view visual visual')
@pytest.mark.usefixtures('contrail_network_cleanup')
def test_add_virtual_network(contrail_api_client):
network_name, = utils.generate_ids()

View File

@ -62,7 +62,7 @@ def test_no_connectivity_between_vms_in_different_tenants(
# Get interfaces list again
after_interfaces = nodes_steps.get_nodes_interfaces(os_faults_steps)
compute_fqdn = getattr(resources[0].server,
stepler_config.SERVER_ATTR_HOST)
settings.SERVER_ATTR_HYPERVISOR_HOSTNAME)
# Check that there is 2 interfaces on compute - one for each VM
assert_that(