From fbc77fdfdf01055f768cd9e9af9fa7fe07548bd8 Mon Sep 17 00:00:00 2001 From: "Vyacheslav.Sviridov" Date: Thu, 9 Sep 2021 00:06:34 +0600 Subject: [PATCH] persistent command --- CHANGELOG.md | 4 ++++ README.md | 7 +++++++ lib/TopologyBrowser.js | 16 +++++++++++----- lib/inputHandler.js | 2 ++ package.json | 2 +- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02c810f..3a70e1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,3 +5,7 @@ ## 1.0.2a Adding `fdn` command + +## 1.0.3a + +Adding `persistent` command diff --git a/README.md b/README.md index 58c30a8..14a5579 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ Authentication Successful - `up` - navigate up one level - `fdn ` - navigate to FDN - `home` - navigate to root folder +- `persistent` - toggle persistent attributes inclusion - `exit` - logout and exit application Start typing and you see only matches commands to your input. @@ -144,6 +145,12 @@ Return to the root from anywhere ... SubNetwork=ONRM_ROOT_MO> ``` +Go to specific FDN ... + +``` +... Network=ONRM_ROOT_MO,SubNetwork=RNC,MeContext=RNC01> fdn NetworkElement=RBS01 +``` + And logout and exit ... ``` diff --git a/lib/TopologyBrowser.js b/lib/TopologyBrowser.js index 64f4bd0..2b04e76 100644 --- a/lib/TopologyBrowser.js +++ b/lib/TopologyBrowser.js @@ -12,8 +12,8 @@ const requestWrapper = require('../util/requestWrapper') const banner = require('../util/banner') const inputByType = require('../lib/inputValue') -const otherCommands = ['show', 'config', 'up', 'home', 'exit'] -const configCommands = ['commit', 'check', 'end', 'exit'] +const otherCommands = ['show', 'config', 'up', 'home', 'fdn', 'persistent', 'exit'] +const configCommands = ['commit', 'check', 'end', 'persistent', 'exit'] axiosCookieJarSupport(axios) @@ -36,6 +36,7 @@ class TopologyBrowser { this.networkDetails = null this.configSet = [] this.heartBeatInterval = null + this.includeNonPersistent = false this.conn = axios.create({ httpsAgent: new https.Agent({ @@ -126,7 +127,7 @@ class TopologyBrowser { } async show(filter) { - const response = await requestWrapper(async () => this.conn.get(`${this.baseUrl}${this.currentPoId}?includeNonPersistent=false&stringifyLong=true`, { + const response = await requestWrapper(async () => this.conn.get(`${this.baseUrl}${this.currentPoId}?includeNonPersistent=${this.includeNonPersistent}&stringifyLong=true`, { withCredentials: true })) logAttributes(response.data.fdn, response.data.attributes.filter(item => item.key.match(filter))) @@ -144,11 +145,11 @@ class TopologyBrowser { async config(fdn) { this.isConfig = true - const responseA = await requestWrapper(async () => this.conn.get(`${this.baseUrl}${this.currentPoId}?includeNonPersistent=false&stringifyLong=true`, { + const responseA = await requestWrapper(async () => this.conn.get(`${this.baseUrl}${this.currentPoId}?includeNonPersistent=${this.includeNonPersistent}&stringifyLong=true`, { withCredentials: true }), 'Reading Attributes...') const { attributes, namespace, namespaceVersion, neType, neVersion, networkDetails, type} = responseA.data - const responseD = await requestWrapper(async () => this.conn.get(`${this.baseUrl}model/${neType}/${neVersion}/${namespace}/${type}/${namespaceVersion}/attributes?includeNonPersistent=false`, { + const responseD = await requestWrapper(async () => this.conn.get(`${this.baseUrl}model/${neType}/${neVersion}/${namespace}/${type}/${namespaceVersion}/attributes?includeNonPersistent=${this.includeNonPersistent}`, { withCredentials: true }), 'Reading Attributes Data...') this.networkDetails = networkDetails @@ -291,6 +292,11 @@ class TopologyBrowser { return fdn } + persistent() { + this.includeNonPersistent = !this.includeNonPersistent + console.log(`Include Non Persistent Atrributes Set to: ${this.includeNonPersistent}`.yellow) + } + } diff --git a/lib/inputHandler.js b/lib/inputHandler.js index 64ae682..96ce060 100644 --- a/lib/inputHandler.js +++ b/lib/inputHandler.js @@ -63,6 +63,8 @@ async function handleCommand(tplg, fdn, command) { fdn = fdn.split(',', 1)[0] } else if (command === 'description') { tplg.description() + } else if (command === 'persistent') { + tplg.persistent() } else if (command.startsWith('fdn')) { const splitted = command.split(/\s(.+)/) fdn = await tplg.fdn(fdn, splitted[1] ? splitted[1].trim() : '') diff --git a/package.json b/package.json index 1a7a83e..98fb945 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tplg-cli", - "version": "1.0.2a", + "version": "1.0.3a", "description": "This is a cli application to access Ericcson Network Manager (ENM) Topology Browser", "bin": "./bin/tplg-cli.js", "scripts": {