Update tests for network templates

Closes-Bug: 1632332
Change-Id: I8ebac9d95de2a86bc9ddcbf2287b81ec9ff6fa06
(cherry picked from commit e26d83beef)
This commit is contained in:
Sergey Novikov 2017-03-14 17:23:47 +04:00
parent e82abec4d8
commit 9a1d0694cc
10 changed files with 33 additions and 141 deletions

View File

@ -36,8 +36,6 @@ adv_net_template:
ep: br-fw-admin ep: br-fw-admin
fake: fake:
ep: br-fake ep: br-fake
mongo:
ep: br-mongo
keystone: keystone:
ep: br-keystone ep: br-keystone
neutron-api: neutron-api:
@ -48,8 +46,6 @@ adv_net_template:
ep: br-swift ep: br-swift
sahara: sahara:
ep: br-sahara ep: br-sahara
ceilometer:
ep: br-ceilometer
cinder: cinder:
ep: br-cinder ep: br-cinder
glance: glance:
@ -60,8 +56,6 @@ adv_net_template:
ep: br-nova ep: br-nova
nova-migration: nova-migration:
ep: br-novamigr ep: br-novamigr
murano:
ep: br-murano
horizon: horizon:
ep: br-horizon ep: br-horizon
messaging: messaging:
@ -176,11 +170,6 @@ adv_net_template:
ironic/baremetal: br-fake ironic/baremetal: br-fake
custom: custom:
transformations: transformations:
- action: add-br
name: br-mongo
- action: add-port
bridge: br-mongo
name: <% if4 %>.201
- action: add-br - action: add-br
name: br-keystone name: br-keystone
- action: add-port - action: add-port
@ -206,11 +195,6 @@ adv_net_template:
- action: add-port - action: add-port
bridge: br-sahara bridge: br-sahara
name: <% if4 %>.206 name: <% if4 %>.206
- action: add-br
name: br-ceilometer
- action: add-port
bridge: br-ceilometer
name: <% if4 %>.207
- action: add-br - action: add-br
name: br-cinder name: br-cinder
- action: add-port - action: add-port
@ -236,11 +220,6 @@ adv_net_template:
- action: add-port - action: add-port
bridge: br-novamigr bridge: br-novamigr
name: <% if4 %>.212 name: <% if4 %>.212
- action: add-br
name: br-murano
- action: add-port
bridge: br-murano
name: <% if4 %>.213
- action: add-br - action: add-br
name: br-horizon name: br-horizon
- action: add-port - action: add-port
@ -287,19 +266,16 @@ adv_net_template:
bridge: br-cephrados bridge: br-cephrados
name: <% if4 %>.222 name: <% if4 %>.222
endpoints: endpoints:
- br-mongo
- br-keystone - br-keystone
- br-neutronapi - br-neutronapi
- br-neutronmesh - br-neutronmesh
- br-swift - br-swift
- br-sahara - br-sahara
- br-ceilometer
- br-cinder - br-cinder
- br-glance - br-glance
- br-heat - br-heat
- br-nova - br-nova
- br-novamigr - br-novamigr
- br-murano
- br-horizon - br-horizon
- br-messaging - br-messaging
- br-corosync - br-corosync
@ -310,20 +286,16 @@ adv_net_template:
- br-cephrepl - br-cephrepl
- br-cephrados - br-cephrados
roles: roles:
mongo/db: br-mongo
keystone/api: br-keystone keystone/api: br-keystone
neutron/api: br-neutronapi neutron/api: br-neutronapi
neutron/mesh: br-neutronmesh neutron/mesh: br-neutronmesh
swift/api: br-swift swift/api: br-swift
sahara/api: br-sahara sahara/api: br-sahara
ceilometer/api: br-ceilometer
cinder/api: br-cinder cinder/api: br-cinder
glance/api: br-glance glance/api: br-glance
heat/api: br-heat heat/api: br-heat
nova/api: br-nova nova/api: br-nova
nova/migration: br-novamigr nova/migration: br-novamigr
murano/api: br-murano
murano/cfapi: br-murano
horizon: br-horizon horizon: br-horizon
mgmt/messaging: br-messaging mgmt/messaging: br-messaging
mgmt/corosync: br-corosync mgmt/corosync: br-corosync

