NSX|V3 replace deprecated nsxlib apis
Depends-on: I887036bad703478247f8c0a47708b0e753ea1dde Change-Id: If651ca52acb8acf8a0eb07f1c7d453a28c387062
This commit is contained in:
parent
cc2a0064f3
commit
5facde5ed9
@ -2888,8 +2888,8 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||||||
original)
|
original)
|
||||||
nsx_updated = nsx_db.get_nsx_security_group_ids(context.session,
|
nsx_updated = nsx_db.get_nsx_security_group_ids(context.session,
|
||||||
updated)
|
updated)
|
||||||
self.nsxlib.ns_group.update_lport(
|
self.nsxlib.ns_group.update_lport_nsgroups(
|
||||||
context, lport_id, nsx_origial, nsx_updated)
|
lport_id, nsx_origial, nsx_updated)
|
||||||
|
|
||||||
def base_create_port(self, context, port):
|
def base_create_port(self, context, port):
|
||||||
neutron_db = super(NsxV3Plugin, self).create_port(context, port)
|
neutron_db = super(NsxV3Plugin, self).create_port(context, port)
|
||||||
@ -4751,8 +4751,8 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||||||
sg_rule['local_ip_prefix'].startswith('0.0.0.0/')):
|
sg_rule['local_ip_prefix'].startswith('0.0.0.0/')):
|
||||||
sg_rule['local_ip_prefix'] = None
|
sg_rule['local_ip_prefix'] = None
|
||||||
|
|
||||||
return self.nsxlib.firewall_section.create_rules(
|
return self.nsxlib.firewall_section.create_section_rules(
|
||||||
context, section_id, nsgroup_id,
|
section_id, nsgroup_id,
|
||||||
logging_enabled, action, _sg_rules,
|
logging_enabled, action, _sg_rules,
|
||||||
ruleid_2_remote_nsgroup_map)
|
ruleid_2_remote_nsgroup_map)
|
||||||
|
|
||||||
@ -4871,8 +4871,8 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||||||
try:
|
try:
|
||||||
nsgroup_id, section_id = nsx_db.get_sg_mappings(
|
nsgroup_id, section_id = nsx_db.get_sg_mappings(
|
||||||
context.session, id)
|
context.session, id)
|
||||||
self.nsxlib.ns_group.update_on_backend(
|
self.nsxlib.ns_group.update_nsgroup_and_section(
|
||||||
context, secgroup_res, nsgroup_id, section_id,
|
secgroup_res, nsgroup_id, section_id,
|
||||||
cfg.CONF.nsx_v3.log_security_groups_allowed_traffic)
|
cfg.CONF.nsx_v3.log_security_groups_allowed_traffic)
|
||||||
except nsx_lib_exc.ManagerError:
|
except nsx_lib_exc.ManagerError:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
|
@ -130,7 +130,8 @@ class TestNSXv3ExtendedSGRule(test_nsxv3_plugin.NsxV3PluginTestCaseMixin,
|
|||||||
'description': ''}]
|
'description': ''}]
|
||||||
|
|
||||||
with mock.patch(
|
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,
|
side_effect=test_nsxv3_plugin._mock_create_firewall_rules,
|
||||||
) as mock_rule:
|
) as mock_rule:
|
||||||
|
|
||||||
@ -138,7 +139,6 @@ class TestNSXv3ExtendedSGRule(test_nsxv3_plugin.NsxV3PluginTestCaseMixin,
|
|||||||
self).test_create_rule_with_local_ip_prefix()
|
self).test_create_rule_with_local_ip_prefix()
|
||||||
|
|
||||||
mock_rule.assert_called_with(
|
mock_rule.assert_called_with(
|
||||||
mock.ANY, # content
|
|
||||||
mock.ANY, # firewall_section_id
|
mock.ANY, # firewall_section_id
|
||||||
mock.ANY, # ns_group_id
|
mock.ANY, # ns_group_id
|
||||||
False, # logging
|
False, # logging
|
||||||
@ -173,12 +173,12 @@ class TestNSXv3ExtendedSGRule(test_nsxv3_plugin.NsxV3PluginTestCaseMixin,
|
|||||||
'description': ''}]
|
'description': ''}]
|
||||||
|
|
||||||
with mock.patch(
|
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,
|
side_effect=test_nsxv3_plugin._mock_create_firewall_rules,
|
||||||
) as mock_rule:
|
) as mock_rule:
|
||||||
self.test_create_rule_with_remote_ip_prefix()
|
self.test_create_rule_with_remote_ip_prefix()
|
||||||
mock_rule.assert_called_with(
|
mock_rule.assert_called_with(
|
||||||
mock.ANY, # content
|
|
||||||
mock.ANY, # firewall_section_id
|
mock.ANY, # firewall_section_id
|
||||||
mock.ANY, # ns_group_id
|
mock.ANY, # ns_group_id
|
||||||
False, # logging
|
False, # logging
|
||||||
|
@ -74,7 +74,7 @@ NSX_DHCP_RELAY_SRV = 'dhcp relay srv'
|
|||||||
def _mock_create_firewall_rules(*args):
|
def _mock_create_firewall_rules(*args):
|
||||||
# NOTE(arosen): the code in the neutron plugin expects the
|
# NOTE(arosen): the code in the neutron plugin expects the
|
||||||
# neutron rule id as the display_name.
|
# neutron rule id as the display_name.
|
||||||
rules = args[5]
|
rules = args[4]
|
||||||
return {
|
return {
|
||||||
'rules': [
|
'rules': [
|
||||||
{'display_name': rule['id'], 'id': uuidutils.generate_uuid()}
|
{'display_name': rule['id'], 'id': uuidutils.generate_uuid()}
|
||||||
|
Loading…
Reference in New Issue
Block a user