Skip to content

telstra/Programmable-Network-SDK-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting started

Telstra Programmable Network is a self-provisioning platform that allows its users to create on-demand connectivity services between multiple end-points and add various network functions to those services. Programmable Network enables to connectivity to a global ecosystem of networking services as well as public and private cloud services. Once you are connected to the platform on one or more POPs (points of presence), you can start creating those services based on the use case that you want to accomplish. The Programmable Network API is available to all customers who have registered to use the Programmable Network. To register, please contact your account representative.

How to Build

The generated SDK relies on Node Package Manager (NPM) being available to resolve dependencies. If you don't already have NPM installed, please go ahead and follow instructions to install NPM from here. The SDK also requires Node to be installed. If Node isn't already installed, please install it from here

NPM is installed by default when Node is installed

To check if node and npm have been successfully installed, write the following commands in command prompt:

  • node --version
  • npm -version

Version Check

Now use npm to resolve all dependencies by running the following command in the root directory (of the SDK folder):

npm install

Resolve Dependencies

Resolve Dependencies

This will install all dependencies in the node_modules folder.

Once dependencies are resolved, you will need to move the folder TelstraProgrammableNetworkAPILib in to your node_modules folder.

How to Use

The following section explains how to use the library in a new project.

1. Open Project Folder

Open an IDE/Text Editor for JavaScript like Sublime Text. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.

Click on File and select Open Folder.

Open Folder

Select the folder of your SDK and click on Select Folder to open it up in Sublime Text. The folder will become visible in the bar on the left.

Open Project

2. Creating a Test File

Now right click on the folder name and select the New File option to create a new test file. Save it as index.js Now import the generated NodeJS library using the following lines of code:

var lib = require('lib');

Save changes.

Create new file

Save new file

3. Running The Test File

To run the index.js file, open up the command prompt and navigate to the Path where the SDK folder resides. Type the following command to run the file:

node index.js

Run file

How to Test

These tests use Mocha framework for testing, coupled with Chai for assertions. These dependencies need to be installed for tests to run. Tests can be run in a number of ways:

Method 1 (Run all tests)

  1. Navigate to the root directory of the SDK folder from command prompt.
  2. Type mocha --recursive to run all the tests.

Method 2 (Run all tests)

  1. Navigate to the ../test/Controllers/ directory from command prompt.
  2. Type mocha * to run all the tests.

