Assign Layer-3 IP address to a virtual server



  • Hello,

    I'm using i-doit api to develop an internal tool in my company. Is there a way to assign an ip address using the api ? Up to now I managed to get the list of used ip in a Layer-3 Object and then calculate the remaining free addresses, I'm struggling to find a way to assign one of the free ip to my objects using the "C__CATG__IP" category.



  • Your question is pretty generic, which makes it difficult to give good advice. It has been some time since I worked on this, so I'm not sure about the details and what is strictly neccessary to get it working. The following python snippet shows what goes into a C__CATG__IP entry in our scripts:

           data = {
                'ipv4_address': str(ip_addr.ipv4), #dotted quad
                'hostname': ip_addr.hostname,
                'description': ip_addr.description,
                'net': ip_addr.subnet_id, # if unset, the global v4 net is used
                'assigned_port': ip_addr.port_id, # probably not neccessary
                'net_type': 1, # IPv4 (required for ipv4_assignment)
                'ipv4_assignment': 1000 # DHCP reserved (sensible default for us)
            }
    


  • @franknagel said in Assign Layer-3 IP address to a virtual server:

    'ipv4_assignment': 1000

    Thank you for the reply ! It's exactly what I needed.


Log in to reply
 


Datenschutz / Privacy Policy