NSX|V3: Use empty value and not ANY for remote prefix

ANY should not be used and we should remove the value of
0.0.0.0/0.

Change-Id: Ie4c8d334ae73b8b40f8be8ca6b540b0fa2370a2c
This commit is contained in:
Gary Kotton 2018-04-11 22:14:53 -07:00 committed by Adit Sarfaty
parent 9743a4d0e4
commit 0315ecf3b1
2 changed files with 7 additions and 5 deletions

View File

@ -4573,11 +4573,11 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
context.session, remote_group_id)
ruleid_2_remote_nsgroup_map[sg_rule['id']] = remote_nsgroup_id
# 0.0.0.0/0 is not a valid entry for local and remote so we need
# to change this to 'ANY'
# to change this to None
if sg_rule.get('remote_ip_prefix') == '0.0.0.0/0':
sg_rule['remote_ip_prefix'] = 'ANY'
sg_rule['remote_ip_prefix'] = None
if sg_rule.get('local_ip_prefix') == '0.0.0.0/0':
sg_rule['local_ip_prefix'] = 'ANY'
sg_rule['local_ip_prefix'] = None
return self.nsxlib.firewall_section.create_rules(
context, section_id, nsgroup_id,

View File

@ -164,10 +164,12 @@ class TestNSXv3ExtendedSGRule(test_nsxv3_plugin.NsxV3PluginTestCaseMixin,
'port_range_min': None,
'local_ip_prefix': None,
'ethertype': 'IPv4',
'protocol': u'udp', 'remote_ip_prefix': 'ANY',
'protocol': u'udp',
'remote_ip_prefix': None,
'port_range_max': None,
'security_group_id': mock.ANY,
'remote_group_id': None, 'direction': u'ingress',
'remote_group_id': None,
'direction': u'ingress',
'description': ''}]
with mock.patch(