本文整理汇总了Python中SoftLayer.CLI.Table.align['IP']方法的典型用法代码示例。如果您正苦于以下问题:Python Table.align['IP']方法的具体用法?Python Table.align['IP']怎么用?Python Table.align['IP']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoftLayer.CLI.Table
的用法示例。
在下文中一共展示了Table.align['IP']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from SoftLayer.CLI import Table [as 别名]
# 或者: from SoftLayer.CLI.Table import align['IP'] [as 别名]
def execute(self, args):
mgr = NetworkManager(self.client)
subnet_id = resolve_id(mgr.resolve_subnet_ids,
args.get('<identifier>'),
name='subnet')
subnet = mgr.get_subnet(subnet_id)
table = KeyValueTable(['Name', 'Value'])
table.align['Name'] = 'r'
table.align['Value'] = 'l'
table.add_row(['id', subnet['id']])
table.add_row(['identifier',
'%s/%s' % (subnet['networkIdentifier'],
str(subnet['cidr']))])
table.add_row(['subnet type', subnet['subnetType']])
table.add_row(['gateway', subnet.get('gateway', blank())])
table.add_row(['broadcast', subnet.get('broadcastAddress', blank())])
table.add_row(['datacenter', subnet['datacenter']['name']])
table.add_row(['usable ips',
subnet.get('usableIpAddressCount', blank())])
if not args.get('--no-cci'):
if subnet['virtualGuests']:
cci_table = Table(['Hostname', 'Domain', 'IP'])
cci_table.align['Hostname'] = 'r'
cci_table.align['IP'] = 'l'
for cci in subnet['virtualGuests']:
cci_table.add_row([cci['hostname'],
cci['domain'],
cci.get('primaryIpAddress')])
table.add_row(['ccis', cci_table])
else:
table.add_row(['cci', 'none'])
if not args.get('--no-hardware'):
if subnet['hardware']:
hw_table = Table(['Hostname', 'Domain', 'IP'])
hw_table.align['Hostname'] = 'r'
hw_table.align['IP'] = 'l'
for hardware in subnet['hardware']:
hw_table.add_row([hardware['hostname'],
hardware['domain'],
hardware.get('primaryIpAddress')])
table.add_row(['hardware', hw_table])
else:
table.add_row(['hardware', 'none'])
return table
示例2: execute
# 需要导入模块: from SoftLayer.CLI import Table [as 别名]
# 或者: from SoftLayer.CLI.Table import align['IP'] [as 别名]
def execute(self, args):
mgr = NetworkManager(self.client)
vlan = mgr.get_vlan(args.get('<identifier>'))
t = KeyValueTable(['Name', 'Value'])
t.align['Name'] = 'r'
t.align['Value'] = 'l'
t.add_row(['id', vlan['id']])
t.add_row(['number', vlan['vlanNumber']])
t.add_row(['datacenter',
vlan['primaryRouter']['datacenter']['longName']])
t.add_row(['primary router',
vlan['primaryRouter']['fullyQualifiedDomainName']])
t.add_row(['firewall', 'Yes' if vlan['firewallInterfaces'] else 'No'])
subnets = []
for subnet in vlan['subnets']:
subnet_table = KeyValueTable(['Name', 'Value'])
subnet_table.align['Name'] = 'r'
subnet_table.align['Value'] = 'l'
subnet_table.add_row(['id', subnet['id']])
subnet_table.add_row(['identifier', subnet['networkIdentifier']])
subnet_table.add_row(['netmask', subnet['netmask']])
subnet_table.add_row(['gateway', subnet.get('gateway', '-')])
subnet_table.add_row(['type', subnet['subnetType']])
subnet_table.add_row(['usable ips',
subnet['usableIpAddressCount']])
subnets.append(subnet_table)
t.add_row(['subnets', subnets])
if not args.get('--no-cci'):
if vlan['virtualGuests']:
cci_table = KeyValueTable(['Hostname', 'Domain', 'IP'])
cci_table.align['Hostname'] = 'r'
cci_table.align['IP'] = 'l'
for cci in vlan['virtualGuests']:
cci_table.add_row([cci['hostname'],
cci['domain'],
cci.get('primaryIpAddress')])
t.add_row(['ccis', cci_table])
else:
t.add_row(['cci', 'none'])
if not args.get('--no-hardware'):
if vlan['hardware']:
hw_table = Table(['Hostname', 'Domain', 'IP'])
hw_table.align['Hostname'] = 'r'
hw_table.align['IP'] = 'l'
for hw in vlan['hardware']:
hw_table.add_row([hw['hostname'],
hw['domain'],
hw.get('primaryIpAddress')])
t.add_row(['hardware', hw_table])
else:
t.add_row(['hardware', 'none'])
return t