From ede950ffb5f1ecbb65d74ef7c1c9e7d1d0326b6f Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Sun, 28 Apr 2019 09:47:39 +0300 Subject: [PATCH] NSX|P: Fix fwaas rules update Adding categotry to the call as it is mandatory. Change-Id: I9b59a29566728052d3e5ba274ca6063edbcc8024 --- .../services/fwaas/nsx_p/fwaas_callbacks_v2.py | 3 ++- vmware_nsx/tests/unit/nsx_p/test_fwaas_v2_driver.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/vmware_nsx/services/fwaas/nsx_p/fwaas_callbacks_v2.py b/vmware_nsx/services/fwaas/nsx_p/fwaas_callbacks_v2.py index 26edd0d8ec..85361609df 100644 --- a/vmware_nsx/services/fwaas/nsx_p/fwaas_callbacks_v2.py +++ b/vmware_nsx/services/fwaas/nsx_p/fwaas_callbacks_v2.py @@ -375,7 +375,8 @@ class NsxpFwaasCallbacksV2(com_callbacks.NsxCommonv3FwaasCallbacksV2): else: # only update the rules of this policy self.nsxpolicy.gateway_policy.update_entries( - policy_constants.DEFAULT_DOMAIN, router_id, fw_rules) + policy_constants.DEFAULT_DOMAIN, router_id, fw_rules, + category=policy_constants.CATEGORY_LOCAL_GW) return tags = self.nsxpolicy.build_v3_tags_payload( diff --git a/vmware_nsx/tests/unit/nsx_p/test_fwaas_v2_driver.py b/vmware_nsx/tests/unit/nsx_p/test_fwaas_v2_driver.py index 36380d00d1..bfe874ea92 100644 --- a/vmware_nsx/tests/unit/nsx_p/test_fwaas_v2_driver.py +++ b/vmware_nsx/tests/unit/nsx_p/test_fwaas_v2_driver.py @@ -250,7 +250,8 @@ class NsxpFwaasTestCase(test_p_plugin.NsxPPluginTestCaseMixin): expected_rules = (self._block_interface_rules(0) + [self._default_rule(2)]) update_fw.assert_called_once_with( - policy_constants.DEFAULT_DOMAIN, FAKE_ROUTER_ID, mock.ANY) + policy_constants.DEFAULT_DOMAIN, FAKE_ROUTER_ID, mock.ANY, + category=policy_constants.CATEGORY_LOCAL_GW) # compare rules one by one actual_rules = update_fw.call_args[0][2] self.assertEqual(len(expected_rules), len(actual_rules)) @@ -279,7 +280,8 @@ class NsxpFwaasTestCase(test_p_plugin.NsxPPluginTestCaseMixin): expected_default_rules = self._block_interface_rules( len(rule_list)) + [self._default_rule(len(rule_list) + 2)] update_fw.assert_called_once_with( - policy_constants.DEFAULT_DOMAIN, FAKE_ROUTER_ID, mock.ANY) + policy_constants.DEFAULT_DOMAIN, FAKE_ROUTER_ID, mock.ANY, + category=policy_constants.CATEGORY_LOCAL_GW) # compare rules one by one actual_rules = update_fw.call_args[0][2] @@ -341,7 +343,8 @@ class NsxpFwaasTestCase(test_p_plugin.NsxPPluginTestCaseMixin): # expecting only the default allow-all rule expected_rules = [self._default_rule(0)] update_fw.assert_called_once_with( - policy_constants.DEFAULT_DOMAIN, FAKE_ROUTER_ID, mock.ANY) + policy_constants.DEFAULT_DOMAIN, FAKE_ROUTER_ID, mock.ANY, + category=policy_constants.CATEGORY_LOCAL_GW) # compare rules one by one actual_rules = update_fw.call_args[0][2] self.assertEqual(len(expected_rules), len(actual_rules)) @@ -363,7 +366,8 @@ class NsxpFwaasTestCase(test_p_plugin.NsxPPluginTestCaseMixin): # expecting only the default allow-all rule expected_rules = [self._default_rule(0)] update_fw.assert_called_once_with( - policy_constants.DEFAULT_DOMAIN, FAKE_ROUTER_ID, mock.ANY) + policy_constants.DEFAULT_DOMAIN, FAKE_ROUTER_ID, mock.ANY, + category=policy_constants.CATEGORY_LOCAL_GW) # compare rules one by one actual_rules = update_fw.call_args[0][2] self.assertEqual(len(expected_rules), len(actual_rules))