Support passing name for action-value in PolicyAction

Also fixes the following:
1) Adds validations for invalid name/uuid
2) Fixes an error with handling Network service policy in update PTG
3) Remove py26 from tox.ini

Change-Id: I9f07bfed7277428eee2187eebb699d4a6768c4b3
Closes-bug:1406704
This commit is contained in:
Magesh GV 2015-01-05 10:47:35 +05:30
parent 2677699d95
commit 7c2b4b0dbf
2 changed files with 10 additions and 4 deletions
gbpclient/gbp/v2_0
tox.ini

@ -250,7 +250,7 @@ class UpdatePolicyTargetGroup(neutronV20.UpdateCommand):
body[self.resource]['network_service_policy_id'] = \
neutronV20.find_resourceid_by_name_or_id(
self.get_client(), 'network_service_policy',
parsed_args.l2_policy)
parsed_args.network_service_policy)
if parsed_args.provided_policy_rule_sets:
for key in parsed_args.provided_policy_rule_sets.keys():
@ -684,7 +684,7 @@ class CreatePolicyAction(neutronV20.CreateCommand):
help=_('Type of action'))
parser.add_argument(
'--action-value',
help=_('uuid of service for redirect action'))
help=_('Name/UUID of servicechain spec for redirect action'))
parser.add_argument(
'name', metavar='NAME',
help=_('Name of action to create'))
@ -692,9 +692,15 @@ class CreatePolicyAction(neutronV20.CreateCommand):
def args2body(self, parsed_args):
body = {self.resource: {}, }
if parsed_args.action_value:
body[self.resource]['action_value'] = (
neutronV20.find_resourceid_by_name_or_id(
self.get_client(), 'servicechain_spec',
parsed_args.action_value))
neutronV20.update_dict(parsed_args, body[self.resource],
['name', 'tenant_id', 'description',
'action_type', 'action_value'])
'action_type'])
return body

@ -1,5 +1,5 @@
[tox]
envlist = py26,py27,py33,pypy,pep8
envlist = py27,py33,pypy,pep8
minversion = 1.6
skipsdist = True