Deployer Example
This tool is intended as an example of deploying different Nimble configurations at runtime.
You can find it under tools/rest_deployer
.
First you will need to make sure that your license manager is configured, and that you have the latest docker images:
user@host:~$ docker-compose pull
To run the example:
user@host:~$ docker-compose up
Code Breakdown
First, we read in the example JSON file:
with open("config.json", "r") as f:
config_json = f.read()
Connect to the Nimble web server on port 6344 (unless configured otherwise):
conn = HTTPConnection(host="nimble", port=6344)
Next, the configuration is pushed to the appropriate endpoint:
conn.request("PUT", "/v1/config", config_json)
Finally, the response is requested:
res = conn.getresponse()
The status of the response can be checked to determine success or failure:
print("Push result:", res.status, res.reason)
If the status is 200 OK, then the new config has been accepted and Nimble has been reconfigured successfully.