vipteladeprecated

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

Usage no npm install needed!

<script type="module">
  import viptela from 'https://cdn.skypack.dev/viptela';
</script>

README

NodeJS for Viptela

NodeJS library of Viptela vManage API.

Work in progress, not for production

About

Viptela 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

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()/dataservice/hardware/status/summary?deviceId= findDeviceInfo()/dataservice/device/system/info getDeviceInfo()/dataservice/device/system/info?deviceId= getDevice()/dataservice/device/config findReachableDevices()/dataservice/device/reachable findUnreachableDevices()/dataservice/device/unreachable findDeviceStates()/data/device/state/ getDeviceStatesFields()/data/device/state//fields getDeviceStatesQuery()**/data/device/state//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()/dataservice/device/counters?deviceId=