Skip to content

Commit e62fc60

Browse files
Merge pull request #1803 from caberos/issue1799
Improve subnet detail
2 parents d589ba4 + 192b8a7 commit e62fc60

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

SoftLayer/CLI/subnet/detail.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def cli(env, identifier, no_vs, no_hardware):
2626
subnet_id = helpers.resolve_id(mgr.resolve_subnet_ids, identifier,
2727
name='subnet')
2828

29-
mask = 'mask[ipAddresses[id, ipAddress,note], datacenter, virtualGuests, hardware, networkVlan[networkSpace]]'
29+
mask = 'mask[ipAddresses[id, ipAddress,note, hardware, virtualGuest], datacenter, virtualGuests, hardware,' \
30+
' networkVlan[networkSpace,primaryRouter]]'
3031

3132
subnet = mgr.get_subnet(subnet_id, mask=mask)
3233

@@ -56,7 +57,13 @@ def cli(env, identifier, no_vs, no_hardware):
5657

5758
ip_table = formatting.KeyValueTable(['id', 'ip', 'note'])
5859
for address in ip_address:
59-
ip_table.add_row([address.get('id'), address.get('ipAddress'), address.get('note')])
60+
description = '-'
61+
if address.get('hardware') is not None:
62+
description = address['hardware']['fullyQualifiedDomainName']
63+
elif address.get('virtualGuest') is not None:
64+
description = address['virtualGuest']['fullyQualifiedDomainName']
65+
ip_table.add_row([address.get('id'),
66+
address.get('ipAddress') + '/' + description, address.get('note', '-')])
6067

6168
table.add_row(['ipAddresses', ip_table])
6269

SoftLayer/fixtures/SoftLayer_Network_Subnet.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
'cidr': '26',
99
'subnetType': 'ADDITIONAL_PRIMARY',
1010
'networkVlan': {
11-
'networkSpace': 'PUBLIC'
11+
'networkSpace': 'PUBLIC',
12+
'primaryRouter': {
13+
'fullyQualifiedDomainName': 'fcr03a.dal13.softlayer.com'
14+
}
1215
},
1316
'gateway': '1.2.3.254',
1417
'broadcastAddress': '1.2.3.255',

SoftLayer/managers/network.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
'usableIpAddressCount',
3535
'note',
3636
'tagReferences[tag]',
37-
'networkVlan[id,networkSpace,fullyQualifiedName]',
37+
'networkVlan[id, primaryRouter, networkSpace,fullyQualifiedName]',
3838
'addressSpace',
3939
'endPointIpAddress'
4040
])
@@ -698,7 +698,7 @@ def _list_subnets_by_identifier(self, identifier):
698698
"""
699699
identifier = identifier.split('/', 1)[0]
700700

701-
results = self.list_subnets()
701+
results = self.list_subnets(identifier=identifier, mask='id')
702702
return [result['id'] for result in results]
703703

704704
def _list_vlans_by_name(self, name):

0 commit comments

Comments
 (0)