Fix: set invalid None project_id on range creation
"project_id" attribute should not be set to None on shared network segment range creation since it is not a valid string type which is required for the API. Change-Id: Ia2bab12e39b4bb7e05ff2acfffb851252c100651 Story: 2005205 Task: 29975
This commit is contained in:
parent
c36e75d986
commit
28c06d0688
@ -207,8 +207,6 @@ class CreateNetworkSegmentRange(command.ShowOne):
|
|||||||
# is not specified.
|
# is not specified.
|
||||||
# Get the project id from the current auth.
|
# Get the project id from the current auth.
|
||||||
attrs['project_id'] = self.app.client_manager.auth_ref.project_id
|
attrs['project_id'] = self.app.client_manager.auth_ref.project_id
|
||||||
else:
|
|
||||||
attrs['project_id'] = None
|
|
||||||
|
|
||||||
if parsed_args.physical_network:
|
if parsed_args.physical_network:
|
||||||
attrs['physical_network'] = parsed_args.physical_network
|
attrs['physical_network'] = parsed_args.physical_network
|
||||||
|
@ -144,19 +144,19 @@ class TestCreateNetworkSegmentRange(TestNetworkSegmentRange):
|
|||||||
self.cmd.take_action,
|
self.cmd.take_action,
|
||||||
parsed_args)
|
parsed_args)
|
||||||
|
|
||||||
def test_create_minimum_options(self):
|
def test_create_private_minimum_options(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
'--private',
|
'--private',
|
||||||
'--project', self._network_segment_range.project_id,
|
'--project', self._network_segment_range.project_id,
|
||||||
'--network-type', self._network_segment_range.network_type,
|
'--network-type', 'vxlan',
|
||||||
'--minimum', str(self._network_segment_range.minimum),
|
'--minimum', str(self._network_segment_range.minimum),
|
||||||
'--maximum', str(self._network_segment_range.maximum),
|
'--maximum', str(self._network_segment_range.maximum),
|
||||||
self._network_segment_range.name,
|
self._network_segment_range.name,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('shared', self._network_segment_range.shared),
|
('shared', False),
|
||||||
('project', self._network_segment_range.project_id),
|
('project', self._network_segment_range.project_id),
|
||||||
('network_type', self._network_segment_range.network_type),
|
('network_type', 'vxlan'),
|
||||||
('minimum', self._network_segment_range.minimum),
|
('minimum', self._network_segment_range.minimum),
|
||||||
('maximum', self._network_segment_range.maximum),
|
('maximum', self._network_segment_range.maximum),
|
||||||
('name', self._network_segment_range.name),
|
('name', self._network_segment_range.name),
|
||||||
@ -166,9 +166,39 @@ class TestCreateNetworkSegmentRange(TestNetworkSegmentRange):
|
|||||||
columns, data = self.cmd.take_action(parsed_args)
|
columns, data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
self.network.create_network_segment_range.assert_called_once_with(**{
|
self.network.create_network_segment_range.assert_called_once_with(**{
|
||||||
'shared': self._network_segment_range.shared,
|
'shared': False,
|
||||||
'project_id': mock.ANY,
|
'project_id': mock.ANY,
|
||||||
'network_type': self._network_segment_range.network_type,
|
'network_type': 'vxlan',
|
||||||
|
'minimum': self._network_segment_range.minimum,
|
||||||
|
'maximum': self._network_segment_range.maximum,
|
||||||
|
'name': self._network_segment_range.name,
|
||||||
|
})
|
||||||
|
|
||||||
|
self.assertEqual(self.columns, columns)
|
||||||
|
self.assertEqual(self.data, data)
|
||||||
|
|
||||||
|
def test_create_shared_minimum_options(self):
|
||||||
|
arglist = [
|
||||||
|
'--shared',
|
||||||
|
'--network-type', 'vxlan',
|
||||||
|
'--minimum', str(self._network_segment_range.minimum),
|
||||||
|
'--maximum', str(self._network_segment_range.maximum),
|
||||||
|
self._network_segment_range.name,
|
||||||
|
]
|
||||||
|
verifylist = [
|
||||||
|
('shared', True),
|
||||||
|
('network_type', 'vxlan'),
|
||||||
|
('minimum', self._network_segment_range.minimum),
|
||||||
|
('maximum', self._network_segment_range.maximum),
|
||||||
|
('name', self._network_segment_range.name),
|
||||||
|
]
|
||||||
|
|
||||||
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
columns, data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
|
self.network.create_network_segment_range.assert_called_once_with(**{
|
||||||
|
'shared': True,
|
||||||
|
'network_type': 'vxlan',
|
||||||
'minimum': self._network_segment_range.minimum,
|
'minimum': self._network_segment_range.minimum,
|
||||||
'maximum': self._network_segment_range.maximum,
|
'maximum': self._network_segment_range.maximum,
|
||||||
'name': self._network_segment_range.name,
|
'name': self._network_segment_range.name,
|
||||||
|
Loading…
Reference in New Issue
Block a user