Set or unset port pair group failed
Set or unset port pair for port pair group failed because the type of 'existing' is wrong Change-Id: I198e745fccff76184d9813805d1c1915aff5a273 Closes-Bug: #1762884
This commit is contained in:
parent
2cf52672b7
commit
2bff68649b
@ -188,9 +188,9 @@ class SetSfcPortPairGroup(command.Command):
|
||||
if parsed_args.no_port_pair:
|
||||
existing = []
|
||||
else:
|
||||
existing = [client.find_resource(
|
||||
existing = client.find_resource(
|
||||
resource, parsed_args.port_pair_group,
|
||||
cmd_resource='sfc_port_pair_group')['port_pairs']]
|
||||
cmd_resource='sfc_port_pair_group')['port_pairs']
|
||||
attrs['port_pairs'] = sorted(list(set(existing) | set(added)))
|
||||
body = {resource: attrs}
|
||||
try:
|
||||
@ -250,12 +250,12 @@ class UnsetSfcPortPairGroup(command.Command):
|
||||
ppg_id = _get_id(client, parsed_args.port_pair_group, resource)
|
||||
attrs = {}
|
||||
if parsed_args.port_pairs:
|
||||
existing = [client.find_resource(
|
||||
existing = client.find_resource(
|
||||
resource, parsed_args.port_pair_group,
|
||||
cmd_resource='sfc_port_pair_group')['port_pairs']]
|
||||
for pp in parsed_args.port_pairs:
|
||||
removed = [client.find_resource(
|
||||
'port_pair', pp, cmd_resource='sfc_port_pair')['id']]
|
||||
cmd_resource='sfc_port_pair_group')['port_pairs']
|
||||
removed = [client.find_resource('port_pair', pp,
|
||||
cmd_resource='sfc_port_pair')['id']
|
||||
for pp in parsed_args.port_pairs]
|
||||
attrs['port_pairs'] = list(set(existing) - set(removed))
|
||||
if parsed_args.all_port_pair:
|
||||
attrs['port_pairs'] = []
|
||||
|
@ -293,7 +293,7 @@ class TestSetSfcPortPairGroup(fakes.TestNeutronClientOSCV2):
|
||||
if self.neutronclient.find_resource.call_count == 3:
|
||||
self.neutronclient.find_resource.assert_called_with(
|
||||
self.res, target, cmd_resource='sfc_port_pair_group')
|
||||
return {'port_pairs': self.ppg_pp}
|
||||
return {'port_pairs': [self.ppg_pp]}
|
||||
|
||||
self.neutronclient.find_resource.side_effect = _mock_port_pair_group
|
||||
|
||||
@ -423,7 +423,7 @@ class TestUnsetSfcPortPairGroup(fakes.TestNeutronClientOSCV2):
|
||||
if self.neutronclient.find_resource.call_count == 1:
|
||||
self.neutronclient.find_resource.assert_called_with(
|
||||
self.res, target, cmd_resource='sfc_port_pair_group')
|
||||
return {'port_pairs': self.ppg_pp}
|
||||
return {'port_pairs': [self.ppg_pp]}
|
||||
|
||||
if self.neutronclient.find_resource.call_count == 2:
|
||||
self.neutronclient.find_resource.assert_called_with(
|
||||
|
Loading…
Reference in New Issue
Block a user