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
diff --git a/etc/accounts.yaml.sample b/etc/accounts.yaml.sample
index 3f57eb7..decc659 100644
--- a/etc/accounts.yaml.sample
+++ b/etc/accounts.yaml.sample
@@ -41,3 +41,4 @@
- 'admin'
resources:
network: 'public'
+ router: 'admin_tenant_1-router'
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index 892e051..fbfbbb7 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -191,10 +191,11 @@
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 @@
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 @@
'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')))