Community
    • Categories
    • Recent
    • Popular
    • Users
    • Search
    • Register
    • Login

    Assign Layer-3 IP address to a virtual server

    Scheduled Pinned Locked Moved Development
    3 Posts 2 Posters 814 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      mirkomatonti
      last edited by mirkomatonti

      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.

      1 Reply Last reply Reply Quote 0
      • F Offline
        franknagel
        last edited by

        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)
                }
        
        M 1 Reply Last reply Reply Quote 1
        • M Offline
          mirkomatonti @franknagel
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post