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 d5de1a7b05
commit c57e5fe33b
10 changed files with 33 additions and 141 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,8 +13,6 @@ adv_net_template:
ep: br-mgmt
messaging:
ep: br-messaging
mongo:
ep: br-mongo
openstack:
ep: br-openstack
private:
@ -98,17 +96,6 @@ adv_net_template:
- action: add-port
bridge: br-messaging
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:
endpoints:
- br-openstack
@ -171,10 +158,7 @@ adv_net_template:
endpoints:
- br-services
roles:
ceilometer/api: br-services
heat/api: br-services
murano/api: br-services
murano/cfapi: br-services
sahara/api: br-services
transformations:
- action: add-br
@ -237,9 +221,3 @@ adv_net_template:
- openstack
- database
- messaging
- mongo
mongo:
- admin
- management
- messaging
- mongo

View File

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

View File

@ -86,20 +86,16 @@ adv_net_template:
management: br-mgmt
mgmt/vip: br-mgmt
mgmt/api: br-mgmt
mongo/db: br-mgmt
keystone/api: br-mgmt
neutron/api: br-mgmt
neutron/mesh: br-mgmt
swift/api: br-mgmt
sahara/api: br-mgmt
ceilometer/api: br-mgmt
cinder/api: br-mgmt
glance/api: br-mgmt
heat/api: br-mgmt
nova/api: br-mgmt
nova/migration: br-mgmt
murano/api: br-mgmt
murano/cfapi: br-mgmt
horizon: br-mgmt
mgmt/messaging: br-mgmt
mgmt/corosync: br-mgmt
@ -231,19 +227,16 @@ adv_net_template:
management: br-mgmt
mgmt/vip: br-mgmt
mgmt/api: br-mgmt
mongo/db: br-mgmt
keystone/api: br-mgmt
neutron/api: br-mgmt
neutron/mesh: br-mgmt
swift/api: br-mgmt
sahara/api: br-mgmt
ceilometer/api: br-mgmt
cinder/api: br-mgmt
glance/api: br-mgmt
heat/api: br-mgmt
nova/api: br-mgmt
nova/migration: br-mgmt
murano/api: br-mgmt
horizon: br-mgmt
mgmt/messaging: 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 ip_nets: Dict with network descriptions.
: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 = []
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))
@ -58,14 +56,13 @@ class TestNetworkTemplatesBase(TestBasic):
n['name'] == nodegroup][0]
ip_network = netaddr.IPNetwork(str(ip_nets[nodegroup]))
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()
networks_data.append(
{
'name': network,
'cidr': str(ip_subnet),
'group_id': group_id,
'interface': interface,
'gateway': None,
'meta': {
"notation": "ip_ranges",
@ -81,6 +78,26 @@ class TestNetworkTemplatesBase(TestBasic):
)
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
@logwrap
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)
# and a bridge for it doesn't have IP, so skipping it for now
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):
node_networks = set()
node_group_name = [ng['name'] for ng in
@ -188,13 +206,16 @@ class TestNetworkTemplatesBase(TestBasic):
if network['name'] not in node_networks or \
network['group_id'] != node['group_id']:
continue
logger.debug('Checking interface "{0}" for IP network '
'"{1}" on "{2}"'.format(network['interface'],
network['cidr'],
node['hostname']))
self.check_interface_ip_exists(remote,
network['interface'],
network['cidr'])
logger.debug(
'Checking interface "{0}" for IP network '
'"{1}" on "{2}"'.format(
mapped_data[node['group_id']][network['name']],
network['cidr'],
node['hostname']))
self.check_interface_ip_exists(
remote,
mapped_data[node['group_id']][network['name']],
network['cidr'])
@staticmethod
@logwrap