Add router to resources section of yaml output
network and router are both top-level network resources and router should be represented in the yaml file both for clarity and also having router name exposed in yaml file is useful for building white list for tempest cleanup. In addition horizon also lists networks and routers as top-level network objects. Adding router to the test account output aligns with this existing pattern. Change-Id: Iddebba793a978281f698ea10c167dc0a8765d785
This commit is contained in:
parent
4209ecfa60
commit
15be99ec2d
@ -41,3 +41,4 @@
|
|||||||
- 'admin'
|
- 'admin'
|
||||||
resources:
|
resources:
|
||||||
network: 'public'
|
network: 'public'
|
||||||
|
router: 'admin_tenant_1-router'
|
||||||
|
@ -191,10 +191,11 @@ def create_resources(opts, resources):
|
|||||||
if network_admin:
|
if network_admin:
|
||||||
for u in resources['users']:
|
for u in resources['users']:
|
||||||
tenant = identity_admin.get_tenant_by_name(u['tenant'])
|
tenant = identity_admin.get_tenant_by_name(u['tenant'])
|
||||||
network_name = create_network_resources(network_admin,
|
network_name, router_name = create_network_resources(network_admin,
|
||||||
tenant['id'],
|
tenant['id'],
|
||||||
u['name'])
|
u['name'])
|
||||||
u['network'] = network_name
|
u['network'] = network_name
|
||||||
|
u['router'] = router_name
|
||||||
LOG.info('Networks created')
|
LOG.info('Networks created')
|
||||||
for u in resources['users']:
|
for u in resources['users']:
|
||||||
try:
|
try:
|
||||||
@ -266,7 +267,7 @@ def create_network_resources(network_admin_client, tenant_id, name):
|
|||||||
router_name = name + "-router"
|
router_name = name + "-router"
|
||||||
router = _create_router(router_name)
|
router = _create_router(router_name)
|
||||||
_add_router_interface(router['id'], subnet['id'])
|
_add_router_interface(router['id'], subnet['id'])
|
||||||
return network_name
|
return network_name, router_name
|
||||||
|
|
||||||
|
|
||||||
def random_user_name(tag, prefix):
|
def random_user_name(tag, prefix):
|
||||||
@ -330,8 +331,12 @@ def dump_accounts(opts, resources):
|
|||||||
'password': user['pass'],
|
'password': user['pass'],
|
||||||
'roles': user['roles']
|
'roles': user['roles']
|
||||||
}
|
}
|
||||||
|
if 'network' or 'router' in user:
|
||||||
|
account['resources'] = {}
|
||||||
if 'network' in user:
|
if 'network' in user:
|
||||||
account['resources'] = {'network': user['network']}
|
account['resources']['network'] = user['network']
|
||||||
|
if 'router' in user:
|
||||||
|
account['resources']['router'] = user['router']
|
||||||
accounts.append(account)
|
accounts.append(account)
|
||||||
if os.path.exists(opts.accounts):
|
if os.path.exists(opts.accounts):
|
||||||
os.rename(opts.accounts, '.'.join((opts.accounts, 'bak')))
|
os.rename(opts.accounts, '.'.join((opts.accounts, 'bak')))
|
||||||
|
Loading…
Reference in New Issue
Block a user