diff --git a/vmware_nsx/tests/unit/nsx_v3/test_plugin.py b/vmware_nsx/tests/unit/nsx_v3/test_plugin.py index 96f6fc8626..5a7b473ae2 100644 --- a/vmware_nsx/tests/unit/nsx_v3/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_v3/test_plugin.py @@ -96,6 +96,18 @@ def _return_id_key_list(*args, **kwargs): return [{'id': uuidutils.generate_uuid()}] +def _mock_add_rules_in_section(*args): + # NOTE(arosen): the code in the neutron plugin expects the + # neutron rule id as the display_name. + rules = args[0] + return { + 'rules': [ + {'display_name': rule['display_name'], + 'id': uuidutils.generate_uuid()} + for rule in rules + ]} + + def _mock_nsx_backend_calls(): mock.patch("vmware_nsxlib.v3.client.NSX3Client").start() @@ -189,6 +201,9 @@ def _mock_nsx_backend_calls(): "get_transport_zones", return_value=[NSX_TZ_NAME, mock.ANY]).start() + mock.patch("vmware_nsxlib.v3.security.NsxLibFirewallSection.add_rules", + side_effect=_mock_add_rules_in_section).start() + class NsxV3PluginTestCaseMixin(test_plugin.NeutronDbPluginV2TestCase, nsxlib_testcase.NsxClientTestCase):