This script allows you to scan a set of devices and ensure their node IDs are unique.
This resolves an issue where UAM cannot reach all devices if some of them were cloned after their initial configuration.
Contents of Package
This scripts is composed of 2 python files:
ApiClient.py
DuplicateNodeScript.py
ApiClient can be used to interface with the Edge Node’s API but will do nothing if run directly.
DuplicateNodeScript must be run in the same folder with ApiClient.
There is an examples folder an export csv that can be used as an example of formatting.
Usage
This script will scan all listed devices for duplicate node IDs, log the detected duplicates, and rename all required devices.
python DuplicateNodeScript.py
Or, on a system with both Python 2 and 3 installed:
python3 DuplicateNodeScript.py
When first run, it will create a Node folder. In that folder, place an appropriately formatted CSV and when next run the devices will be scanned and modified as required.
The devices whose Node IDs are changed will have the Edge Manager restarted.
For further details on running scripts in different environments, see Client Scripts
CSV Formatting
The CSV file’s top row must include the following headers:
Site Name,Edge Device IP,reachable,eACM username,eACM password,OS username,OS password
Each column's meaning is detailed below
Site Name | The unique name for the site, this will be assigned to the to level Node of the edge device. Each Site Name must be unique within the CSV. |
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 configure the device. Otherwise this row 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 |
OS username | The operating system username |
OS password | The operating system password |
Output
Depending on the results of running the script, the files will be moved as follows. The files will end up in one of four subfolders of Imports:
Complete - The script has run succesfully on at least one of the devices in the csv. Consult the log for details.
Error - Either the script did not recognize the formatting of the csv or one of the devices in the csv did not recognize the formatting of the json file. Check log for details.
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 or json, as well as csv and json files without matching names, will be moved here.
Logs
This script will generate its logs in NodeScript.log. It can be checked for further details if an error appears in the Complete report.