def enableDisableMldGroupNgpf(self, protocolSessionUrl, groupRangeList, action='disable'): """ Description: For IPv6 only. To enable or disable specific multicast group range IP addresses by using overlay. 1> Get a list of all the Multicast group range IP addresses. 2> Get the multivalue list of ACTIVE STATE group ranges. 3> Loop through the user list "groupRangeList" and look for the index position of the specified group range IP address. 4> Using overlay to enable|disable the index value. Note: If an overlay is not created, then create one by: - Creating a "ValueList" for overlay pattern. - And add an Overlay. Parameters protocolSessionUrl: http://{apiServerIp:port}/api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1/ipv4/1/igmpHost/1 groupRangeList: A list of multicast group range addresses to disable. Example: ['ff03::1', 'ff03::2'] action: disable or enable """ if action == 'disable': enableDisable = 'false' else: enableDisable = 'true' url = protocolSessionUrl+'/mldMcastIPv6GroupList' response = self.ixnObj.get(url) # /api/v1/sessions/1/ixnetwork/multivalue/59 # Get startMcastAddr multivalue to get a list of all the configured Group Range IP addresses. groupRangeAddressMultivalue = response.json()['startMcastAddr'] # Get the active multivalue to do the overlay on top of. activeMultivalue = response.json()['active'] # Getting the list of Group Range IP addresses. response = self.ixnObj.get(self.ixnObj.httpHeader+groupRangeAddressMultivalue) # groupRangeValues are multicast group ranges: # ['ff03::1', 'ff03::2'] groupRangeValues = response.json()['values'] self.ixnObj.logInfo('Configured groupRangeValues: %s' % groupRangeValues) listOfIndexesToDisable = [] # Loop through user list of specified group ranges to disable. for groupRangeIp in groupRangeList: index = groupRangeValues.index(groupRangeIp) listOfIndexesToDisable.append(index) if listOfIndexesToDisable == []: raise IxNetRestApiException('disableMldGroupNgpf Error: No multicast group range ip address found on your list') for index in listOfIndexesToDisable: currentOverlayUrl = self.ixnObj.httpHeader+activeMultivalue+'/overlay' # http://192.168.70.127:11009/api/v1/sessions/1/ixnetwork/multivalue/5/overlay # NOTE: Index IS NOT zero based. self.ixnObj.logInfo('enableDisableMldGroupNgpf: %s: %s' % (action, groupRangeValues[index])) response = self.ixnObj.post(currentOverlayUrl, data={'index': index+1, 'value': enableDisable})