@@ -26,9 +26,17 @@ 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, isBroadcast, isGateway, isNetwork, isReserved, ' \
30- 'hardware, virtualGuest], datacenter, virtualGuests, hardware,' \
31- ' networkVlan[networkSpace,primaryRouter]]'
29+ mask = """mask[
30+ networkIdentifier, cidr, subnetType, gateway, broadcastAddress, usableIpAddressCount, note, id,
31+ ipAddresses[
32+ id, ipAddress, note, isBroadcast, isGateway, isNetwork, isReserved,
33+ hardware[id, fullyQualifiedDomainName],
34+ virtualGuest[id, fullyQualifiedDomainName]
35+ ],
36+ datacenter[name], networkVlan[networkSpace], tagReferences,
37+ virtualGuests[id, fullyQualifiedDomainName, hostname, domain, primaryIpAddress, primaryBackendIpAddress],
38+ hardware[id, fullyQualifiedDomainName, hostname, domain, primaryIpAddress, primaryBackendIpAddress]
39+ ]"""
3240
3341 subnet = mgr .get_subnet (subnet_id , mask = mask )
3442
@@ -37,22 +45,15 @@ def cli(env, identifier, no_vs, no_hardware):
3745 table .align ['value' ] = 'l'
3846
3947 table .add_row (['id' , subnet ['id' ]])
40- table .add_row (['identifier' ,
41- '%s/%s' % (subnet ['networkIdentifier' ],
42- str (subnet ['cidr' ]))])
48+ table .add_row (['identifier' , f"{ subnet ['networkIdentifier' ]} /{ subnet ['cidr' ]} " ])
4349 table .add_row (['subnet type' , subnet .get ('subnetType' , formatting .blank ())])
44- table .add_row (['network space' ,
45- utils .lookup (subnet , 'networkVlan' , 'networkSpace' )])
50+ table .add_row (['network space' , utils .lookup (subnet , 'networkVlan' , 'networkSpace' )])
4651 table .add_row (['gateway' , subnet .get ('gateway' , formatting .blank ())])
47- table .add_row (['broadcast' ,
48- subnet .get ('broadcastAddress' , formatting .blank ())])
52+ table .add_row (['broadcast' , subnet .get ('broadcastAddress' , formatting .blank ())])
4953 table .add_row (['datacenter' , subnet ['datacenter' ]['name' ]])
50- table .add_row (['usable ips' ,
51- subnet .get ('usableIpAddressCount' , formatting .blank ())])
52- table .add_row (['note' ,
53- subnet .get ('note' , formatting .blank ())])
54- table .add_row (['tags' ,
55- formatting .tags (subnet .get ('tagReferences' ))])
54+ table .add_row (['usable ips' , subnet .get ('usableIpAddressCount' , formatting .blank ())])
55+ table .add_row (['note' , subnet .get ('note' , formatting .blank ())])
56+ table .add_row (['tags' , formatting .tags (subnet .get ('tagReferences' ))])
5657
5758 ip_address = subnet .get ('ipAddresses' )
5859
@@ -72,8 +73,9 @@ def cli(env, identifier, no_vs, no_hardware):
7273 elif address .get ('virtualGuest' ) is not None :
7374 description = address ['virtualGuest' ]['fullyQualifiedDomainName' ]
7475 status = 'In use'
75- ip_table .add_row ([address .get ('id' ), status ,
76- address .get ('ipAddress' ) + '/' + description , address .get ('note' , '-' )])
76+ ip_table .add_row ([
77+ address .get ('id' ), status , f"{ address .get ('ipAddress' )} /{ description } " , address .get ('note' , '-' )
78+ ])
7779
7880 table .add_row (['ipAddresses' , ip_table ])
7981
0 commit comments