Developer

 View Only
last person joined: yesterday 

Expand all | Collapse all

AOS8 API - Adding Configuration to Node

This thread has been viewed 6 times
  • 1.  AOS8 API - Adding Configuration to Node

    Posted 2 days ago

    Hi folks, 

    My team has just started kicking the tires on the AOS8 API. In this instance, consider the following hierarchy:

    (lab) [mynode] #show configuration node-hierarchy
    
    Default-node is not configured. Autopark is disabled.
    
    Configuration node hierarchy
    ----------------------------
    Config Node                                           Type    Name
    -----------                                           ----    ----
    /                                                     System
    /md                                                   System
    /mm                                                   System
    /mm/mynode                                            System

    When we deploy a new site, we create a parent folder (i.e., /md/test/) that contains configuration that will be shared across all cluster members. For this scenario, I'm just starting with the "location" configuration. I'm aware of the `/v1/configuration/object/location` endpoint, but rather than make an API call for each object, we'd like to use the `/v1/configuration/object/configuration_node_filename` after copying the flat text file to the conductor.

    I can create the new node without issue using the `/v1/configuration/object/configuration_node`, but subsequent calls to the configuration_node_filename result in the following error: 

    {
    	"configuration_node_filename": {
    		"node-path": "/md/test",
    		"filename": "/flash/config/test.txt",
    		"_result": {
    			"status": 1,
    			"status_str": "Error: Cannot configure an existing node /md/test"
    		}
    	},
    	"_global_result": {
    		"status": 2,
    		"status_str": "Error: Cannot configure an existing node /md/test",
    		"_pending": false
    	}
    }

    So I can't add it after node is created and it doesn't seem that I can specify a filename when the /md/test/ node is created. So what gives? How is this configuration_filename operation supposed to work?



  • 2.  RE: AOS8 API - Adding Configuration to Node

    EMPLOYEE
    Posted 7 hours ago

    Just issue POST to configuration_node_filename enpoint.  Don't create the node first.  The configuration_node_filename will create a new node in the hierarchy and associate the initial configuration specified.  The problem you're running into is that endpoint will do both steps, (creates the node and associates the config), it's expecting the node not to exist (so don't run configuration_node at all, just configuration_node_filename)

    payload looks good, but for anyone else that comes across this.  This endpoint currently needs the full path /flash/config/<filename>, which is what is listed when you issue "dir" from CLI.