Allow using force option to create and release IPBlockSubnets

Change-Id: I95cd3b5ada9fc4a612bec83ca759258ed1029f81
This commit is contained in:
Gautam Verma 2022-12-22 22:03:04 +05:30 committed by Salvatore Orlando
parent 4f35234766
commit 349c4c3999
1 changed files with 12 additions and 8 deletions

View File

@ -3422,7 +3422,8 @@ class NsxPolicyIpPoolApi(NsxPolicyResourceBase):
ip_subnet_id=None, auto_assign_gateway=IGNORE,
name=IGNORE, description=IGNORE, tags=IGNORE,
tenant=constants.POLICY_INFRA_TENANT,
start_ip=IGNORE, v6_allocation_range=IGNORE):
start_ip=IGNORE, v6_allocation_range=IGNORE,
force=False):
ip_subnet_id = self._init_obj_uuid(ip_subnet_id)
args = self._get_user_args(
ip_pool_id=ip_pool_id,
@ -3440,15 +3441,16 @@ class NsxPolicyIpPoolApi(NsxPolicyResourceBase):
ip_subnet_def = core_defs.IpPoolBlockSubnetDef(
nsx_version=self.version, **args)
self._create_or_store(ip_subnet_def)
self._create_or_store(ip_subnet_def, force=force)
def release_block_subnet(self, ip_pool_id, ip_subnet_id,
tenant=constants.POLICY_INFRA_TENANT):
tenant=constants.POLICY_INFRA_TENANT,
force=False):
ip_subnet_def = core_defs.IpPoolBlockSubnetDef(
ip_subnet_id=ip_subnet_id,
ip_pool_id=ip_pool_id,
tenant=tenant)
self._delete_with_retry(ip_subnet_def)
self._delete_with_retry(ip_subnet_def, force=force)
def list_block_subnets(self, ip_pool_id,
tenant=constants.POLICY_INFRA_TENANT):
@ -3489,7 +3491,8 @@ class NsxPolicyIpPoolApi(NsxPolicyResourceBase):
allocation_ranges, ip_subnet_id=None,
name=IGNORE, description=IGNORE,
gateway_ip=IGNORE, tags=IGNORE,
tenant=constants.POLICY_INFRA_TENANT):
tenant=constants.POLICY_INFRA_TENANT,
force=False):
ip_subnet_id = self._init_obj_uuid(ip_subnet_id)
args = self._get_user_args(
ip_pool_id=ip_pool_id,
@ -3502,15 +3505,16 @@ class NsxPolicyIpPoolApi(NsxPolicyResourceBase):
tenant=tenant)
ip_subnet_def = core_defs.IpPoolStaticSubnetDef(**args)
self._create_or_store(ip_subnet_def)
self._create_or_store(ip_subnet_def, force=force)
def release_static_subnet(self, ip_pool_id, ip_subnet_id,
tenant=constants.POLICY_INFRA_TENANT):
tenant=constants.POLICY_INFRA_TENANT,
force=False):
ip_subnet_def = core_defs.IpPoolStaticSubnetDef(
ip_subnet_id=ip_subnet_id,
ip_pool_id=ip_pool_id,
tenant=tenant)
self._delete_with_retry(ip_subnet_def)
self._delete_with_retry(ip_subnet_def, force=force)
def list_static_subnets(self, ip_pool_id,
tenant=constants.POLICY_INFRA_TENANT):