@@ -38,20 +38,20 @@ def cli(env, identifier, no_vs, no_hardware):
3838 table .add_row (['primary_router' ,
3939 utils .lookup (vlan , 'primaryRouter' , 'fullyQualifiedDomainName' )])
4040 table .add_row (['Gateway/Firewall' , get_gateway_firewall (vlan )])
41- subnets = []
42- for subnet in vlan .get ('subnets' , [] ):
43- subnet_table = formatting .KeyValueTable (['name ' , 'value ' ])
44- subnet_table . align [ 'name' ] = 'r'
45- subnet_table .align [ 'value' ] = 'l'
46- subnet_table . add_row ([ 'id' , subnet .get ('id' )])
47- subnet_table . add_row ([ 'identifier' , subnet .get ('networkIdentifier' )])
48- subnet_table . add_row ([ 'netmask' , subnet .get ('netmask' )])
49- subnet_table . add_row ([ 'gateway' , subnet .get ('gateway' , formatting . blank ())])
50- subnet_table . add_row ([ 'type' , subnet .get ('subnetType ' )])
51- subnet_table . add_row ([ 'usable ips' , subnet . get ( 'usableIpAddressCount' )] )
52- subnets . append ( subnet_table )
53-
54- table .add_row (['subnets' , subnets ])
41+
42+ if vlan .get ('subnets' ):
43+ subnet_table = formatting .Table (['id ' , 'identifier' , 'netmask' , 'gateway' , 'type' , 'usable ips ' ])
44+ for subnet in vlan . get ( 'subnets' ):
45+ subnet_table .add_row ([ subnet . get ( 'id' ),
46+ subnet .get ('networkIdentifier' ),
47+ subnet .get ('netmask' ),
48+ subnet .get ('gateway' ) or formatting . blank (),
49+ subnet .get ('subnetType' ),
50+ subnet .get ('usableIpAddressCount ' )])
51+ # subnets.append(subnet_table )
52+ table . add_row ([ 'subnets' , subnet_table ] )
53+ else :
54+ table .add_row (['subnets' , 'none' ])
5555
5656 server_columns = ['hostname' , 'domain' , 'public_ip' , 'private_ip' ]
5757
0 commit comments