Merge "NSX|V3 replace deprecated nsxlib apis"

This commit is contained in:
Zuul 2018-07-24 05:50:33 +00:00 committed by Gerrit Code Review
commit 7c716ed020
3 changed files with 11 additions and 11 deletions

View File

@ -2899,8 +2899,8 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
original)
nsx_updated = nsx_db.get_nsx_security_group_ids(context.session,
updated)
self.nsxlib.ns_group.update_lport(
context, lport_id, nsx_origial, nsx_updated)
self.nsxlib.ns_group.update_lport_nsgroups(
lport_id, nsx_origial, nsx_updated)
def base_create_port(self, context, port):
neutron_db = super(NsxV3Plugin, self).create_port(context, port)
@ -4762,8 +4762,8 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
sg_rule['local_ip_prefix'].startswith('0.0.0.0/')):
sg_rule['local_ip_prefix'] = None
return self.nsxlib.firewall_section.create_rules(
context, section_id, nsgroup_id,
return self.nsxlib.firewall_section.create_section_rules(
section_id, nsgroup_id,
logging_enabled, action, _sg_rules,
ruleid_2_remote_nsgroup_map)
@ -4882,8 +4882,8 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
try:
nsgroup_id, section_id = nsx_db.get_sg_mappings(
context.session, id)
self.nsxlib.ns_group.update_on_backend(
context, secgroup_res, nsgroup_id, section_id,
self.nsxlib.ns_group.update_nsgroup_and_section(
secgroup_res, nsgroup_id, section_id,
cfg.CONF.nsx_v3.log_security_groups_allowed_traffic)
except nsx_lib_exc.ManagerError:
with excutils.save_and_reraise_exception():

View File

@ -130,7 +130,8 @@ class TestNSXv3ExtendedSGRule(test_nsxv3_plugin.NsxV3PluginTestCaseMixin,
'description': ''}]
with mock.patch(
"vmware_nsxlib.v3.security.NsxLibFirewallSection.create_rules",
"vmware_nsxlib.v3.security.NsxLibFirewallSection."
"create_section_rules",
side_effect=test_nsxv3_plugin._mock_create_firewall_rules,
) as mock_rule:
@ -138,7 +139,6 @@ class TestNSXv3ExtendedSGRule(test_nsxv3_plugin.NsxV3PluginTestCaseMixin,
self).test_create_rule_with_local_ip_prefix()
mock_rule.assert_called_with(
mock.ANY, # content
mock.ANY, # firewall_section_id
mock.ANY, # ns_group_id
False, # logging
@ -173,12 +173,12 @@ class TestNSXv3ExtendedSGRule(test_nsxv3_plugin.NsxV3PluginTestCaseMixin,
'description': ''}]
with mock.patch(
"vmware_nsxlib.v3.security.NsxLibFirewallSection.create_rules",
"vmware_nsxlib.v3.security.NsxLibFirewallSection."
"create_section_rules",
side_effect=test_nsxv3_plugin._mock_create_firewall_rules,
) as mock_rule:
self.test_create_rule_with_remote_ip_prefix()
mock_rule.assert_called_with(
mock.ANY, # content
mock.ANY, # firewall_section_id
mock.ANY, # ns_group_id
False, # logging

View File

@ -74,7 +74,7 @@ NSX_DHCP_RELAY_SRV = 'dhcp relay srv'
def _mock_create_firewall_rules(*args):
# NOTE(arosen): the code in the neutron plugin expects the
# neutron rule id as the display_name.
rules = args[5]
rules = args[4]
return {
'rules': [
{'display_name': rule['id'], 'id': uuidutils.generate_uuid()}