eapi

0.1.0 • Public • Published

node-eAPI

Overview

node.js methods for issuing commands to the Arista EOS API (eAPI).

Requires EOS >= 4.12 and an enabled HTTP API service:

switch1(config)#management api http-commands
switch1(config-mgmt-api-http-cmds)#proto https
switch1(config-mgmt-api-http-cmds)#no shut

Installation

npm install eapi

Usage

Create instance

var eAPI = require('eapi');

var switch1 = new eAPI({
  host: 'switch1',
  proto: 'https',
  port: 443,
  user: 'admin',
  pass: 'admin',
  strict: true
});

Basic commands

eAPI.exec(cmds, callback)

switch1.exec([ 'show version' ], function(err, res) {
  // command output
});

Editing configuration

eAPI.exec([ 'enable', 'configure', ... ], callback)

switch1.exec([
  'enable',
  'configure',
  'interface Et1',
  'switchport mode access',
  'switchport access vlan 10'
], function(err, res) {
  // command output
});

See Arista eAPI documentation for detail.

Notes / Resources

Package Sidebar

Install

npm i eapi

Weekly Downloads

2

Version

0.1.0

License

none

Last publish

Collaborators

  • thwi