@itentialopensource/adapter-f5_bigiq 0.3.4 → 0.3.5
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/adapter.js +240 -0
- package/entities/DeviceUpgrades/action.json +62 -0
- package/entities/DeviceUpgrades/mockdatafiles/getAllUpgradeInstances-default.json +58 -0
- package/entities/DeviceUpgrades/mockdatafiles/getUpgradeInstancesById-default.json +15 -0
- package/entities/DeviceUpgrades/mockdatafiles/updateDeviceUpgrade-default.json +15 -0
- package/entities/DeviceUpgrades/schema.json +4 -1
- package/package.json +2 -2
- package/pronghorn.json +91 -0
- package/refs?service=git-upload-pack +0 -0
- package/test/integration/adapterTestIntegration.js +102 -0
- package/test/unit/adapterTestUnit.js +70 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
## 0.3.5 [09-28-2023]
|
|
3
|
+
|
|
4
|
+
* Adds device upgrade methods for updating and retrieving device upgrades.
|
|
5
|
+
|
|
6
|
+
See merge request itentialopensource/adapters/controller-orchestrator/adapter-f5_bigiq!8
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
2
10
|
## 0.3.4 [09-26-2023]
|
|
3
11
|
|
|
4
12
|
* Add device upgrade calls
|
package/adapter.js
CHANGED
|
@@ -28914,6 +28914,246 @@ class F5BigIQ extends AdapterBaseCl {
|
|
|
28914
28914
|
return callback(null, errorObj);
|
|
28915
28915
|
}
|
|
28916
28916
|
}
|
|
28917
|
+
|
|
28918
|
+
/**
|
|
28919
|
+
* @function updateDeviceUpgrade
|
|
28920
|
+
* @pronghornType method
|
|
28921
|
+
* @name updateDeviceUpgrade
|
|
28922
|
+
* @summary Update Device Upgrade
|
|
28923
|
+
*
|
|
28924
|
+
* @param {object} body - body param
|
|
28925
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
28926
|
+
* @return {object} results - An object containing the response of the action
|
|
28927
|
+
*
|
|
28928
|
+
* @route {POST} /updateDeviceUpgrade
|
|
28929
|
+
* @roles admin
|
|
28930
|
+
* @task true
|
|
28931
|
+
*/
|
|
28932
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
28933
|
+
updateDeviceUpgrade(body, callback) {
|
|
28934
|
+
const meth = 'adapter-updateDeviceUpgrade';
|
|
28935
|
+
const origin = `${this.id}-${meth}`;
|
|
28936
|
+
log.trace(origin);
|
|
28937
|
+
|
|
28938
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
28939
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
28940
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28941
|
+
return callback(null, errorObj);
|
|
28942
|
+
}
|
|
28943
|
+
|
|
28944
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
28945
|
+
if (body === undefined || body === null || body === '') {
|
|
28946
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
28947
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28948
|
+
return callback(null, errorObj);
|
|
28949
|
+
}
|
|
28950
|
+
|
|
28951
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
28952
|
+
const queryParamsAvailable = {};
|
|
28953
|
+
const queryParams = {};
|
|
28954
|
+
const pathVars = [];
|
|
28955
|
+
const bodyVars = body;
|
|
28956
|
+
|
|
28957
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
28958
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
28959
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
28960
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
28961
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
28962
|
+
}
|
|
28963
|
+
});
|
|
28964
|
+
|
|
28965
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
28966
|
+
// see adapter code documentation for more information on the request object's fields
|
|
28967
|
+
const reqObj = {
|
|
28968
|
+
payload: bodyVars,
|
|
28969
|
+
uriPathVars: pathVars,
|
|
28970
|
+
uriQuery: queryParams
|
|
28971
|
+
};
|
|
28972
|
+
|
|
28973
|
+
try {
|
|
28974
|
+
// Make the call -
|
|
28975
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
28976
|
+
return this.requestHandlerInst.identifyRequest('DeviceUpgrades', 'updateDeviceUpgrade', reqObj, true, (irReturnData, irReturnError) => {
|
|
28977
|
+
// if we received an error or their is no response on the results
|
|
28978
|
+
// return an error
|
|
28979
|
+
if (irReturnError) {
|
|
28980
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
28981
|
+
return callback(null, irReturnError);
|
|
28982
|
+
}
|
|
28983
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
28984
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updateDeviceUpgrade'], null, null, null);
|
|
28985
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28986
|
+
return callback(null, errorObj);
|
|
28987
|
+
}
|
|
28988
|
+
|
|
28989
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
28990
|
+
// return the response
|
|
28991
|
+
return callback(irReturnData, null);
|
|
28992
|
+
});
|
|
28993
|
+
} catch (ex) {
|
|
28994
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
28995
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28996
|
+
return callback(null, errorObj);
|
|
28997
|
+
}
|
|
28998
|
+
}
|
|
28999
|
+
|
|
29000
|
+
/**
|
|
29001
|
+
* @function getAllUpgradeInstances
|
|
29002
|
+
* @pronghornType method
|
|
29003
|
+
* @name getAllUpgradeInstances
|
|
29004
|
+
* @summary Get All Upgrade Instances
|
|
29005
|
+
*
|
|
29006
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
29007
|
+
* @return {object} results - An object containing the response of the action
|
|
29008
|
+
*
|
|
29009
|
+
* @route {GET} /getAllUpgradeInstances
|
|
29010
|
+
* @roles admin
|
|
29011
|
+
* @task true
|
|
29012
|
+
*/
|
|
29013
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
29014
|
+
getAllUpgradeInstances(callback) {
|
|
29015
|
+
const meth = 'adapter-getAllUpgradeInstances';
|
|
29016
|
+
const origin = `${this.id}-${meth}`;
|
|
29017
|
+
log.trace(origin);
|
|
29018
|
+
|
|
29019
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
29020
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
29021
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
29022
|
+
return callback(null, errorObj);
|
|
29023
|
+
}
|
|
29024
|
+
|
|
29025
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
29026
|
+
|
|
29027
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
29028
|
+
const queryParamsAvailable = {};
|
|
29029
|
+
const queryParams = {};
|
|
29030
|
+
const pathVars = [];
|
|
29031
|
+
const bodyVars = {};
|
|
29032
|
+
|
|
29033
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
29034
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
29035
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
29036
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
29037
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
29038
|
+
}
|
|
29039
|
+
});
|
|
29040
|
+
|
|
29041
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
29042
|
+
// see adapter code documentation for more information on the request object's fields
|
|
29043
|
+
const reqObj = {
|
|
29044
|
+
payload: bodyVars,
|
|
29045
|
+
uriPathVars: pathVars,
|
|
29046
|
+
uriQuery: queryParams
|
|
29047
|
+
};
|
|
29048
|
+
|
|
29049
|
+
try {
|
|
29050
|
+
// Make the call -
|
|
29051
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
29052
|
+
return this.requestHandlerInst.identifyRequest('DeviceUpgrades', 'getAllUpgradeInstances', reqObj, true, (irReturnData, irReturnError) => {
|
|
29053
|
+
// if we received an error or their is no response on the results
|
|
29054
|
+
// return an error
|
|
29055
|
+
if (irReturnError) {
|
|
29056
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
29057
|
+
return callback(null, irReturnError);
|
|
29058
|
+
}
|
|
29059
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
29060
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAllUpgradeInstances'], null, null, null);
|
|
29061
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
29062
|
+
return callback(null, errorObj);
|
|
29063
|
+
}
|
|
29064
|
+
|
|
29065
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
29066
|
+
// return the response
|
|
29067
|
+
return callback(irReturnData, null);
|
|
29068
|
+
});
|
|
29069
|
+
} catch (ex) {
|
|
29070
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
29071
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
29072
|
+
return callback(null, errorObj);
|
|
29073
|
+
}
|
|
29074
|
+
}
|
|
29075
|
+
|
|
29076
|
+
/**
|
|
29077
|
+
* @function getUpgradeInstancesById
|
|
29078
|
+
* @pronghornType method
|
|
29079
|
+
* @name getUpgradeInstancesById
|
|
29080
|
+
* @summary Get Upgrade Instance By Id
|
|
29081
|
+
*
|
|
29082
|
+
* @param {string} upgradeTaskId - upgradeTaskId param
|
|
29083
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
29084
|
+
* @return {object} results - An object containing the response of the action
|
|
29085
|
+
*
|
|
29086
|
+
* @route {POST} /getUpgradeInstancesById
|
|
29087
|
+
* @roles admin
|
|
29088
|
+
* @task true
|
|
29089
|
+
*/
|
|
29090
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
29091
|
+
getUpgradeInstancesById(upgradeTaskId, callback) {
|
|
29092
|
+
const meth = 'adapter-getUpgradeInstancesById';
|
|
29093
|
+
const origin = `${this.id}-${meth}`;
|
|
29094
|
+
log.trace(origin);
|
|
29095
|
+
|
|
29096
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
29097
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
29098
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
29099
|
+
return callback(null, errorObj);
|
|
29100
|
+
}
|
|
29101
|
+
|
|
29102
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
29103
|
+
if (upgradeTaskId === undefined || upgradeTaskId === null || upgradeTaskId === '') {
|
|
29104
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['upgradeTaskId'], null, null, null);
|
|
29105
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
29106
|
+
return callback(null, errorObj);
|
|
29107
|
+
}
|
|
29108
|
+
|
|
29109
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
29110
|
+
const queryParamsAvailable = {};
|
|
29111
|
+
const queryParams = {};
|
|
29112
|
+
const pathVars = [upgradeTaskId];
|
|
29113
|
+
const bodyVars = {};
|
|
29114
|
+
|
|
29115
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
29116
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
29117
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
29118
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
29119
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
29120
|
+
}
|
|
29121
|
+
});
|
|
29122
|
+
|
|
29123
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
29124
|
+
// see adapter code documentation for more information on the request object's fields
|
|
29125
|
+
const reqObj = {
|
|
29126
|
+
payload: bodyVars,
|
|
29127
|
+
uriPathVars: pathVars,
|
|
29128
|
+
uriQuery: queryParams
|
|
29129
|
+
};
|
|
29130
|
+
|
|
29131
|
+
try {
|
|
29132
|
+
// Make the call -
|
|
29133
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
29134
|
+
return this.requestHandlerInst.identifyRequest('DeviceUpgrades', 'getUpgradeInstancesById', reqObj, true, (irReturnData, irReturnError) => {
|
|
29135
|
+
// if we received an error or their is no response on the results
|
|
29136
|
+
// return an error
|
|
29137
|
+
if (irReturnError) {
|
|
29138
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
29139
|
+
return callback(null, irReturnError);
|
|
29140
|
+
}
|
|
29141
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
29142
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getUpgradeInstancesById'], null, null, null);
|
|
29143
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
29144
|
+
return callback(null, errorObj);
|
|
29145
|
+
}
|
|
29146
|
+
|
|
29147
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
29148
|
+
// return the response
|
|
29149
|
+
return callback(irReturnData, null);
|
|
29150
|
+
});
|
|
29151
|
+
} catch (ex) {
|
|
29152
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
29153
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
29154
|
+
return callback(null, errorObj);
|
|
29155
|
+
}
|
|
29156
|
+
}
|
|
28917
29157
|
}
|
|
28918
29158
|
|
|
28919
29159
|
module.exports = F5BigIQ;
|
|
@@ -142,6 +142,68 @@
|
|
|
142
142
|
"mockFile": "mockdatafiles/getRemoveDeviceTrustStatusById-default.json"
|
|
143
143
|
}
|
|
144
144
|
]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "updateDeviceUpgrade",
|
|
148
|
+
"protocol": "REST",
|
|
149
|
+
"method": "POST",
|
|
150
|
+
"entitypath": "{base_path}/{version}/mgmt/cm/device/upgrade-backups?{query}",
|
|
151
|
+
"requestSchema": "schema.json",
|
|
152
|
+
"responseSchema": "schema.json",
|
|
153
|
+
"timeout": 0,
|
|
154
|
+
"sendEmpty": false,
|
|
155
|
+
"requestDatatype": "JSON",
|
|
156
|
+
"responseDatatype": "JSON",
|
|
157
|
+
"headers": {},
|
|
158
|
+
"responseObjects": [
|
|
159
|
+
{
|
|
160
|
+
"type": "default",
|
|
161
|
+
"key": "",
|
|
162
|
+
"mockFile": "mockdatafiles/updateDeviceUpgrade-default.json"
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "getAllUpgradeInstances",
|
|
168
|
+
"protocol": "REST",
|
|
169
|
+
"method": "GET",
|
|
170
|
+
"entitypath": "{base_path}/{version}/mgmt/cm/device/upgrade-backups?{query}",
|
|
171
|
+
"requestSchema": "schema.json",
|
|
172
|
+
"responseSchema": "schema.json",
|
|
173
|
+
"timeout": 0,
|
|
174
|
+
"sendEmpty": false,
|
|
175
|
+
"sendGetBody": false,
|
|
176
|
+
"requestDatatype": "JSON",
|
|
177
|
+
"responseDatatype": "JSON",
|
|
178
|
+
"headers": {},
|
|
179
|
+
"responseObjects": [
|
|
180
|
+
{
|
|
181
|
+
"type": "default",
|
|
182
|
+
"key": "",
|
|
183
|
+
"mockFile": "mockdatafiles/getAllUpgradeInstances-default.json"
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "getUpgradeInstancesById",
|
|
189
|
+
"protocol": "REST",
|
|
190
|
+
"method": "GET",
|
|
191
|
+
"entitypath": "{base_path}/{version}/mgmt/cm/device/upgrade-backups/{pathv1}?{query}",
|
|
192
|
+
"requestSchema": "schema.json",
|
|
193
|
+
"responseSchema": "schema.json",
|
|
194
|
+
"timeout": 0,
|
|
195
|
+
"sendEmpty": false,
|
|
196
|
+
"sendGetBody": false,
|
|
197
|
+
"requestDatatype": "JSON",
|
|
198
|
+
"responseDatatype": "JSON",
|
|
199
|
+
"headers": {},
|
|
200
|
+
"responseObjects": [
|
|
201
|
+
{
|
|
202
|
+
"type": "default",
|
|
203
|
+
"key": "",
|
|
204
|
+
"mockFile": "mockdatafiles/getUpgradeInstancesById-default.json"
|
|
205
|
+
}
|
|
206
|
+
]
|
|
145
207
|
}
|
|
146
208
|
]
|
|
147
209
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"items": [
|
|
3
|
+
{
|
|
4
|
+
"id": "3a010684-47c5-48f0-ba4a-82eece96aa3a",
|
|
5
|
+
"kind": "cm:device:upgrade-backups:prepostupgradebackupstate",
|
|
6
|
+
"selfLink": "https://localhost/mgmt/cm/device/upgrade-backups/3a010684-47c5-48f0-ba4a-82eece96aa3a",
|
|
7
|
+
"generation": 4,
|
|
8
|
+
"hasPreBackup": true,
|
|
9
|
+
"hasPostBackup": false,
|
|
10
|
+
"needPreBackup": true,
|
|
11
|
+
"taskReference": {
|
|
12
|
+
"link": "https://localhost/mgmt/cm/device/upgrades/dbc4369f-8e33-4364-a612-4cfc6756b8da"
|
|
13
|
+
},
|
|
14
|
+
"needPostBackup": false,
|
|
15
|
+
"lastUpdateMicros": 1695828377417472,
|
|
16
|
+
"preBackupRecords": [
|
|
17
|
+
{
|
|
18
|
+
"backupReference": {
|
|
19
|
+
"link": "https://localhost/mgmt/cm/system/backup-restore/e34e6090-b5db-4973-8cb6-fe9217d3b394"
|
|
20
|
+
},
|
|
21
|
+
"deviceReference": {
|
|
22
|
+
"link": "https://localhost/mgmt/shared/resolver/device-groups/cm-bigip-allBigIpDevices/devices/3fd9cf87-17ff-44b3-afc8-461c115bc5c8"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"includePrivateKeys": true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "03e01c63-44cd-44f5-ae2f-446391ae436f",
|
|
30
|
+
"kind": "cm:device:upgrade-backups:prepostupgradebackupstate",
|
|
31
|
+
"selfLink": "https://localhost/mgmt/cm/device/upgrade-backups/03e01c63-44cd-44f5-ae2f-446391ae436f",
|
|
32
|
+
"generation": 3,
|
|
33
|
+
"hasPreBackup": true,
|
|
34
|
+
"hasPostBackup": false,
|
|
35
|
+
"needPreBackup": true,
|
|
36
|
+
"taskReference": {
|
|
37
|
+
"link": "https://localhost/mgmt/cm/device/upgrades/e577fed5-17ea-4bf6-b811-3045890173ab"
|
|
38
|
+
},
|
|
39
|
+
"needPostBackup": false,
|
|
40
|
+
"lastUpdateMicros": 1695272987904849,
|
|
41
|
+
"preBackupRecords": [
|
|
42
|
+
{
|
|
43
|
+
"backupReference": {
|
|
44
|
+
"link": "https://localhost/mgmt/cm/system/backup-restore/83c3b188-3172-4639-b665-2196a08b9fd4"
|
|
45
|
+
},
|
|
46
|
+
"deviceReference": {
|
|
47
|
+
"link": "https://localhost/mgmt/shared/resolver/device-groups/cm-bigip-allBigIpDevices/devices/b14fc503-0fa0-4597-9042-cb43809b50e5"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"includePrivateKeys": false
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"generation": 18,
|
|
55
|
+
"kind": "cm:device:upgrade-backups:prepostupgradebackupcollectionstate",
|
|
56
|
+
"lastUpdateMicros": 1695830761033292,
|
|
57
|
+
"selfLink": "https://localhost/mgmt/cm/device/upgrade-backups"
|
|
58
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "538c14b3-0331-45df-8663-11caab266c0a",
|
|
3
|
+
"kind": "cm:device:upgrade-backups:prepostupgradebackupstate",
|
|
4
|
+
"selfLink": "https://localhost/mgmt/cm/device/upgrade-backups/538c14b3-0331-45df-8663-11caab266c0a",
|
|
5
|
+
"generation": 1,
|
|
6
|
+
"hasPreBackup": false,
|
|
7
|
+
"hasPostBackup": false,
|
|
8
|
+
"needPreBackup": true,
|
|
9
|
+
"taskReference": {
|
|
10
|
+
"link": "https://localhost/mgmt/cm/device/upgrades/48b1368c-765c-4e1a-b049-d8ed0ba02c60"
|
|
11
|
+
},
|
|
12
|
+
"needPostBackup": false,
|
|
13
|
+
"lastUpdateMicros": 1695830761023352,
|
|
14
|
+
"includePrivateKeys": true
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "538c14b3-0331-45df-8663-11caab266c0a",
|
|
3
|
+
"includePrivateKeys": true,
|
|
4
|
+
"needPreBackup": true,
|
|
5
|
+
"hasPreBackup": false,
|
|
6
|
+
"needPostBackup": false,
|
|
7
|
+
"hasPostBackup": false,
|
|
8
|
+
"taskReference": {
|
|
9
|
+
"link": "https://localhost/mgmt/cm/device/upgrades/48b1368c-765c-4e1a-b049-d8ed0ba02c60"
|
|
10
|
+
},
|
|
11
|
+
"generation": 1,
|
|
12
|
+
"lastUpdateMicros": 1695830761023352,
|
|
13
|
+
"kind": "cm:device:upgrade-backups:prepostupgradebackupstate",
|
|
14
|
+
"selfLink": "https://localhost/mgmt/cm/device/upgrade-backups/538c14b3-0331-45df-8663-11caab266c0a"
|
|
15
|
+
}
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
"removeDeviceServices",
|
|
17
17
|
"getRemoveDeviceServicesStatusById",
|
|
18
18
|
"removeDeviceTrust",
|
|
19
|
-
"getRemoveDeviceTrustStatusById"
|
|
19
|
+
"getRemoveDeviceTrustStatusById",
|
|
20
|
+
"updateDeviceUpgrade",
|
|
21
|
+
"getAllUpgradeInstances",
|
|
22
|
+
"getUpgradeInstancesById"
|
|
20
23
|
],
|
|
21
24
|
"external_name": "ph_request_type"
|
|
22
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-f5_bigiq",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "This adapter integrates with system described as: f5Big-iqApi.",
|
|
5
5
|
"main": "adapter.js",
|
|
6
6
|
"systemName": "f5 BIG-IQ",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"json-query": "^2.2.2",
|
|
64
64
|
"mocha": "^9.0.1",
|
|
65
65
|
"mocha-param": "^2.0.1",
|
|
66
|
-
"mongodb": "^4.1
|
|
66
|
+
"mongodb": "^4.17.1",
|
|
67
67
|
"network-diagnostics": "^0.5.3",
|
|
68
68
|
"nyc": "^15.1.0",
|
|
69
69
|
"readline-sync": "^1.4.10",
|
package/pronghorn.json
CHANGED
|
@@ -12995,6 +12995,97 @@
|
|
|
12995
12995
|
"path": "/getRemoveDeviceTrustStatusById"
|
|
12996
12996
|
},
|
|
12997
12997
|
"task": true
|
|
12998
|
+
},
|
|
12999
|
+
{
|
|
13000
|
+
"name": "updateDeviceUpgrade",
|
|
13001
|
+
"summary": "Update Device Upgrade",
|
|
13002
|
+
"description": "Update Device Upgrade",
|
|
13003
|
+
"input": [
|
|
13004
|
+
{
|
|
13005
|
+
"name": "body",
|
|
13006
|
+
"type": "object",
|
|
13007
|
+
"info": ": object",
|
|
13008
|
+
"required": true,
|
|
13009
|
+
"schema": {
|
|
13010
|
+
"title": "body",
|
|
13011
|
+
"type": "object"
|
|
13012
|
+
}
|
|
13013
|
+
}
|
|
13014
|
+
],
|
|
13015
|
+
"output": {
|
|
13016
|
+
"name": "result",
|
|
13017
|
+
"type": "object",
|
|
13018
|
+
"description": "A JSON Object containing status, code and the result",
|
|
13019
|
+
"schema": {
|
|
13020
|
+
"title": "result",
|
|
13021
|
+
"type": "object"
|
|
13022
|
+
}
|
|
13023
|
+
},
|
|
13024
|
+
"roles": [
|
|
13025
|
+
"admin"
|
|
13026
|
+
],
|
|
13027
|
+
"route": {
|
|
13028
|
+
"verb": "POST",
|
|
13029
|
+
"path": "/updateDeviceUpgrade"
|
|
13030
|
+
},
|
|
13031
|
+
"task": true
|
|
13032
|
+
},
|
|
13033
|
+
{
|
|
13034
|
+
"name": "getAllUpgradeInstances",
|
|
13035
|
+
"summary": "Get All Upgrade Instances",
|
|
13036
|
+
"description": "Get All Upgrade Instances",
|
|
13037
|
+
"input": [],
|
|
13038
|
+
"output": {
|
|
13039
|
+
"name": "result",
|
|
13040
|
+
"type": "object",
|
|
13041
|
+
"description": "A JSON Object containing status, code and the result",
|
|
13042
|
+
"schema": {
|
|
13043
|
+
"title": "body",
|
|
13044
|
+
"type": "object"
|
|
13045
|
+
}
|
|
13046
|
+
},
|
|
13047
|
+
"roles": [
|
|
13048
|
+
"admin"
|
|
13049
|
+
],
|
|
13050
|
+
"route": {
|
|
13051
|
+
"verb": "GET",
|
|
13052
|
+
"path": "/getAllUpgradeInstances"
|
|
13053
|
+
},
|
|
13054
|
+
"task": true
|
|
13055
|
+
},
|
|
13056
|
+
{
|
|
13057
|
+
"name": "getUpgradeInstancesById",
|
|
13058
|
+
"summary": "Get Upgrade Instance By Id",
|
|
13059
|
+
"description": "Get Upgrade Instance By Id",
|
|
13060
|
+
"input": [
|
|
13061
|
+
{
|
|
13062
|
+
"name": "upgradeTaskId",
|
|
13063
|
+
"type": "string",
|
|
13064
|
+
"info": ": string",
|
|
13065
|
+
"required": true,
|
|
13066
|
+
"schema": {
|
|
13067
|
+
"title": "upgradeTaskId",
|
|
13068
|
+
"type": "string"
|
|
13069
|
+
}
|
|
13070
|
+
}
|
|
13071
|
+
],
|
|
13072
|
+
"output": {
|
|
13073
|
+
"name": "result",
|
|
13074
|
+
"type": "object",
|
|
13075
|
+
"description": "A JSON Object containing status, code and the result",
|
|
13076
|
+
"schema": {
|
|
13077
|
+
"title": "result",
|
|
13078
|
+
"type": "object"
|
|
13079
|
+
}
|
|
13080
|
+
},
|
|
13081
|
+
"roles": [
|
|
13082
|
+
"admin"
|
|
13083
|
+
],
|
|
13084
|
+
"route": {
|
|
13085
|
+
"verb": "POST",
|
|
13086
|
+
"path": "/getUpgradeInstancesById"
|
|
13087
|
+
},
|
|
13088
|
+
"task": true
|
|
12998
13089
|
}
|
|
12999
13090
|
],
|
|
13000
13091
|
"views": []
|
|
Binary file
|
|
@@ -9130,5 +9130,107 @@ describe('[integration] F5BigIQ Adapter Test', () => {
|
|
|
9130
9130
|
}
|
|
9131
9131
|
}).timeout(attemptTimeout);
|
|
9132
9132
|
});
|
|
9133
|
+
|
|
9134
|
+
const deviceUpgradesUpdateDeviceUpgradeBodyParam = {
|
|
9135
|
+
hasPostBackup: false,
|
|
9136
|
+
hasPreBackup: false,
|
|
9137
|
+
needPostBackup: false,
|
|
9138
|
+
needPreBackup: true,
|
|
9139
|
+
includePrivateKeys: false,
|
|
9140
|
+
taskReference: {
|
|
9141
|
+
link: 'https://localhost/mgmt/cm/device/upgrades/774a7160-1920-4ff6-b2fc-30c586fc12c8'
|
|
9142
|
+
}
|
|
9143
|
+
};
|
|
9144
|
+
describe('#updateDeviceUpgrade - errors', () => {
|
|
9145
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
9146
|
+
try {
|
|
9147
|
+
a.updateDeviceUpgrade(deviceUpgradesUpdateDeviceUpgradeBodyParam, (data, error) => {
|
|
9148
|
+
try {
|
|
9149
|
+
if (stub) {
|
|
9150
|
+
runCommonAsserts(data, error);
|
|
9151
|
+
assert.equal('538c14b3-0331-45df-8663-11caab266c0a', data.response.id);
|
|
9152
|
+
assert.equal(true, data.response.includePrivateKeys);
|
|
9153
|
+
assert.equal(true, data.response.needPreBackup);
|
|
9154
|
+
assert.equal(false, data.response.hasPreBackup);
|
|
9155
|
+
assert.equal(false, data.response.needPostBackup);
|
|
9156
|
+
assert.equal(false, data.response.hasPostBackup);
|
|
9157
|
+
assert.equal('object', typeof data.response.taskReference);
|
|
9158
|
+
assert.equal(1, data.response.generation);
|
|
9159
|
+
assert.equal(1695830761023352, data.response.lastUpdateMicros);
|
|
9160
|
+
assert.equal('cm:device:upgrade-backups:prepostupgradebackupstate', data.response.kind);
|
|
9161
|
+
assert.equal('https://localhost/mgmt/cm/device/upgrade-backups/538c14b3-0331-45df-8663-11caab266c0a', data.response.selfLink);
|
|
9162
|
+
} else {
|
|
9163
|
+
runCommonAsserts(data, error);
|
|
9164
|
+
}
|
|
9165
|
+
saveMockData('DeviceUpgrades', 'updateDeviceUpgrade', 'default', data);
|
|
9166
|
+
done();
|
|
9167
|
+
} catch (err) {
|
|
9168
|
+
log.error(`Test Failure: ${err}`);
|
|
9169
|
+
done(err);
|
|
9170
|
+
}
|
|
9171
|
+
});
|
|
9172
|
+
} catch (error) {
|
|
9173
|
+
log.error(`Adapter Exception: ${error}`);
|
|
9174
|
+
done(error);
|
|
9175
|
+
}
|
|
9176
|
+
}).timeout(attemptTimeout);
|
|
9177
|
+
});
|
|
9178
|
+
|
|
9179
|
+
describe('#getAllUpgradeInstances - errors', () => {
|
|
9180
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
9181
|
+
try {
|
|
9182
|
+
a.getAllUpgradeInstances((data, error) => {
|
|
9183
|
+
try {
|
|
9184
|
+
if (stub) {
|
|
9185
|
+
runCommonAsserts(data, error);
|
|
9186
|
+
assert.equal(true, Array.isArray(data.response.items));
|
|
9187
|
+
assert.equal(18, data.response.generation);
|
|
9188
|
+
assert.equal('cm:device:upgrade-backups:prepostupgradebackupcollectionstate', data.response.kind);
|
|
9189
|
+
assert.equal(1695830761033292, data.response.lastUpdateMicros);
|
|
9190
|
+
assert.equal('https://localhost/mgmt/cm/device/upgrade-backups', data.response.selfLink);
|
|
9191
|
+
} else {
|
|
9192
|
+
runCommonAsserts(data, error);
|
|
9193
|
+
}
|
|
9194
|
+
saveMockData('DeviceUpgrades', 'getAllUpgradeInstances', 'default', data);
|
|
9195
|
+
done();
|
|
9196
|
+
} catch (err) {
|
|
9197
|
+
log.error(`Test Failure: ${err}`);
|
|
9198
|
+
done(err);
|
|
9199
|
+
}
|
|
9200
|
+
});
|
|
9201
|
+
} catch (error) {
|
|
9202
|
+
log.error(`Adapter Exception: ${error}`);
|
|
9203
|
+
done(error);
|
|
9204
|
+
}
|
|
9205
|
+
}).timeout(attemptTimeout);
|
|
9206
|
+
});
|
|
9207
|
+
|
|
9208
|
+
describe('#getUpgradeInstancesById - errors', () => {
|
|
9209
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
9210
|
+
try {
|
|
9211
|
+
a.getUpgradeInstancesById('fakedata', (data, error) => {
|
|
9212
|
+
try {
|
|
9213
|
+
if (stub) {
|
|
9214
|
+
runCommonAsserts(data, error);
|
|
9215
|
+
assert.equal(1, data.response.generation);
|
|
9216
|
+
assert.equal('cm:device:upgrade-backups:prepostupgradebackupstate', data.response.kind);
|
|
9217
|
+
assert.equal(1695830761023352, data.response.lastUpdateMicros);
|
|
9218
|
+
assert.equal('https://localhost/mgmt/cm/device/upgrade-backups/538c14b3-0331-45df-8663-11caab266c0a', data.response.selfLink);
|
|
9219
|
+
} else {
|
|
9220
|
+
runCommonAsserts(data, error);
|
|
9221
|
+
}
|
|
9222
|
+
saveMockData('DeviceUpgrades', 'getUpgradeInstancesById', 'default', data);
|
|
9223
|
+
done();
|
|
9224
|
+
} catch (err) {
|
|
9225
|
+
log.error(`Test Failure: ${err}`);
|
|
9226
|
+
done(err);
|
|
9227
|
+
}
|
|
9228
|
+
});
|
|
9229
|
+
} catch (error) {
|
|
9230
|
+
log.error(`Adapter Exception: ${error}`);
|
|
9231
|
+
done(error);
|
|
9232
|
+
}
|
|
9233
|
+
}).timeout(attemptTimeout);
|
|
9234
|
+
});
|
|
9133
9235
|
});
|
|
9134
9236
|
});
|
|
@@ -12258,5 +12258,75 @@ describe('[unit] F5BigIQ Adapter Test', () => {
|
|
|
12258
12258
|
}
|
|
12259
12259
|
}).timeout(attemptTimeout);
|
|
12260
12260
|
});
|
|
12261
|
+
|
|
12262
|
+
describe('#updateDeviceUpgrade - errors', () => {
|
|
12263
|
+
it('should have a updateDeviceUpgrade function', (done) => {
|
|
12264
|
+
try {
|
|
12265
|
+
assert.equal(true, typeof a.updateDeviceUpgrade === 'function');
|
|
12266
|
+
done();
|
|
12267
|
+
} catch (error) {
|
|
12268
|
+
log.error(`Test Failure: ${error}`);
|
|
12269
|
+
done(error);
|
|
12270
|
+
}
|
|
12271
|
+
}).timeout(attemptTimeout);
|
|
12272
|
+
it('should error if - missing body', (done) => {
|
|
12273
|
+
try {
|
|
12274
|
+
a.updateDeviceUpgrade(null, (data, error) => {
|
|
12275
|
+
try {
|
|
12276
|
+
const displayE = 'body is required';
|
|
12277
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-f5_bigiq-adapter-updateDeviceUpgrade', displayE);
|
|
12278
|
+
done();
|
|
12279
|
+
} catch (err) {
|
|
12280
|
+
log.error(`Test Failure: ${err}`);
|
|
12281
|
+
done(err);
|
|
12282
|
+
}
|
|
12283
|
+
});
|
|
12284
|
+
} catch (error) {
|
|
12285
|
+
log.error(`Adapter Exception: ${error}`);
|
|
12286
|
+
done(error);
|
|
12287
|
+
}
|
|
12288
|
+
}).timeout(attemptTimeout);
|
|
12289
|
+
});
|
|
12290
|
+
|
|
12291
|
+
describe('#getAllUpgradeInstances - errors', () => {
|
|
12292
|
+
it('should have a getAllUpgradeInstances function', (done) => {
|
|
12293
|
+
try {
|
|
12294
|
+
assert.equal(true, typeof a.getAllUpgradeInstances === 'function');
|
|
12295
|
+
done();
|
|
12296
|
+
} catch (error) {
|
|
12297
|
+
log.error(`Test Failure: ${error}`);
|
|
12298
|
+
done(error);
|
|
12299
|
+
}
|
|
12300
|
+
}).timeout(attemptTimeout);
|
|
12301
|
+
});
|
|
12302
|
+
|
|
12303
|
+
describe('#getUpgradeInstancesById - errors', () => {
|
|
12304
|
+
it('should have a getUpgradeInstancesById function', (done) => {
|
|
12305
|
+
try {
|
|
12306
|
+
assert.equal(true, typeof a.getUpgradeInstancesById === 'function');
|
|
12307
|
+
done();
|
|
12308
|
+
} catch (error) {
|
|
12309
|
+
log.error(`Test Failure: ${error}`);
|
|
12310
|
+
done(error);
|
|
12311
|
+
}
|
|
12312
|
+
}).timeout(attemptTimeout);
|
|
12313
|
+
it('should error if - missing upgradeTaskId', (done) => {
|
|
12314
|
+
try {
|
|
12315
|
+
a.getUpgradeInstancesById(null, (data, error) => {
|
|
12316
|
+
try {
|
|
12317
|
+
const displayE = 'upgradeTaskId is required';
|
|
12318
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-f5_bigiq-adapter-getUpgradeInstancesById', displayE);
|
|
12319
|
+
done();
|
|
12320
|
+
} catch (err) {
|
|
12321
|
+
log.error(`Test Failure: ${err}`);
|
|
12322
|
+
done(err);
|
|
12323
|
+
}
|
|
12324
|
+
});
|
|
12325
|
+
} catch (error) {
|
|
12326
|
+
log.error(`Adapter Exception: ${error}`);
|
|
12327
|
+
done(error);
|
|
12328
|
+
}
|
|
12329
|
+
}).timeout(attemptTimeout);
|
|
12330
|
+
});
|
|
12261
12331
|
});
|
|
12262
12332
|
});
|