Validation: Cannot create network with segmentation id alone
Change-Id: I7d98921fe6f2819a6427bc826d640a6685a00da7 Signed-off-by: Dan lawton <dlawton@redhat.com> Closes-bug: #1693106
This commit is contained in:

committed by
Stephen Finucane

parent
3dfeb5ed08
commit
b808b82dfb
@@ -401,6 +401,16 @@ class CreateNetwork(
|
|||||||
)
|
)
|
||||||
raise exceptions.CommandError(msg)
|
raise exceptions.CommandError(msg)
|
||||||
|
|
||||||
|
if (
|
||||||
|
parsed_args.segmentation_id
|
||||||
|
and not parsed_args.provider_network_type
|
||||||
|
):
|
||||||
|
msg = _(
|
||||||
|
"--provider-segment requires --provider-network-type "
|
||||||
|
"to be specified."
|
||||||
|
)
|
||||||
|
raise exceptions.CommandError(msg)
|
||||||
|
|
||||||
attrs.update(
|
attrs.update(
|
||||||
self._parse_extra_properties(parsed_args.extra_properties)
|
self._parse_extra_properties(parsed_args.extra_properties)
|
||||||
)
|
)
|
||||||
|
@@ -330,6 +330,23 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|||||||
exceptions.CommandError, self.cmd.take_action, parsed_args
|
exceptions.CommandError, self.cmd.take_action, parsed_args
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_create_with_provider_segment_without_provider_type(self):
|
||||||
|
arglist = [
|
||||||
|
"--provider-segment",
|
||||||
|
"123",
|
||||||
|
self._network.name,
|
||||||
|
]
|
||||||
|
verifylist = [
|
||||||
|
('provider_network_type', None),
|
||||||
|
('segmentation_id', "123"),
|
||||||
|
('name', self._network.name),
|
||||||
|
]
|
||||||
|
|
||||||
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
self.assertRaises(
|
||||||
|
exceptions.CommandError, self.cmd.take_action, parsed_args
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestCreateNetworkIdentityV2(
|
class TestCreateNetworkIdentityV2(
|
||||||
identity_fakes_v2.FakeClientMixin,
|
identity_fakes_v2.FakeClientMixin,
|
||||||
|
Reference in New Issue
Block a user