Developer

last person joined: 5 days ago 

Expand all | Collapse all

Central API - setting a static IP on an AP - question

This thread has been viewed 22 times
  • 1.  Central API - setting a static IP on an AP - question

    Posted Jun 23, 2021 01:40 AM
    Hello, looking from some clarification on setting static IP for IAPs via Central API

    I am using GUI config groups in Central (various customers in multiple zones e.g. US-1, APAC-1)
    I am using the REST API via pycentral SDK (pycentral is not really relevant to the issue I'm having, just providing complete info)
    The documentation states the the following fields are supported in the POST
    apdict = {
        'achannel': '0',
        'atxpower': '0',
        'dot11a_radio_disable': False,
        'dot11g_radio_disable': False,
        'gchannel': '0',
        'gtxpower': '0',
        'hostname': 'AP001',
        'ip_address': '0.0.0.0',
        'usb_port_disable': False,
        'zonename': ''
    }​


    I can configure items such as AP hostname easily and smoothly using the REST IP, the basic functionality is working fine.
    And I can configure an AP to use DHCP by setting 'ip_address' : '0.0.0.0'

    But if I need to set a static IP I hit a problem whereby I need more than just the IP. I need a mask, gateway, DNS server, domain name. There are no documented fields for these, and an AP without a gateway is going to be really stuck.

    Looking at the running config of an AP I see these items all listed in a single line in the running config, so I tried listing them all in the 'ip_address' but this failed miserably and Central tried to push the very long string as the IP address while leaving the other fields blank

    Normal static IP config:
    per-ap-settings d0:d3:e0:aa:bb:cc
      hostname AP001
      ip-address 192.168.173.189 255.255.255.0 192.168.173.254 8.8.8.8 domainname.local​


    Config seen in Central when you try to put everything in the IP field (Fails to push to AP thankfully):

    per-ap-settings d0:d3:e0:aa:bb:cc
      hostname AP001
      ip-address 192.168.173.189 255.255.255.0 192.168.173.254 8.8.8.8 domainname.local 0.0.0.0 0.0.0.0 0.0.0.0 ""


    So..... any idea how can I achieve this task?

    (Please don't turn this into a discussion about reasons why all the APs should only use DHCP - that is not the question)



  • 2.  RE: Central API - setting a static IP on an AP - question

    Posted Jul 06, 2021 03:12 PM
    Hi vf556-2,

    Thanks for providing the detailed explanation. The "AP Settings" API endpoint has the limitation as you mentioned. However, there are other API endpoints for the APs in the UI group.

    To reach the swagger API documentation, follow this
    1. Aruba Central Home page -> API Gateway -> click the link to the documentation on the APIs tab 
    2. Choose "Configuration" in the URL dropdown -> Then select "AP Configuration" on the left plane. 
    3. You can use "Get AP Configuration" API, modify the config and then use "Replace AP Configuration" API.
    4. Alternatively, for AP settings that are configured outside of configure terminal mode in CLI, like "hostname", "zonename", etc. use "Get AP Setting" API, modify the settings and then use "Replace AP Setting" API.

    You can also use the pycentral to make those API calls as described in the developer hub and github.

    Thanks!

    ------------------------------
    Karthikeyan Dhandapani
    ------------------------------