0.0.3 • Published 6 years ago

octobox v0.0.3

Weekly downloads
2
License
MIT
Repository
bitbucket
Last release
6 years ago

Node.js API

Example throughput test.

import Octobox from "Octobox";
const { endpoint, throughputTest, trafficPair } = new Octobox();

const test = async () => {
  // Create Throughput Test
  const testInput = {
    name: "Basic Test",
    model: "A",
    revision: "1",
    interval: 1.0,
    testDuration: "10",
    trainingTime: 2
  };
  const { id: testId } = await throughputTest.create(testInput);

  // Get the ids of existing endpoints
  const { id: from } = await endpoint.readByAddress("172.20.0.1");
  const { id: to } = await endpoint.readByAddress("172.20.0.2");

  // Create Traffic Pair
  const trafficPairInput = {
    id: testId,
    name: "Traffic",
    from,
    to,
    active: true,
    bitrate: "1G"
  };
  await trafficPair.create(trafficPairInput);

  // Start the test
  await throughputTest.start(testId);
};

test();

Use with Babel node -r babel-register -r babel-polyfill test.js