Do not set multicast=True if not needed

In some cases - such as isolated segments - multicast cannot
be enabled. Leaving it to default settings will avoid error
responses from the NSX-T backend.

Change-Id: I65beefc574f0167e9679c873c99e48173999741c
This commit is contained in:
Salvatore Orlando 2021-09-06 09:49:57 -07:00 committed by Salvatore Orlando
parent ed3a192788
commit 6f924dd6ca
2 changed files with 5 additions and 2 deletions

View File

@ -103,6 +103,7 @@ from vmware_nsxlib.v3 import exceptions as nsx_lib_exc
from vmware_nsxlib.v3 import nsx_constants as nsxlib_consts
from vmware_nsxlib.v3.policy import constants as policy_constants
from vmware_nsxlib.v3.policy import core_defs as policy_defs
from vmware_nsxlib.v3.policy import core_resources
from vmware_nsxlib.v3.policy import transaction as policy_trans
from vmware_nsxlib.v3.policy import utils as p_utils
from vmware_nsxlib.v3 import security
@ -1160,12 +1161,14 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
return versions
def _get_segment_multicast_setting(self, context, net_id):
# Multicast must be explicitly disabled for v6-only subnets
seg_subnets_ip_ver = self._get_segment_subnets_versions(
context, net_id)
# Multicast cannot be enabled on segments with v6 subnets only
if len(seg_subnets_ip_ver) == 1 and seg_subnets_ip_ver.pop() == 6:
return False
return True
# Ignore value of multicast setting (go with defaults)
return core_resources.IGNORE
def _get_segment_subnets(self, context, net_id, net_az=None,
interface_subnets=None,

View File

@ -2084,7 +2084,7 @@ class NsxPTestL3NatTestCase(NsxPTestL3NatTest,
# We expect two subnet objects on segment
seg_update.assert_called_with(
n['network']['id'],
multicast=True,
multicast=mock.ANY,
subnets=[mock.ANY, mock.ANY],
tier1_id=r['router']['id'])