View File

@ -36,8 +36,6 @@ adv_net_template:
ep: br-fw-admin ep: br-fw-admin
fake: fake:
ep: br-fake ep: br-fake
mongo:
ep: br-mongo
keystone: keystone:
ep: br-keystone ep: br-keystone
neutron-api: neutron-api:
@ -48,8 +46,6 @@ adv_net_template:
ep: br-swift ep: br-swift
sahara: sahara:
ep: br-sahara ep: br-sahara
ceilometer:
ep: br-ceilometer
cinder: cinder:
ep: br-cinder ep: br-cinder
glance: glance:
@ -60,8 +56,6 @@ adv_net_template:
ep: br-nova ep: br-nova
nova-migration: nova-migration:
ep: br-novamigr ep: br-novamigr
murano:
ep: br-murano
horizon: horizon:
ep: br-horizon ep: br-horizon
messaging: messaging:
@ -167,11 +161,6 @@ adv_net_template:
ironic/baremetal: br-fake ironic/baremetal: br-fake
custom: custom:
transformations: transformations:
- action: add-br
name: br-mongo
- action: add-port
bridge: br-mongo
name: <% if4 %>.201
- action: add-br - action: add-br
name: br-keystone name: br-keystone
- action: add-port - action: add-port
@ -197,11 +186,6 @@ adv_net_template:
- action: add-port - action: add-port
bridge: br-sahara bridge: br-sahara
name: <% if4 %>.206 name: <% if4 %>.206
- action: add-br
name: br-ceilometer
- action: add-port
bridge: br-ceilometer
name: <% if4 %>.207
- action: add-br - action: add-br
name: br-cinder name: br-cinder
- action: add-port - action: add-port
@ -227,11 +211,6 @@ adv_net_template:
- action: add-port - action: add-port
bridge: br-novamigr bridge: br-novamigr
name: <% if4 %>.212 name: <% if4 %>.212
- action: add-br
name: br-murano
- action: add-port
bridge: br-murano
name: <% if4 %>.213
- action: add-br - action: add-br
name: br-horizon name: br-horizon
- action: add-port - action: add-port
@ -268,19 +247,16 @@ adv_net_template:
bridge: br-swiftrepl bridge: br-swiftrepl
name: <% if4 %>.220 name: <% if4 %>.220
endpoints: endpoints:
- br-mongo
- br-keystone - br-keystone
- br-neutronapi - br-neutronapi
- br-neutronmesh - br-neutronmesh
- br-swift - br-swift
- br-sahara - br-sahara
- br-ceilometer
- br-cinder - br-cinder
- br-glance - br-glance
- br-heat - br-heat
- br-nova - br-nova
- br-novamigr - br-novamigr
- br-murano
- br-horizon - br-horizon
- br-messaging - br-messaging
- br-corosync - br-corosync
@ -289,20 +265,16 @@ adv_net_template:
- br-cinderiscsi - br-cinderiscsi
- br-swiftrepl - br-swiftrepl
roles: roles:
mongo/db: br-mongo
keystone/api: br-keystone keystone/api: br-keystone
neutron/api: br-neutronapi neutron/api: br-neutronapi
neutron/mesh: br-neutronmesh neutron/mesh: br-neutronmesh
swift/api: br-swift swift/api: br-swift
sahara/api: br-sahara sahara/api: br-sahara
ceilometer/api: br-ceilometer
cinder/api: br-cinder cinder/api: br-cinder
glance/api: br-glance glance/api: br-glance
heat/api: br-heat heat/api: br-heat
nova/api: br-nova nova/api: br-nova
nova/migration: br-novamigr nova/migration: br-novamigr
murano/api: br-murano
murano/cfapi: br-murano
horizon: br-horizon horizon: br-horizon
mgmt/messaging: br-messaging mgmt/messaging: br-messaging
mgmt/corosync: br-corosync mgmt/corosync: br-corosync

View File

