@itentialopensource/adapter-nokia_nsp_network_management 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +5 -0
- package/.eslintrc.js +18 -0
- package/.jshintrc +3 -0
- package/AUTH.md +38 -0
- package/BROKER.md +211 -0
- package/CALLS.md +206 -0
- package/CHANGELOG.md +9 -0
- package/CODE_OF_CONDUCT.md +43 -0
- package/CONTRIBUTING.md +13 -0
- package/ENHANCE.md +69 -0
- package/LICENSE +201 -0
- package/PROPERTIES.md +646 -0
- package/README.md +343 -0
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +22 -0
- package/TAB1.md +14 -0
- package/TAB2.md +321 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +11110 -0
- package/adapterBase.js +1452 -0
- package/entities/.generic/action.json +214 -0
- package/entities/.generic/schema.json +28 -0
- package/entities/.system/action.json +52 -0
- package/entities/.system/mockdatafiles/getToken-default.json +3 -0
- package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
- package/entities/.system/schema.json +19 -0
- package/entities/.system/schemaTokenReq.json +53 -0
- package/entities/.system/schemaTokenResp.json +31 -0
- package/entities/AddressPool/action.json +65 -0
- package/entities/AddressPool/mockdatafiles/getIPv4AddressPool-default.json +47 -0
- package/entities/AddressPool/mockdatafiles/obtainValueFromPool-default.json +23 -0
- package/entities/AddressPool/schema.json +32 -0
- package/entities/AuditAndAlignment/action.json +165 -0
- package/entities/AuditAndAlignment/mockdatafiles/alignConfigurationDeployment-default.json +6 -0
- package/entities/AuditAndAlignment/mockdatafiles/alignConfigurationTemplateAllDeployments-default.json +7 -0
- package/entities/AuditAndAlignment/mockdatafiles/alignConfigurationTemplateMisalignedDeployments-default.json +7 -0
- package/entities/AuditAndAlignment/mockdatafiles/auditDeployment-default.json +7 -0
- package/entities/AuditAndAlignment/mockdatafiles/auditNodeDeployments-default.json +6 -0
- package/entities/AuditAndAlignment/mockdatafiles/auditTemplate-default.json +7 -0
- package/entities/AuditAndAlignment/mockdatafiles/checkAuditStatusCount-default.json +15 -0
- package/entities/AuditAndAlignment/mockdatafiles/getAuditDetails-default.json +9 -0
- package/entities/AuditAndAlignment/schema.json +26 -0
- package/entities/BaselineOperationsRestconfAPI/action.json +207 -0
- package/entities/BaselineOperationsRestconfAPI/mockdatafiles/createBaselineDetector-default.json +35 -0
- package/entities/BaselineOperationsRestconfAPI/mockdatafiles/getAllBaselines-default.json +44 -0
- package/entities/BaselineOperationsRestconfAPI/mockdatafiles/getBaseline-default.json +24 -0
- package/entities/BaselineOperationsRestconfAPI/mockdatafiles/getBaselineDetector-default.json +15 -0
- package/entities/BaselineOperationsRestconfAPI/mockdatafiles/patchBaselineDetector-default.json +13 -0
- package/entities/BaselineOperationsRestconfAPI/schema.json +39 -0
- package/entities/Brownfield/action.json +24 -0
- package/entities/Brownfield/mockdatafiles/discoverDeployments-default.json +7 -0
- package/entities/Brownfield/schema.json +19 -0
- package/entities/ConfigurationDeployments/action.json +207 -0
- package/entities/ConfigurationDeployments/mockdatafiles/createDeployment-default.json +7 -0
- package/entities/ConfigurationDeployments/mockdatafiles/createPortGroup-default.json +18 -0
- package/entities/ConfigurationDeployments/mockdatafiles/createPortGroupDirectory-default.json +16 -0
- package/entities/ConfigurationDeployments/mockdatafiles/deleteDeployments-default.json +7 -0
- package/entities/ConfigurationDeployments/mockdatafiles/getDeployments-default.json +322 -0
- package/entities/ConfigurationDeployments/mockdatafiles/getPortGroupFDN-default.json +18 -0
- package/entities/ConfigurationDeployments/mockdatafiles/getSpecificDeployment-default.json +43 -0
- package/entities/ConfigurationDeployments/mockdatafiles/replaceDeployment-default.json +7 -0
- package/entities/ConfigurationDeployments/mockdatafiles/updateDeploymentConfiguration-default.json +7 -0
- package/entities/ConfigurationDeployments/schema.json +28 -0
- package/entities/ConfigurationTemplates/action.json +85 -0
- package/entities/ConfigurationTemplates/mockdatafiles/createTemplate-default.json +4 -0
- package/entities/ConfigurationTemplates/mockdatafiles/getTemplates-default.json +195 -0
- package/entities/ConfigurationTemplates/schema.json +22 -0
- package/entities/DataTablesRetention/action.json +86 -0
- package/entities/DataTablesRetention/mockdatafiles/getBaselineAgeoutPolicySettings-default.json +22 -0
- package/entities/DataTablesRetention/mockdatafiles/getIndicatorAgeoutPolicySettings-default.json +16 -0
- package/entities/DataTablesRetention/schema.json +22 -0
- package/entities/IETFL2Model/action.json +67 -0
- package/entities/IETFL2Model/mockdatafiles/getL2TopologyAttributes-default.json +5 -0
- package/entities/IETFL2Model/mockdatafiles/getL2TopologyNodeTerminationPoints-default.json +69 -0
- package/entities/IETFL2Model/schema.json +21 -0
- package/entities/IETFL3Model/action.json +277 -0
- package/entities/IETFL3Model/mockdatafiles/getAllNodesInANetwork-default.json +207 -0
- package/entities/IETFL3Model/mockdatafiles/getL3TopologyAttribute-default.json +8 -0
- package/entities/IETFL3Model/mockdatafiles/getNetworkType-default.json +7 -0
- package/entities/IETFL3Model/mockdatafiles/getSpecificLinkInANetwork-default.json +67 -0
- package/entities/IETFL3Model/mockdatafiles/getSpecificNetwork-default.json +498 -0
- package/entities/IETFL3Model/mockdatafiles/getSpecificNodeInANetwork-default.json +56 -0
- package/entities/IETFL3Model/mockdatafiles/getSpecificTerminationPointsOfANode-default.json +17 -0
- package/entities/IETFL3Model/mockdatafiles/getSupportingLink-default.json +8 -0
- package/entities/IETFL3Model/mockdatafiles/getSupportingNetwork-default.json +7 -0
- package/entities/IETFL3Model/mockdatafiles/getSupportingTerminationPoint-default.json +9 -0
- package/entities/IETFL3Model/mockdatafiles/l3GETSRTopologyLinkAttributes-default.json +41 -0
- package/entities/IETFL3Model/mockdatafiles/l3GETSRTopologyNodeAttributes-default.json +16 -0
- package/entities/IETFL3Model/schema.json +42 -0
- package/entities/IETFLogicalInventoryRestconfAPI/action.json +235 -0
- package/entities/IETFLogicalInventoryRestconfAPI/mockdatafiles/retrieveNetworkInterfacesConfig-default.json +14 -0
- package/entities/IETFLogicalInventoryRestconfAPI/mockdatafiles/retrieveNetworkInterfacesUnnumbered-default.json +28 -0
- package/entities/IETFLogicalInventoryRestconfAPI/mockdatafiles/retrieveNetworkInterfacesUnnumberedIntf-default.json +21 -0
- package/entities/IETFLogicalInventoryRestconfAPI/mockdatafiles/retrieveNetworkSubInterfacesConfig-default.json +16 -0
- package/entities/IETFLogicalInventoryRestconfAPI/mockdatafiles/retrieveNetworkSubInterfacesIPv4Addresses-default.json +39 -0
- package/entities/IETFLogicalInventoryRestconfAPI/mockdatafiles/retrieveNetworkSubInterfacesIPv6Addresses-default.json +38 -0
- package/entities/IETFLogicalInventoryRestconfAPI/mockdatafiles/retrieveNetworkSubInterfacesState-default.json +15 -0
- package/entities/IETFLogicalInventoryRestconfAPI/mockdatafiles/retrieveResyncPolicyNodeVersionEntity-default.json +797 -0
- package/entities/IETFLogicalInventoryRestconfAPI/schema.json +51 -0
- package/entities/IETFSAPTopology/action.json +67 -0
- package/entities/IETFSAPTopology/mockdatafiles/getIETFNetworkFromSpecificNode-default.json +483 -0
- package/entities/IETFSAPTopology/mockdatafiles/getSAPNetwork-default.json +9 -0
- package/entities/IETFSAPTopology/mockdatafiles/getSAPsOnASpecificNodeOfSpecificServiceType-default.json +153 -0
- package/entities/IETFSAPTopology/schema.json +21 -0
- package/entities/IndicatorRules/action.json +106 -0
- package/entities/IndicatorRules/mockdatafiles/getAllIndicatorRules-default.json +818 -0
- package/entities/IndicatorRules/mockdatafiles/getSpecificIndicatorRule-default.json +119 -0
- package/entities/IndicatorRules/schema.json +23 -0
- package/entities/IndicatorTemplates/action.json +106 -0
- package/entities/IndicatorTemplates/mockdatafiles/avgCPUAllNodesAllActions-default.json +105 -0
- package/entities/IndicatorTemplates/mockdatafiles/getAllIndicatorTemplates-default.json +512 -0
- package/entities/IndicatorTemplates/mockdatafiles/getSpecificIndicatorTemplate-default.json +88 -0
- package/entities/IndicatorTemplates/mockdatafiles/uPDATEIndicatorTemplate-default.json +48 -0
- package/entities/IndicatorTemplates/schema.json +23 -0
- package/entities/Intent/action.json +105 -0
- package/entities/Intent/mockdatafiles/getIntent-default.json +161 -0
- package/entities/Intent/mockdatafiles/synchronizeIntent-default.json +6 -0
- package/entities/Intent/schema.json +23 -0
- package/entities/IntentTypeManagement/action.json +65 -0
- package/entities/IntentTypeManagement/mockdatafiles/getIntentTypes-default.json +482 -0
- package/entities/IntentTypeManagement/mockdatafiles/importIntentTypeFromIntentManager-default.json +6 -0
- package/entities/IntentTypeManagement/mockdatafiles/removeIntentType-default.json +7 -0
- package/entities/IntentTypeManagement/schema.json +21 -0
- package/entities/LogicalInventoryRestconfAPI/action.json +107 -0
- package/entities/LogicalInventoryRestconfAPI/mockdatafiles/nspInventoryFindWithFilter-default.json +528 -0
- package/entities/LogicalInventoryRestconfAPI/mockdatafiles/retrieveResyncPolicy-default.json +4189 -0
- package/entities/LogicalInventoryRestconfAPI/mockdatafiles/retrieveResyncPolicyNEAndVersionSpecific-default.json +1083 -0
- package/entities/LogicalInventoryRestconfAPI/mockdatafiles/retrieveResyncPollingPolicyNESpecific-default.json +1113 -0
- package/entities/LogicalInventoryRestconfAPI/schema.json +34 -0
- package/entities/ManageZTPListFromDeviceAdministrator/action.json +85 -0
- package/entities/ManageZTPListFromDeviceAdministrator/mockdatafiles/getZTPListFromDeviceAdministrator-default.json +114 -0
- package/entities/ManageZTPListFromDeviceAdministrator/schema.json +33 -0
- package/entities/RouterNECorrelationMappingService/action.json +147 -0
- package/entities/RouterNECorrelationMappingService/mockdatafiles/getCorrelationPolicy-default.json +38 -0
- package/entities/RouterNECorrelationMappingService/mockdatafiles/getRouterNeMapping-default.json +32 -0
- package/entities/RouterNECorrelationMappingService/mockdatafiles/getSpecificMappingPolicy-default.json +32 -0
- package/entities/RouterNECorrelationMappingService/schema.json +47 -0
- package/entities/TemplateMigration/action.json +44 -0
- package/entities/TemplateMigration/mockdatafiles/cloneTemplate-default.json +7 -0
- package/entities/TemplateMigration/mockdatafiles/migrateDeployments-default.json +7 -0
- package/entities/TemplateMigration/schema.json +20 -0
- package/entities/UploadMappingFiles/action.json +45 -0
- package/entities/UploadMappingFiles/mockdatafiles/getIETFMappingFiles-default.json +953 -0
- package/entities/UploadMappingFiles/schema.json +31 -0
- package/error.json +190 -0
- package/metadata.json +61 -0
- package/package.json +81 -0
- package/pronghorn.json +5141 -0
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +1666 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/creationReport.json +657 -0
- package/report/update-postman.json-OpenApi3Json.json +112049 -0
- package/report/updateReport1718639512342.json +120 -0
- package/sampleProperties.json +268 -0
- package/test/integration/adapterTestBasicGet.js +83 -0
- package/test/integration/adapterTestConnectivity.js +142 -0
- package/test/integration/adapterTestIntegration.js +3836 -0
- package/test/unit/adapterBaseTestUnit.js +1024 -0
- package/test/unit/adapterTestUnit.js +5403 -0
- package/utils/adapterInfo.js +206 -0
- package/utils/addAuth.js +94 -0
- package/utils/artifactize.js +146 -0
- package/utils/basicGet.js +50 -0
- package/utils/checkMigrate.js +63 -0
- package/utils/entitiesToDB.js +179 -0
- package/utils/findPath.js +74 -0
- package/utils/methodDocumentor.js +273 -0
- package/utils/modify.js +152 -0
- package/utils/packModificationScript.js +35 -0
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +32 -0
- package/utils/removeHooks.js +20 -0
- package/utils/setup.js +33 -0
- package/utils/taskMover.js +309 -0
- package/utils/tbScript.js +239 -0
- package/utils/tbUtils.js +489 -0
- package/utils/testRunner.js +298 -0
- package/utils/troubleshootingAdapter.js +193 -0
|
@@ -0,0 +1,3836 @@
|
|
|
1
|
+
/* @copyright Itential, LLC 2019 (pre-modifications) */
|
|
2
|
+
|
|
3
|
+
// Set globals
|
|
4
|
+
/* global describe it log pronghornProps */
|
|
5
|
+
/* eslint no-unused-vars: warn */
|
|
6
|
+
/* eslint no-underscore-dangle: warn */
|
|
7
|
+
/* eslint import/no-dynamic-require:warn */
|
|
8
|
+
|
|
9
|
+
// include required items for testing & logging
|
|
10
|
+
const assert = require('assert');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const util = require('util');
|
|
14
|
+
const mocha = require('mocha');
|
|
15
|
+
const winston = require('winston');
|
|
16
|
+
const { expect } = require('chai');
|
|
17
|
+
const { use } = require('chai');
|
|
18
|
+
const td = require('testdouble');
|
|
19
|
+
|
|
20
|
+
const anything = td.matchers.anything();
|
|
21
|
+
|
|
22
|
+
// stub and attemptTimeout are used throughout the code so set them here
|
|
23
|
+
let logLevel = 'none';
|
|
24
|
+
const isRapidFail = false;
|
|
25
|
+
const isSaveMockData = false;
|
|
26
|
+
|
|
27
|
+
// read in the properties from the sampleProperties files
|
|
28
|
+
let adaptdir = __dirname;
|
|
29
|
+
if (adaptdir.endsWith('/test/integration')) {
|
|
30
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 17);
|
|
31
|
+
} else if (adaptdir.endsWith('/test/unit')) {
|
|
32
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 10);
|
|
33
|
+
}
|
|
34
|
+
const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
|
|
35
|
+
|
|
36
|
+
// these variables can be changed to run in integrated mode so easier to set them here
|
|
37
|
+
// always check these in with bogus data!!!
|
|
38
|
+
samProps.stub = true;
|
|
39
|
+
samProps.host = 'replace.hostorip.here';
|
|
40
|
+
samProps.authentication.username = 'username';
|
|
41
|
+
samProps.authentication.password = 'password';
|
|
42
|
+
samProps.protocol = 'http';
|
|
43
|
+
samProps.port = 80;
|
|
44
|
+
samProps.ssl.enabled = false;
|
|
45
|
+
samProps.ssl.accept_invalid_cert = false;
|
|
46
|
+
if (samProps.request.attempt_timeout < 30000) {
|
|
47
|
+
samProps.request.attempt_timeout = 30000;
|
|
48
|
+
}
|
|
49
|
+
samProps.devicebroker.enabled = true;
|
|
50
|
+
const attemptTimeout = samProps.request.attempt_timeout;
|
|
51
|
+
const { stub } = samProps;
|
|
52
|
+
|
|
53
|
+
// these are the adapter properties. You generally should not need to alter
|
|
54
|
+
// any of these after they are initially set up
|
|
55
|
+
global.pronghornProps = {
|
|
56
|
+
pathProps: {
|
|
57
|
+
encrypted: false
|
|
58
|
+
},
|
|
59
|
+
adapterProps: {
|
|
60
|
+
adapters: [{
|
|
61
|
+
id: 'Test-nokia_nsp_network_management',
|
|
62
|
+
type: 'NokiaNspNetworkManagement',
|
|
63
|
+
properties: samProps
|
|
64
|
+
}]
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
global.$HOME = `${__dirname}/../..`;
|
|
69
|
+
|
|
70
|
+
// set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
|
|
71
|
+
// this you may error on log.trace calls.
|
|
72
|
+
const myCustomLevels = {
|
|
73
|
+
levels: {
|
|
74
|
+
spam: 6,
|
|
75
|
+
trace: 5,
|
|
76
|
+
debug: 4,
|
|
77
|
+
info: 3,
|
|
78
|
+
warn: 2,
|
|
79
|
+
error: 1,
|
|
80
|
+
none: 0
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// need to see if there is a log level passed in
|
|
85
|
+
process.argv.forEach((val) => {
|
|
86
|
+
// is there a log level defined to be passed in?
|
|
87
|
+
if (val.indexOf('--LOG') === 0) {
|
|
88
|
+
// get the desired log level
|
|
89
|
+
const inputVal = val.split('=')[1];
|
|
90
|
+
|
|
91
|
+
// validate the log level is supported, if so set it
|
|
92
|
+
if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
|
|
93
|
+
logLevel = inputVal;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// need to set global logging
|
|
99
|
+
global.log = winston.createLogger({
|
|
100
|
+
level: logLevel,
|
|
101
|
+
levels: myCustomLevels.levels,
|
|
102
|
+
transports: [
|
|
103
|
+
new winston.transports.Console()
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Runs the common asserts for test
|
|
109
|
+
*/
|
|
110
|
+
function runCommonAsserts(data, error) {
|
|
111
|
+
assert.equal(undefined, error);
|
|
112
|
+
assert.notEqual(undefined, data);
|
|
113
|
+
assert.notEqual(null, data);
|
|
114
|
+
assert.notEqual(undefined, data.response);
|
|
115
|
+
assert.notEqual(null, data.response);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Runs the error asserts for the test
|
|
120
|
+
*/
|
|
121
|
+
function runErrorAsserts(data, error, code, origin, displayStr) {
|
|
122
|
+
assert.equal(null, data);
|
|
123
|
+
assert.notEqual(undefined, error);
|
|
124
|
+
assert.notEqual(null, error);
|
|
125
|
+
assert.notEqual(undefined, error.IAPerror);
|
|
126
|
+
assert.notEqual(null, error.IAPerror);
|
|
127
|
+
assert.notEqual(undefined, error.IAPerror.displayString);
|
|
128
|
+
assert.notEqual(null, error.IAPerror.displayString);
|
|
129
|
+
assert.equal(code, error.icode);
|
|
130
|
+
assert.equal(origin, error.IAPerror.origin);
|
|
131
|
+
assert.equal(displayStr, error.IAPerror.displayString);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @function saveMockData
|
|
136
|
+
* Attempts to take data from responses and place them in MockDataFiles to help create Mockdata.
|
|
137
|
+
* Note, this was built based on entity file structure for Adapter-Engine 1.6.x
|
|
138
|
+
* @param {string} entityName - Name of the entity saving mock data for
|
|
139
|
+
* @param {string} actionName - Name of the action saving mock data for
|
|
140
|
+
* @param {string} descriptor - Something to describe this test (used as a type)
|
|
141
|
+
* @param {string or object} responseData - The data to put in the mock file.
|
|
142
|
+
*/
|
|
143
|
+
function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
144
|
+
// do not need to save mockdata if we are running in stub mode (already has mock data) or if told not to save
|
|
145
|
+
if (stub || !isSaveMockData) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// must have a response in order to store the response
|
|
150
|
+
if (responseData && responseData.response) {
|
|
151
|
+
let data = responseData.response;
|
|
152
|
+
|
|
153
|
+
// if there was a raw response that one is better as it is untranslated
|
|
154
|
+
if (responseData.raw) {
|
|
155
|
+
data = responseData.raw;
|
|
156
|
+
|
|
157
|
+
try {
|
|
158
|
+
const temp = JSON.parse(data);
|
|
159
|
+
data = temp;
|
|
160
|
+
} catch (pex) {
|
|
161
|
+
// do not care if it did not parse as we will just use data
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
try {
|
|
166
|
+
const base = path.join(__dirname, `../../entities/${entityName}/`);
|
|
167
|
+
const mockdatafolder = 'mockdatafiles';
|
|
168
|
+
const filename = `mockdatafiles/${actionName}-${descriptor}.json`;
|
|
169
|
+
|
|
170
|
+
if (!fs.existsSync(base + mockdatafolder)) {
|
|
171
|
+
fs.mkdirSync(base + mockdatafolder);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// write the data we retrieved
|
|
175
|
+
fs.writeFile(base + filename, JSON.stringify(data, null, 2), 'utf8', (errWritingMock) => {
|
|
176
|
+
if (errWritingMock) throw errWritingMock;
|
|
177
|
+
|
|
178
|
+
// update the action file to reflect the changes. Note: We're replacing the default object for now!
|
|
179
|
+
fs.readFile(`${base}action.json`, (errRead, content) => {
|
|
180
|
+
if (errRead) throw errRead;
|
|
181
|
+
|
|
182
|
+
// parse the action file into JSON
|
|
183
|
+
const parsedJson = JSON.parse(content);
|
|
184
|
+
|
|
185
|
+
// The object update we'll write in.
|
|
186
|
+
const responseObj = {
|
|
187
|
+
type: descriptor,
|
|
188
|
+
key: '',
|
|
189
|
+
mockFile: filename
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// get the object for method we're trying to change.
|
|
193
|
+
const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
|
|
194
|
+
|
|
195
|
+
// if the method was not found - should never happen but...
|
|
196
|
+
if (!currentMethodAction) {
|
|
197
|
+
throw Error('Can\'t find an action for this method in the provided entity.');
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// if there is a response object, we want to replace the Response object. Otherwise we'll create one.
|
|
201
|
+
const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
|
|
202
|
+
|
|
203
|
+
// Add the action responseObj back into the array of response objects.
|
|
204
|
+
if (!actionResponseObj) {
|
|
205
|
+
// if there is a default response object, we want to get the key.
|
|
206
|
+
const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
|
|
207
|
+
|
|
208
|
+
// save the default key into the new response object
|
|
209
|
+
if (defaultResponseObj) {
|
|
210
|
+
responseObj.key = defaultResponseObj.key;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// save the new response object
|
|
214
|
+
currentMethodAction.responseObjects = [responseObj];
|
|
215
|
+
} else {
|
|
216
|
+
// update the location of the mock data file
|
|
217
|
+
actionResponseObj.mockFile = responseObj.mockFile;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Save results
|
|
221
|
+
fs.writeFile(`${base}action.json`, JSON.stringify(parsedJson, null, 2), (err) => {
|
|
222
|
+
if (err) throw err;
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
} catch (e) {
|
|
227
|
+
log.debug(`Failed to save mock data for ${actionName}. ${e.message}`);
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// no response to save
|
|
233
|
+
log.debug(`No data passed to save into mockdata for ${actionName}`);
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// require the adapter that we are going to be using
|
|
238
|
+
const NokiaNspNetworkManagement = require('../../adapter');
|
|
239
|
+
|
|
240
|
+
// begin the testing - these should be pretty well defined between the describe and the it!
|
|
241
|
+
describe('[integration] nokia_nsp_network_management Adapter Test', () => {
|
|
242
|
+
describe('NokiaNspNetworkManagement Class Tests', () => {
|
|
243
|
+
const a = new NokiaNspNetworkManagement(
|
|
244
|
+
pronghornProps.adapterProps.adapters[0].id,
|
|
245
|
+
pronghornProps.adapterProps.adapters[0].properties
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
if (isRapidFail) {
|
|
249
|
+
const state = {};
|
|
250
|
+
state.passed = true;
|
|
251
|
+
|
|
252
|
+
mocha.afterEach(function x() {
|
|
253
|
+
state.passed = state.passed
|
|
254
|
+
&& (this.currentTest.state === 'passed');
|
|
255
|
+
});
|
|
256
|
+
mocha.beforeEach(function x() {
|
|
257
|
+
if (!state.passed) {
|
|
258
|
+
return this.currentTest.skip();
|
|
259
|
+
}
|
|
260
|
+
return true;
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
describe('#class instance created', () => {
|
|
265
|
+
it('should be a class with properties', (done) => {
|
|
266
|
+
try {
|
|
267
|
+
assert.notEqual(null, a);
|
|
268
|
+
assert.notEqual(undefined, a);
|
|
269
|
+
const checkId = global.pronghornProps.adapterProps.adapters[0].id;
|
|
270
|
+
assert.equal(checkId, a.id);
|
|
271
|
+
assert.notEqual(null, a.allProps);
|
|
272
|
+
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
|
|
273
|
+
assert.equal(check, a.healthcheckType);
|
|
274
|
+
done();
|
|
275
|
+
} catch (error) {
|
|
276
|
+
log.error(`Test Failure: ${error}`);
|
|
277
|
+
done(error);
|
|
278
|
+
}
|
|
279
|
+
}).timeout(attemptTimeout);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
describe('#connect', () => {
|
|
283
|
+
it('should get connected - no healthcheck', (done) => {
|
|
284
|
+
try {
|
|
285
|
+
a.healthcheckType = 'none';
|
|
286
|
+
a.connect();
|
|
287
|
+
|
|
288
|
+
try {
|
|
289
|
+
assert.equal(true, a.alive);
|
|
290
|
+
done();
|
|
291
|
+
} catch (error) {
|
|
292
|
+
log.error(`Test Failure: ${error}`);
|
|
293
|
+
done(error);
|
|
294
|
+
}
|
|
295
|
+
} catch (error) {
|
|
296
|
+
log.error(`Adapter Exception: ${error}`);
|
|
297
|
+
done(error);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
it('should get connected - startup healthcheck', (done) => {
|
|
301
|
+
try {
|
|
302
|
+
a.healthcheckType = 'startup';
|
|
303
|
+
a.connect();
|
|
304
|
+
|
|
305
|
+
try {
|
|
306
|
+
assert.equal(true, a.alive);
|
|
307
|
+
done();
|
|
308
|
+
} catch (error) {
|
|
309
|
+
log.error(`Test Failure: ${error}`);
|
|
310
|
+
done(error);
|
|
311
|
+
}
|
|
312
|
+
} catch (error) {
|
|
313
|
+
log.error(`Adapter Exception: ${error}`);
|
|
314
|
+
done(error);
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
describe('#healthCheck', () => {
|
|
320
|
+
it('should be healthy', (done) => {
|
|
321
|
+
try {
|
|
322
|
+
a.healthCheck(null, (data) => {
|
|
323
|
+
try {
|
|
324
|
+
assert.equal(true, a.healthy);
|
|
325
|
+
saveMockData('system', 'healthcheck', 'default', data);
|
|
326
|
+
done();
|
|
327
|
+
} catch (err) {
|
|
328
|
+
log.error(`Test Failure: ${err}`);
|
|
329
|
+
done(err);
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
} catch (error) {
|
|
333
|
+
log.error(`Adapter Exception: ${error}`);
|
|
334
|
+
done(error);
|
|
335
|
+
}
|
|
336
|
+
}).timeout(attemptTimeout);
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
// broker tests
|
|
340
|
+
describe('#getDevicesFiltered - errors', () => {
|
|
341
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
342
|
+
try {
|
|
343
|
+
const opts = {
|
|
344
|
+
filter: {
|
|
345
|
+
name: 'deviceName'
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
a.getDevicesFiltered(opts, (data, error) => {
|
|
349
|
+
try {
|
|
350
|
+
if (stub) {
|
|
351
|
+
if (samProps.devicebroker.getDevicesFiltered[0].handleFailure === 'ignore') {
|
|
352
|
+
assert.equal(null, error);
|
|
353
|
+
assert.notEqual(undefined, data);
|
|
354
|
+
assert.notEqual(null, data);
|
|
355
|
+
assert.equal(0, data.total);
|
|
356
|
+
assert.equal(0, data.list.length);
|
|
357
|
+
} else {
|
|
358
|
+
const displayE = 'Error 400 received on request';
|
|
359
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
360
|
+
}
|
|
361
|
+
} else {
|
|
362
|
+
runCommonAsserts(data, error);
|
|
363
|
+
}
|
|
364
|
+
done();
|
|
365
|
+
} catch (err) {
|
|
366
|
+
log.error(`Test Failure: ${err}`);
|
|
367
|
+
done(err);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
} catch (error) {
|
|
371
|
+
log.error(`Adapter Exception: ${error}`);
|
|
372
|
+
done(error);
|
|
373
|
+
}
|
|
374
|
+
}).timeout(attemptTimeout);
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
describe('#iapGetDeviceCount - errors', () => {
|
|
378
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
379
|
+
try {
|
|
380
|
+
const opts = {
|
|
381
|
+
filter: {
|
|
382
|
+
name: 'deviceName'
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
a.iapGetDeviceCount((data, error) => {
|
|
386
|
+
try {
|
|
387
|
+
if (stub) {
|
|
388
|
+
if (samProps.devicebroker.getDevicesFiltered[0].handleFailure === 'ignore') {
|
|
389
|
+
assert.equal(null, error);
|
|
390
|
+
assert.notEqual(undefined, data);
|
|
391
|
+
assert.notEqual(null, data);
|
|
392
|
+
assert.equal(0, data.count);
|
|
393
|
+
} else {
|
|
394
|
+
const displayE = 'Error 400 received on request';
|
|
395
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
396
|
+
}
|
|
397
|
+
} else {
|
|
398
|
+
runCommonAsserts(data, error);
|
|
399
|
+
}
|
|
400
|
+
done();
|
|
401
|
+
} catch (err) {
|
|
402
|
+
log.error(`Test Failure: ${err}`);
|
|
403
|
+
done(err);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
} catch (error) {
|
|
407
|
+
log.error(`Adapter Exception: ${error}`);
|
|
408
|
+
done(error);
|
|
409
|
+
}
|
|
410
|
+
}).timeout(attemptTimeout);
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
// exposed cache tests
|
|
414
|
+
describe('#iapPopulateEntityCache - errors', () => {
|
|
415
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
416
|
+
try {
|
|
417
|
+
a.iapPopulateEntityCache('Device', (data, error) => {
|
|
418
|
+
try {
|
|
419
|
+
if (stub) {
|
|
420
|
+
assert.equal(null, data);
|
|
421
|
+
assert.notEqual(undefined, error);
|
|
422
|
+
assert.notEqual(null, error);
|
|
423
|
+
done();
|
|
424
|
+
} else {
|
|
425
|
+
assert.equal(undefined, error);
|
|
426
|
+
assert.equal('success', data[0]);
|
|
427
|
+
done();
|
|
428
|
+
}
|
|
429
|
+
} catch (err) {
|
|
430
|
+
log.error(`Test Failure: ${err}`);
|
|
431
|
+
done(err);
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
} catch (error) {
|
|
435
|
+
log.error(`Adapter Exception: ${error}`);
|
|
436
|
+
done(error);
|
|
437
|
+
}
|
|
438
|
+
}).timeout(attemptTimeout);
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
describe('#iapRetrieveEntitiesCache - errors', () => {
|
|
442
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
443
|
+
try {
|
|
444
|
+
a.iapRetrieveEntitiesCache('Device', {}, (data, error) => {
|
|
445
|
+
try {
|
|
446
|
+
if (stub) {
|
|
447
|
+
assert.equal(null, data);
|
|
448
|
+
assert.notEqual(null, error);
|
|
449
|
+
assert.notEqual(undefined, error);
|
|
450
|
+
} else {
|
|
451
|
+
assert.equal(undefined, error);
|
|
452
|
+
assert.notEqual(null, data);
|
|
453
|
+
assert.notEqual(undefined, data);
|
|
454
|
+
}
|
|
455
|
+
done();
|
|
456
|
+
} catch (err) {
|
|
457
|
+
log.error(`Test Failure: ${err}`);
|
|
458
|
+
done(err);
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
} catch (error) {
|
|
462
|
+
log.error(`Adapter Exception: ${error}`);
|
|
463
|
+
done(error);
|
|
464
|
+
}
|
|
465
|
+
}).timeout(attemptTimeout);
|
|
466
|
+
});
|
|
467
|
+
/*
|
|
468
|
+
-----------------------------------------------------------------------
|
|
469
|
+
-----------------------------------------------------------------------
|
|
470
|
+
*** All code above this comment will be replaced during a migration ***
|
|
471
|
+
******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
|
|
472
|
+
-----------------------------------------------------------------------
|
|
473
|
+
-----------------------------------------------------------------------
|
|
474
|
+
*/
|
|
475
|
+
|
|
476
|
+
const iETFLogicalInventoryRestconfAPINetwork = 'fakedata';
|
|
477
|
+
const iETFLogicalInventoryRestconfAPINode = 'fakedata';
|
|
478
|
+
describe('#retrieveNetworkInterfaces - errors', () => {
|
|
479
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
480
|
+
try {
|
|
481
|
+
a.retrieveNetworkInterfaces(iETFLogicalInventoryRestconfAPINetwork, iETFLogicalInventoryRestconfAPINode, (data, error) => {
|
|
482
|
+
try {
|
|
483
|
+
if (stub) {
|
|
484
|
+
const displayE = 'Error 400 received on request';
|
|
485
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
486
|
+
} else {
|
|
487
|
+
runCommonAsserts(data, error);
|
|
488
|
+
}
|
|
489
|
+
saveMockData('IETFLogicalInventoryRestconfAPI', 'retrieveNetworkInterfaces', 'default', data);
|
|
490
|
+
done();
|
|
491
|
+
} catch (err) {
|
|
492
|
+
log.error(`Test Failure: ${err}`);
|
|
493
|
+
done(err);
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
} catch (error) {
|
|
497
|
+
log.error(`Adapter Exception: ${error}`);
|
|
498
|
+
done(error);
|
|
499
|
+
}
|
|
500
|
+
}).timeout(attemptTimeout);
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
describe('#retrieveNetworkInterfacesConfig - errors', () => {
|
|
504
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
505
|
+
try {
|
|
506
|
+
a.retrieveNetworkInterfacesConfig(iETFLogicalInventoryRestconfAPINetwork, iETFLogicalInventoryRestconfAPINode, (data, error) => {
|
|
507
|
+
try {
|
|
508
|
+
if (stub) {
|
|
509
|
+
runCommonAsserts(data, error);
|
|
510
|
+
assert.equal('object', typeof data.response['openconfig-interfaces:config']);
|
|
511
|
+
} else {
|
|
512
|
+
runCommonAsserts(data, error);
|
|
513
|
+
}
|
|
514
|
+
saveMockData('IETFLogicalInventoryRestconfAPI', 'retrieveNetworkInterfacesConfig', 'default', data);
|
|
515
|
+
done();
|
|
516
|
+
} catch (err) {
|
|
517
|
+
log.error(`Test Failure: ${err}`);
|
|
518
|
+
done(err);
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
} catch (error) {
|
|
522
|
+
log.error(`Adapter Exception: ${error}`);
|
|
523
|
+
done(error);
|
|
524
|
+
}
|
|
525
|
+
}).timeout(attemptTimeout);
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
describe('#retrieveNetworkSubInterfaces - errors', () => {
|
|
529
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
530
|
+
try {
|
|
531
|
+
a.retrieveNetworkSubInterfaces(iETFLogicalInventoryRestconfAPINetwork, iETFLogicalInventoryRestconfAPINode, (data, error) => {
|
|
532
|
+
try {
|
|
533
|
+
if (stub) {
|
|
534
|
+
const displayE = 'Error 400 received on request';
|
|
535
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
536
|
+
} else {
|
|
537
|
+
runCommonAsserts(data, error);
|
|
538
|
+
}
|
|
539
|
+
saveMockData('IETFLogicalInventoryRestconfAPI', 'retrieveNetworkSubInterfaces', 'default', data);
|
|
540
|
+
done();
|
|
541
|
+
} catch (err) {
|
|
542
|
+
log.error(`Test Failure: ${err}`);
|
|
543
|
+
done(err);
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
} catch (error) {
|
|
547
|
+
log.error(`Adapter Exception: ${error}`);
|
|
548
|
+
done(error);
|
|
549
|
+
}
|
|
550
|
+
}).timeout(attemptTimeout);
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
const iETFLogicalInventoryRestconfAPISubinterface = 'fakedata';
|
|
554
|
+
describe('#retrieveNetworkSubInterfacesConfig - errors', () => {
|
|
555
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
556
|
+
try {
|
|
557
|
+
a.retrieveNetworkSubInterfacesConfig(iETFLogicalInventoryRestconfAPINetwork, iETFLogicalInventoryRestconfAPINode, iETFLogicalInventoryRestconfAPISubinterface, (data, error) => {
|
|
558
|
+
try {
|
|
559
|
+
if (stub) {
|
|
560
|
+
runCommonAsserts(data, error);
|
|
561
|
+
assert.equal('object', typeof data.response['openconfig-interfaces:config']);
|
|
562
|
+
} else {
|
|
563
|
+
runCommonAsserts(data, error);
|
|
564
|
+
}
|
|
565
|
+
saveMockData('IETFLogicalInventoryRestconfAPI', 'retrieveNetworkSubInterfacesConfig', 'default', data);
|
|
566
|
+
done();
|
|
567
|
+
} catch (err) {
|
|
568
|
+
log.error(`Test Failure: ${err}`);
|
|
569
|
+
done(err);
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
} catch (error) {
|
|
573
|
+
log.error(`Adapter Exception: ${error}`);
|
|
574
|
+
done(error);
|
|
575
|
+
}
|
|
576
|
+
}).timeout(attemptTimeout);
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
describe('#retrieveNetworkInterfacesUnnumbered - errors', () => {
|
|
580
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
581
|
+
try {
|
|
582
|
+
a.retrieveNetworkInterfacesUnnumbered(iETFLogicalInventoryRestconfAPINetwork, iETFLogicalInventoryRestconfAPINode, iETFLogicalInventoryRestconfAPISubinterface, (data, error) => {
|
|
583
|
+
try {
|
|
584
|
+
if (stub) {
|
|
585
|
+
runCommonAsserts(data, error);
|
|
586
|
+
assert.equal('object', typeof data.response['openconfig-interfaces:unnumbered']);
|
|
587
|
+
} else {
|
|
588
|
+
runCommonAsserts(data, error);
|
|
589
|
+
}
|
|
590
|
+
saveMockData('IETFLogicalInventoryRestconfAPI', 'retrieveNetworkInterfacesUnnumbered', 'default', data);
|
|
591
|
+
done();
|
|
592
|
+
} catch (err) {
|
|
593
|
+
log.error(`Test Failure: ${err}`);
|
|
594
|
+
done(err);
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
} catch (error) {
|
|
598
|
+
log.error(`Adapter Exception: ${error}`);
|
|
599
|
+
done(error);
|
|
600
|
+
}
|
|
601
|
+
}).timeout(attemptTimeout);
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
describe('#retrieveNetworkInterfacesUnnumberedIntf - errors', () => {
|
|
605
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
606
|
+
try {
|
|
607
|
+
a.retrieveNetworkInterfacesUnnumberedIntf(iETFLogicalInventoryRestconfAPINetwork, iETFLogicalInventoryRestconfAPINode, iETFLogicalInventoryRestconfAPISubinterface, (data, error) => {
|
|
608
|
+
try {
|
|
609
|
+
if (stub) {
|
|
610
|
+
runCommonAsserts(data, error);
|
|
611
|
+
assert.equal('object', typeof data.response['openconfig-interfaces:interface-ref']);
|
|
612
|
+
} else {
|
|
613
|
+
runCommonAsserts(data, error);
|
|
614
|
+
}
|
|
615
|
+
saveMockData('IETFLogicalInventoryRestconfAPI', 'retrieveNetworkInterfacesUnnumberedIntf', 'default', data);
|
|
616
|
+
done();
|
|
617
|
+
} catch (err) {
|
|
618
|
+
log.error(`Test Failure: ${err}`);
|
|
619
|
+
done(err);
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
} catch (error) {
|
|
623
|
+
log.error(`Adapter Exception: ${error}`);
|
|
624
|
+
done(error);
|
|
625
|
+
}
|
|
626
|
+
}).timeout(attemptTimeout);
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
describe('#retrieveNetworkSubInterfacesIPv6Addresses - errors', () => {
|
|
630
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
631
|
+
try {
|
|
632
|
+
a.retrieveNetworkSubInterfacesIPv6Addresses(iETFLogicalInventoryRestconfAPINetwork, iETFLogicalInventoryRestconfAPINode, iETFLogicalInventoryRestconfAPISubinterface, (data, error) => {
|
|
633
|
+
try {
|
|
634
|
+
if (stub) {
|
|
635
|
+
runCommonAsserts(data, error);
|
|
636
|
+
assert.equal(true, Array.isArray(data.response['openconfig-interfaces:address']));
|
|
637
|
+
} else {
|
|
638
|
+
runCommonAsserts(data, error);
|
|
639
|
+
}
|
|
640
|
+
saveMockData('IETFLogicalInventoryRestconfAPI', 'retrieveNetworkSubInterfacesIPv6Addresses', 'default', data);
|
|
641
|
+
done();
|
|
642
|
+
} catch (err) {
|
|
643
|
+
log.error(`Test Failure: ${err}`);
|
|
644
|
+
done(err);
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
} catch (error) {
|
|
648
|
+
log.error(`Adapter Exception: ${error}`);
|
|
649
|
+
done(error);
|
|
650
|
+
}
|
|
651
|
+
}).timeout(attemptTimeout);
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
describe('#retrieveNetworkSubInterfacesState - errors', () => {
|
|
655
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
656
|
+
try {
|
|
657
|
+
a.retrieveNetworkSubInterfacesState(iETFLogicalInventoryRestconfAPINetwork, iETFLogicalInventoryRestconfAPINode, iETFLogicalInventoryRestconfAPISubinterface, (data, error) => {
|
|
658
|
+
try {
|
|
659
|
+
if (stub) {
|
|
660
|
+
runCommonAsserts(data, error);
|
|
661
|
+
assert.equal('object', typeof data.response['openconfig-interfaces:state']);
|
|
662
|
+
} else {
|
|
663
|
+
runCommonAsserts(data, error);
|
|
664
|
+
}
|
|
665
|
+
saveMockData('IETFLogicalInventoryRestconfAPI', 'retrieveNetworkSubInterfacesState', 'default', data);
|
|
666
|
+
done();
|
|
667
|
+
} catch (err) {
|
|
668
|
+
log.error(`Test Failure: ${err}`);
|
|
669
|
+
done(err);
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
} catch (error) {
|
|
673
|
+
log.error(`Adapter Exception: ${error}`);
|
|
674
|
+
done(error);
|
|
675
|
+
}
|
|
676
|
+
}).timeout(attemptTimeout);
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
const iETFLogicalInventoryRestconfAPIInterfaceParam = 'fakedata';
|
|
680
|
+
describe('#retrieveNetworkSubInterfacesIPv4Addresses - errors', () => {
|
|
681
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
682
|
+
try {
|
|
683
|
+
a.retrieveNetworkSubInterfacesIPv4Addresses(iETFLogicalInventoryRestconfAPINetwork, iETFLogicalInventoryRestconfAPINode, iETFLogicalInventoryRestconfAPIInterfaceParam, iETFLogicalInventoryRestconfAPISubinterface, (data, error) => {
|
|
684
|
+
try {
|
|
685
|
+
if (stub) {
|
|
686
|
+
runCommonAsserts(data, error);
|
|
687
|
+
assert.equal(true, Array.isArray(data.response['openconfig-interfaces:address']));
|
|
688
|
+
} else {
|
|
689
|
+
runCommonAsserts(data, error);
|
|
690
|
+
}
|
|
691
|
+
saveMockData('IETFLogicalInventoryRestconfAPI', 'retrieveNetworkSubInterfacesIPv4Addresses', 'default', data);
|
|
692
|
+
done();
|
|
693
|
+
} catch (err) {
|
|
694
|
+
log.error(`Test Failure: ${err}`);
|
|
695
|
+
done(err);
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
} catch (error) {
|
|
699
|
+
log.error(`Adapter Exception: ${error}`);
|
|
700
|
+
done(error);
|
|
701
|
+
}
|
|
702
|
+
}).timeout(attemptTimeout);
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
describe('#retrieveNetworkInstance - errors', () => {
|
|
706
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
707
|
+
try {
|
|
708
|
+
a.retrieveNetworkInstance(iETFLogicalInventoryRestconfAPINetwork, iETFLogicalInventoryRestconfAPINode, (data, error) => {
|
|
709
|
+
try {
|
|
710
|
+
if (stub) {
|
|
711
|
+
const displayE = 'Error 400 received on request';
|
|
712
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
713
|
+
} else {
|
|
714
|
+
runCommonAsserts(data, error);
|
|
715
|
+
}
|
|
716
|
+
saveMockData('IETFLogicalInventoryRestconfAPI', 'retrieveNetworkInstance', 'default', data);
|
|
717
|
+
done();
|
|
718
|
+
} catch (err) {
|
|
719
|
+
log.error(`Test Failure: ${err}`);
|
|
720
|
+
done(err);
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
} catch (error) {
|
|
724
|
+
log.error(`Adapter Exception: ${error}`);
|
|
725
|
+
done(error);
|
|
726
|
+
}
|
|
727
|
+
}).timeout(attemptTimeout);
|
|
728
|
+
});
|
|
729
|
+
|
|
730
|
+
const iETFLogicalInventoryRestconfAPIResyncPolicy = 'fakedata';
|
|
731
|
+
const iETFLogicalInventoryRestconfAPIVersion = 'fakedata';
|
|
732
|
+
describe('#retrieveResyncPolicyNodeVersionEntity - errors', () => {
|
|
733
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
734
|
+
try {
|
|
735
|
+
a.retrieveResyncPolicyNodeVersionEntity(iETFLogicalInventoryRestconfAPIResyncPolicy, iETFLogicalInventoryRestconfAPINode, iETFLogicalInventoryRestconfAPIVersion, (data, error) => {
|
|
736
|
+
try {
|
|
737
|
+
if (stub) {
|
|
738
|
+
runCommonAsserts(data, error);
|
|
739
|
+
assert.equal(true, Array.isArray(data.response['nsp-admin-resync:entity']));
|
|
740
|
+
} else {
|
|
741
|
+
runCommonAsserts(data, error);
|
|
742
|
+
}
|
|
743
|
+
saveMockData('IETFLogicalInventoryRestconfAPI', 'retrieveResyncPolicyNodeVersionEntity', 'default', data);
|
|
744
|
+
done();
|
|
745
|
+
} catch (err) {
|
|
746
|
+
log.error(`Test Failure: ${err}`);
|
|
747
|
+
done(err);
|
|
748
|
+
}
|
|
749
|
+
});
|
|
750
|
+
} catch (error) {
|
|
751
|
+
log.error(`Adapter Exception: ${error}`);
|
|
752
|
+
done(error);
|
|
753
|
+
}
|
|
754
|
+
}).timeout(attemptTimeout);
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
const intentCreateUsingIntentBodyParam = {
|
|
758
|
+
'ibn:intent': {
|
|
759
|
+
target: 'nspuser',
|
|
760
|
+
'intent-type': 'create_http_user',
|
|
761
|
+
'intent-type-version': 1,
|
|
762
|
+
'required-network-state': 'active',
|
|
763
|
+
'ibn:intent-specific-data': {
|
|
764
|
+
'create_http_user:create_http_user': {
|
|
765
|
+
password: 'bnNwdXNlcg==',
|
|
766
|
+
passwordConfirm: 'bnNwdXNlcg=='
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
describe('#createUsingIntent - errors', () => {
|
|
772
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
773
|
+
try {
|
|
774
|
+
a.createUsingIntent(intentCreateUsingIntentBodyParam, (data, error) => {
|
|
775
|
+
try {
|
|
776
|
+
if (stub) {
|
|
777
|
+
const displayE = 'Error 400 received on request';
|
|
778
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
779
|
+
} else {
|
|
780
|
+
runCommonAsserts(data, error);
|
|
781
|
+
}
|
|
782
|
+
saveMockData('Intent', 'createUsingIntent', 'default', data);
|
|
783
|
+
done();
|
|
784
|
+
} catch (err) {
|
|
785
|
+
log.error(`Test Failure: ${err}`);
|
|
786
|
+
done(err);
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
} catch (error) {
|
|
790
|
+
log.error(`Adapter Exception: ${error}`);
|
|
791
|
+
done(error);
|
|
792
|
+
}
|
|
793
|
+
}).timeout(attemptTimeout);
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
const intentIntent = 'fakedata';
|
|
797
|
+
describe('#synchronizeIntent - errors', () => {
|
|
798
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
799
|
+
try {
|
|
800
|
+
a.synchronizeIntent(intentIntent, (data, error) => {
|
|
801
|
+
try {
|
|
802
|
+
if (stub) {
|
|
803
|
+
runCommonAsserts(data, error);
|
|
804
|
+
assert.equal('object', typeof data.response.response);
|
|
805
|
+
} else {
|
|
806
|
+
runCommonAsserts(data, error);
|
|
807
|
+
}
|
|
808
|
+
saveMockData('Intent', 'synchronizeIntent', 'default', data);
|
|
809
|
+
done();
|
|
810
|
+
} catch (err) {
|
|
811
|
+
log.error(`Test Failure: ${err}`);
|
|
812
|
+
done(err);
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
} catch (error) {
|
|
816
|
+
log.error(`Adapter Exception: ${error}`);
|
|
817
|
+
done(error);
|
|
818
|
+
}
|
|
819
|
+
}).timeout(attemptTimeout);
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
const intentModifyIntentBodyParam = {
|
|
823
|
+
'ibn:intent': {
|
|
824
|
+
target: 'TestProfile2',
|
|
825
|
+
'intent-type': 'ztp-profile',
|
|
826
|
+
'intent-type-version': 1,
|
|
827
|
+
'required-network-state': 'active',
|
|
828
|
+
'ibn:intent-specific-data': {
|
|
829
|
+
'ztp-profile:ztp-profile': {
|
|
830
|
+
'node-type': '7250_IXR',
|
|
831
|
+
'md-management-connection': 'out-of-band',
|
|
832
|
+
'dns-domain': 'nokia-new'
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
describe('#modifyIntent - errors', () => {
|
|
838
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
839
|
+
try {
|
|
840
|
+
a.modifyIntent(intentIntent, intentModifyIntentBodyParam, (data, error) => {
|
|
841
|
+
try {
|
|
842
|
+
if (stub) {
|
|
843
|
+
const displayE = 'Error 400 received on request';
|
|
844
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
845
|
+
} else {
|
|
846
|
+
runCommonAsserts(data, error);
|
|
847
|
+
}
|
|
848
|
+
saveMockData('Intent', 'modifyIntent', 'default', data);
|
|
849
|
+
done();
|
|
850
|
+
} catch (err) {
|
|
851
|
+
log.error(`Test Failure: ${err}`);
|
|
852
|
+
done(err);
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
} catch (error) {
|
|
856
|
+
log.error(`Adapter Exception: ${error}`);
|
|
857
|
+
done(error);
|
|
858
|
+
}
|
|
859
|
+
}).timeout(attemptTimeout);
|
|
860
|
+
});
|
|
861
|
+
|
|
862
|
+
describe('#getIntent - errors', () => {
|
|
863
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
864
|
+
try {
|
|
865
|
+
a.getIntent(intentIntent, (data, error) => {
|
|
866
|
+
try {
|
|
867
|
+
if (stub) {
|
|
868
|
+
runCommonAsserts(data, error);
|
|
869
|
+
assert.equal('object', typeof data.response['ibn:intent']);
|
|
870
|
+
} else {
|
|
871
|
+
runCommonAsserts(data, error);
|
|
872
|
+
}
|
|
873
|
+
saveMockData('Intent', 'getIntent', 'default', data);
|
|
874
|
+
done();
|
|
875
|
+
} catch (err) {
|
|
876
|
+
log.error(`Test Failure: ${err}`);
|
|
877
|
+
done(err);
|
|
878
|
+
}
|
|
879
|
+
});
|
|
880
|
+
} catch (error) {
|
|
881
|
+
log.error(`Adapter Exception: ${error}`);
|
|
882
|
+
done(error);
|
|
883
|
+
}
|
|
884
|
+
}).timeout(attemptTimeout);
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
const manageZTPListFromDeviceAdministratorDevAdminCreateAutodiscoveryNeBodyParam = {
|
|
888
|
+
'autodiscovery-ne': [
|
|
889
|
+
{
|
|
890
|
+
'ne-name': 'a1',
|
|
891
|
+
'mgmt-ip': '1.11.11.1',
|
|
892
|
+
'system-ip': '1.11.11.1',
|
|
893
|
+
'serial-number': 'a1',
|
|
894
|
+
'discovery-status': 'pending',
|
|
895
|
+
'mgmt-mode': 'model-driven',
|
|
896
|
+
'ne-type': '7250_IXR',
|
|
897
|
+
'ne-version': '19.10.R7',
|
|
898
|
+
'disc-rule-name': 'ken-rule',
|
|
899
|
+
'ztp-files': 'configfile.conf;',
|
|
900
|
+
'ztp-primary-file': 'provfile.conf;',
|
|
901
|
+
'ztp-profile-name': 'profile',
|
|
902
|
+
'status-details': ''
|
|
903
|
+
}
|
|
904
|
+
]
|
|
905
|
+
};
|
|
906
|
+
describe('#devAdminCreateAutodiscoveryNe - errors', () => {
|
|
907
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
908
|
+
try {
|
|
909
|
+
a.devAdminCreateAutodiscoveryNe(manageZTPListFromDeviceAdministratorDevAdminCreateAutodiscoveryNeBodyParam, (data, error) => {
|
|
910
|
+
try {
|
|
911
|
+
if (stub) {
|
|
912
|
+
const displayE = 'Error 400 received on request';
|
|
913
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
914
|
+
} else {
|
|
915
|
+
runCommonAsserts(data, error);
|
|
916
|
+
}
|
|
917
|
+
saveMockData('ManageZTPListFromDeviceAdministrator', 'devAdminCreateAutodiscoveryNe', 'default', data);
|
|
918
|
+
done();
|
|
919
|
+
} catch (err) {
|
|
920
|
+
log.error(`Test Failure: ${err}`);
|
|
921
|
+
done(err);
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
} catch (error) {
|
|
925
|
+
log.error(`Adapter Exception: ${error}`);
|
|
926
|
+
done(error);
|
|
927
|
+
}
|
|
928
|
+
}).timeout(attemptTimeout);
|
|
929
|
+
});
|
|
930
|
+
|
|
931
|
+
describe('#getZTPListFromDeviceAdministrator - errors', () => {
|
|
932
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
933
|
+
try {
|
|
934
|
+
a.getZTPListFromDeviceAdministrator((data, error) => {
|
|
935
|
+
try {
|
|
936
|
+
if (stub) {
|
|
937
|
+
runCommonAsserts(data, error);
|
|
938
|
+
assert.equal(true, Array.isArray(data.response['nsp-ne-control:autodiscovery-ne']));
|
|
939
|
+
} else {
|
|
940
|
+
runCommonAsserts(data, error);
|
|
941
|
+
}
|
|
942
|
+
saveMockData('ManageZTPListFromDeviceAdministrator', 'getZTPListFromDeviceAdministrator', 'default', data);
|
|
943
|
+
done();
|
|
944
|
+
} catch (err) {
|
|
945
|
+
log.error(`Test Failure: ${err}`);
|
|
946
|
+
done(err);
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
} catch (error) {
|
|
950
|
+
log.error(`Adapter Exception: ${error}`);
|
|
951
|
+
done(error);
|
|
952
|
+
}
|
|
953
|
+
}).timeout(attemptTimeout);
|
|
954
|
+
});
|
|
955
|
+
|
|
956
|
+
const manageZTPListFromDeviceAdministratorAutodiscoveryNe = 'fakedata';
|
|
957
|
+
const manageZTPListFromDeviceAdministratorDevAdminUpdateAutodiscoveryNeBodyParam = {
|
|
958
|
+
'autodiscovery-ne': [
|
|
959
|
+
{
|
|
960
|
+
'discovery-status': 'success',
|
|
961
|
+
'discovery-timestamp': 4321
|
|
962
|
+
}
|
|
963
|
+
]
|
|
964
|
+
};
|
|
965
|
+
describe('#devAdminUpdateAutodiscoveryNe - errors', () => {
|
|
966
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
967
|
+
try {
|
|
968
|
+
a.devAdminUpdateAutodiscoveryNe(manageZTPListFromDeviceAdministratorAutodiscoveryNe, manageZTPListFromDeviceAdministratorDevAdminUpdateAutodiscoveryNeBodyParam, (data, error) => {
|
|
969
|
+
try {
|
|
970
|
+
if (stub) {
|
|
971
|
+
const displayE = 'Error 400 received on request';
|
|
972
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
973
|
+
} else {
|
|
974
|
+
runCommonAsserts(data, error);
|
|
975
|
+
}
|
|
976
|
+
saveMockData('ManageZTPListFromDeviceAdministrator', 'devAdminUpdateAutodiscoveryNe', 'default', data);
|
|
977
|
+
done();
|
|
978
|
+
} catch (err) {
|
|
979
|
+
log.error(`Test Failure: ${err}`);
|
|
980
|
+
done(err);
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
} catch (error) {
|
|
984
|
+
log.error(`Adapter Exception: ${error}`);
|
|
985
|
+
done(error);
|
|
986
|
+
}
|
|
987
|
+
}).timeout(attemptTimeout);
|
|
988
|
+
});
|
|
989
|
+
|
|
990
|
+
const addressPoolCreateIPv4AddressPoolBodyParam = {
|
|
991
|
+
'nsp-resource-pool:ip-resource-pools': {
|
|
992
|
+
name: 'ip-2',
|
|
993
|
+
scope: 'net-1',
|
|
994
|
+
type: 'nsp-resource-pool-utils:ip-address-prefix',
|
|
995
|
+
description: 'this is a Hosts IP pool',
|
|
996
|
+
'ip-pool-spec': {
|
|
997
|
+
'ip-masks': [
|
|
998
|
+
{
|
|
999
|
+
'ip-mask': '10.0.0.28/31',
|
|
1000
|
+
purposes: [
|
|
1001
|
+
'default'
|
|
1002
|
+
]
|
|
1003
|
+
}
|
|
1004
|
+
]
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
describe('#createIPv4AddressPool - errors', () => {
|
|
1009
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1010
|
+
try {
|
|
1011
|
+
a.createIPv4AddressPool(addressPoolCreateIPv4AddressPoolBodyParam, (data, error) => {
|
|
1012
|
+
try {
|
|
1013
|
+
if (stub) {
|
|
1014
|
+
const displayE = 'Error 400 received on request';
|
|
1015
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
1016
|
+
} else {
|
|
1017
|
+
runCommonAsserts(data, error);
|
|
1018
|
+
}
|
|
1019
|
+
saveMockData('AddressPool', 'createIPv4AddressPool', 'default', data);
|
|
1020
|
+
done();
|
|
1021
|
+
} catch (err) {
|
|
1022
|
+
log.error(`Test Failure: ${err}`);
|
|
1023
|
+
done(err);
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
} catch (error) {
|
|
1027
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1028
|
+
done(error);
|
|
1029
|
+
}
|
|
1030
|
+
}).timeout(attemptTimeout);
|
|
1031
|
+
});
|
|
1032
|
+
|
|
1033
|
+
const addressPoolIpResourcePools = 'fakedata';
|
|
1034
|
+
const addressPoolObtainValueFromPoolBodyParam = {
|
|
1035
|
+
'nsp-resource-pool:input': {
|
|
1036
|
+
owner: 'ztp',
|
|
1037
|
+
'all-or-nothing': true,
|
|
1038
|
+
'total-number-of-resources': 1,
|
|
1039
|
+
'allocation-mask': 32
|
|
1040
|
+
}
|
|
1041
|
+
};
|
|
1042
|
+
describe('#obtainValueFromPool - errors', () => {
|
|
1043
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1044
|
+
try {
|
|
1045
|
+
a.obtainValueFromPool(addressPoolIpResourcePools, addressPoolObtainValueFromPoolBodyParam, (data, error) => {
|
|
1046
|
+
try {
|
|
1047
|
+
if (stub) {
|
|
1048
|
+
runCommonAsserts(data, error);
|
|
1049
|
+
assert.equal('object', typeof data.response['nsp-resource-pool:output']);
|
|
1050
|
+
assert.equal('OK', data.response.statusCode);
|
|
1051
|
+
} else {
|
|
1052
|
+
runCommonAsserts(data, error);
|
|
1053
|
+
}
|
|
1054
|
+
saveMockData('AddressPool', 'obtainValueFromPool', 'default', data);
|
|
1055
|
+
done();
|
|
1056
|
+
} catch (err) {
|
|
1057
|
+
log.error(`Test Failure: ${err}`);
|
|
1058
|
+
done(err);
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
} catch (error) {
|
|
1062
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1063
|
+
done(error);
|
|
1064
|
+
}
|
|
1065
|
+
}).timeout(attemptTimeout);
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
describe('#getIPv4AddressPool - errors', () => {
|
|
1069
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1070
|
+
try {
|
|
1071
|
+
a.getIPv4AddressPool(addressPoolIpResourcePools, (data, error) => {
|
|
1072
|
+
try {
|
|
1073
|
+
if (stub) {
|
|
1074
|
+
runCommonAsserts(data, error);
|
|
1075
|
+
assert.equal(true, Array.isArray(data.response['nsp-resource-pool:ip-resource-pools']));
|
|
1076
|
+
} else {
|
|
1077
|
+
runCommonAsserts(data, error);
|
|
1078
|
+
}
|
|
1079
|
+
saveMockData('AddressPool', 'getIPv4AddressPool', 'default', data);
|
|
1080
|
+
done();
|
|
1081
|
+
} catch (err) {
|
|
1082
|
+
log.error(`Test Failure: ${err}`);
|
|
1083
|
+
done(err);
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
} catch (error) {
|
|
1087
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1088
|
+
done(error);
|
|
1089
|
+
}
|
|
1090
|
+
}).timeout(attemptTimeout);
|
|
1091
|
+
});
|
|
1092
|
+
|
|
1093
|
+
const logicalInventoryRestconfAPINspInventoryFindWithFilterBodyParam = {
|
|
1094
|
+
input: {
|
|
1095
|
+
'xpath-filter': '/nsp-network:network/node[node-id=\'92.168.98.156\']/node-root/openconfig-acl:acl/acl-sets/acl-set'
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1098
|
+
describe('#nspInventoryFindWithFilter - errors', () => {
|
|
1099
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1100
|
+
try {
|
|
1101
|
+
a.nspInventoryFindWithFilter(logicalInventoryRestconfAPINspInventoryFindWithFilterBodyParam, (data, error) => {
|
|
1102
|
+
try {
|
|
1103
|
+
if (stub) {
|
|
1104
|
+
runCommonAsserts(data, error);
|
|
1105
|
+
assert.equal('object', typeof data.response['nsp-inventory:output']);
|
|
1106
|
+
assert.equal('OK', data.response.statusCode);
|
|
1107
|
+
} else {
|
|
1108
|
+
runCommonAsserts(data, error);
|
|
1109
|
+
}
|
|
1110
|
+
saveMockData('LogicalInventoryRestconfAPI', 'nspInventoryFindWithFilter', 'default', data);
|
|
1111
|
+
done();
|
|
1112
|
+
} catch (err) {
|
|
1113
|
+
log.error(`Test Failure: ${err}`);
|
|
1114
|
+
done(err);
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
} catch (error) {
|
|
1118
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1119
|
+
done(error);
|
|
1120
|
+
}
|
|
1121
|
+
}).timeout(attemptTimeout);
|
|
1122
|
+
});
|
|
1123
|
+
|
|
1124
|
+
describe('#retrieveResyncPolicy - errors', () => {
|
|
1125
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1126
|
+
try {
|
|
1127
|
+
a.retrieveResyncPolicy((data, error) => {
|
|
1128
|
+
try {
|
|
1129
|
+
if (stub) {
|
|
1130
|
+
runCommonAsserts(data, error);
|
|
1131
|
+
assert.equal(true, Array.isArray(data.response['nsp-admin-resync:resync-policy']));
|
|
1132
|
+
} else {
|
|
1133
|
+
runCommonAsserts(data, error);
|
|
1134
|
+
}
|
|
1135
|
+
saveMockData('LogicalInventoryRestconfAPI', 'retrieveResyncPolicy', 'default', data);
|
|
1136
|
+
done();
|
|
1137
|
+
} catch (err) {
|
|
1138
|
+
log.error(`Test Failure: ${err}`);
|
|
1139
|
+
done(err);
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
} catch (error) {
|
|
1143
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1144
|
+
done(error);
|
|
1145
|
+
}
|
|
1146
|
+
}).timeout(attemptTimeout);
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1149
|
+
const logicalInventoryRestconfAPIResyncPolicy = 'fakedata';
|
|
1150
|
+
const logicalInventoryRestconfAPINode = 'fakedata';
|
|
1151
|
+
describe('#retrieveResyncPollingPolicyNESpecific - errors', () => {
|
|
1152
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1153
|
+
try {
|
|
1154
|
+
a.retrieveResyncPollingPolicyNESpecific(logicalInventoryRestconfAPIResyncPolicy, logicalInventoryRestconfAPINode, (data, error) => {
|
|
1155
|
+
try {
|
|
1156
|
+
if (stub) {
|
|
1157
|
+
runCommonAsserts(data, error);
|
|
1158
|
+
assert.equal(true, Array.isArray(data.response['nsp-admin-resync:node']));
|
|
1159
|
+
} else {
|
|
1160
|
+
runCommonAsserts(data, error);
|
|
1161
|
+
}
|
|
1162
|
+
saveMockData('LogicalInventoryRestconfAPI', 'retrieveResyncPollingPolicyNESpecific', 'default', data);
|
|
1163
|
+
done();
|
|
1164
|
+
} catch (err) {
|
|
1165
|
+
log.error(`Test Failure: ${err}`);
|
|
1166
|
+
done(err);
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
} catch (error) {
|
|
1170
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1171
|
+
done(error);
|
|
1172
|
+
}
|
|
1173
|
+
}).timeout(attemptTimeout);
|
|
1174
|
+
});
|
|
1175
|
+
|
|
1176
|
+
const logicalInventoryRestconfAPIVersion = 'fakedata';
|
|
1177
|
+
describe('#retrieveResyncPolicyNEAndVersionSpecific - errors', () => {
|
|
1178
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1179
|
+
try {
|
|
1180
|
+
a.retrieveResyncPolicyNEAndVersionSpecific(logicalInventoryRestconfAPIResyncPolicy, logicalInventoryRestconfAPINode, logicalInventoryRestconfAPIVersion, (data, error) => {
|
|
1181
|
+
try {
|
|
1182
|
+
if (stub) {
|
|
1183
|
+
runCommonAsserts(data, error);
|
|
1184
|
+
assert.equal(true, Array.isArray(data.response['nsp-admin-resync:version']));
|
|
1185
|
+
} else {
|
|
1186
|
+
runCommonAsserts(data, error);
|
|
1187
|
+
}
|
|
1188
|
+
saveMockData('LogicalInventoryRestconfAPI', 'retrieveResyncPolicyNEAndVersionSpecific', 'default', data);
|
|
1189
|
+
done();
|
|
1190
|
+
} catch (err) {
|
|
1191
|
+
log.error(`Test Failure: ${err}`);
|
|
1192
|
+
done(err);
|
|
1193
|
+
}
|
|
1194
|
+
});
|
|
1195
|
+
} catch (error) {
|
|
1196
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1197
|
+
done(error);
|
|
1198
|
+
}
|
|
1199
|
+
}).timeout(attemptTimeout);
|
|
1200
|
+
});
|
|
1201
|
+
|
|
1202
|
+
const logicalInventoryRestconfAPIEntity = 'fakedata';
|
|
1203
|
+
const logicalInventoryRestconfAPIEnableResyncPollingPolicyBodyParam = {
|
|
1204
|
+
entity: [
|
|
1205
|
+
{
|
|
1206
|
+
'entity-type': 'openconfig-acl:/acl/acl-sets/acl-set/acl-entries/acl-entry',
|
|
1207
|
+
period: 2,
|
|
1208
|
+
'admin-state': 'enabled',
|
|
1209
|
+
description: 'Enable For OpenconfigAcl'
|
|
1210
|
+
}
|
|
1211
|
+
]
|
|
1212
|
+
};
|
|
1213
|
+
describe('#enableResyncPollingPolicy - errors', () => {
|
|
1214
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1215
|
+
try {
|
|
1216
|
+
a.enableResyncPollingPolicy(logicalInventoryRestconfAPIResyncPolicy, logicalInventoryRestconfAPINode, logicalInventoryRestconfAPIVersion, logicalInventoryRestconfAPIEntity, logicalInventoryRestconfAPIEnableResyncPollingPolicyBodyParam, (data, error) => {
|
|
1217
|
+
try {
|
|
1218
|
+
if (stub) {
|
|
1219
|
+
const displayE = 'Error 400 received on request';
|
|
1220
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
1221
|
+
} else {
|
|
1222
|
+
runCommonAsserts(data, error);
|
|
1223
|
+
}
|
|
1224
|
+
saveMockData('LogicalInventoryRestconfAPI', 'enableResyncPollingPolicy', 'default', data);
|
|
1225
|
+
done();
|
|
1226
|
+
} catch (err) {
|
|
1227
|
+
log.error(`Test Failure: ${err}`);
|
|
1228
|
+
done(err);
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1231
|
+
} catch (error) {
|
|
1232
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1233
|
+
done(error);
|
|
1234
|
+
}
|
|
1235
|
+
}).timeout(attemptTimeout);
|
|
1236
|
+
});
|
|
1237
|
+
|
|
1238
|
+
const iETFL2ModelNetwork = 'fakedata';
|
|
1239
|
+
describe('#getL2TopologyAttributes - errors', () => {
|
|
1240
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1241
|
+
try {
|
|
1242
|
+
a.getL2TopologyAttributes(iETFL2ModelNetwork, (data, error) => {
|
|
1243
|
+
try {
|
|
1244
|
+
if (stub) {
|
|
1245
|
+
runCommonAsserts(data, error);
|
|
1246
|
+
assert.equal('object', typeof data.response['ietf-l2-topology:l2-topology-attributes']);
|
|
1247
|
+
} else {
|
|
1248
|
+
runCommonAsserts(data, error);
|
|
1249
|
+
}
|
|
1250
|
+
saveMockData('IETFL2Model', 'getL2TopologyAttributes', 'default', data);
|
|
1251
|
+
done();
|
|
1252
|
+
} catch (err) {
|
|
1253
|
+
log.error(`Test Failure: ${err}`);
|
|
1254
|
+
done(err);
|
|
1255
|
+
}
|
|
1256
|
+
});
|
|
1257
|
+
} catch (error) {
|
|
1258
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1259
|
+
done(error);
|
|
1260
|
+
}
|
|
1261
|
+
}).timeout(attemptTimeout);
|
|
1262
|
+
});
|
|
1263
|
+
|
|
1264
|
+
describe('#getL2TopologyLinks - errors', () => {
|
|
1265
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1266
|
+
try {
|
|
1267
|
+
a.getL2TopologyLinks(iETFL2ModelNetwork, (data, error) => {
|
|
1268
|
+
try {
|
|
1269
|
+
if (stub) {
|
|
1270
|
+
const displayE = 'Error 400 received on request';
|
|
1271
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
1272
|
+
} else {
|
|
1273
|
+
runCommonAsserts(data, error);
|
|
1274
|
+
}
|
|
1275
|
+
saveMockData('IETFL2Model', 'getL2TopologyLinks', 'default', data);
|
|
1276
|
+
done();
|
|
1277
|
+
} catch (err) {
|
|
1278
|
+
log.error(`Test Failure: ${err}`);
|
|
1279
|
+
done(err);
|
|
1280
|
+
}
|
|
1281
|
+
});
|
|
1282
|
+
} catch (error) {
|
|
1283
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1284
|
+
done(error);
|
|
1285
|
+
}
|
|
1286
|
+
}).timeout(attemptTimeout);
|
|
1287
|
+
});
|
|
1288
|
+
|
|
1289
|
+
const iETFL2ModelNode = 'fakedata';
|
|
1290
|
+
describe('#getL2TopologyNodeTerminationPoints - errors', () => {
|
|
1291
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1292
|
+
try {
|
|
1293
|
+
a.getL2TopologyNodeTerminationPoints(iETFL2ModelNetwork, iETFL2ModelNode, (data, error) => {
|
|
1294
|
+
try {
|
|
1295
|
+
if (stub) {
|
|
1296
|
+
runCommonAsserts(data, error);
|
|
1297
|
+
assert.equal(true, Array.isArray(data.response['ietf-network-topology:termination-point']));
|
|
1298
|
+
} else {
|
|
1299
|
+
runCommonAsserts(data, error);
|
|
1300
|
+
}
|
|
1301
|
+
saveMockData('IETFL2Model', 'getL2TopologyNodeTerminationPoints', 'default', data);
|
|
1302
|
+
done();
|
|
1303
|
+
} catch (err) {
|
|
1304
|
+
log.error(`Test Failure: ${err}`);
|
|
1305
|
+
done(err);
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
} catch (error) {
|
|
1309
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1310
|
+
done(error);
|
|
1311
|
+
}
|
|
1312
|
+
}).timeout(attemptTimeout);
|
|
1313
|
+
});
|
|
1314
|
+
|
|
1315
|
+
describe('#getNetwork - errors', () => {
|
|
1316
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1317
|
+
try {
|
|
1318
|
+
a.getNetwork((data, error) => {
|
|
1319
|
+
try {
|
|
1320
|
+
if (stub) {
|
|
1321
|
+
const displayE = 'Error 400 received on request';
|
|
1322
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
1323
|
+
} else {
|
|
1324
|
+
runCommonAsserts(data, error);
|
|
1325
|
+
}
|
|
1326
|
+
saveMockData('IETFL3Model', 'getNetwork', 'default', data);
|
|
1327
|
+
done();
|
|
1328
|
+
} catch (err) {
|
|
1329
|
+
log.error(`Test Failure: ${err}`);
|
|
1330
|
+
done(err);
|
|
1331
|
+
}
|
|
1332
|
+
});
|
|
1333
|
+
} catch (error) {
|
|
1334
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1335
|
+
done(error);
|
|
1336
|
+
}
|
|
1337
|
+
}).timeout(attemptTimeout);
|
|
1338
|
+
});
|
|
1339
|
+
|
|
1340
|
+
const iETFL3ModelNetwork = 'fakedata';
|
|
1341
|
+
describe('#getSpecificNetwork - errors', () => {
|
|
1342
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1343
|
+
try {
|
|
1344
|
+
a.getSpecificNetwork(iETFL3ModelNetwork, (data, error) => {
|
|
1345
|
+
try {
|
|
1346
|
+
if (stub) {
|
|
1347
|
+
runCommonAsserts(data, error);
|
|
1348
|
+
assert.equal(true, Array.isArray(data.response['ietf-network:network']));
|
|
1349
|
+
} else {
|
|
1350
|
+
runCommonAsserts(data, error);
|
|
1351
|
+
}
|
|
1352
|
+
saveMockData('IETFL3Model', 'getSpecificNetwork', 'default', data);
|
|
1353
|
+
done();
|
|
1354
|
+
} catch (err) {
|
|
1355
|
+
log.error(`Test Failure: ${err}`);
|
|
1356
|
+
done(err);
|
|
1357
|
+
}
|
|
1358
|
+
});
|
|
1359
|
+
} catch (error) {
|
|
1360
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1361
|
+
done(error);
|
|
1362
|
+
}
|
|
1363
|
+
}).timeout(attemptTimeout);
|
|
1364
|
+
});
|
|
1365
|
+
|
|
1366
|
+
describe('#getL3TopologyAttribute - errors', () => {
|
|
1367
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1368
|
+
try {
|
|
1369
|
+
a.getL3TopologyAttribute(iETFL3ModelNetwork, (data, error) => {
|
|
1370
|
+
try {
|
|
1371
|
+
if (stub) {
|
|
1372
|
+
runCommonAsserts(data, error);
|
|
1373
|
+
assert.equal('object', typeof data.response['ietf-l3-unicast-topology:l3-topology-attributes']);
|
|
1374
|
+
} else {
|
|
1375
|
+
runCommonAsserts(data, error);
|
|
1376
|
+
}
|
|
1377
|
+
saveMockData('IETFL3Model', 'getL3TopologyAttribute', 'default', data);
|
|
1378
|
+
done();
|
|
1379
|
+
} catch (err) {
|
|
1380
|
+
log.error(`Test Failure: ${err}`);
|
|
1381
|
+
done(err);
|
|
1382
|
+
}
|
|
1383
|
+
});
|
|
1384
|
+
} catch (error) {
|
|
1385
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1386
|
+
done(error);
|
|
1387
|
+
}
|
|
1388
|
+
}).timeout(attemptTimeout);
|
|
1389
|
+
});
|
|
1390
|
+
|
|
1391
|
+
describe('#getNetworkType - errors', () => {
|
|
1392
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1393
|
+
try {
|
|
1394
|
+
a.getNetworkType(iETFL3ModelNetwork, (data, error) => {
|
|
1395
|
+
try {
|
|
1396
|
+
if (stub) {
|
|
1397
|
+
runCommonAsserts(data, error);
|
|
1398
|
+
assert.equal('object', typeof data.response['ietf-network:network-types']);
|
|
1399
|
+
} else {
|
|
1400
|
+
runCommonAsserts(data, error);
|
|
1401
|
+
}
|
|
1402
|
+
saveMockData('IETFL3Model', 'getNetworkType', 'default', data);
|
|
1403
|
+
done();
|
|
1404
|
+
} catch (err) {
|
|
1405
|
+
log.error(`Test Failure: ${err}`);
|
|
1406
|
+
done(err);
|
|
1407
|
+
}
|
|
1408
|
+
});
|
|
1409
|
+
} catch (error) {
|
|
1410
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1411
|
+
done(error);
|
|
1412
|
+
}
|
|
1413
|
+
}).timeout(attemptTimeout);
|
|
1414
|
+
});
|
|
1415
|
+
|
|
1416
|
+
describe('#getAllNodesInANetwork - errors', () => {
|
|
1417
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1418
|
+
try {
|
|
1419
|
+
a.getAllNodesInANetwork(iETFL3ModelNetwork, (data, error) => {
|
|
1420
|
+
try {
|
|
1421
|
+
if (stub) {
|
|
1422
|
+
runCommonAsserts(data, error);
|
|
1423
|
+
assert.equal(true, Array.isArray(data.response['ietf-network:node']));
|
|
1424
|
+
} else {
|
|
1425
|
+
runCommonAsserts(data, error);
|
|
1426
|
+
}
|
|
1427
|
+
saveMockData('IETFL3Model', 'getAllNodesInANetwork', 'default', data);
|
|
1428
|
+
done();
|
|
1429
|
+
} catch (err) {
|
|
1430
|
+
log.error(`Test Failure: ${err}`);
|
|
1431
|
+
done(err);
|
|
1432
|
+
}
|
|
1433
|
+
});
|
|
1434
|
+
} catch (error) {
|
|
1435
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1436
|
+
done(error);
|
|
1437
|
+
}
|
|
1438
|
+
}).timeout(attemptTimeout);
|
|
1439
|
+
});
|
|
1440
|
+
|
|
1441
|
+
describe('#getSupportingNetwork - errors', () => {
|
|
1442
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1443
|
+
try {
|
|
1444
|
+
a.getSupportingNetwork(iETFL3ModelNetwork, (data, error) => {
|
|
1445
|
+
try {
|
|
1446
|
+
if (stub) {
|
|
1447
|
+
runCommonAsserts(data, error);
|
|
1448
|
+
assert.equal(true, Array.isArray(data.response['ietf-network:supporting-network']));
|
|
1449
|
+
} else {
|
|
1450
|
+
runCommonAsserts(data, error);
|
|
1451
|
+
}
|
|
1452
|
+
saveMockData('IETFL3Model', 'getSupportingNetwork', 'default', data);
|
|
1453
|
+
done();
|
|
1454
|
+
} catch (err) {
|
|
1455
|
+
log.error(`Test Failure: ${err}`);
|
|
1456
|
+
done(err);
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
} catch (error) {
|
|
1460
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1461
|
+
done(error);
|
|
1462
|
+
}
|
|
1463
|
+
}).timeout(attemptTimeout);
|
|
1464
|
+
});
|
|
1465
|
+
|
|
1466
|
+
const iETFL3ModelLink = 'fakedata';
|
|
1467
|
+
describe('#getSpecificLinkInANetwork - errors', () => {
|
|
1468
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1469
|
+
try {
|
|
1470
|
+
a.getSpecificLinkInANetwork(iETFL3ModelNetwork, iETFL3ModelLink, (data, error) => {
|
|
1471
|
+
try {
|
|
1472
|
+
if (stub) {
|
|
1473
|
+
runCommonAsserts(data, error);
|
|
1474
|
+
assert.equal(true, Array.isArray(data.response['ietf-network-topology:link']));
|
|
1475
|
+
} else {
|
|
1476
|
+
runCommonAsserts(data, error);
|
|
1477
|
+
}
|
|
1478
|
+
saveMockData('IETFL3Model', 'getSpecificLinkInANetwork', 'default', data);
|
|
1479
|
+
done();
|
|
1480
|
+
} catch (err) {
|
|
1481
|
+
log.error(`Test Failure: ${err}`);
|
|
1482
|
+
done(err);
|
|
1483
|
+
}
|
|
1484
|
+
});
|
|
1485
|
+
} catch (error) {
|
|
1486
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1487
|
+
done(error);
|
|
1488
|
+
}
|
|
1489
|
+
}).timeout(attemptTimeout);
|
|
1490
|
+
});
|
|
1491
|
+
|
|
1492
|
+
describe('#l3GETSRTopologyLinkAttributes - errors', () => {
|
|
1493
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1494
|
+
try {
|
|
1495
|
+
a.l3GETSRTopologyLinkAttributes(iETFL3ModelNetwork, iETFL3ModelLink, (data, error) => {
|
|
1496
|
+
try {
|
|
1497
|
+
if (stub) {
|
|
1498
|
+
runCommonAsserts(data, error);
|
|
1499
|
+
assert.equal('object', typeof data.response['ietf-sr-mpls-topology:sr-mpls']);
|
|
1500
|
+
} else {
|
|
1501
|
+
runCommonAsserts(data, error);
|
|
1502
|
+
}
|
|
1503
|
+
saveMockData('IETFL3Model', 'l3GETSRTopologyLinkAttributes', 'default', data);
|
|
1504
|
+
done();
|
|
1505
|
+
} catch (err) {
|
|
1506
|
+
log.error(`Test Failure: ${err}`);
|
|
1507
|
+
done(err);
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1510
|
+
} catch (error) {
|
|
1511
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1512
|
+
done(error);
|
|
1513
|
+
}
|
|
1514
|
+
}).timeout(attemptTimeout);
|
|
1515
|
+
});
|
|
1516
|
+
|
|
1517
|
+
describe('#getSupportingLink - errors', () => {
|
|
1518
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1519
|
+
try {
|
|
1520
|
+
a.getSupportingLink(iETFL3ModelNetwork, iETFL3ModelLink, (data, error) => {
|
|
1521
|
+
try {
|
|
1522
|
+
if (stub) {
|
|
1523
|
+
runCommonAsserts(data, error);
|
|
1524
|
+
assert.equal(true, Array.isArray(data.response['ietf-network:supporting-link']));
|
|
1525
|
+
} else {
|
|
1526
|
+
runCommonAsserts(data, error);
|
|
1527
|
+
}
|
|
1528
|
+
saveMockData('IETFL3Model', 'getSupportingLink', 'default', data);
|
|
1529
|
+
done();
|
|
1530
|
+
} catch (err) {
|
|
1531
|
+
log.error(`Test Failure: ${err}`);
|
|
1532
|
+
done(err);
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1535
|
+
} catch (error) {
|
|
1536
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1537
|
+
done(error);
|
|
1538
|
+
}
|
|
1539
|
+
}).timeout(attemptTimeout);
|
|
1540
|
+
});
|
|
1541
|
+
|
|
1542
|
+
const iETFL3ModelNode = 'fakedata';
|
|
1543
|
+
describe('#getSpecificNodeInANetwork - errors', () => {
|
|
1544
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1545
|
+
try {
|
|
1546
|
+
a.getSpecificNodeInANetwork(iETFL3ModelNetwork, iETFL3ModelNode, (data, error) => {
|
|
1547
|
+
try {
|
|
1548
|
+
if (stub) {
|
|
1549
|
+
runCommonAsserts(data, error);
|
|
1550
|
+
assert.equal(true, Array.isArray(data.response['ietf-network:node']));
|
|
1551
|
+
} else {
|
|
1552
|
+
runCommonAsserts(data, error);
|
|
1553
|
+
}
|
|
1554
|
+
saveMockData('IETFL3Model', 'getSpecificNodeInANetwork', 'default', data);
|
|
1555
|
+
done();
|
|
1556
|
+
} catch (err) {
|
|
1557
|
+
log.error(`Test Failure: ${err}`);
|
|
1558
|
+
done(err);
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
} catch (error) {
|
|
1562
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1563
|
+
done(error);
|
|
1564
|
+
}
|
|
1565
|
+
}).timeout(attemptTimeout);
|
|
1566
|
+
});
|
|
1567
|
+
|
|
1568
|
+
describe('#l3GETSRTopologyNodeAttributes - errors', () => {
|
|
1569
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1570
|
+
try {
|
|
1571
|
+
a.l3GETSRTopologyNodeAttributes(iETFL3ModelNetwork, iETFL3ModelNode, (data, error) => {
|
|
1572
|
+
try {
|
|
1573
|
+
if (stub) {
|
|
1574
|
+
runCommonAsserts(data, error);
|
|
1575
|
+
assert.equal('object', typeof data.response['ietf-sr-mpls-topology:sr-mpls']);
|
|
1576
|
+
} else {
|
|
1577
|
+
runCommonAsserts(data, error);
|
|
1578
|
+
}
|
|
1579
|
+
saveMockData('IETFL3Model', 'l3GETSRTopologyNodeAttributes', 'default', data);
|
|
1580
|
+
done();
|
|
1581
|
+
} catch (err) {
|
|
1582
|
+
log.error(`Test Failure: ${err}`);
|
|
1583
|
+
done(err);
|
|
1584
|
+
}
|
|
1585
|
+
});
|
|
1586
|
+
} catch (error) {
|
|
1587
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1588
|
+
done(error);
|
|
1589
|
+
}
|
|
1590
|
+
}).timeout(attemptTimeout);
|
|
1591
|
+
});
|
|
1592
|
+
|
|
1593
|
+
const iETFL3ModelTerminationPoint = 'fakedata';
|
|
1594
|
+
describe('#getSpecificTerminationPointsOfANode - errors', () => {
|
|
1595
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1596
|
+
try {
|
|
1597
|
+
a.getSpecificTerminationPointsOfANode(iETFL3ModelNetwork, iETFL3ModelNode, iETFL3ModelTerminationPoint, (data, error) => {
|
|
1598
|
+
try {
|
|
1599
|
+
if (stub) {
|
|
1600
|
+
runCommonAsserts(data, error);
|
|
1601
|
+
assert.equal(true, Array.isArray(data.response['ietf-network-topology:termination-point']));
|
|
1602
|
+
} else {
|
|
1603
|
+
runCommonAsserts(data, error);
|
|
1604
|
+
}
|
|
1605
|
+
saveMockData('IETFL3Model', 'getSpecificTerminationPointsOfANode', 'default', data);
|
|
1606
|
+
done();
|
|
1607
|
+
} catch (err) {
|
|
1608
|
+
log.error(`Test Failure: ${err}`);
|
|
1609
|
+
done(err);
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
} catch (error) {
|
|
1613
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1614
|
+
done(error);
|
|
1615
|
+
}
|
|
1616
|
+
}).timeout(attemptTimeout);
|
|
1617
|
+
});
|
|
1618
|
+
|
|
1619
|
+
describe('#getSupportingTerminationPoint - errors', () => {
|
|
1620
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1621
|
+
try {
|
|
1622
|
+
a.getSupportingTerminationPoint(iETFL3ModelNetwork, iETFL3ModelNode, iETFL3ModelTerminationPoint, (data, error) => {
|
|
1623
|
+
try {
|
|
1624
|
+
if (stub) {
|
|
1625
|
+
runCommonAsserts(data, error);
|
|
1626
|
+
assert.equal(true, Array.isArray(data.response['ietf-network:supporting-termination-point']));
|
|
1627
|
+
} else {
|
|
1628
|
+
runCommonAsserts(data, error);
|
|
1629
|
+
}
|
|
1630
|
+
saveMockData('IETFL3Model', 'getSupportingTerminationPoint', 'default', data);
|
|
1631
|
+
done();
|
|
1632
|
+
} catch (err) {
|
|
1633
|
+
log.error(`Test Failure: ${err}`);
|
|
1634
|
+
done(err);
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
} catch (error) {
|
|
1638
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1639
|
+
done(error);
|
|
1640
|
+
}
|
|
1641
|
+
}).timeout(attemptTimeout);
|
|
1642
|
+
});
|
|
1643
|
+
|
|
1644
|
+
describe('#getSAPNetwork - errors', () => {
|
|
1645
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1646
|
+
try {
|
|
1647
|
+
a.getSAPNetwork((data, error) => {
|
|
1648
|
+
try {
|
|
1649
|
+
if (stub) {
|
|
1650
|
+
runCommonAsserts(data, error);
|
|
1651
|
+
assert.equal('object', typeof data.response['ietf-sap-ntw:sap-network']);
|
|
1652
|
+
} else {
|
|
1653
|
+
runCommonAsserts(data, error);
|
|
1654
|
+
}
|
|
1655
|
+
saveMockData('IETFSAPTopology', 'getSAPNetwork', 'default', data);
|
|
1656
|
+
done();
|
|
1657
|
+
} catch (err) {
|
|
1658
|
+
log.error(`Test Failure: ${err}`);
|
|
1659
|
+
done(err);
|
|
1660
|
+
}
|
|
1661
|
+
});
|
|
1662
|
+
} catch (error) {
|
|
1663
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1664
|
+
done(error);
|
|
1665
|
+
}
|
|
1666
|
+
}).timeout(attemptTimeout);
|
|
1667
|
+
});
|
|
1668
|
+
|
|
1669
|
+
const iETFSAPTopologyNode = 'fakedata';
|
|
1670
|
+
describe('#getIETFNetworkFromSpecificNode - errors', () => {
|
|
1671
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1672
|
+
try {
|
|
1673
|
+
a.getIETFNetworkFromSpecificNode(iETFSAPTopologyNode, (data, error) => {
|
|
1674
|
+
try {
|
|
1675
|
+
if (stub) {
|
|
1676
|
+
runCommonAsserts(data, error);
|
|
1677
|
+
assert.equal(true, Array.isArray(data.response['ietf-network:node']));
|
|
1678
|
+
} else {
|
|
1679
|
+
runCommonAsserts(data, error);
|
|
1680
|
+
}
|
|
1681
|
+
saveMockData('IETFSAPTopology', 'getIETFNetworkFromSpecificNode', 'default', data);
|
|
1682
|
+
done();
|
|
1683
|
+
} catch (err) {
|
|
1684
|
+
log.error(`Test Failure: ${err}`);
|
|
1685
|
+
done(err);
|
|
1686
|
+
}
|
|
1687
|
+
});
|
|
1688
|
+
} catch (error) {
|
|
1689
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1690
|
+
done(error);
|
|
1691
|
+
}
|
|
1692
|
+
}).timeout(attemptTimeout);
|
|
1693
|
+
});
|
|
1694
|
+
|
|
1695
|
+
const iETFSAPTopologyNetwork = 'fakedata';
|
|
1696
|
+
const iETFSAPTopologyService = 'fakedata';
|
|
1697
|
+
describe('#getSAPsOnASpecificNodeOfSpecificServiceType - errors', () => {
|
|
1698
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1699
|
+
try {
|
|
1700
|
+
a.getSAPsOnASpecificNodeOfSpecificServiceType(iETFSAPTopologyNetwork, iETFSAPTopologyNode, iETFSAPTopologyService, (data, error) => {
|
|
1701
|
+
try {
|
|
1702
|
+
if (stub) {
|
|
1703
|
+
runCommonAsserts(data, error);
|
|
1704
|
+
assert.equal(true, Array.isArray(data.response['ietf-sap-ntw:service']));
|
|
1705
|
+
} else {
|
|
1706
|
+
runCommonAsserts(data, error);
|
|
1707
|
+
}
|
|
1708
|
+
saveMockData('IETFSAPTopology', 'getSAPsOnASpecificNodeOfSpecificServiceType', 'default', data);
|
|
1709
|
+
done();
|
|
1710
|
+
} catch (err) {
|
|
1711
|
+
log.error(`Test Failure: ${err}`);
|
|
1712
|
+
done(err);
|
|
1713
|
+
}
|
|
1714
|
+
});
|
|
1715
|
+
} catch (error) {
|
|
1716
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1717
|
+
done(error);
|
|
1718
|
+
}
|
|
1719
|
+
}).timeout(attemptTimeout);
|
|
1720
|
+
});
|
|
1721
|
+
|
|
1722
|
+
const uploadMappingFilesNspPluginId = 'fakedata';
|
|
1723
|
+
const uploadMappingFilesFile = 'fakedata';
|
|
1724
|
+
describe('#loadIETFMappingFiles - errors', () => {
|
|
1725
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1726
|
+
try {
|
|
1727
|
+
a.loadIETFMappingFiles(uploadMappingFilesNspPluginId, uploadMappingFilesFile, (data, error) => {
|
|
1728
|
+
try {
|
|
1729
|
+
if (stub) {
|
|
1730
|
+
const displayE = 'Error 400 received on request';
|
|
1731
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
1732
|
+
} else {
|
|
1733
|
+
runCommonAsserts(data, error);
|
|
1734
|
+
}
|
|
1735
|
+
saveMockData('UploadMappingFiles', 'loadIETFMappingFiles', 'default', data);
|
|
1736
|
+
done();
|
|
1737
|
+
} catch (err) {
|
|
1738
|
+
log.error(`Test Failure: ${err}`);
|
|
1739
|
+
done(err);
|
|
1740
|
+
}
|
|
1741
|
+
});
|
|
1742
|
+
} catch (error) {
|
|
1743
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1744
|
+
done(error);
|
|
1745
|
+
}
|
|
1746
|
+
}).timeout(attemptTimeout);
|
|
1747
|
+
});
|
|
1748
|
+
|
|
1749
|
+
describe('#getIETFMappingFiles - errors', () => {
|
|
1750
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1751
|
+
try {
|
|
1752
|
+
a.getIETFMappingFiles((data, error) => {
|
|
1753
|
+
try {
|
|
1754
|
+
if (stub) {
|
|
1755
|
+
runCommonAsserts(data, error);
|
|
1756
|
+
assert.equal('object', typeof data.response['nsp-yang-mapping-converter:nsp-yang-mapping-converter']);
|
|
1757
|
+
} else {
|
|
1758
|
+
runCommonAsserts(data, error);
|
|
1759
|
+
}
|
|
1760
|
+
saveMockData('UploadMappingFiles', 'getIETFMappingFiles', 'default', data);
|
|
1761
|
+
done();
|
|
1762
|
+
} catch (err) {
|
|
1763
|
+
log.error(`Test Failure: ${err}`);
|
|
1764
|
+
done(err);
|
|
1765
|
+
}
|
|
1766
|
+
});
|
|
1767
|
+
} catch (error) {
|
|
1768
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1769
|
+
done(error);
|
|
1770
|
+
}
|
|
1771
|
+
}).timeout(attemptTimeout);
|
|
1772
|
+
});
|
|
1773
|
+
|
|
1774
|
+
const routerNECorrelationMappingServiceCreateMappingPolicyBodyParam = {
|
|
1775
|
+
'nsp-equipment-templates:router-ne-mapping': [
|
|
1776
|
+
{
|
|
1777
|
+
'system-id': '35.121.100.176',
|
|
1778
|
+
name: 'cisco ios mapping',
|
|
1779
|
+
'app-id': '',
|
|
1780
|
+
id: '',
|
|
1781
|
+
'object-description': '',
|
|
1782
|
+
'router-infos': [
|
|
1783
|
+
{
|
|
1784
|
+
'router-id': '35.121.100.178',
|
|
1785
|
+
'network-identifier': 0,
|
|
1786
|
+
'bgp-ls-id': 0,
|
|
1787
|
+
'as-number': 100,
|
|
1788
|
+
protocol: 'ANY'
|
|
1789
|
+
}
|
|
1790
|
+
]
|
|
1791
|
+
}
|
|
1792
|
+
]
|
|
1793
|
+
};
|
|
1794
|
+
describe('#createMappingPolicy - errors', () => {
|
|
1795
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1796
|
+
try {
|
|
1797
|
+
a.createMappingPolicy(routerNECorrelationMappingServiceCreateMappingPolicyBodyParam, (data, error) => {
|
|
1798
|
+
try {
|
|
1799
|
+
if (stub) {
|
|
1800
|
+
const displayE = 'Error 400 received on request';
|
|
1801
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
1802
|
+
} else {
|
|
1803
|
+
runCommonAsserts(data, error);
|
|
1804
|
+
}
|
|
1805
|
+
saveMockData('RouterNECorrelationMappingService', 'createMappingPolicy', 'default', data);
|
|
1806
|
+
done();
|
|
1807
|
+
} catch (err) {
|
|
1808
|
+
log.error(`Test Failure: ${err}`);
|
|
1809
|
+
done(err);
|
|
1810
|
+
}
|
|
1811
|
+
});
|
|
1812
|
+
} catch (error) {
|
|
1813
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1814
|
+
done(error);
|
|
1815
|
+
}
|
|
1816
|
+
}).timeout(attemptTimeout);
|
|
1817
|
+
});
|
|
1818
|
+
|
|
1819
|
+
describe('#getCorrelationPolicy - errors', () => {
|
|
1820
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1821
|
+
try {
|
|
1822
|
+
a.getCorrelationPolicy((data, error) => {
|
|
1823
|
+
try {
|
|
1824
|
+
if (stub) {
|
|
1825
|
+
runCommonAsserts(data, error);
|
|
1826
|
+
assert.equal('object', typeof data.response['nsp-equipment-templates:correlation-policy']);
|
|
1827
|
+
} else {
|
|
1828
|
+
runCommonAsserts(data, error);
|
|
1829
|
+
}
|
|
1830
|
+
saveMockData('RouterNECorrelationMappingService', 'getCorrelationPolicy', 'default', data);
|
|
1831
|
+
done();
|
|
1832
|
+
} catch (err) {
|
|
1833
|
+
log.error(`Test Failure: ${err}`);
|
|
1834
|
+
done(err);
|
|
1835
|
+
}
|
|
1836
|
+
});
|
|
1837
|
+
} catch (error) {
|
|
1838
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1839
|
+
done(error);
|
|
1840
|
+
}
|
|
1841
|
+
}).timeout(attemptTimeout);
|
|
1842
|
+
});
|
|
1843
|
+
|
|
1844
|
+
describe('#getRouterNeMapping - errors', () => {
|
|
1845
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1846
|
+
try {
|
|
1847
|
+
a.getRouterNeMapping((data, error) => {
|
|
1848
|
+
try {
|
|
1849
|
+
if (stub) {
|
|
1850
|
+
runCommonAsserts(data, error);
|
|
1851
|
+
assert.equal(true, Array.isArray(data.response['nsp-equipment-templates:router-ne-mapping']));
|
|
1852
|
+
} else {
|
|
1853
|
+
runCommonAsserts(data, error);
|
|
1854
|
+
}
|
|
1855
|
+
saveMockData('RouterNECorrelationMappingService', 'getRouterNeMapping', 'default', data);
|
|
1856
|
+
done();
|
|
1857
|
+
} catch (err) {
|
|
1858
|
+
log.error(`Test Failure: ${err}`);
|
|
1859
|
+
done(err);
|
|
1860
|
+
}
|
|
1861
|
+
});
|
|
1862
|
+
} catch (error) {
|
|
1863
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1864
|
+
done(error);
|
|
1865
|
+
}
|
|
1866
|
+
}).timeout(attemptTimeout);
|
|
1867
|
+
});
|
|
1868
|
+
|
|
1869
|
+
const routerNECorrelationMappingServiceRouterNeMapping = 'fakedata';
|
|
1870
|
+
const routerNECorrelationMappingServiceUpdateMappingPolicyBodyParam = {
|
|
1871
|
+
'nsp-equipment-templates:router-ne-mapping': [
|
|
1872
|
+
{
|
|
1873
|
+
'system-id': '35.121.100.176',
|
|
1874
|
+
name: 'cisco ios mapping',
|
|
1875
|
+
'app-id': '',
|
|
1876
|
+
id: '',
|
|
1877
|
+
'object-description': '',
|
|
1878
|
+
'router-infos': [
|
|
1879
|
+
{
|
|
1880
|
+
'router-id': '35.121.100.177',
|
|
1881
|
+
'network-identifier': 0,
|
|
1882
|
+
'bgp-ls-id': 0,
|
|
1883
|
+
'as-number': 100,
|
|
1884
|
+
protocol: 'OSPFv2'
|
|
1885
|
+
}
|
|
1886
|
+
]
|
|
1887
|
+
}
|
|
1888
|
+
]
|
|
1889
|
+
};
|
|
1890
|
+
describe('#updateMappingPolicy - errors', () => {
|
|
1891
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1892
|
+
try {
|
|
1893
|
+
a.updateMappingPolicy(routerNECorrelationMappingServiceRouterNeMapping, routerNECorrelationMappingServiceUpdateMappingPolicyBodyParam, (data, error) => {
|
|
1894
|
+
try {
|
|
1895
|
+
if (stub) {
|
|
1896
|
+
const displayE = 'Error 400 received on request';
|
|
1897
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
1898
|
+
} else {
|
|
1899
|
+
runCommonAsserts(data, error);
|
|
1900
|
+
}
|
|
1901
|
+
saveMockData('RouterNECorrelationMappingService', 'updateMappingPolicy', 'default', data);
|
|
1902
|
+
done();
|
|
1903
|
+
} catch (err) {
|
|
1904
|
+
log.error(`Test Failure: ${err}`);
|
|
1905
|
+
done(err);
|
|
1906
|
+
}
|
|
1907
|
+
});
|
|
1908
|
+
} catch (error) {
|
|
1909
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1910
|
+
done(error);
|
|
1911
|
+
}
|
|
1912
|
+
}).timeout(attemptTimeout);
|
|
1913
|
+
});
|
|
1914
|
+
|
|
1915
|
+
describe('#getSpecificMappingPolicy - errors', () => {
|
|
1916
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1917
|
+
try {
|
|
1918
|
+
a.getSpecificMappingPolicy(routerNECorrelationMappingServiceRouterNeMapping, (data, error) => {
|
|
1919
|
+
try {
|
|
1920
|
+
if (stub) {
|
|
1921
|
+
runCommonAsserts(data, error);
|
|
1922
|
+
assert.equal(true, Array.isArray(data.response['nsp-equipment-templates:router-ne-mapping']));
|
|
1923
|
+
} else {
|
|
1924
|
+
runCommonAsserts(data, error);
|
|
1925
|
+
}
|
|
1926
|
+
saveMockData('RouterNECorrelationMappingService', 'getSpecificMappingPolicy', 'default', data);
|
|
1927
|
+
done();
|
|
1928
|
+
} catch (err) {
|
|
1929
|
+
log.error(`Test Failure: ${err}`);
|
|
1930
|
+
done(err);
|
|
1931
|
+
}
|
|
1932
|
+
});
|
|
1933
|
+
} catch (error) {
|
|
1934
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1935
|
+
done(error);
|
|
1936
|
+
}
|
|
1937
|
+
}).timeout(attemptTimeout);
|
|
1938
|
+
});
|
|
1939
|
+
|
|
1940
|
+
const dataTablesRetentionUpdateTheRetentionTimeForIndicatorsBodyParam = {
|
|
1941
|
+
'ageout-policy': [
|
|
1942
|
+
{
|
|
1943
|
+
retention: 10
|
|
1944
|
+
}
|
|
1945
|
+
]
|
|
1946
|
+
};
|
|
1947
|
+
describe('#updateTheRetentionTimeForIndicators - errors', () => {
|
|
1948
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
1949
|
+
try {
|
|
1950
|
+
a.updateTheRetentionTimeForIndicators(dataTablesRetentionUpdateTheRetentionTimeForIndicatorsBodyParam, (data, error) => {
|
|
1951
|
+
try {
|
|
1952
|
+
if (stub) {
|
|
1953
|
+
const displayE = 'Error 400 received on request';
|
|
1954
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
1955
|
+
} else {
|
|
1956
|
+
runCommonAsserts(data, error);
|
|
1957
|
+
}
|
|
1958
|
+
saveMockData('DataTablesRetention', 'updateTheRetentionTimeForIndicators', 'default', data);
|
|
1959
|
+
done();
|
|
1960
|
+
} catch (err) {
|
|
1961
|
+
log.error(`Test Failure: ${err}`);
|
|
1962
|
+
done(err);
|
|
1963
|
+
}
|
|
1964
|
+
});
|
|
1965
|
+
} catch (error) {
|
|
1966
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1967
|
+
done(error);
|
|
1968
|
+
}
|
|
1969
|
+
}).timeout(attemptTimeout);
|
|
1970
|
+
});
|
|
1971
|
+
|
|
1972
|
+
describe('#getIndicatorAgeoutPolicySettings - errors', () => {
|
|
1973
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1974
|
+
try {
|
|
1975
|
+
a.getIndicatorAgeoutPolicySettings((data, error) => {
|
|
1976
|
+
try {
|
|
1977
|
+
if (stub) {
|
|
1978
|
+
runCommonAsserts(data, error);
|
|
1979
|
+
assert.equal(true, Array.isArray(data.response['ageout-policy']));
|
|
1980
|
+
} else {
|
|
1981
|
+
runCommonAsserts(data, error);
|
|
1982
|
+
}
|
|
1983
|
+
saveMockData('DataTablesRetention', 'getIndicatorAgeoutPolicySettings', 'default', data);
|
|
1984
|
+
done();
|
|
1985
|
+
} catch (err) {
|
|
1986
|
+
log.error(`Test Failure: ${err}`);
|
|
1987
|
+
done(err);
|
|
1988
|
+
}
|
|
1989
|
+
});
|
|
1990
|
+
} catch (error) {
|
|
1991
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1992
|
+
done(error);
|
|
1993
|
+
}
|
|
1994
|
+
}).timeout(attemptTimeout);
|
|
1995
|
+
});
|
|
1996
|
+
|
|
1997
|
+
const dataTablesRetentionUpdateTheRetentionTimeForBaselineBodyParam = {
|
|
1998
|
+
'ageout-policy': [
|
|
1999
|
+
{
|
|
2000
|
+
retention: 10
|
|
2001
|
+
}
|
|
2002
|
+
]
|
|
2003
|
+
};
|
|
2004
|
+
describe('#updateTheRetentionTimeForBaseline - errors', () => {
|
|
2005
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
2006
|
+
try {
|
|
2007
|
+
a.updateTheRetentionTimeForBaseline(dataTablesRetentionUpdateTheRetentionTimeForBaselineBodyParam, (data, error) => {
|
|
2008
|
+
try {
|
|
2009
|
+
if (stub) {
|
|
2010
|
+
const displayE = 'Error 400 received on request';
|
|
2011
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
2012
|
+
} else {
|
|
2013
|
+
runCommonAsserts(data, error);
|
|
2014
|
+
}
|
|
2015
|
+
saveMockData('DataTablesRetention', 'updateTheRetentionTimeForBaseline', 'default', data);
|
|
2016
|
+
done();
|
|
2017
|
+
} catch (err) {
|
|
2018
|
+
log.error(`Test Failure: ${err}`);
|
|
2019
|
+
done(err);
|
|
2020
|
+
}
|
|
2021
|
+
});
|
|
2022
|
+
} catch (error) {
|
|
2023
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2024
|
+
done(error);
|
|
2025
|
+
}
|
|
2026
|
+
}).timeout(attemptTimeout);
|
|
2027
|
+
});
|
|
2028
|
+
|
|
2029
|
+
describe('#getBaselineAgeoutPolicySettings - errors', () => {
|
|
2030
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2031
|
+
try {
|
|
2032
|
+
a.getBaselineAgeoutPolicySettings((data, error) => {
|
|
2033
|
+
try {
|
|
2034
|
+
if (stub) {
|
|
2035
|
+
runCommonAsserts(data, error);
|
|
2036
|
+
assert.equal(true, Array.isArray(data.response['ageout-policy']));
|
|
2037
|
+
} else {
|
|
2038
|
+
runCommonAsserts(data, error);
|
|
2039
|
+
}
|
|
2040
|
+
saveMockData('DataTablesRetention', 'getBaselineAgeoutPolicySettings', 'default', data);
|
|
2041
|
+
done();
|
|
2042
|
+
} catch (err) {
|
|
2043
|
+
log.error(`Test Failure: ${err}`);
|
|
2044
|
+
done(err);
|
|
2045
|
+
}
|
|
2046
|
+
});
|
|
2047
|
+
} catch (error) {
|
|
2048
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2049
|
+
done(error);
|
|
2050
|
+
}
|
|
2051
|
+
}).timeout(attemptTimeout);
|
|
2052
|
+
});
|
|
2053
|
+
|
|
2054
|
+
const indicatorTemplatesAvgCPUAllNodesAllActionsBodyParam = {
|
|
2055
|
+
template: [
|
|
2056
|
+
{
|
|
2057
|
+
name: 'AvgCpuAllNodesAllActionsTemplate',
|
|
2058
|
+
description: 'avg cpu from all nodes template',
|
|
2059
|
+
formula: 'avg({cpu-usage_avg})',
|
|
2060
|
+
'units-name': '%',
|
|
2061
|
+
'telemetry-type': 'telemetry:/base/system-info/system',
|
|
2062
|
+
counters: [
|
|
2063
|
+
{
|
|
2064
|
+
name: 'cpu-usage',
|
|
2065
|
+
function: 'avg'
|
|
2066
|
+
}
|
|
2067
|
+
],
|
|
2068
|
+
thresholds: [
|
|
2069
|
+
{
|
|
2070
|
+
'threshold-value-decimal': '20',
|
|
2071
|
+
direction: 'increasing',
|
|
2072
|
+
actions: [
|
|
2073
|
+
{
|
|
2074
|
+
name: 'template_threshold_20_increasing_kafka_action',
|
|
2075
|
+
type: 'kafka',
|
|
2076
|
+
kafka: {
|
|
2077
|
+
'topic-name': 'nsp-act-action-event',
|
|
2078
|
+
'topic-content': 'CPU is a rising'
|
|
2079
|
+
}
|
|
2080
|
+
},
|
|
2081
|
+
{
|
|
2082
|
+
name: 'template_threshold_20_increasing_alarm_action',
|
|
2083
|
+
type: 'alarm',
|
|
2084
|
+
alarm: {
|
|
2085
|
+
severity: 'major'
|
|
2086
|
+
}
|
|
2087
|
+
},
|
|
2088
|
+
{
|
|
2089
|
+
name: 'template_threshold_20_increasing_email_action',
|
|
2090
|
+
type: 'email',
|
|
2091
|
+
email: {
|
|
2092
|
+
'email-address': 'userid@user.com',
|
|
2093
|
+
'email-subject': 'Hmmmmm, It\'s getting hot',
|
|
2094
|
+
'email-content': 'Your temperature is rising.'
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
]
|
|
2098
|
+
}
|
|
2099
|
+
]
|
|
2100
|
+
}
|
|
2101
|
+
]
|
|
2102
|
+
};
|
|
2103
|
+
describe('#avgCPUAllNodesAllActions - errors', () => {
|
|
2104
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2105
|
+
try {
|
|
2106
|
+
a.avgCPUAllNodesAllActions(indicatorTemplatesAvgCPUAllNodesAllActionsBodyParam, (data, error) => {
|
|
2107
|
+
try {
|
|
2108
|
+
if (stub) {
|
|
2109
|
+
runCommonAsserts(data, error);
|
|
2110
|
+
assert.equal('object', typeof data.response.created);
|
|
2111
|
+
assert.equal('/restconf/data/nsp-indicator:rta-indicator-templates/template=AvgCpuAllNodesAllActionsTemplate', data.response.Location);
|
|
2112
|
+
} else {
|
|
2113
|
+
runCommonAsserts(data, error);
|
|
2114
|
+
}
|
|
2115
|
+
saveMockData('IndicatorTemplates', 'avgCPUAllNodesAllActions', 'default', data);
|
|
2116
|
+
done();
|
|
2117
|
+
} catch (err) {
|
|
2118
|
+
log.error(`Test Failure: ${err}`);
|
|
2119
|
+
done(err);
|
|
2120
|
+
}
|
|
2121
|
+
});
|
|
2122
|
+
} catch (error) {
|
|
2123
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2124
|
+
done(error);
|
|
2125
|
+
}
|
|
2126
|
+
}).timeout(attemptTimeout);
|
|
2127
|
+
});
|
|
2128
|
+
|
|
2129
|
+
describe('#getAllIndicatorTemplates - errors', () => {
|
|
2130
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2131
|
+
try {
|
|
2132
|
+
a.getAllIndicatorTemplates((data, error) => {
|
|
2133
|
+
try {
|
|
2134
|
+
if (stub) {
|
|
2135
|
+
runCommonAsserts(data, error);
|
|
2136
|
+
assert.equal('object', typeof data.response['nsp-indicator:rta-indicator-templates']);
|
|
2137
|
+
} else {
|
|
2138
|
+
runCommonAsserts(data, error);
|
|
2139
|
+
}
|
|
2140
|
+
saveMockData('IndicatorTemplates', 'getAllIndicatorTemplates', 'default', data);
|
|
2141
|
+
done();
|
|
2142
|
+
} catch (err) {
|
|
2143
|
+
log.error(`Test Failure: ${err}`);
|
|
2144
|
+
done(err);
|
|
2145
|
+
}
|
|
2146
|
+
});
|
|
2147
|
+
} catch (error) {
|
|
2148
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2149
|
+
done(error);
|
|
2150
|
+
}
|
|
2151
|
+
}).timeout(attemptTimeout);
|
|
2152
|
+
});
|
|
2153
|
+
|
|
2154
|
+
const indicatorTemplatesTemplate = 'fakedata';
|
|
2155
|
+
const indicatorTemplatesUPDATEIndicatorTemplateBodyParam = {
|
|
2156
|
+
template: [
|
|
2157
|
+
{
|
|
2158
|
+
name: 'MaxTempNfmp10.10.10.4Template',
|
|
2159
|
+
description: 'Update Indicator template using PUT "max\' temp on \'10.10.10.4\' template',
|
|
2160
|
+
formula: 'max({temperature_avg})',
|
|
2161
|
+
'units-name': 'deg C',
|
|
2162
|
+
'telemetry-type': 'telemetry:/base/hardware/temperature',
|
|
2163
|
+
counters: [
|
|
2164
|
+
{
|
|
2165
|
+
name: 'temperature',
|
|
2166
|
+
function: 'avg'
|
|
2167
|
+
}
|
|
2168
|
+
],
|
|
2169
|
+
thresholds: [
|
|
2170
|
+
{
|
|
2171
|
+
'threshold-value-decimal': '60',
|
|
2172
|
+
direction: 'increasing',
|
|
2173
|
+
actions: [
|
|
2174
|
+
{
|
|
2175
|
+
name: 'template_threshold_60_increasing_kafka_action',
|
|
2176
|
+
type: 'kafka',
|
|
2177
|
+
kafka: {
|
|
2178
|
+
'topic-name': 'nsp-act-action-event',
|
|
2179
|
+
'topic-content': 'Temperature is a rising on 10.10.10.4'
|
|
2180
|
+
}
|
|
2181
|
+
},
|
|
2182
|
+
{
|
|
2183
|
+
name: 'template_threshold_60_increasing_alarm_action',
|
|
2184
|
+
type: 'alarm',
|
|
2185
|
+
alarm: {
|
|
2186
|
+
severity: 'critical'
|
|
2187
|
+
}
|
|
2188
|
+
},
|
|
2189
|
+
{
|
|
2190
|
+
name: 'template_threshold_60_increasing_email_action',
|
|
2191
|
+
type: 'email',
|
|
2192
|
+
email: {
|
|
2193
|
+
'email-address': 'userid@user.com',
|
|
2194
|
+
'email-subject': 'Hmmmmm, It\'s getting hot 10.10.10.4',
|
|
2195
|
+
'email-content': 'Your temperature is rising 10.10.10.4.'
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
]
|
|
2199
|
+
}
|
|
2200
|
+
]
|
|
2201
|
+
}
|
|
2202
|
+
]
|
|
2203
|
+
};
|
|
2204
|
+
describe('#uPDATEIndicatorTemplate - errors', () => {
|
|
2205
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2206
|
+
try {
|
|
2207
|
+
a.uPDATEIndicatorTemplate(indicatorTemplatesTemplate, indicatorTemplatesUPDATEIndicatorTemplateBodyParam, (data, error) => {
|
|
2208
|
+
try {
|
|
2209
|
+
if (stub) {
|
|
2210
|
+
runCommonAsserts(data, error);
|
|
2211
|
+
assert.equal('success', data.response);
|
|
2212
|
+
} else {
|
|
2213
|
+
runCommonAsserts(data, error);
|
|
2214
|
+
}
|
|
2215
|
+
saveMockData('IndicatorTemplates', 'uPDATEIndicatorTemplate', 'default', data);
|
|
2216
|
+
done();
|
|
2217
|
+
} catch (err) {
|
|
2218
|
+
log.error(`Test Failure: ${err}`);
|
|
2219
|
+
done(err);
|
|
2220
|
+
}
|
|
2221
|
+
});
|
|
2222
|
+
} catch (error) {
|
|
2223
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2224
|
+
done(error);
|
|
2225
|
+
}
|
|
2226
|
+
}).timeout(attemptTimeout);
|
|
2227
|
+
});
|
|
2228
|
+
|
|
2229
|
+
describe('#getSpecificIndicatorTemplate - errors', () => {
|
|
2230
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2231
|
+
try {
|
|
2232
|
+
a.getSpecificIndicatorTemplate(indicatorTemplatesTemplate, (data, error) => {
|
|
2233
|
+
try {
|
|
2234
|
+
if (stub) {
|
|
2235
|
+
runCommonAsserts(data, error);
|
|
2236
|
+
assert.equal(true, Array.isArray(data.response['nsp-indicator:template']));
|
|
2237
|
+
} else {
|
|
2238
|
+
runCommonAsserts(data, error);
|
|
2239
|
+
}
|
|
2240
|
+
saveMockData('IndicatorTemplates', 'getSpecificIndicatorTemplate', 'default', data);
|
|
2241
|
+
done();
|
|
2242
|
+
} catch (err) {
|
|
2243
|
+
log.error(`Test Failure: ${err}`);
|
|
2244
|
+
done(err);
|
|
2245
|
+
}
|
|
2246
|
+
});
|
|
2247
|
+
} catch (error) {
|
|
2248
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2249
|
+
done(error);
|
|
2250
|
+
}
|
|
2251
|
+
}).timeout(attemptTimeout);
|
|
2252
|
+
});
|
|
2253
|
+
|
|
2254
|
+
const indicatorRulesPostavgCPUAllNodesAllActionsBodyParam = {
|
|
2255
|
+
rule: [
|
|
2256
|
+
{
|
|
2257
|
+
name: 'AvgCpuAllNodesAllActions',
|
|
2258
|
+
description: 'avg cpu from all nodes',
|
|
2259
|
+
formula: 'avg({cpu-usage_avg})',
|
|
2260
|
+
'window-duration': 'PT1M',
|
|
2261
|
+
'units-name': '%',
|
|
2262
|
+
enabled: true,
|
|
2263
|
+
'collection-interval': 30,
|
|
2264
|
+
'telemetry-type': 'telemetry:/base/system-info/system',
|
|
2265
|
+
counters: [
|
|
2266
|
+
{
|
|
2267
|
+
name: 'cpu-usage',
|
|
2268
|
+
function: 'avg'
|
|
2269
|
+
}
|
|
2270
|
+
],
|
|
2271
|
+
thresholds: [
|
|
2272
|
+
{
|
|
2273
|
+
'threshold-value-decimal': '20',
|
|
2274
|
+
direction: 'increasing',
|
|
2275
|
+
actions: [
|
|
2276
|
+
{
|
|
2277
|
+
type: 'kafka',
|
|
2278
|
+
kafka: {
|
|
2279
|
+
'topic-name': 'nsp-act-action-event',
|
|
2280
|
+
'topic-content': 'CPU is a rising'
|
|
2281
|
+
}
|
|
2282
|
+
},
|
|
2283
|
+
{
|
|
2284
|
+
type: 'alarm',
|
|
2285
|
+
alarm: {
|
|
2286
|
+
severity: 'major'
|
|
2287
|
+
}
|
|
2288
|
+
},
|
|
2289
|
+
{
|
|
2290
|
+
type: 'email',
|
|
2291
|
+
email: {
|
|
2292
|
+
'email-address': 'userid@user.com',
|
|
2293
|
+
'email-subject': 'Hmmmmm, It\'s getting hot',
|
|
2294
|
+
'email-content': 'Your temperature is rising.'
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
]
|
|
2298
|
+
}
|
|
2299
|
+
]
|
|
2300
|
+
}
|
|
2301
|
+
]
|
|
2302
|
+
};
|
|
2303
|
+
describe('#postavgCPUAllNodesAllActions - errors', () => {
|
|
2304
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
2305
|
+
try {
|
|
2306
|
+
a.postavgCPUAllNodesAllActions(indicatorRulesPostavgCPUAllNodesAllActionsBodyParam, (data, error) => {
|
|
2307
|
+
try {
|
|
2308
|
+
if (stub) {
|
|
2309
|
+
const displayE = 'Error 400 received on request';
|
|
2310
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
2311
|
+
} else {
|
|
2312
|
+
runCommonAsserts(data, error);
|
|
2313
|
+
}
|
|
2314
|
+
saveMockData('IndicatorRules', 'postavgCPUAllNodesAllActions', 'default', data);
|
|
2315
|
+
done();
|
|
2316
|
+
} catch (err) {
|
|
2317
|
+
log.error(`Test Failure: ${err}`);
|
|
2318
|
+
done(err);
|
|
2319
|
+
}
|
|
2320
|
+
});
|
|
2321
|
+
} catch (error) {
|
|
2322
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2323
|
+
done(error);
|
|
2324
|
+
}
|
|
2325
|
+
}).timeout(attemptTimeout);
|
|
2326
|
+
});
|
|
2327
|
+
|
|
2328
|
+
describe('#getAllIndicatorRules - errors', () => {
|
|
2329
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2330
|
+
try {
|
|
2331
|
+
a.getAllIndicatorRules((data, error) => {
|
|
2332
|
+
try {
|
|
2333
|
+
if (stub) {
|
|
2334
|
+
runCommonAsserts(data, error);
|
|
2335
|
+
assert.equal('object', typeof data.response['nsp-indicator:rta-indicator-rules']);
|
|
2336
|
+
} else {
|
|
2337
|
+
runCommonAsserts(data, error);
|
|
2338
|
+
}
|
|
2339
|
+
saveMockData('IndicatorRules', 'getAllIndicatorRules', 'default', data);
|
|
2340
|
+
done();
|
|
2341
|
+
} catch (err) {
|
|
2342
|
+
log.error(`Test Failure: ${err}`);
|
|
2343
|
+
done(err);
|
|
2344
|
+
}
|
|
2345
|
+
});
|
|
2346
|
+
} catch (error) {
|
|
2347
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2348
|
+
done(error);
|
|
2349
|
+
}
|
|
2350
|
+
}).timeout(attemptTimeout);
|
|
2351
|
+
});
|
|
2352
|
+
|
|
2353
|
+
const indicatorRulesRule = 'fakedata';
|
|
2354
|
+
const indicatorRulesUpdateIndicatorRuleBodyParam = {
|
|
2355
|
+
rule: [
|
|
2356
|
+
{
|
|
2357
|
+
name: 'MaxTempNfmp104',
|
|
2358
|
+
description: 'Updated using PUT request "max\' temp on \'10.10.10.4\'',
|
|
2359
|
+
formula: 'max({temperature_avg})',
|
|
2360
|
+
'window-duration': 'PT1M',
|
|
2361
|
+
'units-name': 'deg C',
|
|
2362
|
+
enabled: true,
|
|
2363
|
+
'collection-interval': 60,
|
|
2364
|
+
'telemetry-type': 'telemetry:/base/hardware/temperature',
|
|
2365
|
+
'subscription-filter': '/nsp-equipment:network/network-element[ne-id=\'10.10.10.4\']',
|
|
2366
|
+
counters: [
|
|
2367
|
+
{
|
|
2368
|
+
name: 'temperature',
|
|
2369
|
+
function: 'avg'
|
|
2370
|
+
}
|
|
2371
|
+
],
|
|
2372
|
+
thresholds: [
|
|
2373
|
+
{
|
|
2374
|
+
'threshold-value-decimal': '60',
|
|
2375
|
+
direction: 'increasing',
|
|
2376
|
+
actions: [
|
|
2377
|
+
{
|
|
2378
|
+
type: 'kafka',
|
|
2379
|
+
kafka: {
|
|
2380
|
+
'topic-name': 'nsp-act-action-event',
|
|
2381
|
+
'topic-content': 'Temperature is a rising on 10.10.10.4'
|
|
2382
|
+
}
|
|
2383
|
+
},
|
|
2384
|
+
{
|
|
2385
|
+
type: 'alarm',
|
|
2386
|
+
alarm: {
|
|
2387
|
+
severity: 'critical'
|
|
2388
|
+
}
|
|
2389
|
+
},
|
|
2390
|
+
{
|
|
2391
|
+
type: 'email',
|
|
2392
|
+
email: {
|
|
2393
|
+
'email-address': 'userid@user.com',
|
|
2394
|
+
'email-subject': 'Hmmmmm, It\'s getting hot 10.10.10.4',
|
|
2395
|
+
'email-content': 'Your temperature is rising 10.10.10.4'
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
]
|
|
2399
|
+
}
|
|
2400
|
+
]
|
|
2401
|
+
}
|
|
2402
|
+
]
|
|
2403
|
+
};
|
|
2404
|
+
describe('#updateIndicatorRule - errors', () => {
|
|
2405
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
2406
|
+
try {
|
|
2407
|
+
a.updateIndicatorRule(indicatorRulesRule, indicatorRulesUpdateIndicatorRuleBodyParam, (data, error) => {
|
|
2408
|
+
try {
|
|
2409
|
+
if (stub) {
|
|
2410
|
+
const displayE = 'Error 400 received on request';
|
|
2411
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
2412
|
+
} else {
|
|
2413
|
+
runCommonAsserts(data, error);
|
|
2414
|
+
}
|
|
2415
|
+
saveMockData('IndicatorRules', 'updateIndicatorRule', 'default', data);
|
|
2416
|
+
done();
|
|
2417
|
+
} catch (err) {
|
|
2418
|
+
log.error(`Test Failure: ${err}`);
|
|
2419
|
+
done(err);
|
|
2420
|
+
}
|
|
2421
|
+
});
|
|
2422
|
+
} catch (error) {
|
|
2423
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2424
|
+
done(error);
|
|
2425
|
+
}
|
|
2426
|
+
}).timeout(attemptTimeout);
|
|
2427
|
+
});
|
|
2428
|
+
|
|
2429
|
+
describe('#getSpecificIndicatorRule - errors', () => {
|
|
2430
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2431
|
+
try {
|
|
2432
|
+
a.getSpecificIndicatorRule(indicatorRulesRule, (data, error) => {
|
|
2433
|
+
try {
|
|
2434
|
+
if (stub) {
|
|
2435
|
+
runCommonAsserts(data, error);
|
|
2436
|
+
assert.equal(true, Array.isArray(data.response['nsp-indicator:rule']));
|
|
2437
|
+
} else {
|
|
2438
|
+
runCommonAsserts(data, error);
|
|
2439
|
+
}
|
|
2440
|
+
saveMockData('IndicatorRules', 'getSpecificIndicatorRule', 'default', data);
|
|
2441
|
+
done();
|
|
2442
|
+
} catch (err) {
|
|
2443
|
+
log.error(`Test Failure: ${err}`);
|
|
2444
|
+
done(err);
|
|
2445
|
+
}
|
|
2446
|
+
});
|
|
2447
|
+
} catch (error) {
|
|
2448
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2449
|
+
done(error);
|
|
2450
|
+
}
|
|
2451
|
+
}).timeout(attemptTimeout);
|
|
2452
|
+
});
|
|
2453
|
+
|
|
2454
|
+
const baselineOperationsRestconfAPICreateSubscriptionBodyParam = {
|
|
2455
|
+
subscription: [
|
|
2456
|
+
{
|
|
2457
|
+
name: 'test-sub-baseline-mdm',
|
|
2458
|
+
filter: '/network-device-mgr:network-devices/network-device[name=\'2.2.2.2\']/root/nokia-state:state/port[port-id=\'1/1/1\']',
|
|
2459
|
+
type: 'telemetry:/base/interfaces/interface',
|
|
2460
|
+
fields: [
|
|
2461
|
+
'received-octets'
|
|
2462
|
+
],
|
|
2463
|
+
description: '',
|
|
2464
|
+
period: 60,
|
|
2465
|
+
'sync-time': '00:00',
|
|
2466
|
+
state: 'enabled',
|
|
2467
|
+
notification: 'disabled',
|
|
2468
|
+
'rta-notification': 'enabled',
|
|
2469
|
+
db: 'disabled'
|
|
2470
|
+
}
|
|
2471
|
+
]
|
|
2472
|
+
};
|
|
2473
|
+
describe('#createSubscription - errors', () => {
|
|
2474
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
2475
|
+
try {
|
|
2476
|
+
a.createSubscription(baselineOperationsRestconfAPICreateSubscriptionBodyParam, (data, error) => {
|
|
2477
|
+
try {
|
|
2478
|
+
if (stub) {
|
|
2479
|
+
const displayE = 'Error 400 received on request';
|
|
2480
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
2481
|
+
} else {
|
|
2482
|
+
runCommonAsserts(data, error);
|
|
2483
|
+
}
|
|
2484
|
+
saveMockData('BaselineOperationsRestconfAPI', 'createSubscription', 'default', data);
|
|
2485
|
+
done();
|
|
2486
|
+
} catch (err) {
|
|
2487
|
+
log.error(`Test Failure: ${err}`);
|
|
2488
|
+
done(err);
|
|
2489
|
+
}
|
|
2490
|
+
});
|
|
2491
|
+
} catch (error) {
|
|
2492
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2493
|
+
done(error);
|
|
2494
|
+
}
|
|
2495
|
+
}).timeout(attemptTimeout);
|
|
2496
|
+
});
|
|
2497
|
+
|
|
2498
|
+
const baselineOperationsRestconfAPICreateBaselineBodyParam = {
|
|
2499
|
+
baseline: {
|
|
2500
|
+
'admin-state': 'up',
|
|
2501
|
+
'update-status': 'active',
|
|
2502
|
+
name: '2.2.2.2, 1/1/1',
|
|
2503
|
+
description: 'restconf_baseline_nodeB',
|
|
2504
|
+
resource: '/network-device-mgr:network-devices/network-device[name=\'2.2.2.2\']/root/nokia-state:state/port[port-id=\'1/1/1\']',
|
|
2505
|
+
'collection-interval': 60,
|
|
2506
|
+
period: 'pt5m',
|
|
2507
|
+
'window-duration': 'pt1m',
|
|
2508
|
+
'counter-group': 'telemetry:/base/interfaces/interface',
|
|
2509
|
+
counter: 'received-octets',
|
|
2510
|
+
'use-bit-rate': false,
|
|
2511
|
+
'units-name': 'octets',
|
|
2512
|
+
type: 'counter',
|
|
2513
|
+
subscriptionid: 'test-sub-baseline-mdm'
|
|
2514
|
+
}
|
|
2515
|
+
};
|
|
2516
|
+
describe('#createBaseline - errors', () => {
|
|
2517
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
2518
|
+
try {
|
|
2519
|
+
a.createBaseline(baselineOperationsRestconfAPICreateBaselineBodyParam, (data, error) => {
|
|
2520
|
+
try {
|
|
2521
|
+
if (stub) {
|
|
2522
|
+
const displayE = 'Error 400 received on request';
|
|
2523
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
2524
|
+
} else {
|
|
2525
|
+
runCommonAsserts(data, error);
|
|
2526
|
+
}
|
|
2527
|
+
saveMockData('BaselineOperationsRestconfAPI', 'createBaseline', 'default', data);
|
|
2528
|
+
done();
|
|
2529
|
+
} catch (err) {
|
|
2530
|
+
log.error(`Test Failure: ${err}`);
|
|
2531
|
+
done(err);
|
|
2532
|
+
}
|
|
2533
|
+
});
|
|
2534
|
+
} catch (error) {
|
|
2535
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2536
|
+
done(error);
|
|
2537
|
+
}
|
|
2538
|
+
}).timeout(attemptTimeout);
|
|
2539
|
+
});
|
|
2540
|
+
|
|
2541
|
+
describe('#getAllBaselines - errors', () => {
|
|
2542
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2543
|
+
try {
|
|
2544
|
+
a.getAllBaselines((data, error) => {
|
|
2545
|
+
try {
|
|
2546
|
+
if (stub) {
|
|
2547
|
+
runCommonAsserts(data, error);
|
|
2548
|
+
assert.equal(true, Array.isArray(data.response['nsp-rt-analytics:baseline']));
|
|
2549
|
+
} else {
|
|
2550
|
+
runCommonAsserts(data, error);
|
|
2551
|
+
}
|
|
2552
|
+
saveMockData('BaselineOperationsRestconfAPI', 'getAllBaselines', 'default', data);
|
|
2553
|
+
done();
|
|
2554
|
+
} catch (err) {
|
|
2555
|
+
log.error(`Test Failure: ${err}`);
|
|
2556
|
+
done(err);
|
|
2557
|
+
}
|
|
2558
|
+
});
|
|
2559
|
+
} catch (error) {
|
|
2560
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2561
|
+
done(error);
|
|
2562
|
+
}
|
|
2563
|
+
}).timeout(attemptTimeout);
|
|
2564
|
+
});
|
|
2565
|
+
|
|
2566
|
+
const baselineOperationsRestconfAPIBaseline = 'fakedata';
|
|
2567
|
+
const baselineOperationsRestconfAPICreateBaselineDetectorBodyParam = {
|
|
2568
|
+
baseline: {
|
|
2569
|
+
'baseline-detector': [
|
|
2570
|
+
{
|
|
2571
|
+
algorithm: 'relative-diff-mean',
|
|
2572
|
+
comparison: 'greater-than',
|
|
2573
|
+
threshold: 0.1,
|
|
2574
|
+
'evaluate-when': 'end-of-window',
|
|
2575
|
+
'evaluate-what': 'value_'
|
|
2576
|
+
}
|
|
2577
|
+
]
|
|
2578
|
+
}
|
|
2579
|
+
};
|
|
2580
|
+
describe('#createBaselineDetector - errors', () => {
|
|
2581
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2582
|
+
try {
|
|
2583
|
+
a.createBaselineDetector(baselineOperationsRestconfAPIBaseline, baselineOperationsRestconfAPICreateBaselineDetectorBodyParam, (data, error) => {
|
|
2584
|
+
try {
|
|
2585
|
+
if (stub) {
|
|
2586
|
+
runCommonAsserts(data, error);
|
|
2587
|
+
assert.equal('success', data.response);
|
|
2588
|
+
} else {
|
|
2589
|
+
runCommonAsserts(data, error);
|
|
2590
|
+
}
|
|
2591
|
+
saveMockData('BaselineOperationsRestconfAPI', 'createBaselineDetector', 'default', data);
|
|
2592
|
+
done();
|
|
2593
|
+
} catch (err) {
|
|
2594
|
+
log.error(`Test Failure: ${err}`);
|
|
2595
|
+
done(err);
|
|
2596
|
+
}
|
|
2597
|
+
});
|
|
2598
|
+
} catch (error) {
|
|
2599
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2600
|
+
done(error);
|
|
2601
|
+
}
|
|
2602
|
+
}).timeout(attemptTimeout);
|
|
2603
|
+
});
|
|
2604
|
+
|
|
2605
|
+
describe('#getBaseline - errors', () => {
|
|
2606
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2607
|
+
try {
|
|
2608
|
+
a.getBaseline(baselineOperationsRestconfAPIBaseline, (data, error) => {
|
|
2609
|
+
try {
|
|
2610
|
+
if (stub) {
|
|
2611
|
+
runCommonAsserts(data, error);
|
|
2612
|
+
assert.equal(true, Array.isArray(data.response['nsp-rt-analytics:baseline']));
|
|
2613
|
+
} else {
|
|
2614
|
+
runCommonAsserts(data, error);
|
|
2615
|
+
}
|
|
2616
|
+
saveMockData('BaselineOperationsRestconfAPI', 'getBaseline', 'default', data);
|
|
2617
|
+
done();
|
|
2618
|
+
} catch (err) {
|
|
2619
|
+
log.error(`Test Failure: ${err}`);
|
|
2620
|
+
done(err);
|
|
2621
|
+
}
|
|
2622
|
+
});
|
|
2623
|
+
} catch (error) {
|
|
2624
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2625
|
+
done(error);
|
|
2626
|
+
}
|
|
2627
|
+
}).timeout(attemptTimeout);
|
|
2628
|
+
});
|
|
2629
|
+
|
|
2630
|
+
const baselineOperationsRestconfAPIBaselineDetector = 'fakedata';
|
|
2631
|
+
const baselineOperationsRestconfAPIPatchBaselineDetectorBodyParam = {
|
|
2632
|
+
'baseline-detector': {
|
|
2633
|
+
comparison: 'less-than'
|
|
2634
|
+
}
|
|
2635
|
+
};
|
|
2636
|
+
describe('#patchBaselineDetector - errors', () => {
|
|
2637
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2638
|
+
try {
|
|
2639
|
+
a.patchBaselineDetector(baselineOperationsRestconfAPIBaseline, baselineOperationsRestconfAPIBaselineDetector, baselineOperationsRestconfAPIPatchBaselineDetectorBodyParam, (data, error) => {
|
|
2640
|
+
try {
|
|
2641
|
+
if (stub) {
|
|
2642
|
+
runCommonAsserts(data, error);
|
|
2643
|
+
assert.equal('success', data.response);
|
|
2644
|
+
} else {
|
|
2645
|
+
runCommonAsserts(data, error);
|
|
2646
|
+
}
|
|
2647
|
+
saveMockData('BaselineOperationsRestconfAPI', 'patchBaselineDetector', 'default', data);
|
|
2648
|
+
done();
|
|
2649
|
+
} catch (err) {
|
|
2650
|
+
log.error(`Test Failure: ${err}`);
|
|
2651
|
+
done(err);
|
|
2652
|
+
}
|
|
2653
|
+
});
|
|
2654
|
+
} catch (error) {
|
|
2655
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2656
|
+
done(error);
|
|
2657
|
+
}
|
|
2658
|
+
}).timeout(attemptTimeout);
|
|
2659
|
+
});
|
|
2660
|
+
|
|
2661
|
+
describe('#getBaselineDetector - errors', () => {
|
|
2662
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2663
|
+
try {
|
|
2664
|
+
a.getBaselineDetector(baselineOperationsRestconfAPIBaseline, baselineOperationsRestconfAPIBaselineDetector, (data, error) => {
|
|
2665
|
+
try {
|
|
2666
|
+
if (stub) {
|
|
2667
|
+
runCommonAsserts(data, error);
|
|
2668
|
+
assert.equal(true, Array.isArray(data.response['nsp-rt-analytics:baseline-detector']));
|
|
2669
|
+
} else {
|
|
2670
|
+
runCommonAsserts(data, error);
|
|
2671
|
+
}
|
|
2672
|
+
saveMockData('BaselineOperationsRestconfAPI', 'getBaselineDetector', 'default', data);
|
|
2673
|
+
done();
|
|
2674
|
+
} catch (err) {
|
|
2675
|
+
log.error(`Test Failure: ${err}`);
|
|
2676
|
+
done(err);
|
|
2677
|
+
}
|
|
2678
|
+
});
|
|
2679
|
+
} catch (error) {
|
|
2680
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2681
|
+
done(error);
|
|
2682
|
+
}
|
|
2683
|
+
}).timeout(attemptTimeout);
|
|
2684
|
+
});
|
|
2685
|
+
|
|
2686
|
+
const intentTypeManagementImportIntentTypeFromIntentManagerBodyParam = {
|
|
2687
|
+
input: {
|
|
2688
|
+
'imported-intent-types': [
|
|
2689
|
+
{
|
|
2690
|
+
name: 'icm-equipment-port-ethernet',
|
|
2691
|
+
version: 2
|
|
2692
|
+
},
|
|
2693
|
+
{
|
|
2694
|
+
name: 'icm-qos-sapegress-srqos',
|
|
2695
|
+
version: 2
|
|
2696
|
+
},
|
|
2697
|
+
{
|
|
2698
|
+
name: 'icm-qos-sapingress-srqos',
|
|
2699
|
+
version: 2
|
|
2700
|
+
},
|
|
2701
|
+
{
|
|
2702
|
+
name: 'icm-logical-lag-access',
|
|
2703
|
+
version: 2
|
|
2704
|
+
},
|
|
2705
|
+
{
|
|
2706
|
+
name: 'icm-router-policystatement-srrouter',
|
|
2707
|
+
version: 2
|
|
2708
|
+
},
|
|
2709
|
+
{
|
|
2710
|
+
name: 'icm-system-ptp',
|
|
2711
|
+
version: 2
|
|
2712
|
+
},
|
|
2713
|
+
{
|
|
2714
|
+
name: 'icm-equipment-port-e_m',
|
|
2715
|
+
version: 2
|
|
2716
|
+
}
|
|
2717
|
+
]
|
|
2718
|
+
}
|
|
2719
|
+
};
|
|
2720
|
+
describe('#importIntentTypeFromIntentManager - errors', () => {
|
|
2721
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2722
|
+
try {
|
|
2723
|
+
a.importIntentTypeFromIntentManager(intentTypeManagementImportIntentTypeFromIntentManagerBodyParam, (data, error) => {
|
|
2724
|
+
try {
|
|
2725
|
+
if (stub) {
|
|
2726
|
+
runCommonAsserts(data, error);
|
|
2727
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
2728
|
+
assert.equal('OK', data.response.statusCode);
|
|
2729
|
+
} else {
|
|
2730
|
+
runCommonAsserts(data, error);
|
|
2731
|
+
}
|
|
2732
|
+
saveMockData('IntentTypeManagement', 'importIntentTypeFromIntentManager', 'default', data);
|
|
2733
|
+
done();
|
|
2734
|
+
} catch (err) {
|
|
2735
|
+
log.error(`Test Failure: ${err}`);
|
|
2736
|
+
done(err);
|
|
2737
|
+
}
|
|
2738
|
+
});
|
|
2739
|
+
} catch (error) {
|
|
2740
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2741
|
+
done(error);
|
|
2742
|
+
}
|
|
2743
|
+
}).timeout(attemptTimeout);
|
|
2744
|
+
});
|
|
2745
|
+
|
|
2746
|
+
const intentTypeManagementRemoveIntentTypeBodyParam = {
|
|
2747
|
+
input: {
|
|
2748
|
+
name: 'icm-system-ptp',
|
|
2749
|
+
version: 2
|
|
2750
|
+
}
|
|
2751
|
+
};
|
|
2752
|
+
describe('#removeIntentType - errors', () => {
|
|
2753
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2754
|
+
try {
|
|
2755
|
+
a.removeIntentType(intentTypeManagementRemoveIntentTypeBodyParam, (data, error) => {
|
|
2756
|
+
try {
|
|
2757
|
+
if (stub) {
|
|
2758
|
+
runCommonAsserts(data, error);
|
|
2759
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
2760
|
+
assert.equal('OK', data.response.statusCode);
|
|
2761
|
+
} else {
|
|
2762
|
+
runCommonAsserts(data, error);
|
|
2763
|
+
}
|
|
2764
|
+
saveMockData('IntentTypeManagement', 'removeIntentType', 'default', data);
|
|
2765
|
+
done();
|
|
2766
|
+
} catch (err) {
|
|
2767
|
+
log.error(`Test Failure: ${err}`);
|
|
2768
|
+
done(err);
|
|
2769
|
+
}
|
|
2770
|
+
});
|
|
2771
|
+
} catch (error) {
|
|
2772
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2773
|
+
done(error);
|
|
2774
|
+
}
|
|
2775
|
+
}).timeout(attemptTimeout);
|
|
2776
|
+
});
|
|
2777
|
+
|
|
2778
|
+
describe('#getIntentTypes - errors', () => {
|
|
2779
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2780
|
+
try {
|
|
2781
|
+
a.getIntentTypes((data, error) => {
|
|
2782
|
+
try {
|
|
2783
|
+
if (stub) {
|
|
2784
|
+
runCommonAsserts(data, error);
|
|
2785
|
+
assert.equal('object', typeof data.response['nsp-icm:imported-intent-types']);
|
|
2786
|
+
} else {
|
|
2787
|
+
runCommonAsserts(data, error);
|
|
2788
|
+
}
|
|
2789
|
+
saveMockData('IntentTypeManagement', 'getIntentTypes', 'default', data);
|
|
2790
|
+
done();
|
|
2791
|
+
} catch (err) {
|
|
2792
|
+
log.error(`Test Failure: ${err}`);
|
|
2793
|
+
done(err);
|
|
2794
|
+
}
|
|
2795
|
+
});
|
|
2796
|
+
} catch (error) {
|
|
2797
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2798
|
+
done(error);
|
|
2799
|
+
}
|
|
2800
|
+
}).timeout(attemptTimeout);
|
|
2801
|
+
});
|
|
2802
|
+
|
|
2803
|
+
const configurationTemplatesCreateTemplateBodyParam = {
|
|
2804
|
+
template: [
|
|
2805
|
+
{
|
|
2806
|
+
name: 'Gold Port',
|
|
2807
|
+
description: 'Configure an access port with Gold profile',
|
|
2808
|
+
'life-cycle-state': 'released',
|
|
2809
|
+
'intent-type': 'icm-equipment-port-ethernet',
|
|
2810
|
+
'intent-type-version': 2,
|
|
2811
|
+
'schema-form-name': 'gold.schemaForm'
|
|
2812
|
+
}
|
|
2813
|
+
]
|
|
2814
|
+
};
|
|
2815
|
+
describe('#createTemplate - errors', () => {
|
|
2816
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2817
|
+
try {
|
|
2818
|
+
a.createTemplate(configurationTemplatesCreateTemplateBodyParam, (data, error) => {
|
|
2819
|
+
try {
|
|
2820
|
+
if (stub) {
|
|
2821
|
+
runCommonAsserts(data, error);
|
|
2822
|
+
assert.equal('Buffer', data.response.type);
|
|
2823
|
+
assert.equal(true, Array.isArray(data.response.data));
|
|
2824
|
+
} else {
|
|
2825
|
+
runCommonAsserts(data, error);
|
|
2826
|
+
}
|
|
2827
|
+
saveMockData('ConfigurationTemplates', 'createTemplate', 'default', data);
|
|
2828
|
+
done();
|
|
2829
|
+
} catch (err) {
|
|
2830
|
+
log.error(`Test Failure: ${err}`);
|
|
2831
|
+
done(err);
|
|
2832
|
+
}
|
|
2833
|
+
});
|
|
2834
|
+
} catch (error) {
|
|
2835
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2836
|
+
done(error);
|
|
2837
|
+
}
|
|
2838
|
+
}).timeout(attemptTimeout);
|
|
2839
|
+
});
|
|
2840
|
+
|
|
2841
|
+
describe('#getTemplates - errors', () => {
|
|
2842
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2843
|
+
try {
|
|
2844
|
+
a.getTemplates((data, error) => {
|
|
2845
|
+
try {
|
|
2846
|
+
if (stub) {
|
|
2847
|
+
runCommonAsserts(data, error);
|
|
2848
|
+
assert.equal('object', typeof data.response['nsp-icm:templates']);
|
|
2849
|
+
} else {
|
|
2850
|
+
runCommonAsserts(data, error);
|
|
2851
|
+
}
|
|
2852
|
+
saveMockData('ConfigurationTemplates', 'getTemplates', 'default', data);
|
|
2853
|
+
done();
|
|
2854
|
+
} catch (err) {
|
|
2855
|
+
log.error(`Test Failure: ${err}`);
|
|
2856
|
+
done(err);
|
|
2857
|
+
}
|
|
2858
|
+
});
|
|
2859
|
+
} catch (error) {
|
|
2860
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2861
|
+
done(error);
|
|
2862
|
+
}
|
|
2863
|
+
}).timeout(attemptTimeout);
|
|
2864
|
+
});
|
|
2865
|
+
|
|
2866
|
+
const configurationTemplatesTemplate = 'fakedata';
|
|
2867
|
+
const configurationTemplatesUpdateTemplateLifecycleBodyParam = {
|
|
2868
|
+
template: [
|
|
2869
|
+
{
|
|
2870
|
+
'life-cycle-state': 'obsolete'
|
|
2871
|
+
}
|
|
2872
|
+
]
|
|
2873
|
+
};
|
|
2874
|
+
describe('#updateTemplateLifecycle - errors', () => {
|
|
2875
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
2876
|
+
try {
|
|
2877
|
+
a.updateTemplateLifecycle(configurationTemplatesTemplate, configurationTemplatesUpdateTemplateLifecycleBodyParam, (data, error) => {
|
|
2878
|
+
try {
|
|
2879
|
+
if (stub) {
|
|
2880
|
+
const displayE = 'Error 400 received on request';
|
|
2881
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
2882
|
+
} else {
|
|
2883
|
+
runCommonAsserts(data, error);
|
|
2884
|
+
}
|
|
2885
|
+
saveMockData('ConfigurationTemplates', 'updateTemplateLifecycle', 'default', data);
|
|
2886
|
+
done();
|
|
2887
|
+
} catch (err) {
|
|
2888
|
+
log.error(`Test Failure: ${err}`);
|
|
2889
|
+
done(err);
|
|
2890
|
+
}
|
|
2891
|
+
});
|
|
2892
|
+
} catch (error) {
|
|
2893
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2894
|
+
done(error);
|
|
2895
|
+
}
|
|
2896
|
+
}).timeout(attemptTimeout);
|
|
2897
|
+
});
|
|
2898
|
+
|
|
2899
|
+
const configurationDeploymentsCategory = 'fakedata';
|
|
2900
|
+
const configurationDeploymentsCreatePortGroupDirectoryBodyParam = {
|
|
2901
|
+
groupDirectoryName: 'GroupDir1'
|
|
2902
|
+
};
|
|
2903
|
+
describe('#createPortGroupDirectory - errors', () => {
|
|
2904
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2905
|
+
try {
|
|
2906
|
+
a.createPortGroupDirectory(configurationDeploymentsCategory, configurationDeploymentsCreatePortGroupDirectoryBodyParam, (data, error) => {
|
|
2907
|
+
try {
|
|
2908
|
+
if (stub) {
|
|
2909
|
+
runCommonAsserts(data, error);
|
|
2910
|
+
assert.equal('object', typeof data.response.response);
|
|
2911
|
+
} else {
|
|
2912
|
+
runCommonAsserts(data, error);
|
|
2913
|
+
}
|
|
2914
|
+
saveMockData('ConfigurationDeployments', 'createPortGroupDirectory', 'default', data);
|
|
2915
|
+
done();
|
|
2916
|
+
} catch (err) {
|
|
2917
|
+
log.error(`Test Failure: ${err}`);
|
|
2918
|
+
done(err);
|
|
2919
|
+
}
|
|
2920
|
+
});
|
|
2921
|
+
} catch (error) {
|
|
2922
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2923
|
+
done(error);
|
|
2924
|
+
}
|
|
2925
|
+
}).timeout(attemptTimeout);
|
|
2926
|
+
});
|
|
2927
|
+
|
|
2928
|
+
const configurationDeploymentsCreatePortGroupBodyParam = {
|
|
2929
|
+
advanceFilterExpression: '( name EQUAL \'1/2/3\' OR name EQUAL \'1/2/4\' OR name EQUAL \'1/2/5\')',
|
|
2930
|
+
alarmsSeverity: 'critical',
|
|
2931
|
+
filterEditable: true,
|
|
2932
|
+
groupName: 'AccessPorts',
|
|
2933
|
+
groupDescription: 'N/A',
|
|
2934
|
+
groupDirectoryFdn: '{{groupDirFDN}}',
|
|
2935
|
+
usePhysicalMapLayout: true
|
|
2936
|
+
};
|
|
2937
|
+
describe('#createPortGroup - errors', () => {
|
|
2938
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2939
|
+
try {
|
|
2940
|
+
a.createPortGroup(configurationDeploymentsCategory, configurationDeploymentsCreatePortGroupBodyParam, (data, error) => {
|
|
2941
|
+
try {
|
|
2942
|
+
if (stub) {
|
|
2943
|
+
runCommonAsserts(data, error);
|
|
2944
|
+
assert.equal('object', typeof data.response.response);
|
|
2945
|
+
} else {
|
|
2946
|
+
runCommonAsserts(data, error);
|
|
2947
|
+
}
|
|
2948
|
+
saveMockData('ConfigurationDeployments', 'createPortGroup', 'default', data);
|
|
2949
|
+
done();
|
|
2950
|
+
} catch (err) {
|
|
2951
|
+
log.error(`Test Failure: ${err}`);
|
|
2952
|
+
done(err);
|
|
2953
|
+
}
|
|
2954
|
+
});
|
|
2955
|
+
} catch (error) {
|
|
2956
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2957
|
+
done(error);
|
|
2958
|
+
}
|
|
2959
|
+
}).timeout(attemptTimeout);
|
|
2960
|
+
});
|
|
2961
|
+
|
|
2962
|
+
const configurationDeploymentsCreateDeploymentBodyParam = {
|
|
2963
|
+
input: {
|
|
2964
|
+
deployments: [
|
|
2965
|
+
{
|
|
2966
|
+
'deployment-action': 'deploy',
|
|
2967
|
+
'template-name': 'Gold Port',
|
|
2968
|
+
targets: [
|
|
2969
|
+
{
|
|
2970
|
+
target: '/nsp-equipment:network/network-element[ne-id=\'{{nodeA}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=2/mda=2/port=1/2/7\']',
|
|
2971
|
+
'target-identifier-value': '1/2/7'
|
|
2972
|
+
},
|
|
2973
|
+
{
|
|
2974
|
+
target: '/nsp-equipment:network/network-element[ne-id=\'{{nodeA}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=2/mda=2/port=1/2/8\']',
|
|
2975
|
+
'target-identifier-value': '1/2/8'
|
|
2976
|
+
}
|
|
2977
|
+
]
|
|
2978
|
+
}
|
|
2979
|
+
]
|
|
2980
|
+
}
|
|
2981
|
+
};
|
|
2982
|
+
describe('#createDeployment - errors', () => {
|
|
2983
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
2984
|
+
try {
|
|
2985
|
+
a.createDeployment(configurationDeploymentsCreateDeploymentBodyParam, (data, error) => {
|
|
2986
|
+
try {
|
|
2987
|
+
if (stub) {
|
|
2988
|
+
runCommonAsserts(data, error);
|
|
2989
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
2990
|
+
assert.equal('OK', data.response.statusCode);
|
|
2991
|
+
} else {
|
|
2992
|
+
runCommonAsserts(data, error);
|
|
2993
|
+
}
|
|
2994
|
+
saveMockData('ConfigurationDeployments', 'createDeployment', 'default', data);
|
|
2995
|
+
done();
|
|
2996
|
+
} catch (err) {
|
|
2997
|
+
log.error(`Test Failure: ${err}`);
|
|
2998
|
+
done(err);
|
|
2999
|
+
}
|
|
3000
|
+
});
|
|
3001
|
+
} catch (error) {
|
|
3002
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3003
|
+
done(error);
|
|
3004
|
+
}
|
|
3005
|
+
}).timeout(attemptTimeout);
|
|
3006
|
+
});
|
|
3007
|
+
|
|
3008
|
+
const configurationDeploymentsDeleteDeploymentsBodyParam = {
|
|
3009
|
+
input: {
|
|
3010
|
+
'delete-option': 'network-and-nsp',
|
|
3011
|
+
deployments: [
|
|
3012
|
+
{
|
|
3013
|
+
deployment: '/nsp-icm:icm/deployments/deployment[template-name=\'Configure Port\'][target=\'/nsp-equipment:network/network-element[ne-id=\'{{nodeB}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=2/mda=2/port=1/2/9\']\'][target-identifier-value=\'1/2/9\']'
|
|
3014
|
+
},
|
|
3015
|
+
{
|
|
3016
|
+
deployment: '/nsp-icm:icm/deployments/deployment[template-name=\'Configure Port\'][target=\'/nsp-equipment:network/network-element[ne-id=\'{{nodeB}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=2/mda=2/port=1/2/10\']\'][target-identifier-value=\'1/2/10\']'
|
|
3017
|
+
},
|
|
3018
|
+
{
|
|
3019
|
+
deployment: '/nsp-icm:icm/deployments/deployment[template-name=\'Configure Port\'][target=\'/nsp-equipment:network/network-element[ne-id=\'{{nodeA}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=2/mda=2/port=1/2/8\']\'][target-identifier-value=\'1/2/8\']'
|
|
3020
|
+
}
|
|
3021
|
+
]
|
|
3022
|
+
}
|
|
3023
|
+
};
|
|
3024
|
+
describe('#deleteDeployments - errors', () => {
|
|
3025
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3026
|
+
try {
|
|
3027
|
+
a.deleteDeployments(configurationDeploymentsDeleteDeploymentsBodyParam, (data, error) => {
|
|
3028
|
+
try {
|
|
3029
|
+
if (stub) {
|
|
3030
|
+
runCommonAsserts(data, error);
|
|
3031
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3032
|
+
assert.equal('OK', data.response.statusCode);
|
|
3033
|
+
} else {
|
|
3034
|
+
runCommonAsserts(data, error);
|
|
3035
|
+
}
|
|
3036
|
+
saveMockData('ConfigurationDeployments', 'deleteDeployments', 'default', data);
|
|
3037
|
+
done();
|
|
3038
|
+
} catch (err) {
|
|
3039
|
+
log.error(`Test Failure: ${err}`);
|
|
3040
|
+
done(err);
|
|
3041
|
+
}
|
|
3042
|
+
});
|
|
3043
|
+
} catch (error) {
|
|
3044
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3045
|
+
done(error);
|
|
3046
|
+
}
|
|
3047
|
+
}).timeout(attemptTimeout);
|
|
3048
|
+
});
|
|
3049
|
+
|
|
3050
|
+
const configurationDeploymentsReplaceDeploymentBodyParam = {
|
|
3051
|
+
input: {
|
|
3052
|
+
'old-template-name': 'Gold Port',
|
|
3053
|
+
'new-template-name': 'Configure Port',
|
|
3054
|
+
'target-data': '{"port\':{\'description\':null,\'ethernet\':{\'dot1q-etype\':null,\'pbb-etype\':null,\'qinq-etype\':null,\'hold-time\':{},\'down-when-looped\':{},\'lldp\':{\'dest-mac\':[]},\'encap-type\':\'qinq\',\'mtu\':1600,\'mode\':\'access\'},\'admin-state\':\'enable\'}}',
|
|
3055
|
+
'deployment-action': 'deploy',
|
|
3056
|
+
targets: [
|
|
3057
|
+
{
|
|
3058
|
+
target: '/nsp-equipment:network/network-element[ne-id=\'{{nodeA}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=2/mda=2/port=1/2/7\']',
|
|
3059
|
+
'target-identifier-value': '1/2/7'
|
|
3060
|
+
},
|
|
3061
|
+
{
|
|
3062
|
+
target: '/nsp-equipment:network/network-element[ne-id=\'{{nodeA}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=2/mda=2/port=1/2/8\']',
|
|
3063
|
+
'target-identifier-value': '1/2/8'
|
|
3064
|
+
}
|
|
3065
|
+
]
|
|
3066
|
+
}
|
|
3067
|
+
};
|
|
3068
|
+
describe('#replaceDeployment - errors', () => {
|
|
3069
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3070
|
+
try {
|
|
3071
|
+
a.replaceDeployment(configurationDeploymentsReplaceDeploymentBodyParam, (data, error) => {
|
|
3072
|
+
try {
|
|
3073
|
+
if (stub) {
|
|
3074
|
+
runCommonAsserts(data, error);
|
|
3075
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3076
|
+
assert.equal('OK', data.response.statusCode);
|
|
3077
|
+
} else {
|
|
3078
|
+
runCommonAsserts(data, error);
|
|
3079
|
+
}
|
|
3080
|
+
saveMockData('ConfigurationDeployments', 'replaceDeployment', 'default', data);
|
|
3081
|
+
done();
|
|
3082
|
+
} catch (err) {
|
|
3083
|
+
log.error(`Test Failure: ${err}`);
|
|
3084
|
+
done(err);
|
|
3085
|
+
}
|
|
3086
|
+
});
|
|
3087
|
+
} catch (error) {
|
|
3088
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3089
|
+
done(error);
|
|
3090
|
+
}
|
|
3091
|
+
}).timeout(attemptTimeout);
|
|
3092
|
+
});
|
|
3093
|
+
|
|
3094
|
+
const configurationDeploymentsUpdateDeploymentConfigurationBodyParam = {
|
|
3095
|
+
input: {
|
|
3096
|
+
deployments: [
|
|
3097
|
+
{
|
|
3098
|
+
'deployment-action': 'deploy',
|
|
3099
|
+
'template-name': 'Configure Port',
|
|
3100
|
+
'target-data': '{"port\':{\'description\':null,\'ethernet\':{\'dot1q-etype\':null,\'pbb-etype\':null,\'qinq-etype\':null,\'hold-time\':{},\'down-when-looped\':{},\'lldp\':{\'dest-mac\':[]},\'encap-type\':\'qinq\',\'mtu\':1600,\'mode\':\'access\'},\'admin-state\':\'enable\'}}',
|
|
3101
|
+
targets: [
|
|
3102
|
+
{
|
|
3103
|
+
target: '/nsp-equipment:network/network-element[ne-id=\'{{nodeB}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=2/mda=2/port=1/2/9\']',
|
|
3104
|
+
'target-identifier-value': '1/2/9'
|
|
3105
|
+
},
|
|
3106
|
+
{
|
|
3107
|
+
target: '/nsp-equipment:network/network-element[ne-id=\'{{nodeB}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=2/mda=2/port=1/2/10\']',
|
|
3108
|
+
'target-identifier-value': '1/2/10'
|
|
3109
|
+
}
|
|
3110
|
+
]
|
|
3111
|
+
}
|
|
3112
|
+
]
|
|
3113
|
+
}
|
|
3114
|
+
};
|
|
3115
|
+
describe('#updateDeploymentConfiguration - errors', () => {
|
|
3116
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3117
|
+
try {
|
|
3118
|
+
a.updateDeploymentConfiguration(configurationDeploymentsUpdateDeploymentConfigurationBodyParam, (data, error) => {
|
|
3119
|
+
try {
|
|
3120
|
+
if (stub) {
|
|
3121
|
+
runCommonAsserts(data, error);
|
|
3122
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3123
|
+
assert.equal('OK', data.response.statusCode);
|
|
3124
|
+
} else {
|
|
3125
|
+
runCommonAsserts(data, error);
|
|
3126
|
+
}
|
|
3127
|
+
saveMockData('ConfigurationDeployments', 'updateDeploymentConfiguration', 'default', data);
|
|
3128
|
+
done();
|
|
3129
|
+
} catch (err) {
|
|
3130
|
+
log.error(`Test Failure: ${err}`);
|
|
3131
|
+
done(err);
|
|
3132
|
+
}
|
|
3133
|
+
});
|
|
3134
|
+
} catch (error) {
|
|
3135
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3136
|
+
done(error);
|
|
3137
|
+
}
|
|
3138
|
+
}).timeout(attemptTimeout);
|
|
3139
|
+
});
|
|
3140
|
+
|
|
3141
|
+
describe('#getPortGroupFDN - errors', () => {
|
|
3142
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3143
|
+
try {
|
|
3144
|
+
a.getPortGroupFDN(configurationDeploymentsCategory, (data, error) => {
|
|
3145
|
+
try {
|
|
3146
|
+
if (stub) {
|
|
3147
|
+
runCommonAsserts(data, error);
|
|
3148
|
+
assert.equal('object', typeof data.response.response);
|
|
3149
|
+
} else {
|
|
3150
|
+
runCommonAsserts(data, error);
|
|
3151
|
+
}
|
|
3152
|
+
saveMockData('ConfigurationDeployments', 'getPortGroupFDN', 'default', data);
|
|
3153
|
+
done();
|
|
3154
|
+
} catch (err) {
|
|
3155
|
+
log.error(`Test Failure: ${err}`);
|
|
3156
|
+
done(err);
|
|
3157
|
+
}
|
|
3158
|
+
});
|
|
3159
|
+
} catch (error) {
|
|
3160
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3161
|
+
done(error);
|
|
3162
|
+
}
|
|
3163
|
+
}).timeout(attemptTimeout);
|
|
3164
|
+
});
|
|
3165
|
+
|
|
3166
|
+
describe('#getDeployments - errors', () => {
|
|
3167
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3168
|
+
try {
|
|
3169
|
+
a.getDeployments((data, error) => {
|
|
3170
|
+
try {
|
|
3171
|
+
if (stub) {
|
|
3172
|
+
runCommonAsserts(data, error);
|
|
3173
|
+
assert.equal('object', typeof data.response['nsp-icm:deployments']);
|
|
3174
|
+
} else {
|
|
3175
|
+
runCommonAsserts(data, error);
|
|
3176
|
+
}
|
|
3177
|
+
saveMockData('ConfigurationDeployments', 'getDeployments', 'default', data);
|
|
3178
|
+
done();
|
|
3179
|
+
} catch (err) {
|
|
3180
|
+
log.error(`Test Failure: ${err}`);
|
|
3181
|
+
done(err);
|
|
3182
|
+
}
|
|
3183
|
+
});
|
|
3184
|
+
} catch (error) {
|
|
3185
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3186
|
+
done(error);
|
|
3187
|
+
}
|
|
3188
|
+
}).timeout(attemptTimeout);
|
|
3189
|
+
});
|
|
3190
|
+
|
|
3191
|
+
const configurationDeploymentsDeployment = 'fakedata';
|
|
3192
|
+
describe('#getSpecificDeployment - errors', () => {
|
|
3193
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3194
|
+
try {
|
|
3195
|
+
a.getSpecificDeployment(configurationDeploymentsDeployment, (data, error) => {
|
|
3196
|
+
try {
|
|
3197
|
+
if (stub) {
|
|
3198
|
+
runCommonAsserts(data, error);
|
|
3199
|
+
assert.equal(true, Array.isArray(data.response['nsp-icm:deployment']));
|
|
3200
|
+
} else {
|
|
3201
|
+
runCommonAsserts(data, error);
|
|
3202
|
+
}
|
|
3203
|
+
saveMockData('ConfigurationDeployments', 'getSpecificDeployment', 'default', data);
|
|
3204
|
+
done();
|
|
3205
|
+
} catch (err) {
|
|
3206
|
+
log.error(`Test Failure: ${err}`);
|
|
3207
|
+
done(err);
|
|
3208
|
+
}
|
|
3209
|
+
});
|
|
3210
|
+
} catch (error) {
|
|
3211
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3212
|
+
done(error);
|
|
3213
|
+
}
|
|
3214
|
+
}).timeout(attemptTimeout);
|
|
3215
|
+
});
|
|
3216
|
+
|
|
3217
|
+
const brownfieldDiscoverDeploymentsBodyParam = {
|
|
3218
|
+
input: {
|
|
3219
|
+
'template-name': 'Gold Port',
|
|
3220
|
+
targets: [
|
|
3221
|
+
{
|
|
3222
|
+
target: '/nsp-equipment:network/network-element[ne-id=\'{{nodeC}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=2/mda=2/port=1/2/8\']',
|
|
3223
|
+
'target-identifier-value': '1/2/8'
|
|
3224
|
+
},
|
|
3225
|
+
{
|
|
3226
|
+
target: '/nsp-equipment:network/network-element[ne-id=\'{{nodeC}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=2/mda=2/port=1/2/9\']',
|
|
3227
|
+
'target-identifier-value': '1/2/9'
|
|
3228
|
+
},
|
|
3229
|
+
{
|
|
3230
|
+
target: '/nsp-equipment:network/network-element[ne-id=\'{{nodeC}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=2/mda=2/port=1/2/10\']',
|
|
3231
|
+
'target-identifier-value': '1/2/10'
|
|
3232
|
+
}
|
|
3233
|
+
]
|
|
3234
|
+
}
|
|
3235
|
+
};
|
|
3236
|
+
describe('#discoverDeployments - errors', () => {
|
|
3237
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3238
|
+
try {
|
|
3239
|
+
a.discoverDeployments(brownfieldDiscoverDeploymentsBodyParam, (data, error) => {
|
|
3240
|
+
try {
|
|
3241
|
+
if (stub) {
|
|
3242
|
+
runCommonAsserts(data, error);
|
|
3243
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3244
|
+
assert.equal('OK', data.response.statusCode);
|
|
3245
|
+
} else {
|
|
3246
|
+
runCommonAsserts(data, error);
|
|
3247
|
+
}
|
|
3248
|
+
saveMockData('Brownfield', 'discoverDeployments', 'default', data);
|
|
3249
|
+
done();
|
|
3250
|
+
} catch (err) {
|
|
3251
|
+
log.error(`Test Failure: ${err}`);
|
|
3252
|
+
done(err);
|
|
3253
|
+
}
|
|
3254
|
+
});
|
|
3255
|
+
} catch (error) {
|
|
3256
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3257
|
+
done(error);
|
|
3258
|
+
}
|
|
3259
|
+
}).timeout(attemptTimeout);
|
|
3260
|
+
});
|
|
3261
|
+
|
|
3262
|
+
const auditAndAlignmentDeployment = 'fakedata';
|
|
3263
|
+
const auditAndAlignmentAlignConfigurationDeploymentBodyParam = {};
|
|
3264
|
+
describe('#alignConfigurationDeployment - errors', () => {
|
|
3265
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3266
|
+
try {
|
|
3267
|
+
a.alignConfigurationDeployment(auditAndAlignmentDeployment, auditAndAlignmentAlignConfigurationDeploymentBodyParam, (data, error) => {
|
|
3268
|
+
try {
|
|
3269
|
+
if (stub) {
|
|
3270
|
+
runCommonAsserts(data, error);
|
|
3271
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3272
|
+
assert.equal('OK', data.response.statusCode);
|
|
3273
|
+
} else {
|
|
3274
|
+
runCommonAsserts(data, error);
|
|
3275
|
+
}
|
|
3276
|
+
saveMockData('AuditAndAlignment', 'alignConfigurationDeployment', 'default', data);
|
|
3277
|
+
done();
|
|
3278
|
+
} catch (err) {
|
|
3279
|
+
log.error(`Test Failure: ${err}`);
|
|
3280
|
+
done(err);
|
|
3281
|
+
}
|
|
3282
|
+
});
|
|
3283
|
+
} catch (error) {
|
|
3284
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3285
|
+
done(error);
|
|
3286
|
+
}
|
|
3287
|
+
}).timeout(attemptTimeout);
|
|
3288
|
+
});
|
|
3289
|
+
|
|
3290
|
+
const auditAndAlignmentAuditDeploymentBodyParam = {};
|
|
3291
|
+
describe('#auditDeployment - errors', () => {
|
|
3292
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3293
|
+
try {
|
|
3294
|
+
a.auditDeployment(auditAndAlignmentDeployment, auditAndAlignmentAuditDeploymentBodyParam, (data, error) => {
|
|
3295
|
+
try {
|
|
3296
|
+
if (stub) {
|
|
3297
|
+
runCommonAsserts(data, error);
|
|
3298
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3299
|
+
assert.equal('OK', data.response.statusCode);
|
|
3300
|
+
} else {
|
|
3301
|
+
runCommonAsserts(data, error);
|
|
3302
|
+
}
|
|
3303
|
+
saveMockData('AuditAndAlignment', 'auditDeployment', 'default', data);
|
|
3304
|
+
done();
|
|
3305
|
+
} catch (err) {
|
|
3306
|
+
log.error(`Test Failure: ${err}`);
|
|
3307
|
+
done(err);
|
|
3308
|
+
}
|
|
3309
|
+
});
|
|
3310
|
+
} catch (error) {
|
|
3311
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3312
|
+
done(error);
|
|
3313
|
+
}
|
|
3314
|
+
}).timeout(attemptTimeout);
|
|
3315
|
+
});
|
|
3316
|
+
|
|
3317
|
+
const auditAndAlignmentTemplate = 'fakedata';
|
|
3318
|
+
const auditAndAlignmentAlignConfigurationTemplateAllDeploymentsBodyParam = {};
|
|
3319
|
+
describe('#alignConfigurationTemplateAllDeployments - errors', () => {
|
|
3320
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3321
|
+
try {
|
|
3322
|
+
a.alignConfigurationTemplateAllDeployments(auditAndAlignmentTemplate, auditAndAlignmentAlignConfigurationTemplateAllDeploymentsBodyParam, (data, error) => {
|
|
3323
|
+
try {
|
|
3324
|
+
if (stub) {
|
|
3325
|
+
runCommonAsserts(data, error);
|
|
3326
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3327
|
+
assert.equal('OK', data.response.statusCode);
|
|
3328
|
+
} else {
|
|
3329
|
+
runCommonAsserts(data, error);
|
|
3330
|
+
}
|
|
3331
|
+
saveMockData('AuditAndAlignment', 'alignConfigurationTemplateAllDeployments', 'default', data);
|
|
3332
|
+
done();
|
|
3333
|
+
} catch (err) {
|
|
3334
|
+
log.error(`Test Failure: ${err}`);
|
|
3335
|
+
done(err);
|
|
3336
|
+
}
|
|
3337
|
+
});
|
|
3338
|
+
} catch (error) {
|
|
3339
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3340
|
+
done(error);
|
|
3341
|
+
}
|
|
3342
|
+
}).timeout(attemptTimeout);
|
|
3343
|
+
});
|
|
3344
|
+
|
|
3345
|
+
const auditAndAlignmentAlignConfigurationTemplateMisalignedDeploymentsBodyParam = {};
|
|
3346
|
+
describe('#alignConfigurationTemplateMisalignedDeployments - errors', () => {
|
|
3347
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3348
|
+
try {
|
|
3349
|
+
a.alignConfigurationTemplateMisalignedDeployments(auditAndAlignmentTemplate, auditAndAlignmentAlignConfigurationTemplateMisalignedDeploymentsBodyParam, (data, error) => {
|
|
3350
|
+
try {
|
|
3351
|
+
if (stub) {
|
|
3352
|
+
runCommonAsserts(data, error);
|
|
3353
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3354
|
+
assert.equal('OK', data.response.statusCode);
|
|
3355
|
+
} else {
|
|
3356
|
+
runCommonAsserts(data, error);
|
|
3357
|
+
}
|
|
3358
|
+
saveMockData('AuditAndAlignment', 'alignConfigurationTemplateMisalignedDeployments', 'default', data);
|
|
3359
|
+
done();
|
|
3360
|
+
} catch (err) {
|
|
3361
|
+
log.error(`Test Failure: ${err}`);
|
|
3362
|
+
done(err);
|
|
3363
|
+
}
|
|
3364
|
+
});
|
|
3365
|
+
} catch (error) {
|
|
3366
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3367
|
+
done(error);
|
|
3368
|
+
}
|
|
3369
|
+
}).timeout(attemptTimeout);
|
|
3370
|
+
});
|
|
3371
|
+
|
|
3372
|
+
const auditAndAlignmentAuditTemplateBodyParam = {};
|
|
3373
|
+
describe('#auditTemplate - errors', () => {
|
|
3374
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3375
|
+
try {
|
|
3376
|
+
a.auditTemplate(auditAndAlignmentTemplate, auditAndAlignmentAuditTemplateBodyParam, (data, error) => {
|
|
3377
|
+
try {
|
|
3378
|
+
if (stub) {
|
|
3379
|
+
runCommonAsserts(data, error);
|
|
3380
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3381
|
+
assert.equal('OK', data.response.statusCode);
|
|
3382
|
+
} else {
|
|
3383
|
+
runCommonAsserts(data, error);
|
|
3384
|
+
}
|
|
3385
|
+
saveMockData('AuditAndAlignment', 'auditTemplate', 'default', data);
|
|
3386
|
+
done();
|
|
3387
|
+
} catch (err) {
|
|
3388
|
+
log.error(`Test Failure: ${err}`);
|
|
3389
|
+
done(err);
|
|
3390
|
+
}
|
|
3391
|
+
});
|
|
3392
|
+
} catch (error) {
|
|
3393
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3394
|
+
done(error);
|
|
3395
|
+
}
|
|
3396
|
+
}).timeout(attemptTimeout);
|
|
3397
|
+
});
|
|
3398
|
+
|
|
3399
|
+
const auditAndAlignmentCheckAuditStatusCountBodyParam = {};
|
|
3400
|
+
describe('#checkAuditStatusCount - errors', () => {
|
|
3401
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3402
|
+
try {
|
|
3403
|
+
a.checkAuditStatusCount(auditAndAlignmentTemplate, auditAndAlignmentCheckAuditStatusCountBodyParam, (data, error) => {
|
|
3404
|
+
try {
|
|
3405
|
+
if (stub) {
|
|
3406
|
+
runCommonAsserts(data, error);
|
|
3407
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3408
|
+
assert.equal('OK', data.response.statusCode);
|
|
3409
|
+
} else {
|
|
3410
|
+
runCommonAsserts(data, error);
|
|
3411
|
+
}
|
|
3412
|
+
saveMockData('AuditAndAlignment', 'checkAuditStatusCount', 'default', data);
|
|
3413
|
+
done();
|
|
3414
|
+
} catch (err) {
|
|
3415
|
+
log.error(`Test Failure: ${err}`);
|
|
3416
|
+
done(err);
|
|
3417
|
+
}
|
|
3418
|
+
});
|
|
3419
|
+
} catch (error) {
|
|
3420
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3421
|
+
done(error);
|
|
3422
|
+
}
|
|
3423
|
+
}).timeout(attemptTimeout);
|
|
3424
|
+
});
|
|
3425
|
+
|
|
3426
|
+
const auditAndAlignmentAuditNodeDeploymentsBodyParam = {
|
|
3427
|
+
input: {
|
|
3428
|
+
'ne-ids': [
|
|
3429
|
+
'{{nodeA}}',
|
|
3430
|
+
'{{nodeB}}'
|
|
3431
|
+
],
|
|
3432
|
+
action: 'audit'
|
|
3433
|
+
}
|
|
3434
|
+
};
|
|
3435
|
+
describe('#auditNodeDeployments - errors', () => {
|
|
3436
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3437
|
+
try {
|
|
3438
|
+
a.auditNodeDeployments(auditAndAlignmentAuditNodeDeploymentsBodyParam, (data, error) => {
|
|
3439
|
+
try {
|
|
3440
|
+
if (stub) {
|
|
3441
|
+
runCommonAsserts(data, error);
|
|
3442
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3443
|
+
assert.equal('OK', data.response.statusCode);
|
|
3444
|
+
} else {
|
|
3445
|
+
runCommonAsserts(data, error);
|
|
3446
|
+
}
|
|
3447
|
+
saveMockData('AuditAndAlignment', 'auditNodeDeployments', 'default', data);
|
|
3448
|
+
done();
|
|
3449
|
+
} catch (err) {
|
|
3450
|
+
log.error(`Test Failure: ${err}`);
|
|
3451
|
+
done(err);
|
|
3452
|
+
}
|
|
3453
|
+
});
|
|
3454
|
+
} catch (error) {
|
|
3455
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3456
|
+
done(error);
|
|
3457
|
+
}
|
|
3458
|
+
}).timeout(attemptTimeout);
|
|
3459
|
+
});
|
|
3460
|
+
|
|
3461
|
+
describe('#getAuditDetails - errors', () => {
|
|
3462
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3463
|
+
try {
|
|
3464
|
+
a.getAuditDetails(auditAndAlignmentDeployment, (data, error) => {
|
|
3465
|
+
try {
|
|
3466
|
+
if (stub) {
|
|
3467
|
+
runCommonAsserts(data, error);
|
|
3468
|
+
assert.equal('object', typeof data.response['nsp-icm:audit-details']);
|
|
3469
|
+
} else {
|
|
3470
|
+
runCommonAsserts(data, error);
|
|
3471
|
+
}
|
|
3472
|
+
saveMockData('AuditAndAlignment', 'getAuditDetails', 'default', data);
|
|
3473
|
+
done();
|
|
3474
|
+
} catch (err) {
|
|
3475
|
+
log.error(`Test Failure: ${err}`);
|
|
3476
|
+
done(err);
|
|
3477
|
+
}
|
|
3478
|
+
});
|
|
3479
|
+
} catch (error) {
|
|
3480
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3481
|
+
done(error);
|
|
3482
|
+
}
|
|
3483
|
+
}).timeout(attemptTimeout);
|
|
3484
|
+
});
|
|
3485
|
+
|
|
3486
|
+
const templateMigrationCloneTemplateBodyParam = {
|
|
3487
|
+
input: {
|
|
3488
|
+
'source-template-name': 'Gold Port',
|
|
3489
|
+
name: 'Gold Port Updated',
|
|
3490
|
+
description: 'New gold port with updated model',
|
|
3491
|
+
'life-cycle-state': 'released'
|
|
3492
|
+
}
|
|
3493
|
+
};
|
|
3494
|
+
describe('#cloneTemplate - errors', () => {
|
|
3495
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3496
|
+
try {
|
|
3497
|
+
a.cloneTemplate(templateMigrationCloneTemplateBodyParam, (data, error) => {
|
|
3498
|
+
try {
|
|
3499
|
+
if (stub) {
|
|
3500
|
+
runCommonAsserts(data, error);
|
|
3501
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3502
|
+
assert.equal('OK', data.response.statusCode);
|
|
3503
|
+
} else {
|
|
3504
|
+
runCommonAsserts(data, error);
|
|
3505
|
+
}
|
|
3506
|
+
saveMockData('TemplateMigration', 'cloneTemplate', 'default', data);
|
|
3507
|
+
done();
|
|
3508
|
+
} catch (err) {
|
|
3509
|
+
log.error(`Test Failure: ${err}`);
|
|
3510
|
+
done(err);
|
|
3511
|
+
}
|
|
3512
|
+
});
|
|
3513
|
+
} catch (error) {
|
|
3514
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3515
|
+
done(error);
|
|
3516
|
+
}
|
|
3517
|
+
}).timeout(attemptTimeout);
|
|
3518
|
+
});
|
|
3519
|
+
|
|
3520
|
+
const templateMigrationMigrateDeploymentsBodyParam = {
|
|
3521
|
+
input: {
|
|
3522
|
+
'source-template-name': 'Gold Port',
|
|
3523
|
+
'target-template-name': 'Gold Port Updated',
|
|
3524
|
+
'target-data': '{"port\':{\'ethernet\':{\'mtu\':1492}}}',
|
|
3525
|
+
'source-deployments': [
|
|
3526
|
+
{
|
|
3527
|
+
target: '/nsp-equipment:network/network-element[ne-id=\'{{nodeA}}\']/hardware-component/port[component-id=\'shelf=1/cardSlot=1/card=1/mdaSlot=1/mda=1/port=1/2/4\']',
|
|
3528
|
+
'target-identifier-value': '1/2/4'
|
|
3529
|
+
}
|
|
3530
|
+
]
|
|
3531
|
+
}
|
|
3532
|
+
};
|
|
3533
|
+
describe('#migrateDeployments - errors', () => {
|
|
3534
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
3535
|
+
try {
|
|
3536
|
+
a.migrateDeployments(templateMigrationMigrateDeploymentsBodyParam, (data, error) => {
|
|
3537
|
+
try {
|
|
3538
|
+
if (stub) {
|
|
3539
|
+
runCommonAsserts(data, error);
|
|
3540
|
+
assert.equal('object', typeof data.response['nsp-icm:output']);
|
|
3541
|
+
assert.equal('OK', data.response.statusCode);
|
|
3542
|
+
} else {
|
|
3543
|
+
runCommonAsserts(data, error);
|
|
3544
|
+
}
|
|
3545
|
+
saveMockData('TemplateMigration', 'migrateDeployments', 'default', data);
|
|
3546
|
+
done();
|
|
3547
|
+
} catch (err) {
|
|
3548
|
+
log.error(`Test Failure: ${err}`);
|
|
3549
|
+
done(err);
|
|
3550
|
+
}
|
|
3551
|
+
});
|
|
3552
|
+
} catch (error) {
|
|
3553
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3554
|
+
done(error);
|
|
3555
|
+
}
|
|
3556
|
+
}).timeout(attemptTimeout);
|
|
3557
|
+
});
|
|
3558
|
+
|
|
3559
|
+
describe('#deleteIntent - errors', () => {
|
|
3560
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3561
|
+
try {
|
|
3562
|
+
a.deleteIntent(intentIntent, (data, error) => {
|
|
3563
|
+
try {
|
|
3564
|
+
if (stub) {
|
|
3565
|
+
const displayE = 'Error 400 received on request';
|
|
3566
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
3567
|
+
} else {
|
|
3568
|
+
runCommonAsserts(data, error);
|
|
3569
|
+
}
|
|
3570
|
+
saveMockData('Intent', 'deleteIntent', 'default', data);
|
|
3571
|
+
done();
|
|
3572
|
+
} catch (err) {
|
|
3573
|
+
log.error(`Test Failure: ${err}`);
|
|
3574
|
+
done(err);
|
|
3575
|
+
}
|
|
3576
|
+
});
|
|
3577
|
+
} catch (error) {
|
|
3578
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3579
|
+
done(error);
|
|
3580
|
+
}
|
|
3581
|
+
}).timeout(attemptTimeout);
|
|
3582
|
+
});
|
|
3583
|
+
|
|
3584
|
+
describe('#devAdminDeleteAutodiscoverNe - errors', () => {
|
|
3585
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3586
|
+
try {
|
|
3587
|
+
a.devAdminDeleteAutodiscoverNe(manageZTPListFromDeviceAdministratorAutodiscoveryNe, (data, error) => {
|
|
3588
|
+
try {
|
|
3589
|
+
if (stub) {
|
|
3590
|
+
const displayE = 'Error 400 received on request';
|
|
3591
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
3592
|
+
} else {
|
|
3593
|
+
runCommonAsserts(data, error);
|
|
3594
|
+
}
|
|
3595
|
+
saveMockData('ManageZTPListFromDeviceAdministrator', 'devAdminDeleteAutodiscoverNe', 'default', data);
|
|
3596
|
+
done();
|
|
3597
|
+
} catch (err) {
|
|
3598
|
+
log.error(`Test Failure: ${err}`);
|
|
3599
|
+
done(err);
|
|
3600
|
+
}
|
|
3601
|
+
});
|
|
3602
|
+
} catch (error) {
|
|
3603
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3604
|
+
done(error);
|
|
3605
|
+
}
|
|
3606
|
+
}).timeout(attemptTimeout);
|
|
3607
|
+
});
|
|
3608
|
+
|
|
3609
|
+
describe('#deleteAllPoliciesOnARouter - errors', () => {
|
|
3610
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3611
|
+
try {
|
|
3612
|
+
a.deleteAllPoliciesOnARouter(routerNECorrelationMappingServiceRouterNeMapping, (data, error) => {
|
|
3613
|
+
try {
|
|
3614
|
+
if (stub) {
|
|
3615
|
+
const displayE = 'Error 400 received on request';
|
|
3616
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
3617
|
+
} else {
|
|
3618
|
+
runCommonAsserts(data, error);
|
|
3619
|
+
}
|
|
3620
|
+
saveMockData('RouterNECorrelationMappingService', 'deleteAllPoliciesOnARouter', 'default', data);
|
|
3621
|
+
done();
|
|
3622
|
+
} catch (err) {
|
|
3623
|
+
log.error(`Test Failure: ${err}`);
|
|
3624
|
+
done(err);
|
|
3625
|
+
}
|
|
3626
|
+
});
|
|
3627
|
+
} catch (error) {
|
|
3628
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3629
|
+
done(error);
|
|
3630
|
+
}
|
|
3631
|
+
}).timeout(attemptTimeout);
|
|
3632
|
+
});
|
|
3633
|
+
|
|
3634
|
+
const routerNECorrelationMappingServiceRouterInfos = 'fakedata';
|
|
3635
|
+
describe('#deleteOnePolicyOfRouter - errors', () => {
|
|
3636
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3637
|
+
try {
|
|
3638
|
+
a.deleteOnePolicyOfRouter(routerNECorrelationMappingServiceRouterNeMapping, routerNECorrelationMappingServiceRouterInfos, (data, error) => {
|
|
3639
|
+
try {
|
|
3640
|
+
if (stub) {
|
|
3641
|
+
const displayE = 'Error 400 received on request';
|
|
3642
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
3643
|
+
} else {
|
|
3644
|
+
runCommonAsserts(data, error);
|
|
3645
|
+
}
|
|
3646
|
+
saveMockData('RouterNECorrelationMappingService', 'deleteOnePolicyOfRouter', 'default', data);
|
|
3647
|
+
done();
|
|
3648
|
+
} catch (err) {
|
|
3649
|
+
log.error(`Test Failure: ${err}`);
|
|
3650
|
+
done(err);
|
|
3651
|
+
}
|
|
3652
|
+
});
|
|
3653
|
+
} catch (error) {
|
|
3654
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3655
|
+
done(error);
|
|
3656
|
+
}
|
|
3657
|
+
}).timeout(attemptTimeout);
|
|
3658
|
+
});
|
|
3659
|
+
|
|
3660
|
+
describe('#deleteIndicatorTemplate - errors', () => {
|
|
3661
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3662
|
+
try {
|
|
3663
|
+
a.deleteIndicatorTemplate(indicatorTemplatesTemplate, (data, error) => {
|
|
3664
|
+
try {
|
|
3665
|
+
if (stub) {
|
|
3666
|
+
const displayE = 'Error 400 received on request';
|
|
3667
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
3668
|
+
} else {
|
|
3669
|
+
runCommonAsserts(data, error);
|
|
3670
|
+
}
|
|
3671
|
+
saveMockData('IndicatorTemplates', 'deleteIndicatorTemplate', 'default', data);
|
|
3672
|
+
done();
|
|
3673
|
+
} catch (err) {
|
|
3674
|
+
log.error(`Test Failure: ${err}`);
|
|
3675
|
+
done(err);
|
|
3676
|
+
}
|
|
3677
|
+
});
|
|
3678
|
+
} catch (error) {
|
|
3679
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3680
|
+
done(error);
|
|
3681
|
+
}
|
|
3682
|
+
}).timeout(attemptTimeout);
|
|
3683
|
+
});
|
|
3684
|
+
|
|
3685
|
+
describe('#deleteIndicatorRule - errors', () => {
|
|
3686
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3687
|
+
try {
|
|
3688
|
+
a.deleteIndicatorRule(indicatorRulesRule, (data, error) => {
|
|
3689
|
+
try {
|
|
3690
|
+
if (stub) {
|
|
3691
|
+
const displayE = 'Error 400 received on request';
|
|
3692
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
3693
|
+
} else {
|
|
3694
|
+
runCommonAsserts(data, error);
|
|
3695
|
+
}
|
|
3696
|
+
saveMockData('IndicatorRules', 'deleteIndicatorRule', 'default', data);
|
|
3697
|
+
done();
|
|
3698
|
+
} catch (err) {
|
|
3699
|
+
log.error(`Test Failure: ${err}`);
|
|
3700
|
+
done(err);
|
|
3701
|
+
}
|
|
3702
|
+
});
|
|
3703
|
+
} catch (error) {
|
|
3704
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3705
|
+
done(error);
|
|
3706
|
+
}
|
|
3707
|
+
}).timeout(attemptTimeout);
|
|
3708
|
+
});
|
|
3709
|
+
|
|
3710
|
+
const baselineOperationsRestconfAPISubscription = 'fakedata';
|
|
3711
|
+
describe('#deleteSubscription - errors', () => {
|
|
3712
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3713
|
+
try {
|
|
3714
|
+
a.deleteSubscription(baselineOperationsRestconfAPISubscription, (data, error) => {
|
|
3715
|
+
try {
|
|
3716
|
+
if (stub) {
|
|
3717
|
+
const displayE = 'Error 400 received on request';
|
|
3718
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
3719
|
+
} else {
|
|
3720
|
+
runCommonAsserts(data, error);
|
|
3721
|
+
}
|
|
3722
|
+
saveMockData('BaselineOperationsRestconfAPI', 'deleteSubscription', 'default', data);
|
|
3723
|
+
done();
|
|
3724
|
+
} catch (err) {
|
|
3725
|
+
log.error(`Test Failure: ${err}`);
|
|
3726
|
+
done(err);
|
|
3727
|
+
}
|
|
3728
|
+
});
|
|
3729
|
+
} catch (error) {
|
|
3730
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3731
|
+
done(error);
|
|
3732
|
+
}
|
|
3733
|
+
}).timeout(attemptTimeout);
|
|
3734
|
+
});
|
|
3735
|
+
|
|
3736
|
+
describe('#deleteBaseline - errors', () => {
|
|
3737
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3738
|
+
try {
|
|
3739
|
+
a.deleteBaseline(baselineOperationsRestconfAPIBaseline, (data, error) => {
|
|
3740
|
+
try {
|
|
3741
|
+
if (stub) {
|
|
3742
|
+
const displayE = 'Error 400 received on request';
|
|
3743
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
3744
|
+
} else {
|
|
3745
|
+
runCommonAsserts(data, error);
|
|
3746
|
+
}
|
|
3747
|
+
saveMockData('BaselineOperationsRestconfAPI', 'deleteBaseline', 'default', data);
|
|
3748
|
+
done();
|
|
3749
|
+
} catch (err) {
|
|
3750
|
+
log.error(`Test Failure: ${err}`);
|
|
3751
|
+
done(err);
|
|
3752
|
+
}
|
|
3753
|
+
});
|
|
3754
|
+
} catch (error) {
|
|
3755
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3756
|
+
done(error);
|
|
3757
|
+
}
|
|
3758
|
+
}).timeout(attemptTimeout);
|
|
3759
|
+
});
|
|
3760
|
+
|
|
3761
|
+
describe('#deleteBaselineDetector - errors', () => {
|
|
3762
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3763
|
+
try {
|
|
3764
|
+
a.deleteBaselineDetector(baselineOperationsRestconfAPIBaseline, baselineOperationsRestconfAPIBaselineDetector, (data, error) => {
|
|
3765
|
+
try {
|
|
3766
|
+
if (stub) {
|
|
3767
|
+
const displayE = 'Error 400 received on request';
|
|
3768
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
3769
|
+
} else {
|
|
3770
|
+
runCommonAsserts(data, error);
|
|
3771
|
+
}
|
|
3772
|
+
saveMockData('BaselineOperationsRestconfAPI', 'deleteBaselineDetector', 'default', data);
|
|
3773
|
+
done();
|
|
3774
|
+
} catch (err) {
|
|
3775
|
+
log.error(`Test Failure: ${err}`);
|
|
3776
|
+
done(err);
|
|
3777
|
+
}
|
|
3778
|
+
});
|
|
3779
|
+
} catch (error) {
|
|
3780
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3781
|
+
done(error);
|
|
3782
|
+
}
|
|
3783
|
+
}).timeout(attemptTimeout);
|
|
3784
|
+
});
|
|
3785
|
+
|
|
3786
|
+
describe('#deleteTemplate - errors', () => {
|
|
3787
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3788
|
+
try {
|
|
3789
|
+
a.deleteTemplate(configurationTemplatesTemplate, (data, error) => {
|
|
3790
|
+
try {
|
|
3791
|
+
if (stub) {
|
|
3792
|
+
const displayE = 'Error 400 received on request';
|
|
3793
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
3794
|
+
} else {
|
|
3795
|
+
runCommonAsserts(data, error);
|
|
3796
|
+
}
|
|
3797
|
+
saveMockData('ConfigurationTemplates', 'deleteTemplate', 'default', data);
|
|
3798
|
+
done();
|
|
3799
|
+
} catch (err) {
|
|
3800
|
+
log.error(`Test Failure: ${err}`);
|
|
3801
|
+
done(err);
|
|
3802
|
+
}
|
|
3803
|
+
});
|
|
3804
|
+
} catch (error) {
|
|
3805
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3806
|
+
done(error);
|
|
3807
|
+
}
|
|
3808
|
+
}).timeout(attemptTimeout);
|
|
3809
|
+
});
|
|
3810
|
+
|
|
3811
|
+
describe('#deleteSingleDeployment - errors', () => {
|
|
3812
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3813
|
+
try {
|
|
3814
|
+
a.deleteSingleDeployment(configurationDeploymentsDeployment, (data, error) => {
|
|
3815
|
+
try {
|
|
3816
|
+
if (stub) {
|
|
3817
|
+
const displayE = 'Error 400 received on request';
|
|
3818
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_network_management-connectorRest-handleEndResponse', displayE);
|
|
3819
|
+
} else {
|
|
3820
|
+
runCommonAsserts(data, error);
|
|
3821
|
+
}
|
|
3822
|
+
saveMockData('ConfigurationDeployments', 'deleteSingleDeployment', 'default', data);
|
|
3823
|
+
done();
|
|
3824
|
+
} catch (err) {
|
|
3825
|
+
log.error(`Test Failure: ${err}`);
|
|
3826
|
+
done(err);
|
|
3827
|
+
}
|
|
3828
|
+
});
|
|
3829
|
+
} catch (error) {
|
|
3830
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3831
|
+
done(error);
|
|
3832
|
+
}
|
|
3833
|
+
}).timeout(attemptTimeout);
|
|
3834
|
+
});
|
|
3835
|
+
});
|
|
3836
|
+
});
|