@itentialopensource/adapter-f5_bigiq 0.3.3 → 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.
@@ -8913,5 +8913,324 @@ describe('[integration] F5BigIQ Adapter Test', () => {
8913
8913
  }
8914
8914
  }).timeout(attemptTimeout);
8915
8915
  });
8916
+
8917
+ const deviceUpgradesRebootDeviceBodyParam = {
8918
+ passthroughObject: {
8919
+ command: 'reboot',
8920
+ volume: 'HD1.1'
8921
+ },
8922
+ deviceGroupDeviceReference: {
8923
+ link: 'string'
8924
+ },
8925
+ remoteTargetReference: {
8926
+ link: 'string'
8927
+ }
8928
+ };
8929
+ describe('#rebootDevice - errors', () => {
8930
+ it('should work if integrated or standalone with mockdata', (done) => {
8931
+ try {
8932
+ a.rebootDevice(deviceUpgradesRebootDeviceBodyParam, (data, error) => {
8933
+ try {
8934
+ if (stub) {
8935
+ runCommonAsserts(data, error);
8936
+ assert.equal('tm:sys:rebootstate', data.response.kind);
8937
+ assert.equal('reboot', data.response.command);
8938
+ assert.equal('HD1.1', data.response.volume);
8939
+ } else {
8940
+ runCommonAsserts(data, error);
8941
+ }
8942
+ saveMockData('DeviceUpgrades', 'rebootDevice', 'default', data);
8943
+ done();
8944
+ } catch (err) {
8945
+ log.error(`Test Failure: ${err}`);
8946
+ done(err);
8947
+ }
8948
+ });
8949
+ } catch (error) {
8950
+ log.error(`Adapter Exception: ${error}`);
8951
+ done(error);
8952
+ }
8953
+ }).timeout(attemptTimeout);
8954
+ });
8955
+
8956
+ const deviceUpgradesRemoveDeviceServicesBodyParam = {
8957
+ moduleList: [
8958
+ {
8959
+ module: 'adc_core'
8960
+ },
8961
+ {
8962
+ module: 'access'
8963
+ },
8964
+ {
8965
+ module: 'asm'
8966
+ },
8967
+ {
8968
+ module: 'fps'
8969
+ },
8970
+ {
8971
+ module: 'firewall'
8972
+ },
8973
+ {
8974
+ module: 'security_shared'
8975
+ },
8976
+ {
8977
+ module: 'dns'
8978
+ },
8979
+ {
8980
+ module: 'sslo'
8981
+ }
8982
+ ],
8983
+ deviceReference: {
8984
+ link: 'string'
8985
+ },
8986
+ name: 'string'
8987
+ };
8988
+ describe('#removeDeviceServices - errors', () => {
8989
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
8990
+ try {
8991
+ a.removeDeviceServices(deviceUpgradesRemoveDeviceServicesBodyParam, (data, error) => {
8992
+ try {
8993
+ if (stub) {
8994
+ const displayE = 'Error 400 received on request';
8995
+ runErrorAsserts(data, error, 'AD.500', 'Test-f5_bigiq-connectorRest-handleEndResponse', displayE);
8996
+ } else {
8997
+ runCommonAsserts(data, error);
8998
+ }
8999
+ saveMockData('DeviceUpgrades', 'removeDeviceServices', 'default', data);
9000
+ done();
9001
+ } catch (err) {
9002
+ log.error(`Test Failure: ${err}`);
9003
+ done(err);
9004
+ }
9005
+ });
9006
+ } catch (error) {
9007
+ log.error(`Adapter Exception: ${error}`);
9008
+ done(error);
9009
+ }
9010
+ }).timeout(attemptTimeout);
9011
+ });
9012
+
9013
+ describe('#getRemoveDeviceServicesStatusById - errors', () => {
9014
+ it('should work if integrated or standalone with mockdata', (done) => {
9015
+ try {
9016
+ a.getRemoveDeviceServicesStatusById('fakedata', (data, error) => {
9017
+ try {
9018
+ if (stub) {
9019
+ runCommonAsserts(data, error);
9020
+ assert.equal('string', data.response.id);
9021
+ assert.equal('string', data.response.kind);
9022
+ assert.equal('string', data.response.name);
9023
+ assert.equal('FINISHED', data.response.status);
9024
+ assert.equal('string', data.response.selfLink);
9025
+ assert.equal('string', data.response.username);
9026
+ assert.equal(12, data.response.generation);
9027
+ assert.equal(true, Array.isArray(data.response.moduleList));
9028
+ assert.equal('DONE', data.response.currentStep);
9029
+ assert.equal('string', data.response.endDateTime);
9030
+ assert.equal('string', data.response.startDateTime);
9031
+ assert.equal('object', typeof data.response.userReference);
9032
+ assert.equal('string', data.response.ownerMachineId);
9033
+ assert.equal('object', typeof data.response.deviceReference);
9034
+ assert.equal(16, data.response.lastUpdateMicros);
9035
+ assert.equal(true, Array.isArray(data.response.identityReferences));
9036
+ } else {
9037
+ runCommonAsserts(data, error);
9038
+ }
9039
+ saveMockData('DeviceUpgrades', 'getRemoveDeviceServicesStatusById', 'default', data);
9040
+ done();
9041
+ } catch (err) {
9042
+ log.error(`Test Failure: ${err}`);
9043
+ done(err);
9044
+ }
9045
+ });
9046
+ } catch (error) {
9047
+ log.error(`Adapter Exception: ${error}`);
9048
+ done(error);
9049
+ }
9050
+ }).timeout(attemptTimeout);
9051
+ });
9052
+
9053
+ const deviceUpgradesRemoveDeviceTrustBodyParam = {
9054
+ deviceReference: {
9055
+ link: 'string'
9056
+ },
9057
+ name: 'string'
9058
+ };
9059
+ describe('#removeDeviceTrust - errors', () => {
9060
+ it('should work if integrated or standalone with mockdata', (done) => {
9061
+ try {
9062
+ a.removeDeviceTrust(deviceUpgradesRemoveDeviceTrustBodyParam, (data, error) => {
9063
+ try {
9064
+ if (stub) {
9065
+ runCommonAsserts(data, error);
9066
+ assert.equal('object', typeof data.response.deviceReference);
9067
+ assert.equal('string', data.response.id);
9068
+ assert.equal('STARTED', data.response.status);
9069
+ assert.equal('string', data.response.name);
9070
+ assert.equal('object', typeof data.response.userReference);
9071
+ assert.equal(true, Array.isArray(data.response.identityReferences));
9072
+ assert.equal('string', data.response.ownerMachineId);
9073
+ assert.equal(1, data.response.taskWorkerGeneration);
9074
+ assert.equal(1, data.response.generation);
9075
+ assert.equal(16, data.response.lastUpdateMicros);
9076
+ assert.equal('string', data.response.kind);
9077
+ assert.equal('string', data.response.selfLink);
9078
+ } else {
9079
+ runCommonAsserts(data, error);
9080
+ }
9081
+ saveMockData('DeviceUpgrades', 'removeDeviceTrust', 'default', data);
9082
+ done();
9083
+ } catch (err) {
9084
+ log.error(`Test Failure: ${err}`);
9085
+ done(err);
9086
+ }
9087
+ });
9088
+ } catch (error) {
9089
+ log.error(`Adapter Exception: ${error}`);
9090
+ done(error);
9091
+ }
9092
+ }).timeout(attemptTimeout);
9093
+ });
9094
+
9095
+ describe('#getRemoveDeviceTrustStatusById - errors', () => {
9096
+ it('should work if integrated or standalone with mockdata', (done) => {
9097
+ try {
9098
+ a.getRemoveDeviceTrustStatusById('fakedata', (data, error) => {
9099
+ try {
9100
+ if (stub) {
9101
+ runCommonAsserts(data, error);
9102
+ assert.equal('string', data.response.id);
9103
+ assert.equal('string', data.response.kind);
9104
+ assert.equal('string', data.response.name);
9105
+ assert.equal('FINISHED', data.response.status);
9106
+ assert.equal('string', data.response.selfLink);
9107
+ assert.equal('string', data.response.username);
9108
+ assert.equal(15, data.response.generation);
9109
+ assert.equal('DONE', data.response.currentStep);
9110
+ assert.equal('string', data.response.endDateTime);
9111
+ assert.equal('string', data.response.startDateTime);
9112
+ assert.equal('object', typeof data.response.userReference);
9113
+ assert.equal('string', data.response.ownerMachineId);
9114
+ assert.equal('object', typeof data.response.deviceReference);
9115
+ assert.equal(16, data.response.lastUpdateMicros);
9116
+ assert.equal(true, Array.isArray(data.response.identityReferences));
9117
+ } else {
9118
+ runCommonAsserts(data, error);
9119
+ }
9120
+ saveMockData('DeviceUpgrades', 'getRemoveDeviceTrustStatusById', 'default', data);
9121
+ done();
9122
+ } catch (err) {
9123
+ log.error(`Test Failure: ${err}`);
9124
+ done(err);
9125
+ }
9126
+ });
9127
+ } catch (error) {
9128
+ log.error(`Adapter Exception: ${error}`);
9129
+ done(error);
9130
+ }
9131
+ }).timeout(attemptTimeout);
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
+ });
8916
9235
  });
