# viptela

> NodeJS library of Viptela vManage API. > Work in progress, not for production

Latest version **1.0.0** (published 2018-03-27) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install viptela
pnpm add viptela
yarn add viptela
bun add viptela
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-03-27 |
| First published | 2018-03-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 69.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | pvalette06 |

## Links

- npm: https://www.npmjs.com/package/viptela
- npm.io page: https://npm.io/package/viptela

## Dependencies (4)

- [promise](https://npm.io/package/promise.md) ^8.0.1
- [request](https://npm.io/package/request.md) ^2.83.0
- [json-templater](https://npm.io/package/json-templater.md) ^1.2.0
- [request-promise](https://npm.io/package/request-promise.md) ^4.2.2

## Recent versions

- 1.0.0 (latest) — 2018-03-27

## README

# NodeJS for Viptela 
NodeJS library of Viptela vManage API.  
> Work in progress, not for production
 
 
### About
[Viptela](http://viptela.com/) is an SD-WAN vendor with a solid rest API. 
The API is documented on the vManage host and can be found by going to 
`https://vmanage-hostname:port/apidocs`. Additional API documentation can be 
found on the viptela site support portal `http://viptela.com/support/` (login required)


### Installation
```npm install node-viptela
```
 
### connect to vManage API
vManage API use a cookie authentication and the library is based on *request*.
So first, import required libraries

 
    var promise = require('promise');
    var request = require('request-promise');
 
and create a structure for the authentication
     
    let session = 
    {
    		host: <hostname>,
    		 j : request.jar(),
    'user': <login>,
    'pass': <password>'
    };

last step
 
    var session =ViptelaLogins(session);
     
    	session().login()
    	.then(function () 
    	{
    		console.log("connected");
			<YOUR CODE>
    	})
    	.catch(function (err) 
    	{
    		console.log(JSON.stringify( err , null, "\t"));
    	}


### select a Tenant
For Multi-Tenant instances, you have to select the tenant before using methods such as **getDevices** etc...


    var tenant =ViptelaTenant(session);
    tenant().selectTenant(<TENANT ID>)
    	.then(function (sessionID) 
    	{
    	 	session.sessionId = sessionID.VSessionId;	
    	})
    	.catch(function (err) 
    	{
    		console.log(JSON.stringify( err , null, "\t"));
    	})

It is very impostant to save the VSessionId in the session object.

### List Devices
For listing Viptela devices, the method is simple 

First, load the library on the top of you file

    var ViptelaDevices = require("./lib/devices")


next steps are 

    var devices =  ViptelaDevices(auth);
    devices().findDevisesMap({})
    	.then(function (items) 
    	{
			//device list is in the data attribute
    		console.log(JSON.stringify( items.data , null, "\t")  );
    	})
    	.catch(function (err) 
    	{
    		console.log(JSON.stringify( err , null, "\t"));
    	});; 	


### Functions of  **ViptelaDevices**

**findvEdges()**									/system/device/vedges
**findControllers()**								/system/device/controllers
**findDevices()**									/dataservice/device
**findDevisesMap()**								/dataservice/group/map/devices
**findDeviceStatus()**								/dataservice/device/status
**getDeviceStatus()**								/dataservice/device/devicestatus
**getDeviceHardwareStatus(<deviceId>)**				/dataservice/hardware/status/summary?deviceId=*<deviceId>*
**findDeviceInfo()**								/dataservice/device/system/info
**getDeviceInfo(<deviceId>)**						/dataservice/device/system/info?deviceId=*<deviceId>*
**getDevice()**										/dataservice/device/config
**findReachableDevices()**							/dataservice/device/reachable
**findUnreachableDevices()**						/dataservice/device/unreachable
**findDeviceStates(<stateDataType>)**				/data/device/state/*<stateDataType>*
**getDeviceStatesFields(<stateDataType>)**			/data/device/state/*<stateDataType>*/fields
**getDeviceStatesQuery(<stateDataType>)	**			/data/device/state/*<stateDataType>*/query
**findHardwareHeathSummary()**						/device/hardwarehealth/summary
**findHardwareHeath()**								/dataservice/device/hardwarehealth/detail
**findTLOC()**										/dataservice/device/tlocutil
**findTLOCDetails()**								/dataservice/device/tlocutil/detail
**getTLOCStatus()**									/dataservice/device/tloc
**findCounters()**									/dataservice/device/counters
**getCounters(<deviceId>)**							/dataservice/device/counters?deviceId=*<deviceId>*

---
_Source: https://npm.io/package/viptela · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