@ -42,8 +42,6 @@ adv_net_template:
ep: br-fw-admin ep: br-fw-admin
fake: fake:
ep: br-fake ep: br-fake
mongo:
ep: br-mongo
keystone: keystone:
ep: br-keystone ep: br-keystone
neutron-api: neutron-api:
@ -54,8 +52,6 @@ adv_net_template:
ep: br-swift ep: br-swift
sahara: sahara:
ep: br-sahara ep: br-sahara
ceilometer:
ep: br-ceilometer
cinder: cinder:
ep: br-cinder ep: br-cinder
glance: glance:
@ -66,8 +62,6 @@ adv_net_template:
ep: br-nova ep: br-nova
nova-migration: nova-migration:
ep: br-novamigr ep: br-novamigr
murano:
ep: br-murano
horizon: horizon:
ep: br-horizon ep: br-horizon
messaging: messaging:
@ -173,11 +167,6 @@ adv_net_template:
ironic/baremetal: br-fake ironic/baremetal: br-fake
custom: custom:
transformations: transformations:
- action: add-br
name: br-mongo
- action: add-port
bridge: br-mongo
name: <% if4 %>.201
- action: add-br - action: add-br
name: br-keystone name: br-keystone
- action: add-port - action: add-port
@ -203,11 +192,6 @@ adv_net_template:
- action: add-port - action: add-port
bridge: br-sahara bridge: br-sahara
name: <% if4 %>.206 name: <% if4 %>.206
- action: add-br
name: br-ceilometer
- action: add-port
bridge: br-ceilometer
name: <% if4 %>.207
- action: add-br - action: add-br
name: br-cinder name: br-cinder
- action: add-port - action: add-port
@ -233,11 +217,6 @@ adv_net_template:
- action: add-port - action: add-port
bridge: br-novamigr bridge: br-novamigr
name: <% if4 %>.212 name: <% if4 %>.212
- action: add-br
name: br-murano
- action: add-port
bridge: br-murano
name: <% if4 %>.213
- action: add-br - action: add-br
name: br-horizon name: br-horizon
- action: add-port - action: add-port
@ -274,19 +253,16 @@ adv_net_template:
bridge: br-swiftrepl bridge: br-swiftrepl
name: <% if4 %>.220 name: <% if4 %>.220
endpoints: endpoints:
- br-mongo
- br-keystone - br-keystone
- br-neutronapi - br-neutronapi
- br-neutronmesh - br-neutronmesh
- br-swift - br-swift
- br-sahara - br-sahara
- br-ceilometer
- br-cinder - br-cinder
- br-glance - br-glance
- br-heat - br-heat
- br-nova - br-nova
- br-novamigr - br-novamigr
- br-murano
- br-horizon - br-horizon
- br-messaging - br-messaging
- br-corosync - br-corosync
@ -295,20 +271,16 @@ adv_net_template:
- br-cinderiscsi - br-cinderiscsi
- br-swiftrepl - br-swiftrepl
roles: roles:
mongo/db: br-mongo
keystone/api: br-keystone keystone/api: br-keystone
neutron/api: br-neutronapi neutron/api: br-neutronapi
neutron/mesh: br-neutronmesh neutron/mesh: br-neutronmesh
swift/api: br-swift swift/api: br-swift
sahara/api: br-sahara sahara/api: br-sahara
ceilometer/api: br-ceilometer
cinder/api: br-cinder cinder/api: br-cinder
glance/api: br-glance glance/api: br-glance
heat/api: br-heat heat/api: br-heat
nova/api: br-nova nova/api: br-nova
nova/migration: br-novamigr nova/migration: br-novamigr
murano/api: br-murano
murano/cfapi: br-murano
horizon: br-horizon horizon: br-horizon
mgmt/messaging: br-messaging mgmt/messaging: br-messaging
mgmt/corosync: br-corosync mgmt/corosync: br-corosync

View File

@ -110,21 +110,17 @@ adv_net_template:
roles: roles:
admin/pxe: br-fw-admin admin/pxe: br-fw-admin
fw-admin: br-fw-admin fw-admin: br-fw-admin
mongo/db: br-mgmt
management: br-mgmt management: br-mgmt
keystone/api: br-mgmt keystone/api: br-mgmt
neutron/api: br-mgmt neutron/api: br-mgmt
neutron/mesh: br-mgmt neutron/mesh: br-mgmt
swift/api: br-mgmt swift/api: br-mgmt
sahara/api: br-mgmt sahara/api: br-mgmt
ceilometer/api: br-mgmt
cinder/api: br-mgmt cinder/api: br-mgmt
glance/api: br-mgmt glance/api: br-mgmt
heat/api: br-mgmt heat/api: br-mgmt
nova/api: br-mgmt nova/api: br-mgmt
nova/migration: br-mgmt nova/migration: br-mgmt
murano/api: br-mgmt
murano/cfapi: br-mgmt
horizon: br-mgmt horizon: br-mgmt
mgmt/api: br-mgmt mgmt/api: br-mgmt
mgmt/memcache: br-mgmt mgmt/memcache: br-mgmt

