Skip to main content
Versa Networks

Migrate Versa Director APIs to Release 23.1

Versa-logo-release-icon.pngFor supported software information, click here.

Versa Director Release 23.1 includes significant API changes across the three API families. This article helps you to simplify migration from Versa Director Releases 22.1.3 or 22.1.4 to Releases 23.1.1 and later, and provides multiple tools and reference documents.

The following table describes the API changes introduced in Releases 23.1.1 and later:

API Family Old Paths (Releases 22.1.4 and Earlier) New Paths (Releases 23.1.1 and Later) High-level Changes
VNMS/Director APIs

/vnms/*

/nextgen/*

/auth/*

/vnms/dashboard/*

Same base paths (some endpoints added, removed, or modified) Path, payload, or both
Appliance APIs /api/config/devices/*
/api/operational/devices/*
Same REST API path, internal model changes Primarily payload structure
Migrated NMS APIs

/api/config/nms

/api/config/vnmsha/

/api/config/system

/api/config/security

/api/config/aaa

/api/operational/system/

/api/operational/nms/

/vnms/* Path change (YANG - PostgreSQL-backed
VNMS)

API Difference Documents

To understand the detailed changes, refer to the following documents:

  • VNMS_API_Diff.pdf
    This document provides information on which APIs are new, deleted, deprecated, or changed, and lists API differences between Release 22.1.4 and Release 23.1 for Director-level APIs. You use this API when the application calls /vnms or /nextgen APIs.
    Covers changes for:
    • /vnms/*
    • /nextgen/*
    • /auth/*
    • /vnms/dashboard/* (except appliance live paths)
  • Payload diff.pdf
    This document provides the payload structure differences for appliance APIs between Release 22.1.4 and Release 23.1 with examples. You use this when the application configures or monitors appliances. 
    Covers changes in:
    • /api/config/devices/*
    • /api/operational/devices/*
  • Migrated NMS API.pdf
    This document provides information on mapping paths for NMS to VNMS. You use this when the application uses legacy /api/config/nms, /api/config/system, or other migrated prefixes.
    Covers changes in:

    Note: Director-level YANGs under /api/system/api/nms have been migrated to PostgreSQL-backed /vnms APIs. Refer to the updated documentation to understand the new corresponding /vnms API structures.

    • /api/config/nms
    • /api/config/vnmsha/
    • /api/config/system
    • /api/config/security
    • /api/config/aaa
    • /api/operational/system/
    • /api/operational/nms/

API Migration Tool

The API migration tool provides mappings and references to update the API integrations. It does not rewrite the application code. You can use the API migration tool to:

  • Map APIs for Releases 22.1.4 or earlier to APIs for Releases 23.1 or later.
  • Find respective Swagger documentation.
  • Detect payload changes, if applicable.
  • Generate an HTML migration report for bulk input from access log files or CSV files.
  • Support single APIs and bulk migration using access log files and CSV files.

Access the Migration Files

You can access the API migration script from the locations listed in the table below.

Location  Script Path When to Use
Director (Releases 23.1.1 and later) /opt/versa/vnms/swagger-utils/script/main/migration_tool.sh Use when you have SSH access. No extra packages needed.
 
Local machine swagger-scripts/script/main/migration_tool.sh (after extracting the tarball) Use when you do not have SSH access or when you prefer offline analysis.

To navigate to the tool directories, use the following commands.

  • On the Director node:
Administrator@Director01$ cd /opt/versa/vnms/swagger-utils/script/main
  • On the local machine (after extracting the tarball):
Administrator@Director01$ cd swagger-scripts/script/main

The table below lists the paths for all migration tool files. 

Resource Path on Release 23.1 Director Path When Running Locally
Migration tool script /opt/versa/vnms/swagger-utils/ script/main/migration_tool.sh swagger-scripts/script/main/migration_tool.sh
Tool README /opt/versa/vnms/swagger-utils/readme.md swagger-scripts/readme.md
Tool output (HTML report) /opt/versa/vnms/swagger-utils/output/output_swagger.html swagger-scripts/output/output_swagger.html
Sample access log /opt/versa/vnms/swagger-utils/requisite/main/ concerto_access_log.log swagger-scripts/requisite/main/concerto_access_log.log
Sample CSV /opt/versa/vnms/swagger-utils/requisite/main/22.1.4.csv swagger-scripts/requisite/main/22.1.4.csv

Prepare API Input

Use the following guidelines to prepare the input for the API migration:

  • Use curly braces { } for parameter names in the path. For example, in the path below, SDWAN-Controller1 is the device parameter:
    •  /api/config/devices/device/{SDWAN-Controller1}/config/networks/network path
  • Do not include query parameters in the path. For example, in the /vnms/appliance/appliance/liteView?offset=0&limit=25 API path, omit the query parameter part (?offset=0&limit=25) 
  • For input options 1 to 3 in Releases 22.1.4 and earlier:
    • Use the exact API path from Swagger/OpenAPI. For example, use /vnms/... , not /rest/vnms/....
    • Provide the path starting with /, not a full https://... URL.
  • Use one API path per line in the CSV file.  Duplicate API paths are removed automatically.

API Search Behavior

When the API tool looks up an API in the Swagger specification, it normalizes the input path before matching the path.

For example, for the following API:

/api/config/devices/device/{SDWAN-Controller1}/config/networks/network?offset=0&limit=25

The normalized Swagger input path is:

/config/devices/device/{device}/config/networks/network

In this example:

  • In the Swagger API path, the search starts from /config/. The /api prefix is part of the REST base URL, not the Swagger API path.
  • Use curly braces { } for parameter names in the path. For example, {SDWAN-Controller1} can be any value and is not matched literally.
  • Use the equivalent Swagger path with a path-parameter placeholder (for example, {device} ), not a literal device name.
  • The API migration tool ignores the query parameters. The tool strips the question mark (?) and all subsequent query parameters after the question mark (such as ?offset=0&limit=25 in the above example) before the search, and the query parameters are not part of the Swagger API path.

Migrate the APIs

To migrate the APIs, perform the following steps in order:

  1. Inventory the APIs—Collect the API paths that the application uses from access logs, automation scripts, or a CSV list. A sample CSV file (22.1.4.csv) is provided. See Access the Migration Files, above.
  2. Run the API migration tool—Map each old API to its equivalent for Releases 23.1 and later, and get Swagger links. You can run the migration tool on the Director node or on a local machine. See the following sections:
  3. Refer to the reference document for each API family. See API Difference Documents, above. 
  4. Update the client code—Change paths, request bodies, and response parsing as needed.
  5. Validate on a staging Director, Releases 23.1.1 and later—Test against Swagger and the updated automation.
  6. Contact Versa Customer Support if an API is not covered by the tool or reference documents.

Run the Migration Tool on Versa Director

  1. Navigate to the tool directory and run the script.
Administrator@Director01$ cd /opt/versa/vnms/swagger-utils/script/main/
Administrator@Director01$ ./migration_tool.sh

The script starts an interactive menu. Choose one of the following options. For detailed information on each option, see Input Options for Migration Tool, below.

  • Migrate APIs from an access log file
  • Migrate APIs from a CSV file
  • Migrate a single API
  • Find Swagger link for a 23.1 API
  1. If HTML output is generated using an access log or CSV file, package the generated HTML files into a single archive and copy the archive from Versa Director. See Migrate APIs from an Access Log File (Option 1) and Migrate APIs from a CSV File (Option 2). For example:
Administrator@Director01$ cd ../../
Administrator@Director01$ tar -czvf output.tar.gz output
Administrator@Director01$ mv output.tar.gz /home/Administrator/
  1. Download or copy the output.tar.gz file to a machine where you can open it in a browser.
  2. Extract the archive and open output/output_swagger.html.

Run the Migration Tool on a Local Machine

To get the local script (swagger-scripts/script/main/migration_tool.sh) to run the migration tool on a local machine, download and extract the api_migration_tool.tar.gz file. If you need support to get the tar file, contact Versa Networks Customer Support team.

  1. As a prerequisite, run the following script to verify that the required packages are installed:
Administrator@Director01$ missing=$(for p in jq colordiff python3 python3-pip; do dpkg -s "$p" &>/dev/null || echo "$p"; done; command -v ansi2html &>/dev/null || echo "ansi2html")
if [ -n "$missing" ]; then
echo "Please get the following packages installed first:"
echo "$missing"
else
echo "All required packages are present."
fi
  1. Install any packages that are missing. For example:
Administrator@Director01$ sudo apt install jq -y
Administrator@Director01$ sudo apt-get install colordiff
Administrator@Director01$ sudo apt install python3 python3-pip -y
Administrator@Director01$ sudo apt install colorized-logs
  1. Download and extract the API migration tool.
Administrator@Director01$ wget <tar file link>
Administrator@Director01$ tar -xvf api_migration_tool.tar.gz
  1. Run the API migration tool script.
Administrator@Director01$ cd swagger-scripts/script/main/
Administrator@Director01$ ./migration_tool.sh

The script starts an interactive menu. Choose any one of the following options. For information on what each option requires and step-by-step sample runs, see Input Options for Migration Tool, below.

  • Migrate APIs from an access log file
  • Migrate APIs from a CSV file
  • Migrate a single API
  • Find Swagger link for a 23.1 API
  1. If HTML output is generated using an access log or CSV file, open the HTML report in any browser at ../../output/output_swagger.html. See Migrate APIs from an Access Log File (Option 1) and Migrate APIs from a CSV File (Option 2).
  2. After running the tool on the local machine, remove packages installed in Step 2, above. This step is optional.
Administrator@Director01$ sudo apt remove --purge -y jq colordiff python3-pip colorized-logs
Administrator@Director01$ sudo apt autoremove -y

Input Options for Migration Tool

When you run the migration tool script on a Director node or on a local machine, the script starts an interactive menu and prompts you to select a method for providing input:

This tool helps migrate VNMS APIs to 23.1, generate Swagger links, and identify payload changes.

Input options:•
Access log file (VNMS APIs)•
CSV file with multiple APIs•
A single API

Output:•
Mapped 23.1 APIs with Swagger URLs•
Payload change details (if applicable)•
HTML report for file-based inputs•
Console output for single API inputs
==========================================================================
Choose an option:

1. Migrate APIs from an access log file
2. Migrate APIs from a CSV file
3. Migrate a single API
4. Find Swagger link for a 23.1 API

Enter your choice(1, 2, 3 or 4)

In response to the prompt, you can select one of the following options:

Option Input Output
1 Access log file from Director for Releases 22.1.4 or earlier

HTML report—output/output_swagger.html

2 CSV file listing multiple API paths

HTML report—output/output_swagger.html

3 Single API path for Releases 22.1.4 or earlier Console—Mapped for Releases 23.1 and later API and Swagger URL
4 Find Swagger link for a single API path for Releases 23.1 and later Console—Swagger URL only (lookup, not migration)

Note: When entering API paths in the CSV file or at the console prompt, use curly braces ({ }) for parameter names. For example, in the API path below, SDWAN-Controller2 is the device name and provider-org is the organization name.

/api/config/devices/device/{SDWAN-Controller2}/config/orgs/org-services/{provider-org}

Migrate APIs from an Access Log File (Option 1)

For Director Releases 22.1.4 or earlier, the access log file is located at /var/log/vnms/spring-boot/access_log.log.

When you use an access log file as input (option 1), respond to the prompts as follows:

  • Absolute path of the input access log file—Provide an absolute path to the saved access log file. If you run the script from script/main, you can provide relative paths also (for example: ../../requisite/main/concerto_access_log.log). To use multiple access log files, merge them into a single log file first.
  • Current Director version—The supported Director versions are 22.1.3 and 22.1.4. Press Enter to accept the default version, which is 22.1.4.
  • Client IP address(s)—The tool displays sample log lines from the access log format to help you identify the correct IP. Copy the client IP address exactly as it appears in the log. To add more than one client IP address, enter each IP address when prompted, and press Enter on an empty line after entering an IP address.
  • Swagger IP address—Enter Releases 23.1 and later Director IP address, or press Enter to skip and set the IP address later in the HTML report. See Director IP Address for Swagger Links.

Example: Access Log File Input

The following example uses the sample log file and accepts default values for the Director version and Swagger IP address.  When running locally, a relative path to the sample log works from the script/main/ directory.

Enter your choice(1, 2, 3 or 4): 1

Access log file is located at /var/log/vnms/spring-boot/access_log.log on the (<=22.1.4) director

If you wish to give multiple access log files as input, please merge them into a single log file
Please enter the absolute path of the input access log file. (A sample file is located at
../../requisite/main/concerto_access_log.log):
../../requisite/main/concerto_access_log.log

Please enter the current Director version (e.g., 22.1.3 or 22.1.4).
Press Enter to use the default version 22.1.4.

Please enter the IP(s) for the client which is making director API calls.
You will find this IP is access log file. For example : In ../../requisite/main/concerto_access_log.log you can see
'10.192.252.22'

[24/Aug/2024:02:23:17 +0000] 10.192.252.22 - https-jsse-nio-9183-exec-39 ECP_ADMIN cc6ad5df97c0c2dd4dc0ab9030706309 GET
/vnms/spack/predefined?xPath=/predefined/config/predefined-geoip/geoip-countries HTTP/1.1 200 25624 1571ms 1568ms
[24/Aug/2024:02:23:17 +0000] 10.192.252.22 - https-jsse-nio-9183-exec-17 ECP_ADMIN cc6ad5df97c0c2dd4dc0ab9030706309 GET
/vnms/spack/predefined?xPath=/predefined/config/predefined-dlp-data/predefined-threat-severity/threat-severity HTTP/1.1
200 79 42ms 41ms

Enter IP address, or type Enter if there are no more IPs to enter:
10.192.252.22

Enter IP address, or type Enter if there are no more IPs to enter:

API endpoints are being extracted from access logs....

Please enter the host or IP address of the >= 23.1 director for Swagger URL generation. Press Enter if you do not want to input
the director IP:

Please wait while the output is being generated...

Results are generated as an HTML file in ../../output/output_swagger.html.

 Migrate APIs from a CSV File (Option 2)

When you use a CSV file as input (option 2), respond to the prompts as follows:

  • Absolute path of the input access log file—Provide an absolute path to the CSV file with one API path per line. If you run the script from script/main, you can provide relative paths also. For example:
    • ../../requisite/main/22.1.4.csv
    • Sample file when running on Director:
      • /opt/versa/vnms/swagger-utils/requisite/main/22.1.4.csv
    • Sample file when running locally:
      • swagger-scripts/requisite/main/22.1.4.csv
  • Current Director version—The supported Director versions are 22.1.3 and 22.1.4. Press Enter to accept the default version, which is 22.1.4. After you enter the version, the tool displays API endpoints are being extracted from the CSV file while it processes input.
  • Swagger IP address—Enter Releases 23.1 and later Director IP address to get working links immediately, or press Enter to skip and set the IP address later in the HTML report. See Director IP Address for Swagger Links

Example: CSV File Input

The following example uses a sample CSV file with a relative path from the script/main/ directory.

Enter your choice(1, 2, 3 or 4): 2

NOTE:
Use angle brackets '{ }' to define parameter names when specifying the API in the CSV file or on the console.

For example: '/api/config/devices/device/{SDWAN-Controller2}/config/orgs/org-services/{provider-org}'
Here, SDWAN-Controller2 and provider-org represent the device and organization names, respectively.

Please enter the absolute path of the input csv file (A sample file is located at ../../requisite/main/22.1.4.csv):
../../requisite/main/22.1.4.csv

Please enter the current Director version (e.g., 22.1.3 or 22.1.4).
Press Enter to use the default version 22.1.4.
22.1.4

API endpoints are being extracted from the csv file...

Please enter the host or IP address of the >= 23.1 director for Swagger URL generation. Press Enter if you do not want to input
the director IP:
10.192.159.23

Please wait while the output is being generated...

Results are generated as an HTML file in ../../output/output_swagger.html.

Migrate a Single API (Option 3)

To migrate a single API (option 3), respond to the prompts as follows:

  • There is no Director version prompt for Option 3. Enter the Releases 22.1.4 or earlier API path directly.
  • Swagger IP address—Press Enter to skip if you do not have the Releases 23.1 and later Director IP address. The Swagger URL will use the placeholder director-host (for example, https://director-host/swagger-ui/index.html?... ). Replace the director-host placeholder with Releases 23.1 and later Director IP address before opening the link, or re-run and enter the IP address at the prompt. See Director IP Address for Swagger Links, below.
  • The Swagger URL is printed without the port :9182. Use the URL as displayed or add the port number :9182 if Director setup requires it.

For this option, results are printed to the console (not to an HTML report).

Example: Single Appliance API

Many appliance APIs keep the same path in Releases 23.1 and later. The tool provides the Swagger link. Refer to the Appliance Payload Diff document for structural payload changes. See API Difference Documents, above.

Enter your choice(1, 2, 3 or 4): 3

NOTE : Give param names inside angle bracket '{}' while defining the API inside the csv file or console.
For example '/api/config/devices/device/{SDWAN-Controller1}/config/networks/network'. SDWAN-Controller1 is device name

Enter a REST API with version <= 22.1.
/api/config/devices/device/{SDWAN-Controller1}/config/networks/network

Please enter the host or IP address of the >= 23.1 director for generation of swagger link. Press Enter if you do not want to
input the director IP:

The>=23.1 REST API is as follows
/api/config/devices/device/{SDWAN-Controller1}/config/networks/network

Swagger URL is as follows:
https://director-host/swagger-ui/index.html?urls.primaryName=network+-+Appliance+Configuration+API

Example: Single Migrated NMS API

During API migration, NMS APIs under migrated prefixes, such as /api/config/system/ and /api/config/nms/, are mapped to new /vnms paths.

Enter your choice(1, 2, 3 or 4): 3

NOTE : Give param names inside angle bracket '{}' while defining the API inside the csv file or console.
For example '/api/config/devices/device/{SDWAN-Controller1}/config/networks/network'. SDWAN-Controller1 is device name

Enter a REST API with version <= 22.1.
/api/config/system/proxy

Please enter the host or IP address of the >= 23.1 director for generation of swagger link. Press Enter if you do not want to
input the director IP:
10.195.9.11

The>=23.1 REST API is as follows
/vnms/system/proxy

Swagger URL is as follows:
https://10.195.9.11/swagger-ui/index.html?urls.primaryName=Proxy+APIs

Find Swagger Link for a 23.1.1 Version API (Option 4)

Use this option when you already have Releases 23.1 and later API paths and only need the Swagger documentation link. 

To find a Swagger link for a 23.1.1 API (option 3), respond to the prompts as follows:

  • There is no Director version prompt and no mapped API output. The tool only prints the Swagger documentation URL and does not perform migration mapping.
  • Swagger IP address—Press Enter to skip if needed. The Swagger URL uses the placeholder director-host (for example, https://director-host/swagger-ui/index.html?... ). Replace the director-host in the printed URL with Releases 23.1 and later Director IP address before opening the link, or re-run and enter the IP address at the prompt. See Director IP Address for Swagger Links, below.
  • The Swagger URL is printed without the port :9182. Use the URL as displayed or add the port number :9182 if Director setup requires it.

For this option, results are printed to the console (not to an HTML report).

Example: Find Swagger Link for a 23.1.1 Version API

Use this option If you already have an API path for Releases 23.1 and later, and need only the Swagger documentation link. 

Enter your choice(1, 2, 3 or 4): 4

Enter a >=23.1 REST API
For example: '/api/config/devices/device/{SDWAN-Controller2}/config/orgs/org-services/{provider-org}/source-ip-guard'
Here, SDWAN-Controller2 and provider-org represent the device and organization names, respectively.
/api/config/devices/device/{SDWAN-Controller2}/config/orgs/org-services/{provider-org}/source-ip-guard

Please enter the host or IP address of the >= 23.1 director for Swagger URL generation. Press Enter if you do not want to input
the director IP:

Swagger URL is as follows:
https://director-host/swagger-ui/index.html?urls.primaryName=source-ip-guard+-+Appliance+Configuration+API

Director IP Address for Swagger Links

The migration tool asks for the Release 23.1 Director IP address to build Swagger URLs in the report. For example, https://10.195.9.11/swagger-ui/index...s.primaryName=...

If the migration tool prompts for the Director IP address, use any of the following options:

  • Enter the Release 23.1 Director IP address (recommended)With this option, the Swagger URLs are ready to open or copy immediately in the HTML output.
  • Press Enter to skipSwagger URLs contain the placeholder hostname director-host instead of the Director IP address. For example, https://director-host/swagger-ui/
    index.html?urls.primaryName=... This link does not work until the hostname is replaced.

If you skip the prompt to enter the Director IP address, you must update the links after opening the HTML report:

  1. In the browser, open output/output_swagger.html.
  2. In the Enter IP to generate Swagger URL option at the top of the page, enter the 23.1 Director IP address or hostname. For example, 10.195.9.11.
  3. Click Update Link. Each Swagger URL in the table is updated in one step.
  4. Use the copy button (copy) next to a link, or click the updated URL to open Swagger in a web browser.

For Console output (input options 3 and 4), there is no HTML report. If you skipped the Director IP address prompt for these options, manually replace director-host in the printed Swagger URL with 23.1 Director IP address, or re-run the tool and enter the IP address at the prompt.

You can skip the IP address at the console prompt if you do not know the 23.1 Director IP address, or if you want to send the report to someone else to update the Director IP address later.

HTML Report

When you use an access log file or CSV file as input (options 1 and 2), the results are generated in an HTML file named output_swagger.html. You can move this file to your local directory and open the file in any browser to view the output. The report provides a clear, tabular view of API migration details between Director Releases 22.1.4 and earlier and Releases 23.1.1 and later.

The following table lists paths to the report when you run the tool on Director or on a local machine. 

Location Path to HTML Report
Director /opt/versa/vnms/swagger-utils/output/output_swagger.html
Local swagger-scripts/output/output_swagger.html
(relative to extracted tarball root: ../../output/output_swagger.html from script/main/)

The migration tool matches API paths and payloads against its reference data. Incorrect input can produce no match or misleading results. The tool also copies the Appliance_payload_diff.pdf document into the output directory alongside output_swagger.html for appliance payload reference links in the report.

The following table provides descriptions for the columns in the HTML report:

Column Description
S. No Row number
≤ 22.1.4 API Original API path used in Director Releases 22.1.4 and earlier.
≥ 23.1 API Mapped API path in Director Release 23.1.1 and later, or if mapping failed
Swagger URL Direct link to Swagger API documentation for the Releases 23.1.1 and later, or if mapping failed
API Changed
  • Yes—If a payload difference entry exists for the input path, or the API is an appliance API. Review the payload difference link or Appliance_payload_diff.pdf. See API Difference Documents, above.
  • New—If a legacy NMS API mapped to a new path for Releases 23.1.1 and later. For example, the /api/config/system/proxy path mapped to the /vnms/system/proxy path. If the payload difference shows NA, check the Swagger URL.
  • No—Mapped with no payload difference (the payload diff shows NA) and no legacy NMS path migration.
  • Empty—An empty field indicates that mapping failed.

See HTML Report, above.

Payload Diff
  • Clickable JSON payload diff (VNMS APIs with documented changes), PDF link for appliance APIs flagged as changed
  • NA—When mapped without a difference entry, or empty when mapping failed.

The HTML report includes the following interactive features:

  • Update Swagger URLs—If you skipped the Director IP address at the console prompt, use the Enter IP to generate the Swagger URL field at the top of the report. Enter a valid IPv4 address and click Update Link to replace director-host in all Swagger URLs at once. Host names are not accepted by the validator.
  • Copy Swagger URL—Click the Copy button next to any Swagger URL to copy to the clipboard.
  • Filter APIs—Drop-down values: All, Yes, No, or New (filters on the API Changed column only).
  • Exclude API Paths—Hide rows matching comma-separated path fragments (for example, /vnms, /live). Matching is case-insensitive.

Supported Software Information

Releases 23.1.1 and later support all content described in this article.

  • Was this article helpful?