Merge "Fix subnet no show in networktopology graph"

This commit is contained in:
Jenkins 2017-10-14 09:38:39 +00:00 committed by Gerrit Code Review
commit 5943036286
2 changed files with 17 additions and 14 deletions

View File

@ -134,14 +134,19 @@ class NetworkTopologyTests(test.TestCase):
# networks
expect_net_urls = []
if router_enable:
expect_net_urls += [{'id': net.id,
'url': '/project/networks/%s/detail' % net.id,
'name': net.name,
'router:external': net.router__external,
'status': net.status.title(),
'original_status': net.status,
'subnets': []}
for net in external_networks]
expect_net_urls += [{
'id': net.id,
'url': '/project/networks/%s/detail' % net.id,
'name': net.name,
'router:external': net.router__external,
'status': net.status.title(),
'original_status': net.status,
'subnets': [{
'cidr': snet.cidr,
'id': snet.id,
'url': '/project/networks/subnets/%s/detail' % snet.id}
for snet in net.subnets]}
for net in external_networks]
expect_net_urls.extend([{
'id': net.id,
'url': '/project/networks/%s/detail' % net.id,

View File

@ -301,13 +301,11 @@ class JSONView(View):
if publicnet.id in my_network_ids:
continue
try:
subnets = []
for subnet in publicnet.subnets:
snet = {'id': subnet.id,
subnets = [{'id': subnet.id,
'cidr': subnet.cidr}
self.add_resource_url(
'horizon:project:networks:subnets:detail', snet)
subnets.append(snet)
for subnet in publicnet.subnets]
self.add_resource_url(
'horizon:project:networks:subnets:detail', subnets)
except Exception:
subnets = []
networks.append({