def configDhcpClientV4(self, obj, **kwargs): """ Description Create or modify DHCP V4 Client in NGPF. To create a new DCHP v4 Client stack in NGPF, pass in the Ethernet object. To modify an existing DHCP V4 Client stack in NGPF, pass in the dhcpv4client object. Parameters obj: : To create new DHCP obj. Example: /api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1 obj: : To Modify DHCP client. Example: /api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1/ipv4/1/dhcpv4client/1 dhcp4Broadcast: multiplier: : The amount of DHCP clients to create. dhcp4ServerAddress: : The DHCP server IP address. dhcp4UseFirstServer: : Default=True dhcp4GatewayMac: : Gateway mac address in the format of 00:00:00:00:00:00 useRapdCommit: : Default=False renewTimer: : Default=0 Syntax POST: /api/v1/sessions/{id}/ixnetwork/topology/{id}/deviceGroup/{id}/ethernet/{id}/ipv4/{id}/dhcpv4client PATCH: /api/v1/sessions/{id}/ixnetwork/topology/{id}/deviceGroup/{id}/ethernet/{id}/ipv4/{id}/dhcpv4client/{id} Example: dhcpClientObj = protocolObj.configV4DhcpClient(ethernetObj1, dhcp4Broadcast=True, multiplier = 10, dhcp4ServerAddress='1.1.1.11', dhcp4UseFirstServer=True, dhcp4GatewayMac='00:00:00:00:00:00', useRapdCommit=False, renewTimer=0) Return /api/v1/sessions/{id}/ixnetwork/topology/{id}/deviceGroup/{id}/ethernet/{id}/ipv4/{id}/dhcpv4client/{id} """ # To create new DHCP object if 'dhcp' not in obj: dhcpUrl = self.ixnObj.httpHeader+obj+'/dhcpv4client' self.ixnObj.logInfo('Create new DHCP client V4') response = self.ixnObj.post(dhcpUrl) # /api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1/ipv4/1/dhcpv4client/1 dhcpObj = response.json()['links'][0]['href'] # To modify DHCP if 'dhcp' in obj: dhcpObj = obj dhcpObjResponse = self.ixnObj.get(self.ixnObj.httpHeader+dhcpObj) if 'name' in kwargs: self.ixnObj.patch(self.ixnObj.httpHeader+dhcpObj, data={'name': kwargs['name']}) # All of these DHCP attributes configures multivalue singleValue. So just loop them to do the same thing. dhcpAttributes = ['dhcp4Broadcast', 'dhcp4UseFirstServer', 'dhcp4ServerAddress', 'dhcp4GatewayMac', 'dhcp4GatewayAddress' 'useRapidCommit', 'dhcp4GatewayMac', 'renewTimer'] for dhcpAttribute in dhcpAttributes: if dhcpAttribute in kwargs: multiValue = dhcpObjResponse.json()[dhcpAttribute] self.ixnObj.logInfo('Configuring DHCP Client attribute: %s' % dhcpAttribute) self.ixnObj.patch(self.ixnObj.httpHeader+multiValue+"/singleValue", data={'value': kwargs[dhcpAttribute]}) self.configuredProtocols.append(dhcpObj) return dhcpObj