Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Commit

Permalink
persistent command
Browse files Browse the repository at this point in the history
  • Loading branch information
vvsviridov committed Sep 8, 2021
1 parent 30c2aa5 commit fbc77fd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
## 1.0.2a

Adding `fdn` command

## 1.0.3a

Adding `persistent` command
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Authentication Successful
- `up` - navigate up one level
- `fdn <valid 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.
Expand Down Expand Up @@ -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 ...

```
Expand Down
16 changes: 11 additions & 5 deletions lib/TopologyBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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({
Expand Down Expand Up @@ -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)))
Expand All @@ -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
Expand Down Expand Up @@ -291,6 +292,11 @@ class TopologyBrowser {
return fdn
}

persistent() {
this.includeNonPersistent = !this.includeNonPersistent
console.log(`Include Non Persistent Atrributes Set to: ${this.includeNonPersistent}`.yellow)
}

}


Expand Down
2 changes: 2 additions & 0 deletions lib/inputHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() : '')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit fbc77fd

Please sign in to comment.