@itentialopensource/adapter-nokia_altiplano 0.2.0 → 0.3.0
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/CHANGELOG.md +8 -0
- package/SYSTEMINFO.md +12 -0
- package/adapter.js +83 -0
- package/package.json +1 -1
- package/pronghorn.json +188 -0
- package/refs?service=git-upload-pack +0 -0
- package/test/integration/adapterTestIntegration.js +26 -0
- package/test/unit/adapterTestUnit.js +29 -0
package/CHANGELOG.md
CHANGED
package/SYSTEMINFO.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Nokia Altiplano Access Controller
|
|
2
|
+
|
|
3
|
+
Vendor: Nokia
|
|
4
|
+
Homepage: https://www.nokia.com/
|
|
5
|
+
|
|
6
|
+
Product: Altiplano Access Controller
|
|
7
|
+
Product Page: https://www.nokia.com/networks/products/altiplano-access-controller/
|
|
8
|
+
|
|
9
|
+
## Introduction
|
|
10
|
+
|
|
11
|
+
## Additional Product Documentation
|
|
12
|
+
|
package/adapter.js
CHANGED
|
@@ -1423,6 +1423,89 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
1425
|
|
|
1426
|
+
/**
|
|
1427
|
+
* @function createOntWithQuery
|
|
1428
|
+
* @pronghornType method
|
|
1429
|
+
* @name createOntWithQuery
|
|
1430
|
+
* @summary Create ont with query params
|
|
1431
|
+
*
|
|
1432
|
+
* @param {object} body - body param
|
|
1433
|
+
* @param {object} query - query param
|
|
1434
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1435
|
+
* @return {object} results - An object containing the response of the action
|
|
1436
|
+
*
|
|
1437
|
+
* @route {POST} /createOntWithQuery
|
|
1438
|
+
* @roles admin
|
|
1439
|
+
* @task true
|
|
1440
|
+
*/
|
|
1441
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1442
|
+
createOntWithQuery(body, query, callback) {
|
|
1443
|
+
const meth = 'adapter-createOntWithQuery';
|
|
1444
|
+
const origin = `${this.id}-${meth}`;
|
|
1445
|
+
log.trace(origin);
|
|
1446
|
+
|
|
1447
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1448
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1449
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1450
|
+
return callback(null, errorObj);
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1454
|
+
if (body === undefined || body === null || body === '') {
|
|
1455
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
1456
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1457
|
+
return callback(null, errorObj);
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1461
|
+
const queryParamsAvailable = query;
|
|
1462
|
+
const queryParams = {};
|
|
1463
|
+
const pathVars = [];
|
|
1464
|
+
const bodyVars = body;
|
|
1465
|
+
|
|
1466
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1467
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1468
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1469
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1470
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
|
|
1474
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1475
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1476
|
+
const reqObj = {
|
|
1477
|
+
payload: bodyVars,
|
|
1478
|
+
uriPathVars: pathVars,
|
|
1479
|
+
uriQuery: queryParams
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1482
|
+
try {
|
|
1483
|
+
// Make the call -
|
|
1484
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1485
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'createOnt', reqObj, true, (irReturnData, irReturnError) => {
|
|
1486
|
+
// if we received an error or their is no response on the results
|
|
1487
|
+
// return an error
|
|
1488
|
+
if (irReturnError) {
|
|
1489
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1490
|
+
return callback(null, irReturnError);
|
|
1491
|
+
}
|
|
1492
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1493
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createOntWithQuery'], null, null, null);
|
|
1494
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1495
|
+
return callback(null, errorObj);
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1499
|
+
// return the response
|
|
1500
|
+
return callback(irReturnData, null);
|
|
1501
|
+
});
|
|
1502
|
+
} catch (ex) {
|
|
1503
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1504
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1505
|
+
return callback(null, errorObj);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1426
1509
|
/**
|
|
1427
1510
|
* @function getOnt
|
|
1428
1511
|
* @pronghornType method
|
package/package.json
CHANGED
package/pronghorn.json
CHANGED
|
@@ -987,6 +987,194 @@
|
|
|
987
987
|
},
|
|
988
988
|
"task": true
|
|
989
989
|
},
|
|
990
|
+
{
|
|
991
|
+
"name": "createOntWithQuery",
|
|
992
|
+
"summary": "Create ont with query",
|
|
993
|
+
"description": "Create ont with query",
|
|
994
|
+
"input": [
|
|
995
|
+
{
|
|
996
|
+
"name": "body",
|
|
997
|
+
"type": "object",
|
|
998
|
+
"info": ": {\"ibn:intent\": {\"target\": \"string\", \"intent-type\": \"string\", \"intent-type-version\": \"string\", \"required-network-state\": \"string\", \"intent-specific-data\": {\"ont:ont\": {\"ont-type\": \"string\", \"fiber-name\": \"string\", \"expected-serial-number\": \"string\", \"onu-service-profile\": \"string\", \"uni-service-configuration\": {\"uni-id\": \"string\", \"service-profile\": \"string\"}}}}}",
|
|
999
|
+
"required": true,
|
|
1000
|
+
"schema": {
|
|
1001
|
+
"title": "CreateontRequest",
|
|
1002
|
+
"required": [
|
|
1003
|
+
"ibn:intent"
|
|
1004
|
+
],
|
|
1005
|
+
"type": "object",
|
|
1006
|
+
"properties": {
|
|
1007
|
+
"ibn:intent": {
|
|
1008
|
+
"title": "IbnIntent",
|
|
1009
|
+
"required": [
|
|
1010
|
+
"target",
|
|
1011
|
+
"intent-type",
|
|
1012
|
+
"intent-type-version",
|
|
1013
|
+
"required-network-state",
|
|
1014
|
+
"intent-specific-data"
|
|
1015
|
+
],
|
|
1016
|
+
"type": "object",
|
|
1017
|
+
"properties": {
|
|
1018
|
+
"target": {
|
|
1019
|
+
"type": "string"
|
|
1020
|
+
},
|
|
1021
|
+
"intent-type": {
|
|
1022
|
+
"type": "string"
|
|
1023
|
+
},
|
|
1024
|
+
"intent-type-version": {
|
|
1025
|
+
"type": "string"
|
|
1026
|
+
},
|
|
1027
|
+
"required-network-state": {
|
|
1028
|
+
"type": "string"
|
|
1029
|
+
},
|
|
1030
|
+
"intent-specific-data": {
|
|
1031
|
+
"title": "IntentSpecificData",
|
|
1032
|
+
"required": [
|
|
1033
|
+
"ont:ont"
|
|
1034
|
+
],
|
|
1035
|
+
"type": "object",
|
|
1036
|
+
"properties": {
|
|
1037
|
+
"ont:ont": {
|
|
1038
|
+
"title": "OntOnt",
|
|
1039
|
+
"required": [
|
|
1040
|
+
"ont-type",
|
|
1041
|
+
"fiber-name",
|
|
1042
|
+
"expected-serial-number",
|
|
1043
|
+
"onu-service-profile",
|
|
1044
|
+
"uni-service-configuration"
|
|
1045
|
+
],
|
|
1046
|
+
"type": "object",
|
|
1047
|
+
"properties": {
|
|
1048
|
+
"ont-type": {
|
|
1049
|
+
"type": "string"
|
|
1050
|
+
},
|
|
1051
|
+
"fiber-name": {
|
|
1052
|
+
"type": "string"
|
|
1053
|
+
},
|
|
1054
|
+
"expected-serial-number": {
|
|
1055
|
+
"type": "string"
|
|
1056
|
+
},
|
|
1057
|
+
"onu-service-profile": {
|
|
1058
|
+
"type": "string"
|
|
1059
|
+
},
|
|
1060
|
+
"uni-service-configuration": {
|
|
1061
|
+
"title": "UniServiceConfiguration",
|
|
1062
|
+
"required": [
|
|
1063
|
+
"uni-id",
|
|
1064
|
+
"service-profile"
|
|
1065
|
+
],
|
|
1066
|
+
"type": "object",
|
|
1067
|
+
"properties": {
|
|
1068
|
+
"uni-id": {
|
|
1069
|
+
"type": "string"
|
|
1070
|
+
},
|
|
1071
|
+
"service-profile": {
|
|
1072
|
+
"type": "string"
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
"example": {
|
|
1076
|
+
"uni-id": "LAN1",
|
|
1077
|
+
"service-profile": "default"
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
},
|
|
1081
|
+
"example": {
|
|
1082
|
+
"ont-type": "G-010G-Q",
|
|
1083
|
+
"fiber-name": "INES-1-1-4-3",
|
|
1084
|
+
"expected-serial-number": "ALCLF846403A",
|
|
1085
|
+
"onu-service-profile": "default",
|
|
1086
|
+
"uni-service-configuration": {
|
|
1087
|
+
"uni-id": "LAN1",
|
|
1088
|
+
"service-profile": "default"
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
},
|
|
1093
|
+
"example": {
|
|
1094
|
+
"ont:ont": {
|
|
1095
|
+
"ont-type": "G-010G-Q",
|
|
1096
|
+
"fiber-name": "INES-1-1-4-3",
|
|
1097
|
+
"expected-serial-number": "ALCLF846403A",
|
|
1098
|
+
"onu-service-profile": "default",
|
|
1099
|
+
"uni-service-configuration": {
|
|
1100
|
+
"uni-id": "LAN1",
|
|
1101
|
+
"service-profile": "default"
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
},
|
|
1107
|
+
"example": {
|
|
1108
|
+
"target": "INES-1-1-4-3-a",
|
|
1109
|
+
"intent-type": "ont",
|
|
1110
|
+
"intent-type-version": "4",
|
|
1111
|
+
"required-network-state": "active",
|
|
1112
|
+
"intent-specific-data": {
|
|
1113
|
+
"ont:ont": {
|
|
1114
|
+
"ont-type": "G-010G-Q",
|
|
1115
|
+
"fiber-name": "INES-1-1-4-3",
|
|
1116
|
+
"expected-serial-number": "ALCLF846403A",
|
|
1117
|
+
"onu-service-profile": "default",
|
|
1118
|
+
"uni-service-configuration": {
|
|
1119
|
+
"uni-id": "LAN1",
|
|
1120
|
+
"service-profile": "default"
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
},
|
|
1127
|
+
"example": {
|
|
1128
|
+
"ibn:intent": {
|
|
1129
|
+
"target": "INES-1-1-4-3-a",
|
|
1130
|
+
"intent-type": "ont",
|
|
1131
|
+
"intent-type-version": "4",
|
|
1132
|
+
"required-network-state": "active",
|
|
1133
|
+
"intent-specific-data": {
|
|
1134
|
+
"ont:ont": {
|
|
1135
|
+
"ont-type": "G-010G-Q",
|
|
1136
|
+
"fiber-name": "INES-1-1-4-3",
|
|
1137
|
+
"expected-serial-number": "ALCLF846403A",
|
|
1138
|
+
"onu-service-profile": "default",
|
|
1139
|
+
"uni-service-configuration": {
|
|
1140
|
+
"uni-id": "LAN1",
|
|
1141
|
+
"service-profile": "default"
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
"name": "query",
|
|
1151
|
+
"type": "object",
|
|
1152
|
+
"info": "{\"altiplano-triggerSyncUponSuccess\": \"true\"}",
|
|
1153
|
+
"required": true,
|
|
1154
|
+
"schema": {
|
|
1155
|
+
"title": "query",
|
|
1156
|
+
"type": "object"
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
],
|
|
1160
|
+
"output": {
|
|
1161
|
+
"name": "result",
|
|
1162
|
+
"type": "object",
|
|
1163
|
+
"description": "A JSON Object containing status, code and the result",
|
|
1164
|
+
"schema": {
|
|
1165
|
+
"title": "result",
|
|
1166
|
+
"type": "object"
|
|
1167
|
+
}
|
|
1168
|
+
},
|
|
1169
|
+
"roles": [
|
|
1170
|
+
"admin"
|
|
1171
|
+
],
|
|
1172
|
+
"route": {
|
|
1173
|
+
"verb": "POST",
|
|
1174
|
+
"path": "/createOntWithQuery"
|
|
1175
|
+
},
|
|
1176
|
+
"task": true
|
|
1177
|
+
},
|
|
990
1178
|
{
|
|
991
1179
|
"name": "getOnt",
|
|
992
1180
|
"summary": "GET ont",
|
|
Binary file
|
|
@@ -471,6 +471,7 @@ describe('[integration] Nokia_altiplano Adapter Test', () => {
|
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
};
|
|
474
|
+
|
|
474
475
|
describe('#createOnt - errors', () => {
|
|
475
476
|
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
476
477
|
try {
|
|
@@ -496,6 +497,31 @@ describe('[integration] Nokia_altiplano Adapter Test', () => {
|
|
|
496
497
|
}).timeout(attemptTimeout);
|
|
497
498
|
});
|
|
498
499
|
|
|
500
|
+
describe('#createOntWithQuery - errors', () => {
|
|
501
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
502
|
+
try {
|
|
503
|
+
a.createOntWithQuery(intentCreateOntBodyParam, {}, (data, error) => {
|
|
504
|
+
try {
|
|
505
|
+
if (stub) {
|
|
506
|
+
const displayE = 'Error 400 received on request';
|
|
507
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
|
|
508
|
+
} else {
|
|
509
|
+
runCommonAsserts(data, error);
|
|
510
|
+
}
|
|
511
|
+
saveMockData('Intent', 'createOnt', 'default', data);
|
|
512
|
+
done();
|
|
513
|
+
} catch (err) {
|
|
514
|
+
log.error(`Test Failure: ${err}`);
|
|
515
|
+
done(err);
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
} catch (error) {
|
|
519
|
+
log.error(`Adapter Exception: ${error}`);
|
|
520
|
+
done(error);
|
|
521
|
+
}
|
|
522
|
+
}).timeout(attemptTimeout);
|
|
523
|
+
});
|
|
524
|
+
|
|
499
525
|
const intentIntent = 'fakedata';
|
|
500
526
|
describe('#dependentsSummaryFiber - errors', () => {
|
|
501
527
|
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
@@ -1494,6 +1494,35 @@ describe('[unit] Nokia_altiplano Adapter Test', () => {
|
|
|
1494
1494
|
}).timeout(attemptTimeout);
|
|
1495
1495
|
});
|
|
1496
1496
|
|
|
1497
|
+
describe('#createOntWithQuery - errors', () => {
|
|
1498
|
+
it('should have a createOntWithQuery function', (done) => {
|
|
1499
|
+
try {
|
|
1500
|
+
assert.equal(true, typeof a.createOntWithQuery === 'function');
|
|
1501
|
+
done();
|
|
1502
|
+
} catch (error) {
|
|
1503
|
+
log.error(`Test Failure: ${error}`);
|
|
1504
|
+
done(error);
|
|
1505
|
+
}
|
|
1506
|
+
}).timeout(attemptTimeout);
|
|
1507
|
+
it('should error if - missing body', (done) => {
|
|
1508
|
+
try {
|
|
1509
|
+
a.createOntWithQuery(null, null, (data, error) => {
|
|
1510
|
+
try {
|
|
1511
|
+
const displayE = 'body is required';
|
|
1512
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-nokia_altiplano-adapter-createOntWithQuery', displayE);
|
|
1513
|
+
done();
|
|
1514
|
+
} catch (err) {
|
|
1515
|
+
log.error(`Test Failure: ${err}`);
|
|
1516
|
+
done(err);
|
|
1517
|
+
}
|
|
1518
|
+
});
|
|
1519
|
+
} catch (error) {
|
|
1520
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1521
|
+
done(error);
|
|
1522
|
+
}
|
|
1523
|
+
}).timeout(attemptTimeout);
|
|
1524
|
+
});
|
|
1525
|
+
|
|
1497
1526
|
describe('#getOnt - errors', () => {
|
|
1498
1527
|
it('should have a getOnt function', (done) => {
|
|
1499
1528
|
try {
|