@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,239 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
/* eslint import/no-unresolved: warn */
|
|
3
|
+
/* eslint global-require: warn */
|
|
4
|
+
|
|
5
|
+
// suppress eslint rule in adapter
|
|
6
|
+
/* eslint arrow-parens: warn */
|
|
7
|
+
/* eslint import/no-extraneous-dependencies: warn */
|
|
8
|
+
/* eslint import/no-dynamic-require: warn */
|
|
9
|
+
|
|
10
|
+
const program = require('commander');
|
|
11
|
+
const rls = require('readline-sync');
|
|
12
|
+
const prompts = require('prompts');
|
|
13
|
+
const utils = require('./tbUtils');
|
|
14
|
+
const basicGet = require('./basicGet');
|
|
15
|
+
const { name } = require('../package.json');
|
|
16
|
+
const sampleProperties = require('../sampleProperties.json');
|
|
17
|
+
const adapterPronghorn = require('../pronghorn.json');
|
|
18
|
+
const { addAuthInfo } = require('./addAuth');
|
|
19
|
+
|
|
20
|
+
const { troubleshoot, offline } = require('./troubleshootingAdapter');
|
|
21
|
+
|
|
22
|
+
const executeInStandaloneMode = async (command) => {
|
|
23
|
+
console.info('\n> Executing the script outside of IAP installation directory');
|
|
24
|
+
console.info('> Using sampleProperties.json configuration');
|
|
25
|
+
switch (command) {
|
|
26
|
+
case 'install': {
|
|
27
|
+
console.error('Not currently in IAP directory - installation not possible');
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case 'connectivity': {
|
|
31
|
+
const { host } = sampleProperties.properties;
|
|
32
|
+
console.log(`perform networking diagnositics to ${host}`);
|
|
33
|
+
utils.runConnectivity(host);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case 'healthcheck': {
|
|
37
|
+
const a = basicGet.getAdapterInstance({ properties: sampleProperties });
|
|
38
|
+
await utils.healthCheck(a);
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case 'basicget': {
|
|
42
|
+
utils.runBasicGet();
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
default: {
|
|
46
|
+
if (rls.keyInYN('Troubleshooting without IAP?')) {
|
|
47
|
+
await offline();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
process.exit(0);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const getAdapterInstanceConfig = async (command) => {
|
|
55
|
+
const instances = await utils.getAllAdapterInstances();
|
|
56
|
+
if (!instances || instances.length === 0) {
|
|
57
|
+
return console.log('None adapter instances found!');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let instance;
|
|
61
|
+
if (instances.length === 1) {
|
|
62
|
+
[instance] = instances;
|
|
63
|
+
} else {
|
|
64
|
+
const choices = instances.map((item) => ({ title: item.name }));
|
|
65
|
+
const menu = {
|
|
66
|
+
type: 'select',
|
|
67
|
+
name: 'index',
|
|
68
|
+
message: `Pick an adapter for ${command} check`,
|
|
69
|
+
choices
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
console.log('\n');
|
|
73
|
+
const selected = await prompts(menu);
|
|
74
|
+
console.log('\n');
|
|
75
|
+
instance = instances[selected.index];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!instance) {
|
|
79
|
+
console.error('No adapter instance selected');
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const { serviceItem: adapterConfig } = await utils.getAdapterConfig(instance._id); /* eslint-disable-line no-underscore-dangle */
|
|
84
|
+
|
|
85
|
+
console.log('\nAdapter instance configuration =>');
|
|
86
|
+
console.log('======================================');
|
|
87
|
+
console.log(adapterConfig);
|
|
88
|
+
console.log('======================================');
|
|
89
|
+
|
|
90
|
+
return adapterConfig;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const executeCommandOnInstance = async (command) => {
|
|
94
|
+
const adapterConfig = await getAdapterInstanceConfig(command);
|
|
95
|
+
if (!adapterConfig) {
|
|
96
|
+
process.exit(0);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
switch (command) {
|
|
100
|
+
case 'connectivity': {
|
|
101
|
+
const { host } = adapterConfig.properties.properties;
|
|
102
|
+
console.log(`perform networking diagnositics to ${host}`);
|
|
103
|
+
utils.runConnectivity(host, true);
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case 'healthcheck': {
|
|
107
|
+
const adapterInstance = basicGet.getAdapterInstance(adapterConfig);
|
|
108
|
+
await utils.healthCheck(adapterInstance);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case 'basicget': {
|
|
112
|
+
utils.runBasicGet(true);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
case 'troubleshoot': {
|
|
116
|
+
const adapter = { properties: adapterConfig };
|
|
117
|
+
await troubleshoot({}, true, true, adapter);
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
default: {
|
|
121
|
+
console.error(`Unknown command: ${command}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return process.exit(0);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const executeUnderIAPInstallationDirectory = async (command) => {
|
|
128
|
+
if (command === 'install') {
|
|
129
|
+
const { database, serviceItem, pronghornProps } = await utils.getAdapterConfig();
|
|
130
|
+
const filter = { id: pronghornProps.id };
|
|
131
|
+
const profileItem = await database.collection(utils.IAP_PROFILES_COLLECTION).findOne(filter);
|
|
132
|
+
if (!profileItem) {
|
|
133
|
+
console.log(`Could not find IAP profile for id ${pronghornProps.id}`);
|
|
134
|
+
process.exit(0);
|
|
135
|
+
}
|
|
136
|
+
if (serviceItem) {
|
|
137
|
+
console.log(`A service by the name ${name} already exits!`);
|
|
138
|
+
if (rls.keyInYN(`Do you want to completely remove ${name}?`)) {
|
|
139
|
+
console.log(`Removing ${name} from db...`);
|
|
140
|
+
await database.collection(utils.SERVICE_CONFIGS_COLLECTION).deleteOne({ model: name });
|
|
141
|
+
console.log(`${name} removed from db.`);
|
|
142
|
+
if (profileItem.services.includes(serviceItem.name)) {
|
|
143
|
+
const serviceIndex = profileItem.services.indexOf(serviceItem.name);
|
|
144
|
+
profileItem.services.splice(serviceIndex, 1);
|
|
145
|
+
const update = { $set: { services: profileItem.services } };
|
|
146
|
+
await database.collection(utils.IAP_PROFILES_COLLECTION).updateOne({ id: pronghornProps.id }, update);
|
|
147
|
+
console.log(`${serviceItem.name} removed from profileItem.services.`);
|
|
148
|
+
console.log(`Rerun the script to reinstall ${serviceItem.name}.`);
|
|
149
|
+
process.exit(0);
|
|
150
|
+
} else {
|
|
151
|
+
process.exit(0);
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
console.log('Exiting...');
|
|
155
|
+
process.exit(0);
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
const dirname = utils.getCurrentExecutionPath();
|
|
159
|
+
utils.verifyInstallationDir(dirname, name);
|
|
160
|
+
utils.runTest();
|
|
161
|
+
if (rls.keyInYN(`Do you want to install ${name} to IAP?`)) {
|
|
162
|
+
console.log('Creating database entries...');
|
|
163
|
+
const adapter = utils.createAdapter(pronghornProps, profileItem, sampleProperties, adapterPronghorn);
|
|
164
|
+
adapter.properties.properties = await addAuthInfo(adapter.properties.properties);
|
|
165
|
+
|
|
166
|
+
await database.collection(utils.SERVICE_CONFIGS_COLLECTION).insertOne(adapter);
|
|
167
|
+
profileItem.services.push(adapter.name);
|
|
168
|
+
const update = { $set: { services: profileItem.services } };
|
|
169
|
+
await database.collection(utils.IAP_PROFILES_COLLECTION).updateOne({ id: pronghornProps.id }, update);
|
|
170
|
+
console.log('Database entry creation complete.');
|
|
171
|
+
}
|
|
172
|
+
console.log('Exiting...');
|
|
173
|
+
process.exit(0);
|
|
174
|
+
}
|
|
175
|
+
} else if (['healthcheck', 'basicget', 'connectivity', 'troubleshoot'].includes(command)) {
|
|
176
|
+
await executeCommandOnInstance(command);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const main = async (command) => {
|
|
181
|
+
if (!utils.areWeUnderIAPinstallationDirectory()) {
|
|
182
|
+
executeInStandaloneMode(command); // configuration from sampleproperties.json
|
|
183
|
+
} else {
|
|
184
|
+
executeUnderIAPInstallationDirectory(command); // configuration from $IAP_HOME/properties.json
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
program
|
|
189
|
+
.command('connectivity')
|
|
190
|
+
.alias('c')
|
|
191
|
+
.description('networking diagnostics')
|
|
192
|
+
.action(() => {
|
|
193
|
+
main('connectivity');
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
program
|
|
197
|
+
.command('install')
|
|
198
|
+
.alias('i')
|
|
199
|
+
.description('install current adapter')
|
|
200
|
+
.action(() => {
|
|
201
|
+
main('install');
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
program
|
|
205
|
+
.command('healthcheck')
|
|
206
|
+
.alias('hc')
|
|
207
|
+
.description('perfom none interative healthcheck with current setting')
|
|
208
|
+
.action(() => {
|
|
209
|
+
main('healthcheck');
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
program
|
|
213
|
+
.command('basicget')
|
|
214
|
+
.alias('bg')
|
|
215
|
+
.description('perfom basicget')
|
|
216
|
+
.action(() => {
|
|
217
|
+
main('basicget');
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
program
|
|
221
|
+
.command('troubleshoot')
|
|
222
|
+
.alias('tb')
|
|
223
|
+
.description('perfom troubleshooting')
|
|
224
|
+
.action(() => {
|
|
225
|
+
main('troubleshoot');
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// Allow commander to parse `process.argv`
|
|
229
|
+
program.parse(process.argv);
|
|
230
|
+
|
|
231
|
+
if (process.argv.length < 3) {
|
|
232
|
+
main();
|
|
233
|
+
}
|
|
234
|
+
const allowedParams = ['install', 'healthcheck', 'basicget', 'connectivity', 'troubleshoot'];
|
|
235
|
+
if (process.argv.length === 3 && !allowedParams.includes(process.argv[2])) {
|
|
236
|
+
console.log(`unknown parameter ${process.argv[2]}`);
|
|
237
|
+
console.log('try `node troubleshootingAdapter.js -h` to see allowed parameters. Exiting...');
|
|
238
|
+
process.exit(0);
|
|
239
|
+
}
|