Method 3 (Run specific controller's tests)

  1. Navigate to the ../test/Controllers/ directory from command prompt.
  2. Type mocha Telstra Programmable Network APIController to run all the tests in that controller file.

To increase mocha's default timeout, you can change the TEST_TIMEOUT parameter's value in TestBootstrap.js.

Run Tests

Initialization

API client can be initialized as following:

const lib = require('lib');

Class Reference

List of Controllers

Class: AuthenticationController

Get singleton instance

The singleton instance of the AuthenticationController class can be accessed from the API Client.

var controller = lib.AuthenticationController;

Method: get100AuthValidatetokenGet

Tags: Skips Authentication

Validate the authentication token and get information about the user (roles, permissions, etc.)

function get100AuthValidatetokenGet(callback)

Example Usage

    controller.get100AuthValidatetokenGet(function(error, response, context) {

    
    });

Method: create100AuthGeneratetokenPost

Tags: Skips Authentication

Create an authentication token

function create100AuthGeneratetokenPost(grantType, username, password, callback)

Parameters

Parameter Tags Description
grantType Required TODO: Add a parameter description
username Required TODO: Add a parameter description
password Required TODO: Add a parameter description

Example Usage

    var grantType = 'password';
    var username = 'username';
    var password = 'password';

    controller.create100AuthGeneratetokenPost(grantType, username, password, function(error, response, context) {

    
    });

Errors

Error Code Error Description
412 Provided authorization grant is invalid

Back to List of Controllers

Class: TopologiesController

Get singleton instance

The singleton instance of the TopologiesController class can be accessed from the API Client.

var controller = lib.TopologiesController;

Method: deleteTtms100TopologyTagByTopotaguuidDelete

Tags: Skips Authentication

Delete a topology tag

function deleteTtms100TopologyTagByTopotaguuidDelete(topotaguuid, callback)

Parameters

Parameter Tags Description
topotaguuid Required Unique identifier representing a specific topology tag

Example Usage

    var topotaguuid = 'topotaguuid';

    controller.deleteTtms100TopologyTagByTopotaguuidDelete(topotaguuid, function(error, response, context) {

    
    });

Method: getTtms100TopologyTagByTopotaguuidGet

Tags: Skips Authentication

Get information about the specified topology tag

function getTtms100TopologyTagByTopotaguuidGet(topotaguuid, callback)

Parameters

Parameter Tags Description
topotaguuid Required Unique identifier representing a specific topology tag

Example Usage

    var topotaguuid = 'topotaguuid';

    controller.getTtms100TopologyTagByTopotaguuidGet(topotaguuid, function(error, response, context) {

    
    });

Method: createTtms100TopologyTagPost

Tags: Skips Authentication

Create a named topology tag

function createTtms100TopologyTagPost(body, callback)

Parameters

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

    var body = new Ttms100TopologyTagRequest({"key":"value"});

    controller.createTtms100TopologyTagPost(body, function(error, response, context) {

    
    });

Method: getTtms100TopologyTagGet

Tags: Skips Authentication

List all topology tags

function getTtms100TopologyTagGet(callback)

Example Usage

    controller.getTtms100TopologyTagGet(function(error, response, context) {

    
    });

Method: getTtms100TopologyTagObjectsByTopotaguuidGet

Tags: Skips Authentication

List all objects (Endpoints, Links, VPorts, etc.) associated with the topology tag.

function getTtms100TopologyTagObjectsByTopotaguuidGet(topotaguuid, callback)

Parameters

Parameter Tags Description
topotaguuid Required Unique identifier representing a specific topology tag

Example Usage

    var topotaguuid = 'topotaguuid';

    controller.getTtms100TopologyTagObjectsByTopotaguuidGet(topotaguuid, function(error, response, context) {

    
    });

Method: updateTtms100TopologyTagByTopotaguuidPut

Tags: Skips Authentication

Update a topology tag's name and/or description

function updateTtms100TopologyTagByTopotaguuidPut(topotaguuid, body, callback)

Parameters

Parameter Tags Description
topotaguuid Required Unique identifier representing a specific topology tag
body Optional TODO: Add a parameter description

Example Usage

    var topotaguuid = 'topotaguuid';
    var body = new Ttms100TopologyTagRequest({"key":"value"});

    controller.updateTtms100TopologyTagByTopotaguuidPut(topotaguuid, body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: VnfsController

Get singleton instance

The singleton instance of the VnfsController class can be accessed from the API Client.

var controller = lib.VnfsController;

Method: get100MarketplaceImageGet

Tags: Skips Authentication

List images in the Marketplace

function get100MarketplaceImageGet(callback)

Example Usage

    controller.get100MarketplaceImageGet(function(error, response, context) {

    
    });

Back to List of Controllers

Class: VportsController

Get singleton instance

The singleton instance of the VportsController class can be accessed from the API Client.

var controller = lib.VportsController;

Method: get100InventoryVportByVportuuidGet

Tags: Skips Authentication

Get information about the specified VPort

function get100InventoryVportByVportuuidGet(vportuuid, callback)

Parameters

Parameter Tags Description
vportuuid Required Unique identifier representing a specific virtual port

Example Usage

    var vportuuid = 'vportuuid';

    controller.get100InventoryVportByVportuuidGet(vportuuid, function(error, response, context) {

    
    });

Method: create100InventoryRegularvportPost

Tags: Skips Authentication

Create VPort representing a VLAN on a Physical Ethernet Port

function create100InventoryRegularvportPost(body, callback)

Parameters

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

    var body = new M100InventoryRegularvportRequest({"key":"value"});

    controller.create100InventoryRegularvportPost(body, function(error, response, context) {

    
    });

Method: create100InventoryVnfVportPost

Tags: Skips Authentication

Create VNF VPort

function create100InventoryVnfVportPost(body, callback)

Parameters

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

    var body = new M100InventoryVnfVportRequest({"key":"value"});

    controller.create100InventoryVnfVportPost(body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: LinksController

Get singleton instance

The singleton instance of the LinksController class can be accessed from the API Client.

var controller = lib.LinksController;

Method: get100InventoryLinksByLinkidGet

Tags: Skips Authentication

Get details of specified link

function get100InventoryLinksByLinkidGet(linkid, callback)

Parameters

Parameter Tags Description
linkid Required Unique identifier representing a specific link

Example Usage

    var linkid = 'linkid';

    controller.get100InventoryLinksByLinkidGet(linkid, function(error, response, context) {

    
    });

Method: get100InventoryLinksHistoryByLinkidGet

Tags: Skips Authentication

Get Link history

function get100InventoryLinksHistoryByLinkidGet(linkid, callback)

Parameters

Parameter Tags Description
linkid Required Unique identifier representing a specific link

Example Usage

    var linkid = 'linkid';

    controller.get100InventoryLinksHistoryByLinkidGet(linkid, function(error, response, context) {

    
    });

Method: get100InventoryLinksCustomerByCustomeruuidGet

Tags: Skips Authentication

Get active Links

function get100InventoryLinksCustomerByCustomeruuidGet(customeruuid, callback)

Parameters

Parameter Tags Description
customeruuid Required Unique identifier representing a specific customer

Example Usage

    var customeruuid = 'customeruuid';

    controller.get100InventoryLinksCustomerByCustomeruuidGet(customeruuid, function(error, response, context) {

    
    });

Method: create100InventoryLinkPost

Tags: Skips Authentication

Create Link and initial Contract

function create100InventoryLinkPost(body, callback)

Parameters

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

    var body = new M100InventoryLinkRequest({"key":"value"});

    controller.create100InventoryLinkPost(body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: EndpointsController

Get singleton instance

The singleton instance of the EndpointsController class can be accessed from the API Client.

var controller = lib.EndpointsController;

Method: create100InventoryRegularendpointPost

Tags: Skips Authentication

Create Physical (Port) Endpoint

function create100InventoryRegularendpointPost(body, callback)

Parameters

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

    var body = new M100InventoryRegularendpointRequest({"key":"value"});

    controller.create100InventoryRegularendpointPost(body, function(error, response, context) {

    
    });

Method: create100InventoryVnfendpointPost

Tags: Skips Authentication

Create VNF Endpoint

function create100InventoryVnfendpointPost(body, callback)

Parameters

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

    var body = new M100InventoryVnfendpointRequest({"key":"value"});

    controller.create100InventoryVnfendpointPost(body, function(error, response, context) {

    
    });

Method: createEis100EndpointsAssignTopologyTagByEndpointuuidPost

Tags: Skips Authentication

Assign a Topology Tag to an Endpoint

function createEis100EndpointsAssignTopologyTagByEndpointuuidPost(endpointuuid, body, callback)

Parameters

Parameter Tags Description
endpointuuid Required Unique identifier representing a specific endpoint
body Optional TODO: Add a parameter description

Example Usage

    var endpointuuid = 'endpointuuid';
    var body = new Eis100EndpointsAssignTopologyTagRequest({"key":"value"});

    controller.createEis100EndpointsAssignTopologyTagByEndpointuuidPost(endpointuuid, body, function(error, response, context) {

    
    });

Method: get100InventoryEndpointByEndpointuuidGet

Tags: Skips Authentication

Get information about the specified endpoint

function get100InventoryEndpointByEndpointuuidGet(endpointuuid, callback)

Parameters

Parameter Tags Description
endpointuuid Required Unique identifier representing a specific endpoint

Example Usage

    var endpointuuid = 'endpointuuid';

    controller.get100InventoryEndpointByEndpointuuidGet(endpointuuid, function(error, response, context) {

    
    });

Method: get100InventoryEndpointsCustomeruuidByCustomeruuidGet

Tags: Skips Authentication

Get list of endpoints for a customer

function get100InventoryEndpointsCustomeruuidByCustomeruuidGet(customeruuid, callback)

Parameters

Parameter Tags Description
customeruuid Required Unique identifier representing a specific customer

Example Usage

    var customeruuid = 'customeruuid';

    controller.get100InventoryEndpointsCustomeruuidByCustomeruuidGet(customeruuid, function(error, response, context) {

    
    });

Back to List of Controllers

Class: CustomersController

Get singleton instance

The singleton instance of the CustomersController class can be accessed from the API Client.

var controller = lib.CustomersController;

Method: get100AccountByCustomeruuidGet

Tags: Skips Authentication

Get the account information for the specified customer

function get100AccountByCustomeruuidGet(customeruuid, callback)

Parameters

Parameter Tags Description
customeruuid Required Unique identifier representing a specific customer

Example Usage

    var customeruuid = 'customeruuid';

    controller.get100AccountByCustomeruuidGet(customeruuid, function(error, response, context) {

    
    });

Errors

Error Code Error Description
401 Authorization Failed

Method: get100AccountUserByCustomeruuidGet

Tags: Skips Authentication

List all users associated with the specified customer

function get100AccountUserByCustomeruuidGet(customeruuid, callback)

Parameters

Parameter Tags Description
customeruuid Required Unique identifier representing a specific customer

Example Usage

    var customeruuid = 'customeruuid';

    controller.get100AccountUserByCustomeruuidGet(customeruuid, function(error, response, context) {

    
    });

Back to List of Controllers

Class: ContractsController

Get singleton instance

The singleton instance of the ContractsController class can be accessed from the API Client.

var controller = lib.ContractsController;

Method: create100InventoryLinksContractByLinkidPost

Tags: Skips Authentication

Create new Contract on specified link

function create100InventoryLinksContractByLinkidPost(linkid, body, callback)

Parameters

Parameter Tags Description
linkid Required Unique identifier representing a specific link
body Optional TODO: Add a parameter description

Example Usage

    var linkid = 'linkid';
    var body = new M100InventoryLinksContractRequest37({"key":"value"});

    controller.create100InventoryLinksContractByLinkidPost(linkid, body, function(error, response, context) {

    
    });

Method: update100InventoryLinksContractByLinkidAndContractidPut

Tags: Skips Authentication

Update active Contract by ContractID

function update100InventoryLinksContractByLinkidAndContractidPut(linkid, contractid, body, callback)

Parameters

Parameter Tags Description
linkid Required Unique identifier representing a specific link
contractid Required Unique identifier representing a specific contract
body Optional TODO: Add a parameter description

Example Usage

    var linkid = 'linkid';
    var contractid = 'contractid';
    var body = new M100InventoryLinksContractRequest({"key":"value"});

    controller.update100InventoryLinksContractByLinkidAndContractidPut(linkid, contractid, body, function(error, response, context) {

    
    });

Method: get100InventoryLinksContractByLinkidAndContractidGet

Tags: Skips Authentication

Get active Contract by ContractID

function get100InventoryLinksContractByLinkidAndContractidGet(linkid, contractid, callback)

Parameters

Parameter Tags Description
linkid Required Unique identifier representing a specific link
contractid Required Unique identifier representing a specific contract

Example Usage

    var linkid = 'linkid';
    var contractid = 'contractid';

    controller.get100InventoryLinksContractByLinkidAndContractidGet(linkid, contractid, function(error, response, context) {

    
    });

Back to List of Controllers

Class: DatacentresController

Get singleton instance

The singleton instance of the DatacentresController class can be accessed from the API Client.

var controller = lib.DatacentresController;

Method: get100InventoryDatacentersGet

Tags: Skips Authentication

Get list of all the data centers

function get100InventoryDatacentersGet(callback)

Example Usage

    controller.get100InventoryDatacentersGet(function(error, response, context) {

    
    });

Errors

Error Code Error Description
400 Request is not correctly formatted
401 Missing Token
403 Authorization Failed
404 Specified object cannot be found
405 Method Not Allowed
409 Status onflict
422 Request is invalid
0 Backend Error

Back to List of Controllers

Releases

No releases published

Packages

No packages published