diff --git a/gbpclient/gbp/v2_0/groupbasedpolicy.py b/gbpclient/gbp/v2_0/groupbasedpolicy.py index 85db642..5eec7f6 100644 --- a/gbpclient/gbp/v2_0/groupbasedpolicy.py +++ b/gbpclient/gbp/v2_0/groupbasedpolicy.py @@ -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 diff --git a/gbpclient/tests/unit/test_cli20_policytargetgroup.py b/gbpclient/tests/unit/test_cli20_policytargetgroup.py index 3125417..c2c45d1 100644 --- a/gbpclient/tests/unit/test_cli20_policytargetgroup.py +++ b/gbpclient/tests/unit/test_cli20_policytargetgroup.py @@ -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)