This script allows you to request full node level configuration from multiple Edge ACM systems at once
Contents of Package
This scripts is composed of 2 python files:
ApiClient.py
ExportScript.py
ApiClient can be used to interface with the Edge Node’s API but will do nothing if run directly.
ExportScriptmust be run in the same folder with ApiClient.
The examples folder includes a csv and json export with matching names, as expected by the script
Usage
This script will collect the node level configuration json from every device listed in a csv file. When run initially the script will create every folder it requires.
A csv file (eg. example123.csv) should be placed in the Exports folder. Then run ExportScript.py using python 3. In Windows, this can be done by entering cmd in the start menu, then using cd commands to navigate to the folder that holds the import script. From the command line, run:
python ImportScript.py
It will connect to each device in order, export the current configuration, and write to individual json files with names specified in the csv.
For further details on running scripts in different environments, see Client Scripts
CSV Formatting
The CSV file’s top row must be the header:
Site Name,Edge Device IP,reachable,eACM username,eACM password
Each columns meaning is detailed below
Column Header | Meaning |
---|---|
Site Name | The unique name for the site, this will be used as the name for the json file retrieved |
Edge Device IP | The IP address or url the edge device; this is the IP we will attempt to contact. Unless otherwise specified, it will be assumped an IP or url is of the format, Eg “192.168.0.10” will be read as “http://192.168.0.10:8080”. If a different port is expected, or the node is configured for https, that must be included, eg “https://192.168.0.10:8181”. Each Edge Device IP must be unique within the CSV. |
reachable | If this is a lower case x the script will attempt to connect to and read configuration from this device; otherwise it will be ignored |
eACM username | The web interface username used to connect to the Edge Manager website and API. Default: admin |
eACM password | The web interface password used to connect to the Edge Manager website and API. Default: admin |
Output
Depending on the results of running the script, the files will be moved as follows. The files will end up in one of three subfolders of Exports:
Complete - The script has run succesfully on at least one of the devices in the csv. A report.txt file is also generated in this folder to detail which sites had their config retrieved and which did not. All of the json files generated will appear here.
Process - Files should only be here while the script is running; they will be collected from Import, moved to Process, then sent to Error or Complete. Any files that remain here when the program is done indicate an unexpected exception. Check log for further details and contact support if necessary.
Unrecognized - Files that are not csv, as well as csv and json files without matching names, will be moved here.
Logs
Two log files will be created in the Logs subfolder, ApiClient.log and ExportScript.log. They can be checked for further details if an error appears in the Complete report.
Troubleshooting
If you experience a timeout durring the process, there are 3 variables at the top of ImportScript.py that can be adjusted. The script can be edited in any text editing software, eg. notepad or notepad++.
#Shared timeout and retry parameters to tune if network is difficult timeOut=40 exportTimeOut=1200 retries=Retry( total=3, status_forcelist=[429, 500, 502, 503, 504], method_whitelist=["HEAD", "GET", "POST"] )
timeOut is used for the timeout of all communications except the json import
exportTimeOut only controlls the timeout for the json export
Retry covers all the rules for retries after a timeout or http error; only the total should be adjusted.