-
Notifications
You must be signed in to change notification settings - Fork 2
/
hunt.js
35 lines (28 loc) · 1.24 KB
/
hunt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict'
var CiscoAXL = require('./utils/axl');
var HuntHelper = require('./utils/hunthelper');
var authentication = process.env.UCM_USER+':'+process.env.UCM_PASS;
var ucmVersion = process.env.UCM_VERSION;
var ucmHost = process.env.UCM_HOST;
async function doCli(){
try{
const axl = CiscoAXL;
axl.init(ucmVersion, ucmHost, authentication);
if(process.argv[2] === 'help'){
console.log('-- options:');
console.log('node hunt.js LineGroupMembership 1234 (find out what linegroup[s] this extension is member of)');
console.log('node hunt.js ListAllHuntGroups (find out which huntgroups exist with)');
console.log('node hunt.js ListLineGroupMembers lg_blah (find out what extensions are in this linegroup)');
}else if(process.argv[2] === 'LineGroupMembership'){
await axl.runAxlSqlQuery(HuntHelper.getLineGroupMembershipQ(process.argv[3]));
}else if(process.argv[2] === 'ListAllHuntGroups'){
await axl.runAxlSqlQuery(HuntHelper.getAllHuntGroupDetailsQ());
}else if(process.argv[2] === 'ListLineGroupMembers'){
await axl.runAxlSqlQuery(HuntHelper.getLineGroupMemberQ(process.argv[3]));
}
}catch(err){
console.error('__Error__: '+err);
process.exit(1);
}
}
doCli();