8917
9236
  });
@@ -12113,5 +12113,220 @@ describe('[unit] F5BigIQ Adapter Test', () => {
12113
12113
  }
12114
12114
  }).timeout(attemptTimeout);
12115
12115
  });
12116
+
12117
+ describe('#rebootDevice - errors', () => {
12118
+ it('should have a rebootDevice function', (done) => {
12119
+ try {
12120
+ assert.equal(true, typeof a.rebootDevice === 'function');
12121
+ done();
12122
+ } catch (error) {
12123
+ log.error(`Test Failure: ${error}`);
12124
+ done(error);
12125
+ }
12126
+ }).timeout(attemptTimeout);
12127
+ it('should error if - missing body', (done) => {
12128
+ try {
12129
+ a.rebootDevice(null, (data, error) => {
12130
+ try {
12131
+ const displayE = 'body is required';
12132
+ runErrorAsserts(data, error, 'AD.300', 'Test-f5_bigiq-adapter-rebootDevice', displayE);
12133
+ done();
12134
+ } catch (err) {
12135
+ log.error(`Test Failure: ${err}`);
12136
+ done(err);
12137
+ }
12138
+ });
12139
+ } catch (error) {
12140
+ log.error(`Adapter Exception: ${error}`);
12141
+ done(error);
12142
+ }
12143
+ }).timeout(attemptTimeout);
12144
+ });
12145
+
12146
+ describe('#removeDeviceServices - errors', () => {
12147
+ it('should have a removeDeviceServices function', (done) => {
12148
+ try {
12149
+ assert.equal(true, typeof a.removeDeviceServices === 'function');
12150
+ done();
12151
+ } catch (error) {
12152
+ log.error(`Test Failure: ${error}`);
12153
+ done(error);
12154
+ }
12155
+ }).timeout(attemptTimeout);
12156
+ it('should error if - missing body', (done) => {
12157
+ try {
12158
+ a.removeDeviceServices(null, (data, error) => {
12159
+ try {
12160
+ const displayE = 'body is required';
12161
+ runErrorAsserts(data, error, 'AD.300', 'Test-f5_bigiq-adapter-removeDeviceServices', displayE);
12162
+ done();
12163
+ } catch (err) {
12164
+ log.error(`Test Failure: ${err}`);
12165
+ done(err);
12166
+ }
12167
+ });
12168
+ } catch (error) {
12169
+ log.error(`Adapter Exception: ${error}`);
12170
+ done(error);
12171
+ }
12172
+ }).timeout(attemptTimeout);
12173
+ });
12174
+
12175
+ describe('#getRemoveDeviceServicesStatusById - errors', () => {
12176
+ it('should have a getRemoveDeviceServicesStatusById function', (done) => {
12177
+ try {
12178
+ assert.equal(true, typeof a.getRemoveDeviceServicesStatusById === 'function');
12179
+ done();
12180
+ } catch (error) {
12181
+ log.error(`Test Failure: ${error}`);
12182
+ done(error);
12183
+ }
12184
+ }).timeout(attemptTimeout);
12185
+ it('should error if - missing id', (done) => {
12186
+ try {
12187
+ a.getRemoveDeviceServicesStatusById(null, (data, error) => {
12188
+ try {
12189
+ const displayE = 'id is required';
12190
+ runErrorAsserts(data, error, 'AD.300', 'Test-f5_bigiq-adapter-getRemoveDeviceServicesStatusById', displayE);
12191
+ done();
12192
+ } catch (err) {
12193
+ log.error(`Test Failure: ${err}`);
12194
+ done(err);
12195
+ }
12196
+ });
12197
+ } catch (error) {
12198
+ log.error(`Adapter Exception: ${error}`);
12199
+ done(error);
12200
+ }
12201
+ }).timeout(attemptTimeout);
12202
+ });
12203
+
12204
+ describe('#removeDeviceTrust - errors', () => {
12205
+ it('should have a removeDeviceTrust function', (done) => {
12206
+ try {
12207
+ assert.equal(true, typeof a.removeDeviceTrust === 'function');
12208
+ done();
12209
+ } catch (error) {
12210
+ log.error(`Test Failure: ${error}`);
12211
+ done(error);
12212
+ }
12213
+ }).timeout(attemptTimeout);
12214
+ it('should error if - missing body', (done) => {
12215
+ try {
12216
+ a.removeDeviceTrust(null, (data, error) => {
12217
+ try {
12218
+ const displayE = 'body is required';
12219
+ runErrorAsserts(data, error, 'AD.300', 'Test-f5_bigiq-adapter-removeDeviceTrust', displayE);
12220
+ done();
12221
+ } catch (err) {
12222
+ log.error(`Test Failure: ${err}`);
12223
+ done(err);
12224
+ }
12225
+ });
12226
+ } catch (error) {
12227
+ log.error(`Adapter Exception: ${error}`);
12228
+ done(error);
12229
+ }
12230
+ }).timeout(attemptTimeout);
12231
+ });
12232
+
12233
+ describe('#getRemoveDeviceTrustStatusById - errors', () => {
12234
+ it('should have a getRemoveDeviceTrustStatusById function', (done) => {
12235
+ try {
12236
+ assert.equal(true, typeof a.getRemoveDeviceTrustStatusById === 'function');
12237
+ done();
12238
+ } catch (error) {
12239
+ log.error(`Test Failure: ${error}`);
12240
+ done(error);
12241
+ }
12242
+ }).timeout(attemptTimeout);
12243
+ it('should error if - missing id', (done) => {
12244
+ try {
12245
+ a.getRemoveDeviceTrustStatusById(null, (data, error) => {
12246
+ try {
12247
+ const displayE = 'id is required';
12248
+ runErrorAsserts(data, error, 'AD.300', 'Test-f5_bigiq-adapter-getRemoveDeviceTrustStatusById', displayE);
12249
+ done();
12250
+ } catch (err) {
12251
+ log.error(`Test Failure: ${err}`);
12252
+ done(err);
12253
+ }
12254
+ });
12255
+ } catch (error) {
12256
+ log.error(`Adapter Exception: ${error}`);
12257
+ done(error);
12258
+ }
12259
+ }).timeout(attemptTimeout);
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
+ });
12116
12331
  });
12117
12332
  });