diff --git a/plugin_test/vapor/vapor/tests/common/test_base.py b/plugin_test/vapor/vapor/tests/common/test_base.py index 60257531d..e725f6383 100644 --- a/plugin_test/vapor/vapor/tests/common/test_base.py +++ b/plugin_test/vapor/vapor/tests/common/test_base.py @@ -15,6 +15,7 @@ import sys from hamcrest import (assert_that, calling, raises, contains_string, has_item, has_entry, is_not, empty, equal_to, all_of) # noqa H301 from neutronclient.common import exceptions as neutron_exceptions +from novaclient import exceptions as nova_exceptions from stepler import config as stepler_config from stepler.third_party import utils from pycontrail import exceptions @@ -361,3 +362,20 @@ def test_various_type_of_subnets_associated_with_vn( result = server_ssh.check_call('ip a') assert_that(result.stdout, all_of(*[contains_string(name) for name in iface_names])) + + +def test_create_server_on_network_without_subnet( + cirros_image, + flavor, + contrail_network, + server_steps, ): + """Creating server on network without subnet should raise an exception.""" + assert_that( + calling(server_steps.create_servers).with_args( + image=cirros_image, + flavor=flavor, + networks=[{ + 'id': contrail_network.uuid + }], + check=False), + raises(nova_exceptions.BadRequest, 'requires a subnet'))