I've made some more progress in a solution for my initial issue using openwisp_ipam. I've managed to request an IP address and save the resulting ip in the subnet with my signal function, now I need to assign to the static interface config of the device I'm trying to save.
I've defined the JSON with the network interface that I want to use, next step is set column config of the config_config table that has the device id, I'm not so sure how to access the confg_config with the foreign key pointing to my device object, should I import another model? I noticed that when I'm manually adding the device from the Django admin interface I need to create the device config manually, but devices subscribing to the controller create this entry automatically. Still need some improvements but the code looks like this: if created: #get device_id and device_org_id in device object device = Device.objects.first() device_id = str(getattr(device, 'id')) device_org_id = str(getattr(device, 'organization_id')) #define a config object config = Config.objects.filter(device_id=device_id).first # to be use later to filer subnets inside same orgs #get org subnet_id r = requests.get('http://127.0.0.1:8000/api/v1/subnet/',auth=('user', 'pass')).json() sub_id= str(r["results"][0]['id']) mask = str(r["results"][0]['subnet'].split('/',3)[1]) req_ip = requests.get('http://127.0.0.1:8000/api/v1/subnet/'+str( sub_id)+'/get-first-available-ip/',auth=('user','pass')).json() p_data = { 'description': 'auto generated ip', 'ip_address': temp_ip, 'subnet': sub_id } #save ip to device's subnet config r = requests.post('http://127.0.0.1:8000/api/v1/subnet/'+str(sub_id)+ '/request-ip/', json=p_data, auth=('user','pass')) #config to be inserted in the database config_list = {'interfaces': [{'type': 'bridge', 'bridge_members': [ 'eth0.1', 'eth0.2'], 'name': 'cable', 'disabled': False, 'addresses': [{ 'proto': 'static', 'family': 'ipv4', 'address': req_ip, 'mask': mask}], 'network': 'cable'}]} #insert json in config column of config_device table setattr(config, 'config',json.dumps(config_list)) #get device config_id Thanks for the suggestions so far. I'm open to feedback how to improve this . Cheers -- You received this message because you are subscribed to the Google Groups "OpenWISP" group. To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+unsubscr...@googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/msgid/openwisp/33b40e20-6f18-4738-90e1-7c6c5473b949%40googlegroups.com.