View File

@ -102,20 +102,16 @@ adv_net_template:
roles: roles:
admin/pxe: br-fw-admin admin/pxe: br-fw-admin
fw-admin: br-fw-admin fw-admin: br-fw-admin
mongo/db: br-fw-admin
management: br-fw-admin management: br-fw-admin
keystone/api: br-fw-admin keystone/api: br-fw-admin
neutron/api: br-fw-admin neutron/api: br-fw-admin
neutron/mesh: br-fw-admin neutron/mesh: br-fw-admin
sahara/api: br-fw-admin sahara/api: br-fw-admin
ceilometer/api: br-fw-admin
cinder/api: br-fw-admin cinder/api: br-fw-admin
glance/api: br-fw-admin glance/api: br-fw-admin
heat/api: br-fw-admin heat/api: br-fw-admin
nova/api: br-fw-admin nova/api: br-fw-admin
nova/migration: br-fw-admin nova/migration: br-fw-admin
murano/api: br-fw-admin
murano/cfapi: br-fw-admin
horizon: br-fw-admin horizon: br-fw-admin
mgmt/api: br-fw-admin mgmt/api: br-fw-admin
mgmt/memcache: br-fw-admin mgmt/memcache: br-fw-admin

View File

@ -121,21 +121,17 @@ adv_net_template:
roles: roles:
admin/pxe: br-fw-admin admin/pxe: br-fw-admin
fw-admin: br-fw-admin fw-admin: br-fw-admin
mongo/db: br-mgmt
management: br-mgmt management: br-mgmt
keystone/api: br-mgmt keystone/api: br-mgmt
neutron/api: br-mgmt neutron/api: br-mgmt
neutron/mesh: br-mgmt neutron/mesh: br-mgmt
swift/api: br-mgmt swift/api: br-mgmt
sahara/api: br-mgmt sahara/api: br-mgmt
ceilometer/api: br-mgmt
cinder/api: br-mgmt cinder/api: br-mgmt
glance/api: br-mgmt glance/api: br-mgmt
heat/api: br-mgmt heat/api: br-mgmt
nova/api: br-mgmt nova/api: br-mgmt
nova/migration: br-mgmt nova/migration: br-mgmt
murano/api: br-mgmt
murano/cfapi: br-mgmt
horizon: br-mgmt horizon: br-mgmt
mgmt/api: br-mgmt mgmt/api: br-mgmt
mgmt/memcache: br-mgmt mgmt/memcache: br-mgmt

View File

@ -13,8 +13,6 @@ adv_net_template:
ep: br-mgmt ep: br-mgmt
messaging: messaging:
ep: br-messaging ep: br-messaging
mongo:
ep: br-mongo
openstack: openstack:
ep: br-openstack ep: br-openstack
private: private:
@ -98,17 +96,6 @@ adv_net_template:
- action: add-port - action: add-port
bridge: br-messaging bridge: br-messaging
name: <% if2 %>.368 name: <% if2 %>.368
mongo:
endpoints:
- br-mongo
roles:
mongo/db: br-mongo
transformations:
- action: add-br
name: br-mongo
- action: add-port
bridge: br-mongo
name: <% if1 %>.369
openstack: openstack:
endpoints: endpoints:
- br-openstack - br-openstack
@ -171,10 +158,7 @@ adv_net_template:
endpoints: endpoints:
- br-services - br-services
roles: roles:
ceilometer/api: br-services
heat/api: br-services heat/api: br-services
murano/api: br-services
murano/cfapi: br-services
sahara/api: br-services sahara/api: br-services
transformations: transformations:
- action: add-br - action: add-br
@ -237,9 +221,3 @@ adv_net_template:
- openstack - openstack
- database - database
- messaging - messaging
- mongo
mongo:
- admin
- management
- messaging
- mongo

