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:
David Paterson 2015-04-08 21:58:19 -04:00
parent 4209ecfa60
commit 15be99ec2d
2 changed files with 11 additions and 5 deletions

View File

@ -41,3 +41,4 @@
- 'admin'
resources:
network: 'public'
router: 'admin_tenant_1-router'

View File

@ -191,10 +191,11 @@ def create_resources(opts, resources):
if network_admin:
for u in resources['users']:
tenant = identity_admin.get_tenant_by_name(u['tenant'])
network_name = create_network_resources(network_admin,
tenant['id'],
u['name'])
network_name, router_name = create_network_resources(network_admin,
tenant['id'],
u['name'])
u['network'] = network_name
u['router'] = router_name
LOG.info('Networks created')
for u in resources['users']:
try:
@ -266,7 +267,7 @@ def create_network_resources(network_admin_client, tenant_id, name):
router_name = name + "-router"
router = _create_router(router_name)
_add_router_interface(router['id'], subnet['id'])
return network_name
return network_name, router_name
def random_user_name(tag, prefix):
@ -330,8 +331,12 @@ def dump_accounts(opts, resources):
'password': user['pass'],
'roles': user['roles']
}
if 'network' or 'router' in user:
account['resources'] = {}
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)
if os.path.exists(opts.accounts):
os.rename(opts.accounts, '.'.join((opts.accounts, 'bak')))