npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@itentialopensource/adapter-mockdevice

v2.1.3

Published

mock implementation of device broker

Downloads

337

Readme

Adapter for Mockdevice

Overview

This adapter is a mock implementation of device broker. It should be used if there is a need of mock devices for testing purposes.

Getting Started

These instructions will help you get a copy of the project on your local machine for development and testing. Reading this section is also helpful for deployments as it provides you with pertinent information on prerequisites and properties.

Prerequisites

The following is a list of required packages for installation on the system the adapter will run on:

Node.js
npm
Git

How to Install

  1. Set up the name space location in your IAP node_modules.
cd /opt/pronghorn/current/node_modules (* could be in a different place)
if the @itentialopensource directory does not exist, create it:
    mkdir @itentialopensource
  1. Clone/unzip/tar the adapter into your IAP environment.
cd \@itentialopensource
git clone [email protected]:\@itentialopensource/adapters/adapter-mockdevice
or
unzip adapter-mockdevice.zip
or
tar -xvf adapter-mockdevice.tar
  1. Run the adapter install script.
cd adapter-mockdevice
npm run adapter:install
  1. Restart IAP
systemctl restart pronghorn
  1. Change the adapter service instance configuration (host, port, credentials, etc) in IAP Admin Essentials GUI

npm run adapter:install can be dependent on where the adapter is installed and on the version of IAP so it is subject to fail. If this happens you can replace step 3-5 above with these:

  1. Install adapter dependencies and check the adapter.
cd adapter-mockdevice
npm run install
npm run lint:errors
npm run test
  1. Restart IAP
systemctl restart pronghorn
  1. Create an adapter service instance configuration in IAP Admin Essentials GUI

Adapter Properties and Descriptions

This section provides sample properties that can be used to configure the adpater in IAP.

{
  "name": "mockDevice",
  "model": "@itential/adapter-mockdevice",
  "type": "Adapter",
  "properties": {
    "id": "mockDevice",
    "type": "MockDevice",
    "brokers": [
      "device"
    ],
    "groups": [],
    "properties": {}
  },
  "isEncrypted": true,
  "loggerProps": {
    "description": "Logging",
    "log_max_files": 10,
    "log_max_file_size": 10485760,
    "log_level": "warn",
    "log_directory": "/opt/itential/logs",
    "log_filename": "mockDevice.log",
    "log_timezone_offset": 0,
    "console_level": "warn",
    "syslog": {
      "level": "warning",
      "host": "127.0.0.1",
      "port": 514,
      "protocol": "udp4",
      "facility": "local0",
      "type": "BSD",
      "path": "",
      "pid": "process.pid",
      "localhost": "",
      "app_name": "",
      "eol": ""
    }
  },
  "virtual": false
}

Configuring MongoDB

Inside of your pronghorn database, a new collection will need to be created called mock_devices. Inside of this collection, all the mock adapters that are to be used will live. Two example devices are listed below:

{
    "_id" : ObjectId("643ebeb47a16b404b2cd9ffe"),
    "name" : "nx03-atl",
    "authgroup" : "admin",
    "ipaddress" : "172.20.100.226",
    "address" : "172.20.100.226",
    "port" : 22.0,
    "device-type" : "cli",
    "ostype" : "cisco-nx-cli-5.22",
    "ned" : "cisco-nx-cli-5.22",
    "admin" : true,
    "tenant" : "",
    "chosenAdapter" : "mockAdapter",
    "origin" : "mockAdapter",
    "host" : "mockAdapter",
    "online" : "true",
    "deleted" : false,
    "actions" : [
        "addDevice",
        "deleteDevice",
        "getConfig",
        "getDevice",
        "getDevicesFiltered",
        "isAlive",
        "loadConfig",
        "restoreConfig",
        "runCommand",
        "setConfig"
    ]
}
{
    "_id" : ObjectId("643ebed97a16b404b2cd9fff"),
    "name" : "Cisco-IOS-Cypress",
    "authgroup" : "admin",
    "ipaddress" : "172.20.100.226",
    "address" : "172.20.100.226",
    "port" : 22.0,
    "device-type" : "cli",
    "ostype" : "cisco-nx-cli-5.22",
    "ned" : "cisco-nx-cli-5.22",
    "admin" : true,
    "tenant" : "",
    "chosenAdapter" : "mockAdapter",
    "origin" : "mockAdapter",
    "host" : "mockAdapter",
    "online" : "true",
    "deleted" : false,
    "actions" : [
        "addDevice",
        "deleteDevice",
        "getConfig",
        "getDevice",
        "getDevicesFiltered",
        "isAlive",
        "loadConfig",
        "restoreConfig",
        "runCommand",
        "setConfig"
    ]
}