View File

@ -30,7 +30,6 @@ adv_net_template:
endpoints: endpoints:
- br-mgmt - br-mgmt
roles: roles:
ceilometer/api: br-mgmt
ceph/radosgw: br-mgmt ceph/radosgw: br-mgmt
ceph/replication: br-mgmt ceph/replication: br-mgmt
cinder/api: br-mgmt cinder/api: br-mgmt
@ -48,9 +47,6 @@ adv_net_template:
mgmt/memcache: br-mgmt mgmt/memcache: br-mgmt
mgmt/messaging: br-mgmt mgmt/messaging: br-mgmt
mgmt/vip: br-mgmt mgmt/vip: br-mgmt
mongo/db: br-mgmt
murano/api: br-mgmt
murano/cfapi: br-mgmt
neutron/api: br-mgmt neutron/api: br-mgmt
neutron/mesh: br-mgmt neutron/mesh: br-mgmt
nova/api: br-mgmt nova/api: br-mgmt

View File

@ -86,20 +86,16 @@ adv_net_template:
management: br-mgmt management: br-mgmt
mgmt/vip: br-mgmt mgmt/vip: br-mgmt
mgmt/api: br-mgmt mgmt/api: br-mgmt
mongo/db: br-mgmt
keystone/api: br-mgmt keystone/api: br-mgmt
neutron/api: br-mgmt neutron/api: br-mgmt
neutron/mesh: br-mgmt neutron/mesh: br-mgmt
swift/api: br-mgmt swift/api: br-mgmt
sahara/api: br-mgmt sahara/api: br-mgmt
ceilometer/api: br-mgmt
cinder/api: br-mgmt cinder/api: br-mgmt
glance/api: br-mgmt glance/api: br-mgmt
heat/api: br-mgmt heat/api: br-mgmt
nova/api: br-mgmt nova/api: br-mgmt
nova/migration: br-mgmt nova/migration: br-mgmt
murano/api: br-mgmt
murano/cfapi: br-mgmt
horizon: br-mgmt horizon: br-mgmt
mgmt/messaging: br-mgmt mgmt/messaging: br-mgmt
mgmt/corosync: br-mgmt mgmt/corosync: br-mgmt
@ -231,19 +227,16 @@ adv_net_template:
management: br-mgmt management: br-mgmt
mgmt/vip: br-mgmt mgmt/vip: br-mgmt
mgmt/api: br-mgmt mgmt/api: br-mgmt
mongo/db: br-mgmt
keystone/api: br-mgmt keystone/api: br-mgmt
neutron/api: br-mgmt neutron/api: br-mgmt
neutron/mesh: br-mgmt neutron/mesh: br-mgmt
swift/api: br-mgmt swift/api: br-mgmt
sahara/api: br-mgmt sahara/api: br-mgmt
ceilometer/api: br-mgmt
cinder/api: br-mgmt cinder/api: br-mgmt
glance/api: br-mgmt glance/api: br-mgmt
heat/api: br-mgmt heat/api: br-mgmt
nova/api: br-mgmt nova/api: br-mgmt
nova/migration: br-mgmt nova/migration: br-mgmt
murano/api: br-mgmt
horizon: br-mgmt horizon: br-mgmt
mgmt/messaging: br-mgmt mgmt/messaging: br-mgmt
mgmt/corosync: br-mgmt mgmt/corosync: br-mgmt

View File

