Browse Source

Tier-1 GW: Allow to set multicast on specific locale-service

This patch adds an optional 'service_id' parameter to multicast
enablement / disablement methods to allow multicast to be set
also for locale-services whose id was not auto-generated by
vmware-nsxlib.

Change-Id: I68d0149179eea3177252f4986ce1b2d085b0950b
changes/36/766636/1
Salvatore Orlando 1 year ago
parent
commit
f6f86385ae
  1. 19
      vmware_nsxlib/v3/policy/core_resources.py

19
vmware_nsxlib/v3/policy/core_resources.py

@ -1327,29 +1327,32 @@ class NsxPolicyTier1Api(NsxPolicyResourceBase):
tenant=tenant)
return self._list(t1interface_def)
def get_multicast(self, tier1_id, tenant=constants.POLICY_INFRA_TENANT):
def get_multicast(self, tier1_id, service_id=None,
tenant=constants.POLICY_INFRA_TENANT):
mcast_def = core_defs.Tier1MulticastDef(
tier1_id=tier1_id,
service_id=self._locale_service_id(tier1_id),
service_id=(service_id or
self._locale_service_id(tier1_id)),
tenant=tenant)
mcast_data = self.policy_api.get(mcast_def)
return mcast_data.get('enabled')
def _set_multicast(self, tier1_id, enabled, tenant):
def _set_multicast(self, tier1_id, enabled, service_id, tenant):
args = {'tier1_id': tier1_id,
'service_id': self._locale_service_id(tier1_id),
'service_id': (service_id or
self._locale_service_id(tier1_id)),
'enabled': enabled,
'tenant': tenant}
mcast_def = core_defs.Tier1MulticastDef(**args)
self.policy_api.create_or_update(mcast_def)
def enable_multicast(self, tier1_id,
def enable_multicast(self, tier1_id, service_id=None,
tenant=constants.POLICY_INFRA_TENANT):
self._set_multicast(tier1_id, True, tenant)
self._set_multicast(tier1_id, True, service_id, tenant)
def disable_multicast(self, tier1_id,
def disable_multicast(self, tier1_id, service_id=None,
tenant=constants.POLICY_INFRA_TENANT):
self._set_multicast(tier1_id, False, tenant)
self._set_multicast(tier1_id, False, service_id, tenant)
def get_realized_state(self, tier1_id, entity_type=None,
tenant=constants.POLICY_INFRA_TENANT,

Loading…
Cancel
Save