def activateIgmpHostSession(self, portName=None, ipAddress=None, activate=True): """ Description Active or deactivate the IGMP host session ID by the portName and IPv4 host address. Parameters: portName: : The name of the port in which this API will search in all the Topology Groups. ipAddress: : Within the Topology Group, the IPv4 address for the IGMP host. activate: : To activate or not to activate. """ # Get the IPv4 address index. This index position is the same index position for the IGMP host sessionID. # Will use this variable to change the value of the IGMP host object's active valueList. ipv4AddressIndex = self.getIpAddrIndexNumber(ipAddress) # Get the IPv4 object by the port name. This will search through all the Topology Groups for the portName. ipv4Obj = self.getIpv4ObjByPortName(portName=portName) # With the ipv4Obj, get the IGMP host object's "active" multivalue so we could modify the active valueList. queryData = {'from': ipv4Obj, 'nodes': [{'node': 'igmpHost', 'properties': ['active'], 'where': []}]} queryResponse = self.ixnObj.query(data=queryData, silentMode=False) if queryResponse.json()['result'][0]['igmpHost'] == []: raise IxNetRestApiException('\nNo IGMP HOST found\n') igmpHostActiveMultivalue = queryResponse.json()['result'][0]['igmpHost'][0]['active'] response = self.ixnObj.get(self.ixnObj.httpHeader+igmpHostActiveMultivalue) valueList = response.json()['values'] # Using the ipv4 address index, activate the IGMP session ID which is the same index position. valueList[ipv4AddressIndex] = activate self.ixnObj.configMultivalue(igmpHostActiveMultivalue, multivalueType='valueList', data={'values': valueList})