Get list of IP block and IP block subnet

Change-Id: I90a1f5c7d255e29e896c375c0319cf87c273b22d
This commit is contained in:
Danting Liu 2017-02-07 02:05:55 -08:00 committed by dantingl
parent c85f1505dd
commit 26b6466f03
1 changed files with 11 additions and 0 deletions

View File

@ -73,6 +73,8 @@ class NsxLib(object):
self.client, nsxlib_config)
self.ip_block_subnet = NsxLibIpBlockSubnet(
self.client, nsxlib_config)
self.ip_block = NsxLibIpBlock(
self.client, nsxlib_config)
super(NsxLib, self).__init__()
@ -501,3 +503,12 @@ class NsxLibIpBlockSubnet(utils.NsxLibApiBase):
"""Delete a IP block subnet on the backend."""
resource = 'pools/ip-blocks/%s/subnets/%s' % (ip_block_id, subnet_id)
self.client.delete(resource)
def list(self, ip_block_id):
resource = 'pools/ip-blocks/%s/subnets' % ip_block_id
return self.client.get(resource)
class NsxLibIpBlock(utils.NsxLibApiBase):
def list(self):
return self.client.get('pools/ip-blocks')