Skip to content

Commit 3d00884

Browse files
Merge pull request #1672 from caberos/issue1671
fix the vlan table
2 parents 8bc29f6 + 1e26c61 commit 3d00884

File tree

2 files changed

+44
-14
lines changed

2 files changed

+44
-14
lines changed

SoftLayer/CLI/vlan/detail.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@ def cli(env, identifier, no_vs, no_hardware):
3838
table.add_row(['primary_router',
3939
utils.lookup(vlan, 'primaryRouter', 'fullyQualifiedDomainName')])
4040
table.add_row(['Gateway/Firewall', get_gateway_firewall(vlan)])
41-
subnets = []
42-
for subnet in vlan.get('subnets', []):
43-
subnet_table = formatting.KeyValueTable(['name', 'value'])
44-
subnet_table.align['name'] = 'r'
45-
subnet_table.align['value'] = 'l'
46-
subnet_table.add_row(['id', subnet.get('id')])
47-
subnet_table.add_row(['identifier', subnet.get('networkIdentifier')])
48-
subnet_table.add_row(['netmask', subnet.get('netmask')])
49-
subnet_table.add_row(['gateway', subnet.get('gateway', formatting.blank())])
50-
subnet_table.add_row(['type', subnet.get('subnetType')])
51-
subnet_table.add_row(['usable ips', subnet.get('usableIpAddressCount')])
52-
subnets.append(subnet_table)
53-
54-
table.add_row(['subnets', subnets])
41+
42+
if vlan.get('subnets'):
43+
subnet_table = formatting.Table(['id', 'identifier', 'netmask', 'gateway', 'type', 'usable ips'])
44+
for subnet in vlan.get('subnets'):
45+
subnet_table.add_row([subnet.get('id'),
46+
subnet.get('networkIdentifier'),
47+
subnet.get('netmask'),
48+
subnet.get('gateway') or formatting.blank(),
49+
subnet.get('subnetType'),
50+
subnet.get('usableIpAddressCount')])
51+
# subnets.append(subnet_table)
52+
table.add_row(['subnets', subnet_table])
53+
else:
54+
table.add_row(['subnets', 'none'])
5555

5656
server_columns = ['hostname', 'domain', 'public_ip', 'private_ip']
5757

SoftLayer/fixtures/SoftLayer_Network_Vlan.py

+30
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,36 @@
1414
'notes': 'test cli',
1515
'orderItemId': 147258,
1616
},
17+
'subnets': [
18+
{
19+
'broadcastAddress': '169.46.22.127',
20+
'cidr': 28,
21+
'gateway': '169.46.22.113',
22+
'id': 1804813,
23+
'netmask': '255.255.255.240',
24+
'networkIdentifier': '169.46.22.112',
25+
'networkVlanId': 1404267,
26+
'subnetType': 'ADDITIONAL_PRIMARY',
27+
'totalIpAddresses': '16',
28+
'usableIpAddressCount': '13',
29+
'addressSpace': 'PUBLIC'
30+
},
31+
{
32+
'broadcastAddress': '150.239.7.191',
33+
'cidr': 27,
34+
'gateway': '150.239.7.161',
35+
'id': 2415982,
36+
'netmask': '255.255.255.224',
37+
'networkIdentifier': '150.239.7.160',
38+
'networkVlanId': 1404267,
39+
'subnetType': 'SECONDARY_ON_VLAN',
40+
'totalIpAddresses': '32',
41+
'usableIpAddressCount': '29',
42+
'version': 4,
43+
'addressSpace': 'PUBLIC'
44+
}],
45+
'hardware': [],
46+
'virtualGuests': [],
1747
'tagReferences': [],
1848
}
1949

0 commit comments

Comments
 (0)