Network Intents - Visual Studio Code extension

Getting started with the Visual Studio Code extension for Intent Manager

Introduction

Network Intents provides a very intuitive graphical user interfaces, where users can create, update and execute intent-types and intent instances. This interface provides very broad details to help the user creating new instances, auditing, synchronizing, viewing audit reports, etc. For more details on Network Intents framework capabilities, please read here.

However, users with a developer profile are used to interface with IDEs that facilitate code development and integration, and not to program their code via web browsers. Some situations, like connection issues/timeouts, undesired navigation or refresh of the development window can drive into lose code changes. The purpose of this Visual Studio Code extension for Network Intents is to provide this type of users with a new interface to speed up their code design process/activities.

This activity is community driven, meaning that contributions are expected from anyone with access to the community (bug reporting, code development, etc).

Installation

The visual studio code extension, can be Installed directly from vsCode Marketplace

If you wish to compile the project or modify the code, clone the project repository at Github.com

    • Clone the project.
    • Compile the project and Install the VSIX
npm install .
npm run compile
vsce package

As prerequisite, we support vsCode rel ^1.76.0.

Setup

After successfully installing the extension, you should see in you Explorer > Workspace a new folder called Intent Manager.

For installing the extension, access vsCode Settings (workspace) > Extensions > NOKIA_IM and select Extension Settings form the gear icon. You should see the following attributes to configure:

vsCodeSettings

  • Intent Manager: Ignore Labels This can be used to ignore intent-types that have a specific label in the meta-info. Adding an item will hide those intents within the editor
  • Intent Manager: Log Limit Maximum number of logs to be received from server
  • Intent Manager › Parallel Operations The activates concurrent intent operations
  • Intent Manager: Password : Password of your NSP system.
  • Intent Manager: Port : Port used by WFM.
  • Intent Manager: NSPIP address of your NSP system.
  • Intent Manager: Query Limit Maximum number of intent-types and intents to be received from server
  • Intent Manager: Server Logs Full Stack Include full stack trace in logs
  • Intent Manager: Server Logs Offset Time window for receiving server logs
  • Intent Manager: User Username to access your NSP system.
  • Intent Manager: Timeout Connection timeout in seconds

After modifying these settings, vsCode requires to reload the window. The can be done either closing and reopening vsCode, or by opening the command palette and entering the Developer: Reload Window command

Main functionalities

Creating & Editing Intent-types

With the installation and setup process successfully completed, a new folder "Intent Manager" will appear in the user's workspace.

This folder contains the intent-types (definitions) and intents (instances) folders for all hosted intent-types.

The extension allows to create a new intent-type, clone an existing intent-type, create a new version of an existing intent type, or delete an intent type.

  • To create new: right-click on intent-types folder, select Create intent-type

vsCodeCreateIntentType

Enter the name of the intent-type, the author and select from a list of pre-defined examples

  • To Clone or create a new version, right-click on a particular intent-type folder to see both options.

Clone intent-type

New intent-type version

  • Delete intent-type: right-click and “Delete Permanently option

All operations are executed in the backend using the remote NSO system.

Update Intent-type content

The extension allows to create, delete and update intent-type resources, script, yang, views and meta info.

To create a new resource, right-click on the desired folder (resource/yang/views) and provide a name. For views, there is no need to provide the extension name, while for other resources (.js, .yang) it is required.

To remove an existing file, right-click on the file and delete permanently. Some files (meta, script, schemaform) are blocked from deletion.

To update the file, open it in the editor view, save and vsCode will automatically upload your changes for you.

vscodeIM_editResource

Snippets

vsCode allows the usage of code snippets to help users with the automatic generation of code based on key words (see example below). Snippets should be code fragments that can be easily integrated and reusable.

In this first extension, we include few examples that are documented in the developer portal. However, we expect contributions from anyone on which snippets make sense to be included. This is an open topic, which will be very helpful for developers starting their intent development journey.

vscodeIM_snippets

Managing intents

The user can open intents, edit and save them to the remote NSP server. Also create a local copy of intent instances by selecting and clicking “Download”. Same applies to upload: a user can copy local intent instances and paste them into the IM folder (automatically creating the intents in Network Intents).

The extension shows the network status of the intent, while also the alignment status. It also implements same functionality as Network Intents, by providing access to synchronize, audit, change network state, etc.

The extension provides some visibility of audit results by loading a webview. For a more comprehensive view, the extension provide the right pointer to the specific intent instance in Network Intents.

vscodeIM_IntentCapabilities

Working locally

The extension allows to download intent-types and intents from the server, so the user can continue their developments offline.

To upload any modification, the current restriction is that it can only be done from the meta-info.json file, so the plugin identifies that you are editing an intent-type and not something different.

By clicking on upload, the plugin explores files and folders on the same path and generates the payload to upload to Network Intents. If the intent-type exists, it updates the existing one. Otherwise it creates one from the scratch.

If no name or version appear in the meta-info.json, the plugin will request this from the user.

Local development provides, among other capabilities, access to source control tools already available in vsCode (git). This allows the developers to have their local repository in sync with their source control platform (GitHub, GitLab) and push their latest changes directly into IM.

vscodeIM_uploadLocal

Logs

The extension has the ability to open a link to OpenSearch to pull logs related to a particular intent.

The functionality uses the intent ID (targets) to filter information. However, if this ID is included in other logs, they may be pulled and included in the report.

This currently works with logs exposed with the “log” and “logger” classes.

vscodeIM_logs

Disclaimers

  • As explained in the introduction, this project is community-driven. This means that support is best-effort coming from the community (i.e. anyone with access to the code extension) and contributions from the community are welcome at any time.
  • As such, this tool has not been scale tested and it is meant to help in the developer journey with a limited number of intent-types and instances, but it is not designed to work in a production network setup.
  • The logs features is integrated to help during the development process, but has been tested in few scenarios. If more detailed logs are needed, we recommend to use OpenSearch Logviewer for this.
  • The tool has been tested with 23.4 / 23.8 setups. It is expected to continue working with 23.11 onwards. However, it has not been tested with 22.9 due to the integration of views.
  • As such, old intents that do not contain views could raise the following warning below. This will prevent users from creating new views until it gets resolved.
vscodeIM_warnViews

Contacts

Alejandro Aguado (PLM Automation Frameworks)

Sven Wisotzky (DevEx owner)

On this page