@itentialopensource/adapter-nokia_nsp_sdn
Version:
This adapter integrates with system described as: networkServicesPlatformRestApi-V4.
1,662 lines (1,601 loc) • 527 kB
JavaScript
/* @copyright Itential, LLC 2019 (pre-modifications) */
// Set globals
/* global describe it log pronghornProps */
/* eslint no-unused-vars: warn */
/* eslint no-underscore-dangle: warn */
/* eslint import/no-dynamic-require:warn */
// include required items for testing & logging
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const util = require('util');
const mocha = require('mocha');
const winston = require('winston');
const { expect } = require('chai');
const { use } = require('chai');
const td = require('testdouble');
const log = require('../../utils/logger');
const anything = td.matchers.anything();
// stub and attemptTimeout are used throughout the code so set them here
const isRapidFail = false;
const isSaveMockData = false;
// read in the properties from the sampleProperties files
let adaptdir = __dirname;
if (adaptdir.endsWith('/test/integration')) {
adaptdir = adaptdir.substring(0, adaptdir.length - 17);
} else if (adaptdir.endsWith('/test/unit')) {
adaptdir = adaptdir.substring(0, adaptdir.length - 10);
}
const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
// these variables can be changed to run in integrated mode so easier to set them here
// always check these in with bogus data!!!
samProps.stub = true;
// uncomment if connecting
// samProps.host = 'replace.hostorip.here';
// samProps.authentication.username = 'username';
// samProps.authentication.password = 'password';
// samProps.authentication.token = 'password';
// samProps.protocol = 'http';
// samProps.port = 80;
// samProps.ssl.enabled = false;
// samProps.ssl.accept_invalid_cert = false;
if (samProps.request.attempt_timeout < 30000) {
samProps.request.attempt_timeout = 30000;
}
samProps.devicebroker.enabled = true;
const attemptTimeout = samProps.request.attempt_timeout;
const { stub } = samProps;
// these are the adapter properties. You generally should not need to alter
// any of these after they are initially set up
global.pronghornProps = {
pathProps: {
encrypted: false
},
adapterProps: {
adapters: [{
id: 'Test-nokia_nsp_sdn',
type: 'NokiaNSPSDN',
properties: samProps
}]
}
};
global.$HOME = `${__dirname}/../..`;
/**
* Runs the common asserts for test
*/
function runCommonAsserts(data, error) {
assert.equal(undefined, error);
assert.notEqual(undefined, data);
assert.notEqual(null, data);
assert.notEqual(undefined, data.response);
assert.notEqual(null, data.response);
}
/**
* Runs the error asserts for the test
*/
function runErrorAsserts(data, error, code, origin, displayStr) {
assert.equal(null, data);
assert.notEqual(undefined, error);
assert.notEqual(null, error);
assert.notEqual(undefined, error.IAPerror);
assert.notEqual(null, error.IAPerror);
assert.notEqual(undefined, error.IAPerror.displayString);
assert.notEqual(null, error.IAPerror.displayString);
assert.equal(code, error.icode);
assert.equal(origin, error.IAPerror.origin);
assert.equal(displayStr, error.IAPerror.displayString);
}
/**
* @function saveMockData
* Attempts to take data from responses and place them in MockDataFiles to help create Mockdata.
* Note, this was built based on entity file structure for Adapter-Engine 1.6.x
* @param {string} entityName - Name of the entity saving mock data for
* @param {string} actionName - Name of the action saving mock data for
* @param {string} descriptor - Something to describe this test (used as a type)
* @param {string or object} responseData - The data to put in the mock file.
*/
function saveMockData(entityName, actionName, descriptor, responseData) {
// do not need to save mockdata if we are running in stub mode (already has mock data) or if told not to save
if (stub || !isSaveMockData) {
return false;
}
// must have a response in order to store the response
if (responseData && responseData.response) {
let data = responseData.response;
// if there was a raw response that one is better as it is untranslated
if (responseData.raw) {
data = responseData.raw;
try {
const temp = JSON.parse(data);
data = temp;
} catch (pex) {
// do not care if it did not parse as we will just use data
}
}
try {
const base = path.join(__dirname, `../../entities/${entityName}/`);
const mockdatafolder = 'mockdatafiles';
const filename = `mockdatafiles/${actionName}-${descriptor}.json`;
if (!fs.existsSync(base + mockdatafolder)) {
fs.mkdirSync(base + mockdatafolder);
}
// write the data we retrieved
fs.writeFile(base + filename, JSON.stringify(data, null, 2), 'utf8', (errWritingMock) => {
if (errWritingMock) throw errWritingMock;
// update the action file to reflect the changes. Note: We're replacing the default object for now!
fs.readFile(`${base}action.json`, (errRead, content) => {
if (errRead) throw errRead;
// parse the action file into JSON
const parsedJson = JSON.parse(content);
// The object update we'll write in.
const responseObj = {
type: descriptor,
key: '',
mockFile: filename
};
// get the object for method we're trying to change.
const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
// if the method was not found - should never happen but...
if (!currentMethodAction) {
throw Error('Can\'t find an action for this method in the provided entity.');
}
// if there is a response object, we want to replace the Response object. Otherwise we'll create one.
const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
// Add the action responseObj back into the array of response objects.
if (!actionResponseObj) {
// if there is a default response object, we want to get the key.
const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
// save the default key into the new response object
if (defaultResponseObj) {
responseObj.key = defaultResponseObj.key;
}
// save the new response object
currentMethodAction.responseObjects = [responseObj];
} else {
// update the location of the mock data file
actionResponseObj.mockFile = responseObj.mockFile;
}
// Save results
fs.writeFile(`${base}action.json`, JSON.stringify(parsedJson, null, 2), (err) => {
if (err) throw err;
});
});
});
} catch (e) {
log.debug(`Failed to save mock data for ${actionName}. ${e.message}`);
return false;
}
}
// no response to save
log.debug(`No data passed to save into mockdata for ${actionName}`);
return false;
}
// require the adapter that we are going to be using
const NokiaNSPSDN = require('../../adapter');
// begin the testing - these should be pretty well defined between the describe and the it!
describe('[integration] nokia_nsp_sdn Adapter Test', () => {
describe('NokiaNSPSDN Class Tests', () => {
const a = new NokiaNSPSDN(
pronghornProps.adapterProps.adapters[0].id,
pronghornProps.adapterProps.adapters[0].properties
);
if (isRapidFail) {
const state = {};
state.passed = true;
mocha.afterEach(function x() {
state.passed = state.passed
&& (this.currentTest.state === 'passed');
});
mocha.beforeEach(function x() {
if (!state.passed) {
return this.currentTest.skip();
}
return true;
});
}
describe('#class instance created', () => {
it('should be a class with properties', (done) => {
try {
assert.notEqual(null, a);
assert.notEqual(undefined, a);
const checkId = global.pronghornProps.adapterProps.adapters[0].id;
assert.equal(checkId, a.id);
assert.notEqual(null, a.allProps);
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
assert.equal(check, a.healthcheckType);
done();
} catch (error) {
log.error(`Test Failure: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
describe('#connect', () => {
it('should get connected - no healthcheck', (done) => {
try {
a.healthcheckType = 'none';
a.connect();
try {
assert.equal(true, a.alive);
done();
} catch (error) {
log.error(`Test Failure: ${error}`);
done(error);
}
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
});
it('should get connected - startup healthcheck', (done) => {
try {
a.healthcheckType = 'startup';
a.connect();
try {
assert.equal(true, a.alive);
done();
} catch (error) {
log.error(`Test Failure: ${error}`);
done(error);
}
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
});
});
describe('#healthCheck', () => {
it('should be healthy', (done) => {
try {
a.healthCheck(null, (data) => {
try {
assert.equal(true, a.healthy);
saveMockData('system', 'healthcheck', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
// broker tests
describe('#getDevicesFiltered - errors', () => {
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
try {
const opts = {
filter: {
name: 'deviceName'
}
};
a.getDevicesFiltered(opts, (data, error) => {
try {
if (stub) {
if (samProps.devicebroker.getDevicesFiltered[0].handleFailure === 'ignore') {
assert.equal(null, error);
assert.notEqual(undefined, data);
assert.notEqual(null, data);
assert.equal(0, data.total);
assert.equal(0, data.list.length);
} else {
const displayE = 'Error 400 received on request';
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_sdn-connectorRest-handleEndResponse', displayE);
}
} else {
runCommonAsserts(data, error);
}
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
describe('#iapGetDeviceCount - errors', () => {
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
try {
const opts = {
filter: {
name: 'deviceName'
}
};
a.iapGetDeviceCount((data, error) => {
try {
if (stub) {
if (samProps.devicebroker.getDevicesFiltered[0].handleFailure === 'ignore') {
assert.equal(null, error);
assert.notEqual(undefined, data);
assert.notEqual(null, data);
assert.equal(0, data.count);
} else {
const displayE = 'Error 400 received on request';
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_sdn-connectorRest-handleEndResponse', displayE);
}
} else {
runCommonAsserts(data, error);
}
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
// exposed cache tests
describe('#iapPopulateEntityCache - errors', () => {
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
try {
a.iapPopulateEntityCache('Device', (data, error) => {
try {
if (stub) {
assert.equal(null, data);
assert.notEqual(undefined, error);
assert.notEqual(null, error);
done();
} else {
assert.equal(undefined, error);
assert.equal('success', data[0]);
done();
}
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
describe('#iapRetrieveEntitiesCache - errors', () => {
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
try {
a.iapRetrieveEntitiesCache('Device', {}, (data, error) => {
try {
if (stub) {
assert.equal(null, data);
assert.notEqual(null, error);
assert.notEqual(undefined, error);
} else {
assert.equal(undefined, error);
assert.notEqual(null, data);
assert.notEqual(undefined, data);
}
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
/*
-----------------------------------------------------------------------
-----------------------------------------------------------------------
*** All code above this comment will be replaced during a migration ***
******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
-----------------------------------------------------------------------
-----------------------------------------------------------------------
*/
const sdnGenericFindByExternalIdBodyParam = {
data: {
context: 'NFM_T',
id: 'string',
location: [
'string'
]
}
};
describe('#findByExternalId - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.findByExternalId(sdnGenericFindByExternalIdBodyParam, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnGeneric', 'findByExternalId', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnGenericId = 'fakedata';
describe('#getApplicationId - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.getApplicationId(sdnGenericId, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnGeneric', 'getApplicationId', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnGenericAppId = 'fakedata';
describe('#setApplicationId - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.setApplicationId(sdnGenericAppId, sdnGenericId, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('success', data.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnGeneric', 'setApplicationId', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnGenericUuid = 'fakedata';
describe('#getConsumed - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.getConsumed(sdnGenericUuid, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnGeneric', 'getConsumed', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
describe('#getTenants - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.getTenants(sdnGenericUuid, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnGeneric', 'getTenants', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
describe('#get - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.get(sdnGenericUuid, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnGeneric', 'get', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnServicesServiceUuid = 'fakedata';
const sdnServicesAddL2BackhaulEndpointBodyParam = {
data: {
accessLtpId: {
ipAddress: {
ipv4Address: {},
ipv6Address: {}
},
uint32: 3
},
accessNodeId: {
dottedQuad: {
string: 'string'
}
},
bandwidthProfiles: {
egressBandwidthProfileName: 'string',
ingressBandwidthProfileName: 'string',
ingressEgressBandwidthProfileName: 'string'
},
baseEndpointRequest: {
adminState: 'UP',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
id: 'string',
name: 'string',
readOnly: false
},
outerTag: {
vlanClassification: {
tagType: {},
vlanRange: {},
vlanValue: {}
}
},
secondTag: {
vlanClassification: {
tagType: {},
vlanRange: {},
vlanValue: {}
}
},
serviceClassificationType: {},
splitHorizonGroup: 'string',
vlanOperations: {
asymmetricalOperation: {
egress: {},
ingress: {}
},
symmetricalOperation: {
vlanOperations: {}
}
}
}
};
describe('#addL2BackhaulEndpoint - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.addL2BackhaulEndpoint(sdnServicesAddL2BackhaulEndpointBodyParam, sdnServicesServiceUuid, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnServices', 'addL2BackhaulEndpoint', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnServicesAutoPath = true;
const sdnServicesCreateL2backhaulBodyParam = {
data: {
adminState: 'MAINTENANCE',
appId: 'string',
bidirectional: 'ASYMMETRIC_STRICT',
bw: 4,
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
customerId: 2,
description: 'string',
endpoints: [
{
accessLtpId: {
ipAddress: {
ipv4Address: {},
ipv6Address: {}
},
uint32: 8
},
accessNodeId: {
dottedQuad: {
string: 'string'
}
},
bandwidthProfiles: {
egressBandwidthProfileName: 'string',
ingressBandwidthProfileName: 'string',
ingressEgressBandwidthProfileName: 'string'
},
baseEndpointRequest: {
adminState: 'DOWN',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
id: 'string',
name: 'string',
readOnly: true
},
outerTag: {
vlanClassification: {
tagType: {},
vlanRange: {},
vlanValue: {}
}
},
secondTag: {
vlanClassification: {
tagType: {},
vlanRange: {},
vlanValue: {}
}
},
serviceClassificationType: {},
splitHorizonGroup: 'string',
vlanOperations: {
asymmetricalOperation: {
egress: {},
ingress: {}
},
symmetricalOperation: {
vlanOperations: {}
}
}
}
],
ethtSvcDescr: 'string',
ethtSvcName: 'string',
ethtSvcType: {
string: 'string'
},
groupId: 'string',
maxCost: 2,
maxHops: 10,
maxLatency: 8,
name: 'string',
nodeServiceId: 6,
objective: 'STAR_WEIGHT',
pathProfileId: 'string',
readOnly: true,
requestedEndState: 'Saved',
reverseBW: 8,
templateId: 'string',
tunnelSelectionId: 'string',
workflowProfileId: 'string'
}
};
describe('#createL2backhaul - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.createL2backhaul(sdnServicesAutoPath, sdnServicesCreateL2backhaulBodyParam, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnServices', 'createL2backhaul', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnServicesCreateClinesBodyParam = {
data: {
adminState: 'DOWN',
appId: 'string',
bidirectional: 'SYMMETRIC_STRICT',
bw: 8,
cemUseRtpHeader: false,
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
customerId: 3,
description: 'string',
endpoints: [
{
adminState: 'DOWN',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
id: 'string',
name: 'string',
readOnly: false,
siteServiceQosProfile: {
egressOverrideQueues: [
{}
],
egressParam: {},
ingressOverrideQueues: [
{}
],
ingressParam: {},
qosProfile: 8
},
timeSlots: 'string'
}
],
groupId: 'string',
maxCost: 10,
maxHops: 4,
maxLatency: 1,
mtu: 3,
name: 'string',
nodeServiceId: 4,
objective: 'COST',
pathProfileId: 'string',
readOnly: false,
requestedEndState: 'Saved',
reverseBW: 2,
templateId: 'string',
transportSliceName: 'string',
tunnelSelectionId: 'string',
vcType: 'ETHERNET',
workflowProfileId: 'string'
}
};
describe('#createClines - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.createClines(sdnServicesCreateClinesBodyParam, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnServices', 'createClines', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnServicesCreateEaccessBodyParam = {
data: {
adjacencies: [
{
farEndIpAddress: {
ipv4Address: {},
ipv6Address: {}
},
vcId: 9
}
],
adminState: 'UP',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
customerId: 8,
endpoints: [
{
adminState: 'UP',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
encapType: 'Null',
id: 'string',
innerTag: 4,
isHub: true,
name: 'string',
outerTag: 6,
portMode: 'ACCESS',
readOnly: false,
siteServiceQosProfile: {
egressOverrideQueues: [
{}
],
egressParam: {},
ingressOverrideQueues: [
{}
],
ingressParam: {},
qosProfile: 1
}
}
],
mtu: 10,
name: 'string',
readOnly: true,
requestedEndState: 'Deployed',
templateId: 'string',
tunnelSelectionId: 'string',
vcType: 'ETHERNET'
}
};
describe('#createEaccess - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.createEaccess(sdnServicesCreateEaccessBodyParam, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnServices', 'createEaccess', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnServicesCreateElansBodyParam = {
data: {
adminState: 'UP',
appId: 'string',
autoBindType: 'rsvp_te',
bidirectional: 'ANY_REVERSE_ROUTE',
bw: 3,
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
customerId: 1,
description: 'string',
endpointExtensions: [
{
connectedInner: 9,
connectedOuter: 10,
connectedPortId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
nniPortConfig: {
adminState: 'MAINTENANCE',
appId: 'string',
customAttributes: [
{}
],
customAttributesTemplateId: 'string',
description: 'string',
id: 'string',
innerTag: 6,
name: 'string',
outerTag: 10,
readOnly: false
},
uniPortConfig: {
adminState: 'DOWN',
appId: 'string',
customAttributes: [
{}
],
customAttributesTemplateId: 'string',
description: 'string',
id: 'string',
innerTag: 1,
name: 'string',
outerTag: 3,
readOnly: true
}
}
],
endpoints: [
{
adminState: 'DOWN',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
encapType: 'Unknown',
id: 'string',
innerTag: 5,
isHub: true,
name: 'string',
outerTag: 2,
portMode: 'ACCESS',
readOnly: true,
siteServiceQosProfile: {
egressOverrideQueues: [
{}
],
egressParam: {},
ingressOverrideQueues: [
{}
],
ingressParam: {},
qosProfile: 10
}
}
],
groupId: 'string',
maxCost: 2,
maxHops: 8,
maxLatency: 9,
mtu: 7,
name: 'string',
nodeServiceId: 9,
objective: 'TE_METRIC',
pathProfileId: 'string',
readOnly: true,
requestedEndState: 'Saved',
reverseBW: 2,
templateId: 'string',
transportSliceName: 'string',
tunnelSelectionId: 'string',
vcType: 'SATOP_T1',
workflowProfileId: 'string'
}
};
describe('#createElans - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.createElans(sdnServicesCreateElansBodyParam, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnServices', 'createElans', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnServicesAddElanEndpointBodyParam = {
data: {
adminState: 'MAINTENANCE',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
encapType: 'Dot1Q',
id: 'string',
innerTag: 7,
isHub: false,
name: 'string',
outerTag: 9,
portMode: 'HYBRID',
readOnly: true,
siteServiceQosProfile: {
egressOverrideQueues: [
{}
],
egressParam: {},
ingressOverrideQueues: [
{}
],
ingressParam: {},
qosProfile: 4
}
}
};
describe('#addElanEndpoint - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.addElanEndpoint(sdnServicesAddElanEndpointBodyParam, sdnServicesServiceUuid, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnServices', 'addElanEndpoint', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnServicesCreateElinesBodyParam = {
data: {
adminState: 'UP',
appId: 'string',
autoBindType: 'sr_te',
bidirectional: 'ANY_REVERSE_ROUTE',
bw: 5,
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
customerId: 9,
description: 'string',
diverseFrom: 'string',
endpointExtensions: [
{
connectedInner: 5,
connectedOuter: 2,
connectedPortId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
nniPortConfig: {
adminState: 'UP',
appId: 'string',
customAttributes: [
{}
],
customAttributesTemplateId: 'string',
description: 'string',
id: 'string',
innerTag: 2,
name: 'string',
outerTag: 3,
readOnly: false
},
uniPortConfig: {
adminState: 'MAINTENANCE',
appId: 'string',
customAttributes: [
{}
],
customAttributesTemplateId: 'string',
description: 'string',
id: 'string',
innerTag: 8,
name: 'string',
outerTag: 2,
readOnly: true
}
}
],
endpoints: [
{
adminState: 'MAINTENANCE',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
encapType: 'Unknown',
id: 'string',
innerTag: 8,
isHub: true,
name: 'string',
outerTag: 6,
portMode: 'UNDEFINED',
readOnly: true,
siteServiceQosProfile: {
egressOverrideQueues: [
{}
],
egressParam: {},
ingressOverrideQueues: [
{}
],
ingressParam: {},
qosProfile: 8
}
}
],
groupId: 'string',
maxCost: 1,
maxHops: 3,
maxLatency: 3,
monitorBandwidth: true,
mtu: 7,
name: 'string',
nodeServiceId: 7,
objective: 'TE_METRIC',
pathProfileId: 'string',
readOnly: false,
requestedEndState: 'Saved',
reverseBW: 10,
templateId: 'string',
transportSliceName: 'string',
tunnelSelectionId: 'string',
vcType: 'SATOP_E1',
workflowProfileId: 'string'
}
};
describe('#createElines - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.createElines(sdnServicesCreateElinesBodyParam, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnServices', 'createElines', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnServicesCreateIesBodyParam = {
data: {
adminState: 'DOWN',
appId: 'string',
bidirectional: 'ASYMMETRIC_LOOSE',
bw: 8,
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
customerId: 8,
description: 'string',
endpoints: [
{
adminState: 'DOWN',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
encapType: 'Unknown',
id: 'string',
innerTag: 10,
isHub: false,
name: 'string',
outerTag: 1,
portMode: 'NETWORK',
primaryAddress: {
ipv4Prefix: {},
ipv6Prefix: {}
},
readOnly: true,
routingBgp: {
routes: [
{}
]
},
routingStatic: {
routes: [
{}
]
},
secondaryAddresses: [
{
ipv4Prefix: {},
ipv6Prefix: {}
}
],
siteServiceQosProfile: {
egressOverrideQueues: [
{}
],
egressParam: {},
ingressOverrideQueues: [
{}
],
ingressParam: {},
qosProfile: 5
},
vrfName: 'string'
}
],
groupId: 'string',
loopbackEndpoints: [
{
adminState: 'DOWN',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
id: 'string',
isHub: true,
name: 'string',
primaryAddress: {
ipv4Prefix: {},
ipv6Prefix: {}
},
readOnly: true,
vrfName: 'string'
}
],
maxCost: 10,
maxHops: 3,
maxLatency: 1,
mtu: 7,
name: 'string',
nodeServiceId: 9,
objective: 'STAR_WEIGHT',
pathProfileId: 'string',
readOnly: true,
requestedEndState: 'Saved',
reverseBW: 5,
templateId: 'string',
transportSliceName: 'string',
tunnelSelectionId: 'string',
vcType: 'SATOP_E3',
workflowProfileId: 'string'
}
};
describe('#createIes - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.createIes(sdnServicesCreateIesBodyParam, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnServices', 'createIes', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnServicesAddIesEndpointBodyParam = {
data: {
adminState: 'UP',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
encapType: 'Dot1Q',
id: 'string',
innerTag: 10,
isHub: true,
name: 'string',
outerTag: 7,
portMode: 'UNDEFINED',
primaryAddress: {
ipv4Prefix: {},
ipv6Prefix: {}
},
readOnly: true,
routingBgp: {
routes: [
{}
]
},
routingStatic: {
routes: [
{}
]
},
secondaryAddresses: [
{
ipv4Prefix: {},
ipv6Prefix: {}
}
],
siteServiceQosProfile: {
egressOverrideQueues: [
{}
],
egressParam: {},
ingressOverrideQueues: [
{}
],
ingressParam: {},
qosProfile: 2
},
vrfName: 'string'
}
};
describe('#addIesEndpoint - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.addIesEndpoint(sdnServicesAddIesEndpointBodyParam, sdnServicesServiceUuid, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnServices', 'addIesEndpoint', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnServicesAddIesLoopbackEndpointBodyParam = {
data: {
adminState: 'MAINTENANCE',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
id: 'string',
isHub: false,
name: 'string',
primaryAddress: {
ipv4Prefix: {},
ipv6Prefix: {}
},
readOnly: false,
vrfName: 'string'
}
};
describe('#addIesLoopbackEndpoint - errors', () => {
it('should work if integrated or standalone with mockdata', (done) => {
try {
a.addIesLoopbackEndpoint(sdnServicesAddIesLoopbackEndpointBodyParam, sdnServicesServiceUuid, (data, error) => {
try {
if (stub) {
runCommonAsserts(data, error);
assert.equal('object', typeof data.response.response);
} else {
runCommonAsserts(data, error);
}
saveMockData('SdnServices', 'addIesLoopbackEndpoint', 'default', data);
done();
} catch (err) {
log.error(`Test Failure: ${err}`);
done(err);
}
});
} catch (error) {
log.error(`Adapter Exception: ${error}`);
done(error);
}
}).timeout(attemptTimeout);
});
const sdnServicesCreateL3DciVpnsBodyParam = {
data: {
adminState: 'DOWN',
appId: 'string',
autobind: 'sr_te',
backhaulMtu: 10,
bidirectional: 'ASYMMETRIC_LOOSE',
bw: 7,
connectivity: 'VXLAN_STITCHED',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
customerId: 5,
dcEndpoints: [
{
adminState: 'DOWN',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
domainTemplateId: 'string',
id: 'string',
name: 'string',
readOnly: false
}
],
description: 'string',
dualHomed: true,
ecmp: 5,
encryption: true,
endpoints: [
{
adminState: 'UP',
appId: 'string',
customAttributes: [
{
attributeName: 'string',
attributeValue: 'string'
}
],
customAttributesTemplateId: 'string',
description: 'string',
encapType: 'Dot1Q',
id: 'string',
innerTag: 7,
isHub: false,
name: 'string',
outerTag: 6,
portMode: 'ACCESS',
primaryAddress: {
ipv4Prefix: {},
ipv6Prefix: {}
},
readOnly: false,
routingBgp: {
routes: [
{}
]
},
routingStatic: {
routes: [
{}
]
},
secondaryAddresses: [
{
ipv4Prefix: {},
ipv6Prefix: {}
}
],