The uncli is a command line utility written with Javascript on top of Node JS framework. It allows users to use the Utility Network functionalities by calling the dedicated REST API.
By just installing Node JS 13 or higher you will have access to ability to connect to a Utility network service, list the subnetworks, query the topology status, update subnetworks, export subnetworks, disable and enable topology and much more.
You can use this tool to schedule task to update all subnetworks, or configure Jenkins (an automation server) to update export subnetworks nightly and much more. The uncli works on all operating systems, Windows, Linux & MacOS.
In this blog I will go through the process of installing the uncli tools and I will also link the github repo where you can download and take a look at the source code too.
Installing uncli
The installation process of the tool is simple. All you need to do is to install Node JS 13.x or higher. The current version of Node JS is 14.x.
Once you install Node js , open a command line prompt and type in the following
npm install -g un-cli
Once you install the uncli tools, you can now use them as follows: Connect to your portal by specifying the user name, password and the feature service name that has a utility network in it.
> uncli --portal https://utilitynetwork.esri.com/portal --service NapervilleElectric_SQLServer --user tester --password tester.108
Commands
I’ll go through the most popular commands but feel free to explore the rest. Also feel free to suggest new commands that might be useful to add to the tool!
Help
>help
At any time you can type “help” to get a list of all commands available.
Get Count of Features
> count
Count how many features you have in your Utility Network
Update All Subnetworks
>update subnetworks -all
This command updates all dirty subnetworks one by one. It fetches all subnetworks that are dirty and updates them in a synchronous manner.
Update Deleted Subnetworks
>update subnetworks -deleted
This commands only update subnetworks that has been marked for deleted (or have some of their controllers disabled).
Export All Subnetworks
>export subnetworks -all
This command exports all subnetworks that have been cleaned and successfully updated and writes the exported json in the home directory.
Export New Subnetworks
>export subnetworks -new
This command exports all subnetworks that have been cleaned and successfully updated but haven’t yet been exported and writes the exported json in the home directory.
Automate uncli or execute commands in bulk
To automate or execute multiple commands in bulk you can use the -file parameter to specify a txt file with the list of command to execute ..
Create a text file and add your commands to it. For example below is two commands that update all subnetworks and export them. Name the file commands.txt
update subnetworks -all
export subnetworks -new
add the -file option and provide the text file that you need to execute.
uncli –portal https://utilitynetwork.esri.com/portal –service NapervilleElectric_SQLServer –user tester –password tester.108 –file commands.txt
Jenkins is an automation server that allows you to automate tasks, this tools works with Jenkins as well
Considerations
This tool is still in alpha phase, please report any bugs you find in the comments box in this blog post. Thank you so much! The tool works only on DEFAULT currently.
Update: 1/28/2022
The tool was updated to include connecting to a specific gdbVersion and also list attribute rules execution summary by querying the logs.
Article Discussion: