@@ -35,8 +35,8 @@ def cli(env, sortby, datacenter, identifier, subnet_type, network_space, ipv4, i
3535 mgr = SoftLayer .NetworkManager (env .client )
3636
3737 table = formatting .Table ([
38- 'id ' , 'identifier ' , 'type ' , 'network_space ' , 'datacenter ' , 'vlan_id ' ,
39- 'IPs' , 'hardware ' , 'vs' ,
38+ 'Id ' , 'Identifier ' , 'Network ' , 'Type ' , 'VLAN ' , 'Location' , 'Target ' ,
39+ 'IPs' , 'Hardware ' , 'Vs' , 'Tags' , 'Note'
4040 ])
4141 table .sortby = sortby
4242
@@ -55,18 +55,36 @@ def cli(env, sortby, datacenter, identifier, subnet_type, network_space, ipv4, i
5555 )
5656
5757 for subnet in subnets :
58+ subnet_type = subnet .get ('subnetType' , formatting .blank ())
59+ if subnet_type == 'PRIMARY' or subnet_type == 'PRIMARY_6' or subnet_type == 'ADDITIONAL_PRIMARY' :
60+ subnet_type = 'Primary'
61+ if subnet_type == 'SECONDARY_ON_VLAN' :
62+ subnet_type = 'Portable'
63+ if subnet_type == 'STATIC_IP_ROUTED' :
64+ subnet_type = 'Static'
65+ if subnet_type == 'GLOBAL_IP' :
66+ subnet_type = 'Global'
67+
68+ network = subnet .get ('addressSpace' , formatting .blank ())
69+ if network is not None :
70+ network = str (network ).capitalize ()
71+
72+ vlan = utils .lookup (subnet , 'networkVlan' , 'fullyQualifiedName' )
73+ if vlan is None :
74+ vlan = 'Unrouted'
5875 table .add_row ([
5976 subnet ['id' ],
6077 '%s/%s' % (subnet ['networkIdentifier' ], str (subnet ['cidr' ])),
61- subnet .get ('subnetType' , formatting .blank ()),
62- utils .lookup (subnet ,
63- 'networkVlan' ,
64- 'networkSpace' ) or formatting .blank (),
65- utils .lookup (subnet , 'datacenter' , 'name' ,) or formatting .blank (),
66- subnet ['networkVlanId' ],
78+ network ,
79+ subnet_type ,
80+ vlan ,
81+ utils .lookup (subnet , 'datacenter' , 'name' ) or formatting .blank (),
82+ utils .lookup (subnet , 'endPointIpAddress' , 'ipAddress' ) or formatting .blank (),
6783 subnet ['ipAddressCount' ],
6884 len (subnet ['hardware' ]),
6985 len (subnet ['virtualGuests' ]),
86+ formatting .tags (subnet .get ('tagReferences' )),
87+ utils .lookup (subnet , 'note' ) or formatting .blank (),
7088 ])
7189
7290 env .fout (table )
0 commit comments