Giter Club home page Giter Club logo

xenajs's Introduction

XenaJS - WIP Build Status

A NodeJS client library for Xena Networks' XenaScripting API

XenaJS (NPM: xenascripting) provides a simple, promise-based API for controlling and monitoring Xena Networks devices using their XenaScripting API.

Usage

const Xena = require('xenascripting');

const xc1 = new Xena('10.0.0.151');
const xc2 = new Xena('10.0.0.152', {
  user: 'Michael',      // Display name for your session (default: "XenaScripting")
  password: 'password', // Logon password for chassis
  autoreserve: true,    // Automatically reserves all resources (default: false)
  autorelinquish: true, // Automatically relinquish resources reserved by others (default: false),
  refresh: 60,          // Seconds to cache chassis info for (default: 60 seconds) 
  debug: console        // Object to log debug messages to (default: none)
});

xc2.setTimeout(60);     // Connection timeout in seconds

xc2.connect()
  .then((chassis) => {

    // Chassis info
    console.log(chassis.name);          // Chassis name                             (String)
    console.log(chassis.description);   // Chassis description                      (String)
    console.log(chassis.password);      // Chassis password                         (String)
    console.log(chassis.model);         // Chassis model                            (String)
    console.log(chassis.serial);        // Chassis serial                           (String)
    console.log(chassis.version);       // Chassis firmware version                 (String)
    console.log(chassis.driver);        // Chassis PCI driver version               (String)
    console.log(chassis.capabilities);  // Chassis capabilities                     (Array)
    console.log()

    // Reservation
    console.log(chassis.mine);          // Chassis reserved by you                  (Boolean)
    console.log(chassis.reservation);   // Username of reservation, or false.       (String | false)
    chassis.relinquish();               // Kicks the previous user off the chassis. (Promise)
    chassis.reserve();                  // Reserves chassis for this session.       (Promise)

    // Sessions
    chassis.sessions.map((session) => {

      console.log(session.index);       // Session ID                               (Number)
      console.log(session.type);        // "Manager" or "Script"                    (String)
      console.log(session.address);     // Client IP address                        (String)
      console.log(session.user);        // Session display name                     (String)
      console.log(session.ops);         // Count of session operations              (Number)
      console.log(session.rx);          // Session bytes to chassis                 (Number)
      console.log(session.tx);          // Session bytes from chassis               (Number)
    
    });

    /* WIP */

    // Modules
    chassis.modules.map((module) => {



      module.ports.map((port) => {

        console.log(port.errors); // from C_PORTERRORS if need be

      })

    })

  });

xenajs's People

Contributors

gdyr avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.