Skip to content

Commit

Permalink
Merge pull request #1672 from caberos/issue1671
Browse files Browse the repository at this point in the history
fix the vlan table
  • Loading branch information
allmightyspiff committed Jun 23, 2022
2 parents 8bc29f6 + 1e26c61 commit 3d00884
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 14 deletions.
28 changes: 14 additions & 14 deletions SoftLayer/CLI/vlan/detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ def cli(env, identifier, no_vs, no_hardware):
table.add_row(['primary_router',
utils.lookup(vlan, 'primaryRouter', 'fullyQualifiedDomainName')])
table.add_row(['Gateway/Firewall', get_gateway_firewall(vlan)])
subnets = []
for subnet in vlan.get('subnets', []):
subnet_table = formatting.KeyValueTable(['name', 'value'])
subnet_table.align['name'] = 'r'
subnet_table.align['value'] = 'l'
subnet_table.add_row(['id', subnet.get('id')])
subnet_table.add_row(['identifier', subnet.get('networkIdentifier')])
subnet_table.add_row(['netmask', subnet.get('netmask')])
subnet_table.add_row(['gateway', subnet.get('gateway', formatting.blank())])
subnet_table.add_row(['type', subnet.get('subnetType')])
subnet_table.add_row(['usable ips', subnet.get('usableIpAddressCount')])
subnets.append(subnet_table)

table.add_row(['subnets', subnets])

if vlan.get('subnets'):
subnet_table = formatting.Table(['id', 'identifier', 'netmask', 'gateway', 'type', 'usable ips'])
for subnet in vlan.get('subnets'):
subnet_table.add_row([subnet.get('id'),
subnet.get('networkIdentifier'),
subnet.get('netmask'),
subnet.get('gateway') or formatting.blank(),
subnet.get('subnetType'),
subnet.get('usableIpAddressCount')])
# subnets.append(subnet_table)
table.add_row(['subnets', subnet_table])
else:
table.add_row(['subnets', 'none'])

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

Expand Down
30 changes: 30 additions & 0 deletions SoftLayer/fixtures/SoftLayer_Network_Vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,36 @@
'notes': 'test cli',
'orderItemId': 147258,
},
'subnets': [
{
'broadcastAddress': '169.46.22.127',
'cidr': 28,
'gateway': '169.46.22.113',
'id': 1804813,
'netmask': '255.255.255.240',
'networkIdentifier': '169.46.22.112',
'networkVlanId': 1404267,
'subnetType': 'ADDITIONAL_PRIMARY',
'totalIpAddresses': '16',
'usableIpAddressCount': '13',
'addressSpace': 'PUBLIC'
},
{
'broadcastAddress': '150.239.7.191',
'cidr': 27,
'gateway': '150.239.7.161',
'id': 2415982,
'netmask': '255.255.255.224',
'networkIdentifier': '150.239.7.160',
'networkVlanId': 1404267,
'subnetType': 'SECONDARY_ON_VLAN',
'totalIpAddresses': '32',
'usableIpAddressCount': '29',
'version': 4,
'addressSpace': 'PUBLIC'
}],
'hardware': [],
'virtualGuests': [],
'tagReferences': [],
}

Expand Down

0 comments on commit 3d00884

Please sign in to comment.