@@ -26,9 +26,17 @@ def cli(env, identifier, no_vs, no_hardware):
26
26
subnet_id = helpers .resolve_id (mgr .resolve_subnet_ids , identifier ,
27
27
name = 'subnet' )
28
28
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
+ ]"""
32
40
33
41
subnet = mgr .get_subnet (subnet_id , mask = mask )
34
42
@@ -37,22 +45,15 @@ def cli(env, identifier, no_vs, no_hardware):
37
45
table .align ['value' ] = 'l'
38
46
39
47
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' ]} " ])
43
49
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' )])
46
51
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 ())])
49
53
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' ))])
56
57
57
58
ip_address = subnet .get ('ipAddresses' )
58
59
@@ -72,8 +73,9 @@ def cli(env, identifier, no_vs, no_hardware):
72
73
elif address .get ('virtualGuest' ) is not None :
73
74
description = address ['virtualGuest' ]['fullyQualifiedDomainName' ]
74
75
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
+ ])
77
79
78
80
table .add_row (['ipAddresses' , ip_table ])
79
81
0 commit comments