[aim-mapping] intra-ptg-allow ext attr for PTG

CLI support for this extended attribute added to the backend.

Change-Id: Ic76b5f7d8bebeee02ba381cc4533beddbe87e269
Partial-bug: #1648019
This commit is contained in:
Sumit Naiksatam 2016-12-07 16:03:39 -08:00
parent 52a6399a3d
commit 9d924f669a
2 changed files with 26 additions and 6 deletions

View File

@ -225,6 +225,12 @@ class CreatePolicyTargetGroup(neutronV20.CreateCommand):
n_utils.add_boolean_argument(
parser, '--shared', dest='shared',
help=_('Enable or disable resource sharing, default is False'))
n_utils.add_boolean_argument(
parser, '--intra-ptg-allow', dest='intra_ptg_allow',
help=_("Allow or disallow communication between Policy Targets of "
"this Policy Target Group. Default is True, i.e., all "
"Policy Targets can communicate with each other. This "
"option is only available with the APIC backend."))
def args2body(self, parsed_args):
body = {self.resource: {}, }
@ -260,7 +266,8 @@ class CreatePolicyTargetGroup(neutronV20.CreateCommand):
neutronV20.update_dict(parsed_args, body[self.resource],
['name', 'tenant_id', 'description',
'provided_policy_rule_sets', 'subnets',
'consumed_policy_rule_sets', 'shared'])
'consumed_policy_rule_sets', 'shared',
'intra_ptg_allow'])
return body
@ -303,6 +310,12 @@ class UpdatePolicyTargetGroup(neutronV20.UpdateCommand):
n_utils.add_boolean_argument(
parser, '--shared', dest='shared',
help=_('Enable or disable resource sharing, default is False'))
n_utils.add_boolean_argument(
parser, '--intra-ptg-allow', dest='intra_ptg_allow',
help=_("Allow or disallow communication between Policy Targets of "
"this Policy Target Group. Default is True, i.e., all "
"Policy Targets can communicate with each other. This "
"option is only available with the APIC backend."))
def args2body(self, parsed_args):
body = {self.resource: {}, }
@ -340,7 +353,8 @@ class UpdatePolicyTargetGroup(neutronV20.UpdateCommand):
neutronV20.update_dict(parsed_args, body[self.resource],
['name', 'tenant_id', 'description',
'provided_policy_rule_sets', 'subnets',
'consumed_policy_rule_sets', 'shared'])
'consumed_policy_rule_sets', 'shared',
'intra_ptg_allow'])
return body

View File

@ -53,6 +53,7 @@ class CLITestV20PolicyTargetGroupJSON(test_cli20.CLITestV20Base):
consumed_prs = "ssh-prs=true,ftp-prs=false"
network_service_policy_id = 'network_service_policy_id'
shared = 'true'
intra_ptg_allow = 'false'
args = [name,
'--tenant-id', tenant_id,
'--description', description,
@ -60,7 +61,8 @@ class CLITestV20PolicyTargetGroupJSON(test_cli20.CLITestV20Base):
'--provided-policy-rule-sets', provided_prs,
'--consumed-policy-rule-sets', consumed_prs,
'--network-service-policy-id', network_service_policy_id,
'--shared', shared]
'--shared', shared,
'--intra-ptg-allow', intra_ptg_allow]
position_names = ['name', 'description', 'l2_policy_id',
'provided_policy_rule_sets',
'consumed_policy_rule_sets',
@ -77,7 +79,8 @@ class CLITestV20PolicyTargetGroupJSON(test_cli20.CLITestV20Base):
network_service_policy_id]
self._test_create_resource(resource, cmd, name, my_id, args,
position_names, position_values,
tenant_id=tenant_id, shared=shared)
tenant_id=tenant_id, shared=shared,
intra_ptg_allow=intra_ptg_allow)
def test_list_policy_target_groups(self):
"""policy-target-group-list."""
@ -113,6 +116,7 @@ class CLITestV20PolicyTargetGroupJSON(test_cli20.CLITestV20Base):
consumed_prs = "ssh-prs=true,ftp-prs=false"
network_service_policy_id = 'network_service_policy_id'
shared = 'true'
intra_ptg_allow = 'false'
args = [my_id,
'--name', name,
'--description', description,
@ -120,7 +124,8 @@ class CLITestV20PolicyTargetGroupJSON(test_cli20.CLITestV20Base):
'--provided-policy-rule-sets', provided_prs,
'--consumed-policy-rule-sets', consumed_prs,
'--network-service-policy-id', network_service_policy_id,
'--shared', shared]
'--shared', shared,
'--intra-ptg-allow', intra_ptg_allow]
provided_policy_rule_sets = {
'icmp-prs': 'false',
'web-prs': 'true'}
@ -134,7 +139,8 @@ class CLITestV20PolicyTargetGroupJSON(test_cli20.CLITestV20Base):
'provided_policy_rule_sets': provided_policy_rule_sets,
'consumed_policy_rule_sets': consumed_policy_rule_sets,
'network_service_policy_id': network_service_policy_id,
'shared': shared
'shared': shared,
'intra_ptg_allow': intra_ptg_allow
}
self._test_update_resource(resource, cmd, my_id, args, params)