@ -44,13 +44,11 @@ class TestNetworkTemplatesBase(TestBasic):
:param template: Yaml template with network assignments on interfaces. :param template: Yaml template with network assignments on interfaces.
:param ip_nets: Dict with network descriptions. :param ip_nets: Dict with network descriptions.
:param ip_prefixlen: Integer for slicing network prefix. :param ip_prefixlen: Integer for slicing network prefix.
:return: Data to be used to assign networks to nodes. :return: Data to be used to assign networks to nodes
""" """
networks_data = [] networks_data = []
nodegroups = self.fuel_web.client.get_nodegroups() nodegroups = self.fuel_web.client.get_nodegroups()
for nodegroup, section in template['adv_net_template'].items(): for nodegroup, section in template['adv_net_template'].items():
networks = [(n, section['network_assignments'][n]['ep'])
for n in section['network_assignments']]
assert_true(any(n['name'] == nodegroup for n in nodegroups), assert_true(any(n['name'] == nodegroup for n in nodegroups),
'Network templates contains settings for Node Group ' 'Network templates contains settings for Node Group '
'"{0}", which does not exist!'.format(nodegroup)) '"{0}", which does not exist!'.format(nodegroup))
@ -58,14 +56,13 @@ class TestNetworkTemplatesBase(TestBasic):
n['name'] == nodegroup][0] n['name'] == nodegroup][0]
ip_network = netaddr.IPNetwork(str(ip_nets[nodegroup])) ip_network = netaddr.IPNetwork(str(ip_nets[nodegroup]))
ip_subnets = list(ip_network.subnet(int(ip_prefixlen))) ip_subnets = list(ip_network.subnet(int(ip_prefixlen)))
for network, interface in networks: for network in section['network_assignments']:
ip_subnet = ip_subnets.pop() ip_subnet = ip_subnets.pop()
networks_data.append( networks_data.append(
{ {
'name': network, 'name': network,
'cidr': str(ip_subnet), 'cidr': str(ip_subnet),
'group_id': group_id, 'group_id': group_id,
'interface': interface,
'gateway': None, 'gateway': None,
'meta': { 'meta': {
"notation": "ip_ranges", "notation": "ip_ranges",
@ -81,6 +78,26 @@ class TestNetworkTemplatesBase(TestBasic):
) )
return networks_data return networks_data
@logwrap
def map_group_by_iface_and_network(self, template):
""" Map groip id, iface name and network name
:param template: Yaml template with network assignments on interfaces.
:return: Data to be used for check of ip assignment
"""
mapped_data = {}
nodegroups = self.fuel_web.client.get_nodegroups()
for nodegroup, section in template['adv_net_template'].items():
networks = [(n, section['network_assignments'][n]['ep'])
for n in section['network_assignments']]
assert_true(any(n['name'] == nodegroup for n in nodegroups),
'Network templates contains settings for Node Group '
'"{0}", which does not exist!'.format(nodegroup))
group_id = [n['id'] for n in nodegroups if
n['name'] == nodegroup][0]
mapped_data[group_id] = dict(networks)
return mapped_data
@staticmethod @staticmethod
@logwrap @logwrap
def get_template_ep_for_role(template, role, nodegroup='default', def get_template_ep_for_role(template, role, nodegroup='default',
@ -172,6 +189,7 @@ class TestNetworkTemplatesBase(TestBasic):
# Network for Neutron is configured in namespaces (l3/dhcp agents) # Network for Neutron is configured in namespaces (l3/dhcp agents)
# and a bridge for it doesn't have IP, so skipping it for now # and a bridge for it doesn't have IP, so skipping it for now
skip_roles = {'neutron/private'} skip_roles = {'neutron/private'}
mapped_data = self.map_group_by_iface_and_network(network_template)
for node in self.fuel_web.client.list_cluster_nodes(cluster_id): for node in self.fuel_web.client.list_cluster_nodes(cluster_id):
node_networks = set() node_networks = set()
node_group_name = [ng['name'] for ng in node_group_name = [ng['name'] for ng in
@ -188,13 +206,16 @@ class TestNetworkTemplatesBase(TestBasic):
if network['name'] not in node_networks or \ if network['name'] not in node_networks or \
network['group_id'] != node['group_id']: network['group_id'] != node['group_id']:
continue continue
logger.debug('Checking interface "{0}" for IP network ' logger.debug(
'"{1}" on "{2}"'.format(network['interface'], 'Checking interface "{0}" for IP network '
network['cidr'], '"{1}" on "{2}"'.format(
node['hostname'])) mapped_data[node['group_id']][network['name']],
self.check_interface_ip_exists(remote, network['cidr'],
network['interface'], node['hostname']))
network['cidr']) self.check_interface_ip_exists(
remote,
mapped_data[node['group_id']][network['name']],
network['cidr'])
@staticmethod @staticmethod
@logwrap @logwrap