Starting with mr11.2 the ngcp-klish-config project is obsolete and no longer available. We have stopped supporting klish. Change-Id: I24c0b99688568ffe05ad6afd4f10ed9931351193master
parent
fe9c75683f
commit
9cb4262edd
@ -1,6 +0,0 @@
|
||||
return {
|
||||
default = {
|
||||
lua = "/usr/bin/lua5.2",
|
||||
helper = "./spec/helper.lua",
|
||||
},
|
||||
}
|
@ -1 +0,0 @@
|
||||
results/
|
@ -1,4 +0,0 @@
|
||||
[gerrit]
|
||||
host=gerrit.mgm.sipwise.com
|
||||
port=29418
|
||||
project=ngcp-klish-config
|
@ -1,87 +1,5 @@
|
||||
ngcp-klish-config
|
||||
=================
|
||||
|
||||
Sipwise NGCP/SPCE CLI shell based on klish/clish
|
||||
|
||||
|
||||
#######
|
||||
#################
|
||||
###### ######
|
||||
#### ####
|
||||
### ###
|
||||
## EEEEEEEE
|
||||
## EEEEE EEEEE
|
||||
## EEE EEE
|
||||
## EE EED
|
||||
### EEE EE
|
||||
### EEE EE
|
||||
## #### ##EE EEE
|
||||
##################EE EEE
|
||||
##### ##### EEEEEE EEEE
|
||||
#### EEEEEEEE
|
||||
### EEEEEE
|
||||
## EEE
|
||||
#### ## ##### E E E EE EEE EEEEEE
|
||||
###### ### ####### ## EE EE EEE EEE EEEEEE EEEEEEE
|
||||
###### ## ######## ## EE EE EEE EEE EEEEED EEEEEEE
|
||||
#### ## ### ## ## EE EE EEE EEE EEE EEE
|
||||
###### ## ### ## EE EE EEE EEE EEEEEE EEEEEE
|
||||
#### ## ### ## EE EE EEE EEE EEE EEE
|
||||
##### ## ######## ## EEEEEEEEEEE EEE EEEE EEEEEEE
|
||||
###### ## ####### ## EEEEEEEEEEE EEE EEEEEE EEEEEE
|
||||
### # ### EEEEEEEE E EEE DEEEE
|
||||
###
|
||||
|
||||
|
||||
|
||||
WARNING:
|
||||
=======
|
||||
|
||||
The status is work-in-progress. Do not expect a full blown shell just yet!
|
||||
This package & its components are meant for a SIP:Provider CE 3.x Server *ONLY*
|
||||
|
||||
|
||||
BASIC HOW-TO:
|
||||
============
|
||||
|
||||
1) Clone & Install the system & software requirements:
|
||||
|
||||
- NGCP-CLISH (https://github.com/sipwise/klish)
|
||||
- LUA-URI (https://github.com/sipwise/lua-uri.git)
|
||||
|
||||
2) Clone & Deploy NGCP-KLISH-CONFIG to your /etc:
|
||||
|
||||
# git clone https://github.com/sipwise/ngcp-clish-config
|
||||
# cd ngcp-clish-config; cp -r etc/* /etc/
|
||||
|
||||
3) Add execution permissions to the launcher if needed, ie:
|
||||
|
||||
# chmod +x /etc/cli.sh
|
||||
|
||||
4) Create a limited user (ie: cliuser) with default clish shell:
|
||||
|
||||
# useradd -s /etc/cli.sh -r -M cliuser
|
||||
# passwd cliuser
|
||||
|
||||
5) Modify /etc/sudoers to allow 'cliuser'' to execute enable clish. For example:
|
||||
|
||||
Defaults:cliuser targetpw
|
||||
cliuser ALL=(ALL) /usr/bin/clish, /usr/local/bin/clish
|
||||
|
||||
|
||||
|
||||
BASIC USAGE:
|
||||
===========
|
||||
|
||||
1) SSH to the system as 'cliuser' using the new account or manually launch /etc/cli.sh
|
||||
|
||||
2) Use tab/autocompletion and ? to explore the menus, commands and parameters
|
||||
|
||||
3) Use 'enable' to enter privileged mode (use the system's root password when asked)
|
||||
|
||||
|
||||
EXAMPLE COMMANDS:
|
||||
================
|
||||
|
||||
- coming soon! -
|
||||
Repository discontinued
|
||||
-----------------------
|
||||
|
||||
The repository is for historical purposes only, it was obsoleted and
|
||||
no longer available starting with mr11.2.
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
clish -x /etc/clish/clish-enable/ -c "$@"
|
||||
else
|
||||
echo "Entering 'clish-enable' view (press Ctrl+Z to exit)..."
|
||||
clish -x /etc/clish/clish-enable/
|
||||
fi
|
@ -1,8 +0,0 @@
|
||||
*.debhelper
|
||||
*.log
|
||||
*.substvars
|
||||
/.debhelper/
|
||||
/debhelper-build-stamp
|
||||
/files
|
||||
/lua-ngcp-klish/
|
||||
/ngcp-klish-config/
|
@ -1,397 +0,0 @@
|
||||
ngcp-klish-config (11.2.0.0+0~mr11.2.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 04 Oct 2022 13:51:01 +0200
|
||||
|
||||
ngcp-klish-config (11.1.0.0+0~mr11.1.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 22 Aug 2022 20:01:44 +0200
|
||||
|
||||
ngcp-klish-config (11.0.0.0+0~mr11.0.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 07 Jun 2022 11:43:47 +0200
|
||||
|
||||
ngcp-klish-config (10.5.0.0+0~mr10.5.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Thu, 31 Mar 2022 00:00:16 +0200
|
||||
|
||||
ngcp-klish-config (10.4.0.0+0~mr10.4.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 24 Jan 2022 16:56:12 +0100
|
||||
|
||||
ngcp-klish-config (10.3.0.0+0~mr10.3.0.0) unstable; urgency=medium
|
||||
|
||||
[ Guillem Jover ]
|
||||
* [c044a72] TT#124273 Update packaging for bullseye
|
||||
* [65f099c] TT#124273 Remove obsolete Conflicts field
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 23 Nov 2021 14:18:22 +0100
|
||||
|
||||
ngcp-klish-config (10.2.0.0+0~mr10.2.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 05 Oct 2021 13:19:30 +0200
|
||||
|
||||
ngcp-klish-config (10.1.0.0+0~mr10.1.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 24 Aug 2021 16:51:39 +0200
|
||||
|
||||
ngcp-klish-config (10.0.0.0+0~mr10.0.0.0) unstable; urgency=medium
|
||||
|
||||
[ Manuel Montecelo ]
|
||||
* [fe5996e] TT#118659 Switch Dockerfile from Debian buster to bullseye
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 14 Jun 2021 16:36:53 +0200
|
||||
|
||||
ngcp-klish-config (9.5.0.0+0~mr9.5.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 20 Apr 2021 11:58:09 +0200
|
||||
|
||||
ngcp-klish-config (9.4.0.0+0~mr9.4.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 15 Feb 2021 17:53:09 +0100
|
||||
|
||||
ngcp-klish-config (9.3.0.0+0~mr9.3.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 05 Jan 2021 15:31:53 +0100
|
||||
|
||||
ngcp-klish-config (9.2.0.0+0~mr9.2.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 09 Nov 2020 16:25:16 +0100
|
||||
|
||||
ngcp-klish-config (9.1.0.0+0~mr9.1.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 31 Aug 2020 21:54:34 +0200
|
||||
|
||||
ngcp-klish-config (9.0.0.0+0~mr9.0.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 21 Jul 2020 14:48:37 +0200
|
||||
|
||||
ngcp-klish-config (8.6.0.0+0~mr8.6.0.0) unstable; urgency=medium
|
||||
|
||||
[ Victor Seva ]
|
||||
* [595a5ca] TT#64357 switch to lua5.2
|
||||
* [5522960] TT#64357 remove lua-uri dependence
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 14 Jul 2020 11:53:00 +0200
|
||||
|
||||
ngcp-klish-config (8.5.0.0+0~mr8.5.0.0) unstable; urgency=medium
|
||||
|
||||
[ Victor Seva ]
|
||||
* [464078a] TT#64358 fix testrunner and add missing test dependences on Dockerfile
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 19 May 2020 11:09:53 +0200
|
||||
|
||||
ngcp-klish-config (8.4.0.0+0~mr8.4.0.0) unstable; urgency=medium
|
||||
|
||||
[ Guillem Jover ]
|
||||
* [35fc547] TT#71950 Fix typos
|
||||
* [c33037a] TT#64358 Change package architecture from any to all
|
||||
* [ba0262a] TT#64358 Update tests to work with current lua-unit modules
|
||||
* [9246e7f] TT#64358 Remove unused debhelper dir fragment files
|
||||
* [0b58957] TT#64358 Rework test suite to conform to project standards
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 16 Mar 2020 11:15:05 +0100
|
||||
|
||||
ngcp-klish-config (8.3.0.0+0~mr8.3.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 27 Jan 2020 12:22:58 +0100
|
||||
|
||||
ngcp-klish-config (8.2.0.0+0~mr8.2.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 25 Nov 2019 14:56:21 +0100
|
||||
|
||||
ngcp-klish-config (8.1.0.0+0~mr8.1.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 08 Oct 2019 09:09:21 +0200
|
||||
|
||||
ngcp-klish-config (8.0.0.0+0~mr8.0.0.0) unstable; urgency=medium
|
||||
|
||||
[ Guillem Jover ]
|
||||
* [eb3f53c] TT#61954 Update copyright Format URL to use https
|
||||
* [ef9e4ed] TT#61954 Move license location in Debian systems into a Comment field
|
||||
* [ef9feac] TT#63301 Fix lua modules package section and description
|
||||
* [4146ee9] TT#61954 Set debhelper compat level in Build-Depends instead of debian/compat
|
||||
* [45d529c] TT#61954 Fix URL to upstream file
|
||||
* [35d09d6] TT#61954 Update copyright years
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 05 Aug 2019 20:56:33 +0200
|
||||
|
||||
ngcp-klish-config (7.5.0.0+0~mr7.5.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 17 Jun 2019 14:37:11 +0200
|
||||
|
||||
ngcp-klish-config (7.4.0.0+0~mr7.4.0.0) unstable; urgency=medium
|
||||
|
||||
[ Guillem Jover ]
|
||||
* [f555352] TT#56550 Rename ngcp-sercmd to ngcp-kamcmd
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Thu, 25 Apr 2019 14:29:02 +0200
|
||||
|
||||
ngcp-klish-config (7.3.0.0+0~mr7.3.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 25 Feb 2019 22:54:54 +0100
|
||||
|
||||
ngcp-klish-config (7.2.0.0+0~mr7.2.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Wed, 09 Jan 2019 21:58:40 +0100
|
||||
|
||||
ngcp-klish-config (7.1.0.0+0~mr7.1.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 12 Nov 2018 22:36:43 +0100
|
||||
|
||||
ngcp-klish-config (7.0.0.0+0~mr7.0.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 24 Sep 2018 18:55:21 +0200
|
||||
|
||||
ngcp-klish-config (6.5.0.0+0~mr6.5.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 24 Jul 2018 13:36:31 +0200
|
||||
|
||||
ngcp-klish-config (6.4.0.0+0~mr6.4.0.0) unstable; urgency=medium
|
||||
|
||||
[ Guillem Jover ]
|
||||
* [1249e33] TT#26264 Use ngcp-service instead of directly calling /etc/init.d/<service>
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 29 May 2018 10:05:32 +0200
|
||||
|
||||
ngcp-klish-config (6.3.0.0+0~mr6.3.0.0) unstable; urgency=medium
|
||||
|
||||
[ Marco Capetta ]
|
||||
* [9bb7751] TT#33867 Update ngcp-kamctl format to the one used in kamailio 5.1.2
|
||||
|
||||
[ Alexander Lutay ]
|
||||
* [f01863e] TT#33867 Perform 'wrap-and-sort -sat'
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 03 Apr 2018 22:29:16 +0200
|
||||
|
||||
ngcp-klish-config (6.2.0.0+0~mr6.2.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 29 Jan 2018 21:54:35 +0100
|
||||
|
||||
ngcp-klish-config (6.1.0.0+0~mr6.1.0.0) unstable; urgency=medium
|
||||
|
||||
[ Guillem Jover ]
|
||||
* [a203d1b] TT#22072 Update packaging
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Wed, 06 Dec 2017 00:08:48 +0100
|
||||
|
||||
ngcp-klish-config (6.0.0.0+0~mr6.0.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 02 Oct 2017 23:41:01 +0200
|
||||
|
||||
ngcp-klish-config (5.5.0.0+0~mr5.5.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 17 Jul 2017 22:44:52 +0200
|
||||
|
||||
ngcp-klish-config (5.4.0.0+0~mr5.4.0.0) unstable; urgency=medium
|
||||
|
||||
[ Alexander Lutay ]
|
||||
* [e0a6406] TT#12759 Fix shellcheck warnings for run_tests.sh
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Tue, 16 May 2017 21:39:02 +0200
|
||||
|
||||
ngcp-klish-config (5.3.0.0+0~mr5.3.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Wed, 22 Mar 2017 10:57:02 +0100
|
||||
|
||||
ngcp-klish-config (5.2.0.0+0~mr5.2.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Fri, 03 Feb 2017 00:37:01 +0100
|
||||
|
||||
ngcp-klish-config (5.1.0.0+0~mr5.1.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Thu, 17 Nov 2016 23:16:43 +0100
|
||||
|
||||
ngcp-klish-config (5.0.0.0+0~mr5.0.0.0) unstable; urgency=medium
|
||||
|
||||
* [5233e70] MT#22619 Switch Debian Source to Sipwise GitHub mirror
|
||||
|
||||
-- Alexander Lutay <alutay@sipwise.com> Fri, 21 Oct 2016 15:29:02 +0200
|
||||
|
||||
ngcp-klish-config (0.15.0.0+0~mr5.0.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 01 Aug 2016 16:29:35 +0200
|
||||
|
||||
ngcp-klish-config (0.14.0.0+0~mr4.5.0.0) unstable; urgency=medium
|
||||
|
||||
[ Victor Seva ]
|
||||
* [4d46842] MT#18815 remove templates
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 23 May 2016 18:50:59 +0200
|
||||
|
||||
ngcp-klish-config (0.13.0.0+0~mr4.4.0.0) unstable; urgency=medium
|
||||
|
||||
[ Michael Prokop ]
|
||||
* [366a17e] MT#17699 Bump Standards-Version to 3.9.7
|
||||
|
||||
[ Alexander Lutay ]
|
||||
* [da4fc07] MT#18619 Remove ossbss from ngcp-clish-helper.xml
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 21 Mar 2016 22:22:22 +0100
|
||||
|
||||
ngcp-klish-config (0.12.0.0+0~mr4.3.0.0) unstable; urgency=medium
|
||||
|
||||
[ Michael Prokop ]
|
||||
* [9235bf3] MT#15943 Provide commit message to 'ngcpcfg apply'
|
||||
|
||||
[ Victor Seva ]
|
||||
* [91e6942] MT#16637 use get_ngcp_type helper
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Wed, 16 Dec 2015 09:21:05 +0100
|
||||
|
||||
ngcp-klish-config (0.11.0.0+0~mr4.2.0.0) unstable; urgency=medium
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 12 Oct 2015 15:36:59 +0200
|
||||
|
||||
ngcp-klish-config (0.10.0.0+0~mr4.1.0.0) unstable; urgency=low
|
||||
|
||||
[ Alexander Lutay ]
|
||||
* [802087d] MT#13909 Removed ngcp-www-csc as discontinued
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 13 Jul 2015 15:20:32 +0200
|
||||
|
||||
ngcp-klish-config (0.9.0.0+0~mr4.0.0.0) unstable; urgency=low
|
||||
|
||||
[ Michael Prokop ]
|
||||
* [8964e7f] MT#9127 Bump Standards-Version to 3.9.6
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Wed, 18 Mar 2015 14:06:30 +0100
|
||||
|
||||
ngcp-klish-config (0.8.0.0+0~mr3.8.0.0) unstable; urgency=low
|
||||
|
||||
[ Alexander Lutay ]
|
||||
* [cd58b2f] MT#7505 Add .gitreview file for ngcp-klish-config
|
||||
* [bf234ea] MT#10425 Add ngcp-clish wrapper, pssh dependency and templates
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Wed, 07 Jan 2015 21:31:12 +0100
|
||||
|
||||
ngcp-klish-config (0.7.0.0+0~mr3.7.0.0) unstable; urgency=low
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Thu, 30 Oct 2014 17:25:12 +0100
|
||||
|
||||
ngcp-klish-config (0.6.0.0+0~mr3.6.0.0) unstable; urgency=low
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Thu, 09 Oct 2014 16:36:50 +0200
|
||||
|
||||
ngcp-klish-config (0.5.0.0+0~mr3.5.0.0) unstable; urgency=low
|
||||
|
||||
* New release.
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Thu, 10 Jul 2014 15:29:22 +0200
|
||||
|
||||
ngcp-klish-config (0.4.0.0+0~mr3.4.0.0) unstable; urgency=low
|
||||
|
||||
[ Michael Prokop ]
|
||||
* [f3e64fb] MT#6511 Bump Standards-Version to 3.9.5
|
||||
|
||||
[ Victor Seva ]
|
||||
* [a82db68] MT#6611 rename mediaproxy to rtpengine
|
||||
|
||||
[ Sipwise Jenkins Builder ]
|
||||
|
||||
-- Sipwise Jenkins Builder <jenkins@sipwise.com> Mon, 26 May 2014 15:50:25 +0200
|
||||
|
||||
ngcp-klish-config (0.3.0.0+0~mr3.3.0.0) unstable; urgency=low
|
||||
|
||||
* New release.
|
||||
|
||||
-- Alexander Lutay <alutay@sipwise.com> Fri, 21 Mar 2014 15:33:01 +0100
|
||||
|
||||
ngcp-klish-config (0.2.0) UNRELEASE; urgency=low
|
||||
|
||||
* [e9bccac] MT#5075 fix error with non existent callid at concurrent-calls details
|
||||
|
||||
-- Victor Seva <vseva@sipwise.com> Fri, 22 Nov 2013 22:46:17 +0100
|
||||
|
||||
ngcp-klish-config (0.1.0) unstable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
-- Victor Seva <vseva@sipwise.com> Wed, 30 Oct 2013 11:02:46 +0100
|
@ -1,34 +0,0 @@
|
||||
Source: ngcp-klish-config
|
||||
Section: shells
|
||||
Priority: optional
|
||||
Maintainer: Sipwise Development Team <support@sipwise.com>
|
||||
Homepage: https://github.com/sipwise/ngcp-klish-config
|
||||
Standards-Version: 4.5.1
|
||||
Build-Depends:
|
||||
debhelper-compat (= 13),
|
||||
|
||||
Package: ngcp-klish-config
|
||||
Section: shells
|
||||
Architecture: all
|
||||
Depends:
|
||||
jq,
|
||||
klish,
|
||||
lua-ngcp-klish,
|
||||
lua5.2,
|
||||
pssh,
|
||||
${misc:Depends},
|
||||
Description: NGCP config for klish
|
||||
This package provides the NGCP config for klish.
|
||||
|
||||
Package: lua-ngcp-klish
|
||||
Section: interpreters
|
||||
Architecture: all
|
||||
Depends:
|
||||
jq,
|
||||
lua-dbi-mysql,
|
||||
lua-socket,
|
||||
lua-yaml,
|
||||
${misc:Depends},
|
||||
Description: Lua modules for ngcp-klish-config
|
||||
This package provides the Lua NGCP modules that ngcp-klish-config
|
||||
uses.
|
@ -1,50 +0,0 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Source: https://github.com/sipwise/ngcp-klish-config.git
|
||||
Upstream-Name: ngcp-klish-config
|
||||
|
||||
Files:
|
||||
*
|
||||
Copyright:
|
||||
Copyright © 2013-2021 Sipwise GmbH, Austria
|
||||
License: GPL-3.0+
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
Comment:
|
||||
On Debian systems, the complete text of the GNU General Public License
|
||||
version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
|
||||
Files:
|
||||
ngcp-klish/bencode.lua
|
||||
ngcp-klish/expand.lua
|
||||
Copyright:
|
||||
Copyright © 2009-2012 Moritz Wilhelmy
|
||||
Copyright © 2009 Kristofer Karlsson
|
||||
Copyright © 2006-2007 Peter Shook
|
||||
License: MIT
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
@ -1 +0,0 @@
|
||||
ngcp-klish/*lua usr/share/lua/5.2/ngcp-klish
|
@ -1,2 +0,0 @@
|
||||
bin/* usr/sbin/
|
||||
etc/* etc
|
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
%:
|
||||
dh $@
|
@ -1 +0,0 @@
|
||||
3.0 (native)
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Clish Shell Launcher to be used as default shell in user profiles
|
||||
# NOTE: -l switch prevents usage of lockfile
|
||||
clish -l
|
||||
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<COMMAND name="exit"
|
||||
help="Exit from the CLI"
|
||||
lock="false">
|
||||
<ACTION builtin="clish_close"/>
|
||||
</COMMAND>
|
||||
|
||||
<!--
|
||||
<COMMAND name="!"
|
||||
help="Comments"
|
||||
args="comment"
|
||||
args_help="ignored comment text">
|
||||
<ACTION builtin="clish_nop"/>
|
||||
</COMMAND>
|
||||
-->
|
||||
|
||||
</CLISH_MODULE>
|
||||
|
||||
|
@ -1,82 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<VIEW name="configure-view"
|
||||
prompt="${SYSTEM_NAME}(config)# "
|
||||
restore="depth">
|
||||
|
||||
<!-- Inheritance -->
|
||||
|
||||
<NAMESPACE ref="enable-view"
|
||||
prefix="do"
|
||||
help="true"
|
||||
completion="true"/>
|
||||
|
||||
<COMMAND name="do"
|
||||
help="To run exec commands in config mode"/>
|
||||
|
||||
<!-- Virtual commands -->
|
||||
|
||||
<COMMAND name="no"
|
||||
help="Negate a command or set its defaults"/>
|
||||
|
||||
<COMMAND name="ip"
|
||||
help="Global IP configuration subcommands"/>
|
||||
|
||||
<COMMAND name="no ip"
|
||||
help="Global IP configuration subcommands"/>
|
||||
|
||||
<!-- Simple configuration mode commands -->
|
||||
|
||||
<COMMAND name="exit"
|
||||
help="Exit from configure mode"
|
||||
view="enable-view"
|
||||
lock="false">
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="ngcpcfg" help="NGCP Configuration utilities">
|
||||
<DETAIL>
|
||||
Control NGCPCFG Utility
|
||||
</DETAIL>
|
||||
<PARAM name="ngcpcfg"
|
||||
help="Set the utility sub-command"
|
||||
ptype="STRING"
|
||||
optional="true"
|
||||
default="?"/>
|
||||
<ACTION>ngcpcfg ${ngcpcfg}</ACTION>
|
||||
</COMMAND>
|
||||
<!--=======================================================-->
|
||||
<COMMAND name="upgrade" help="Upgrade system (full)">
|
||||
<DETAIL>
|
||||
Upgrade NGCP release to latest patchlevel.
|
||||
</DETAIL>
|
||||
<ACTION>apt-get update;apt-get upgrade;ngcpcfg apply "system upgrade via klish";echo "Upgrade Completed.";echo</ACTION>
|
||||
</COMMAND>
|
||||
<!--=======================================================-->
|
||||
|
||||
|
||||
|
||||
<COMMAND name="hostname"
|
||||
help="Set system's network name">
|
||||
<PARAM name="hostname"
|
||||
help="This system's network name"
|
||||
optional="true"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
if test "${hostname}"; then
|
||||
hostname "${hostname}"
|
||||
#echo "${hostname}" > /etc/hostname
|
||||
#sed -i "s|^127\.0\.0\.1.*$|127.0.0.1 localhost ${hostname}|" /etc/hosts
|
||||
else
|
||||
echo "Current hostname is: $(hostname)"
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
</VIEW>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,284 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<HOTKEY key="^Z" cmd="exit"/>
|
||||
|
||||
<VIEW name="enable-view"
|
||||
prompt="${SYSTEM_NAME}# ">
|
||||
|
||||
<!-- Inheritance -->
|
||||
|
||||
<NAMESPACE ref="utils-view"
|
||||
help="true"
|
||||
interrupt="true"
|
||||
completion="true"/>
|
||||
|
||||
<!--
|
||||
<NAMESPACE ref="ping-view"
|
||||
help="true"
|
||||
interrupt="true"
|
||||
completion="true"/>
|
||||
-->
|
||||
|
||||
|
||||
<!-- Simple enable mode commands -->
|
||||
|
||||
<COMMAND name="disable"
|
||||
help="Turn off privileged commands">
|
||||
<ACTION builtin="clish_close"/>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="system" help="Enter upgrade mode" />
|
||||
|
||||
<COMMAND name="system reboot"
|
||||
help="Halt and perform a cold restart">
|
||||
<ACTION>reboot</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="system upgrade" help="System Update (menu)" />
|
||||
<COMMAND name="system upgrade packages" help="Upgrade system packages.">
|
||||
<DETAIL>
|
||||
Upgrade NGCP packages to latest patchlevel.
|
||||
</DETAIL>
|
||||
<ACTION>apt-get update;apt-get upgrade;echo "Package Upgrade Completed.";echo;echo "To Activate the changes, run 'system activate-config'"</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="system upgrade activate-config" help="Upgrade system packages and Activate configuration.">
|
||||
<DETAIL>
|
||||
Upgrade NGCP packages to latest patchlevel and activate.
|
||||
</DETAIL>
|
||||
<ACTION>apt-get update;apt-get upgrade;ngcpcfg apply "system upgrade via klish";echo "Package Upgrade and Activate Completed.";echo</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="system activate-config" help="Generate and Activate configuration.">
|
||||
<DETAIL>
|
||||
Generate and Activate NGCP Configuration from templates.
|
||||
</DETAIL>
|
||||
<ACTION>ngcpcfg apply "system upgrade via klish";echo "Apply Completed.";echo</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- SERVICES -->
|
||||
|
||||
<COMMAND name="notify service" help="Manage System Services (menu)" />
|
||||
<COMMAND name="notify service lb" help="Manage NGCP Load-Balance service">
|
||||
<!-- command options -->
|
||||
<PARAM name="command"
|
||||
help="Switch Command"
|
||||
ptype="STRING"
|
||||
optional="false"
|
||||
default=""
|
||||
mode="switch">
|
||||
<PARAM name="start"
|
||||
help="start"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="stop"
|
||||
help="stop"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="restart"
|
||||
help="restart"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="status"
|
||||
help="status"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
<ACTION>ngcp-service lb "${command}";echo</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="notify service proxy" help="Manage NGCP Proxy service">
|
||||
<!-- command options -->
|
||||
<PARAM name="command"
|
||||
help="Switch Command"
|
||||
ptype="STRING"
|
||||
optional="false"
|
||||
default=""
|
||||
mode="switch">
|
||||
<PARAM name="start"
|
||||
help="start"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="stop"
|
||||
help="stop"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="restart"
|
||||
help="restart"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="status"
|
||||
help="status"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
<ACTION>ngcp-service proxy "${command}";echo</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="notify service rtpengine" help="Manage rtpengine service">
|
||||
<!-- command options -->
|
||||
<PARAM name="command"
|
||||
help="Switch Command"
|
||||
ptype="STRING"
|
||||
optional="false"
|
||||
default=""
|
||||
mode="switch">
|
||||
<PARAM name="start"
|
||||
help="start"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="stop"
|
||||
help="stop"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="restart"
|
||||
help="restart"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="status"
|
||||
help="status"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
<ACTION>ngcp-service rtpengine "${command}";echo</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="notify service mysql" help="Manage MYSQL service.">
|
||||
<!-- command options -->
|
||||
<PARAM name="command"
|
||||
help="Switch Command"
|
||||
ptype="STRING"
|
||||
optional="false"
|
||||
default=""
|
||||
mode="switch">
|
||||
<PARAM name="start"
|
||||
help="start"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="stop"
|
||||
help="stop"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="restart"
|
||||
help="restart"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="status"
|
||||
help="status"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
<ACTION>ngcp-service mysql "${command}";echo</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="notify service asterisk" help="Manage ASTERISK-Voicemail service.">
|
||||
<!-- command options -->
|
||||
<PARAM name="command"
|
||||
help="Switch Command"
|
||||
ptype="STRING"
|
||||
optional="false"
|
||||
default=""
|
||||
mode="switch">
|
||||
<PARAM name="start"
|
||||
help="start"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="stop"
|
||||
help="stop"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="restart"
|
||||
help="restart"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
<PARAM name="status"
|
||||
help="status"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
<ACTION>ngcp-service asterisk "${command}";echo</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
<!--=======================================================-->
|
||||
|
||||
|
||||
<COMMAND name="configure"
|
||||
help="Enter configuration mode"/>
|
||||
|
||||
<COMMAND name="configure terminal"
|
||||
help="Configure from the terminal"
|
||||
view="configure-view">
|
||||
</COMMAND>
|
||||
|
||||
<!-- Show commands -->
|
||||
|
||||
<COMMAND name="show"
|
||||
help="Show running system information"/>
|
||||
|
||||
<COMMAND name="show ip"
|
||||
help="Show IP information"/>
|
||||
|
||||
<COMMAND name="show ngcp"
|
||||
help="Show NGCP system components information"/>
|
||||
|
||||
<COMMAND name="show diag"
|
||||
help="Show diagnostic information for port adapters/modules">
|
||||
<ACTION>lspci</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show files"
|
||||
help="Show files generated by the system tools">
|
||||
<ACTION>ls -alF /tmp/</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show running-config" help="Show running NGCP configuration" />
|
||||
<COMMAND name="show running-config network"
|
||||
help="Current operating Network configuration">
|
||||
<ACTION> cat /etc/ngcp-config/network.yml</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show running-config system"
|
||||
help="Current operating NGCP configuration">
|
||||
<ACTION> cat /etc/ngcp-config/config.yml</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
<!-- Copy commands -->
|
||||
|
||||
<!--
|
||||
<COMMAND name="copy"
|
||||
help="Copy from one file to another"/>
|
||||
|
||||
<COMMAND name="copy running-config"
|
||||
help="Copy from current system configuration"/>
|
||||
|
||||
<COMMAND name="copy running-config startup-config"
|
||||
help="Copy to startup configuration">
|
||||
<CONFIG operation="dump" file="/etc/startup-config"/>
|
||||
</COMMAND>
|
||||
-->
|
||||
|
||||
</VIEW>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<VIEW name="enable-view">
|
||||
|
||||
<COMMAND name="show interfaces"
|
||||
help="Show Interface status and configuration">
|
||||
<ACTION>ip addr show</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ip interface"
|
||||
help="Show IP interface status and configuration">
|
||||
<ACTION>ip addr show</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
</VIEW>
|
||||
|
||||
<VIEW name="configure-view">
|
||||
|
||||
<COMMAND name="interface"
|
||||
help="Select an interface to configure"/>
|
||||
|
||||
<COMMAND name="interface ethernet"
|
||||
help="Ethernet IEEE 802.3"
|
||||
view="configure-if-view"
|
||||
viewid="iface=eth${iface_num}">
|
||||
<PARAM name="iface_num"
|
||||
help="Ethernet interface number"
|
||||
ptype="IFACE_NUM"/>
|
||||
<CONFIG priority="0x2001" pattern="^${__line}$"/>
|
||||
</COMMAND>
|
||||
|
||||
</VIEW>
|
||||
|
||||
<VIEW name="configure-if-view"
|
||||
prompt="${SYSTEM_NAME}(config-if-${iface})# "
|
||||
depth="1">
|
||||
|
||||
<!-- Inheritance -->
|
||||
|
||||
<NAMESPACE ref="configure-view"
|
||||
help="false"
|
||||
completion="true"/>
|
||||
|
||||
<!-- Simple configure-if mode commands -->
|
||||
|
||||
<COMMAND name="exit"
|
||||
help="Exit from interface configuration mode"
|
||||
lock="false">
|
||||
<ACTION builtin="clish_nested_up"/>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="no"
|
||||
help="Negate a command or set its defaults"/>
|
||||
|
||||
<COMMAND name="ip"
|
||||
help="Interface Internet Protocol config commands"/>
|
||||
|
||||
<COMMAND name="no ip"
|
||||
help="Interface Internet Protocol config commands"/>
|
||||
|
||||
<!-- IP address -->
|
||||
|
||||
<COMMAND name="ip address"
|
||||
help="Set the IP address of an interface">
|
||||
<PARAM name="ip_method"
|
||||
help="Method to get IP"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="switch">
|
||||
<PARAM name="dhcp"
|
||||
help="IP Address negotiated via DHCP"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand"/>
|
||||
<PARAM name="ip"
|
||||
help="IP address"
|
||||
ptype="IP_ADDR_MASK"/>
|
||||
</PARAM>
|
||||
<CONFIG/>
|
||||
<ACTION>
|
||||
if test "${ip_method}" = "dhcp"; then
|
||||
dhclient ${iface}
|
||||
elif test "${ip_method}" = "ip"; then
|
||||
ip addr show dev ${iface} | grep "inet " | (while read a b c; do ip addr del $b dev ${iface}; done)
|
||||
ip addr add ${ip} dev ${iface}
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="no ip address"
|
||||
help="Set the IP address of an interface">
|
||||
<CONFIG operation="unset" pattern="^ip address"/>
|
||||
<ACTION>
|
||||
ip addr show dev ${iface} | grep "inet " | (while read a b c; do ip addr del $b dev ${iface}; done)
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- Enable/Disable -->
|
||||
|
||||
<COMMAND name="disable"
|
||||
help="Disable the selected interface">
|
||||
<CONFIG operation="unset" pattern="^enable"/>
|
||||
<ACTION>
|
||||
ip link set ${iface} down
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="enable"
|
||||
help="Enable the selected interface">
|
||||
<CONFIG/>
|
||||
<ACTION>
|
||||
ip link set ${iface} up
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
</VIEW>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,265 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<VIEW name="enable-view">
|
||||
|
||||
<!-- LOG PROCESSING -->
|
||||
|
||||
|
||||
|
||||
<!-- COMMAND CONTAINERS -->
|
||||
|
||||
<COMMAND name="show ngcp log" help="Search Logs PROXY"/>
|
||||
<COMMAND name="show ngcp log proxy" help="Search Logs PROXY" />
|
||||
<COMMAND name="show ngcp log lb" help="Search Logs LB" />
|
||||
<COMMAND name="show ngcp log sems" help="Search Logs SEMS" />
|
||||
<COMMAND name="show ngcp log rtpengine" help="Search Logs RTPENGINE" />
|
||||
<COMMAND name="show ngcp log rate" help="Search Logs RATE-O-MAT" />
|
||||
<COMMAND name="show ngcp log oss" help="Search Logs OSS" />
|
||||
<COMMAND name="show ngcp banned" help="Search OSS Logs" />
|
||||
|
||||
|
||||
<!-- CURRENT LOGS TAIL -->
|
||||
|
||||
<COMMAND name="show ngcp log proxy tail" lock="false" help="Search Logs" interrupt="true">
|
||||
<PARAM name="tlimit"
|
||||
optional="true"
|
||||
default="100"
|
||||
help="Specify the number of lines to tail"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
if test -n "${tlimit}"; then
|
||||
tail -n "${tlimit}" /var/log/ngcp/kamailio-proxy.log
|
||||
else
|
||||
tail -n 30 /var/log/ngcp/kamailio-proxy.log
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log lb tail" lock="false" help="Search Logs" interrupt="true">
|
||||
<PARAM name="tlimit"
|
||||
optional="true"
|
||||
default="100"
|
||||
help="Specify the number of lines to tail"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
if test -n "${tlimit}"; then
|
||||
tail -n "${tlimit}" /var/log/ngcp/lb-proxy.log
|
||||
else
|
||||
tail -n 30 /var/log/ngcp/lb-proxy.log
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log sems tail" lock="false" help="Search Logs" interrupt="true">
|
||||
<PARAM name="tlimit"
|
||||
optional="true"
|
||||
default="100"
|
||||
help="Specify the number of lines to tail"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
if test -n "${tlimit}"; then
|
||||
tail -n "${tlimit}" /var/log/ngcp/sems.log
|
||||
else
|
||||
tail -n 30 /var/log/ngcp/sems.log
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log rtpengine tail" lock="false" help="Search Logs" interrupt="true">
|
||||
<PARAM name="tlimit"
|
||||
optional="true"
|
||||
default="100"
|
||||
help="Specify the number of lines to tail"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
if test -n "${tlimit}"; then
|
||||
tail -n "${tlimit}" /var/log/ngcp/rtp.log
|
||||
else
|
||||
tail -n 30 /var/log/ngcp/rtp.log
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log rate tail" lock="false" help="Search Logs" interrupt="true">
|
||||
<PARAM name="tlimit"
|
||||
optional="true"
|
||||
default="100"
|
||||
help="Specify the number of lines to tail"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
if test -n "${tlimit}"; then
|
||||
tail -n "${tlimit}" /var/log/ngcp/rate-o-mat.log
|
||||
else
|
||||
tail -n 30 /var/log/ngcp/rate-o-mat.log
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log oss tail" lock="false" help="Search Logs" interrupt="true">
|
||||
<PARAM name="tlimit"
|
||||
optional="true"
|
||||
default="100"
|
||||
help="Specify the number of lines to tail"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
if test -n "${tlimit}"; then
|
||||
tail -n "${tlimit}" /var/log/ngcp/oss.log
|
||||
else
|
||||
tail -n 30 /var/log/ngcp/oss.log
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- NEW LOGS GREP -->
|
||||
|
||||
<COMMAND name="show ngcp log proxy grep" lock="false" help="Search PROXY Logs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Call-ID)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
grep "${grepstring}" /var/log/ngcp/kamailio-proxy.log
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log lb grep" lock="false" help="Search LB Logs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Call-ID)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
grep "${grepstring}" /var/log/ngcp/kamailio-lb.log
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log sems grep" lock="false" help="Search SEMS Logs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Call-ID)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
grep "${grepstring}" /var/log/ngcp/sems.log
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log rate grep" lock="false" help="Search RATE Logs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Call-ID)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
grep "${grepstring}" /var/log/ngcp/old/rate-o-mat.log
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log rtpengine grep" lock="false" help="Search RTPENGINE Logs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Call-ID)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
grep "${grepstring}" /var/log/ngcp/old/rtp.log
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log oss grep" lock="false" help="Search OSS Logs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Call-ID)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
grep "${grepstring}" /var/log/ngcp/oss.log
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- OLD LOGS ZGREP -->
|
||||
|
||||
<COMMAND name="show ngcp log proxy grep-old" lock="false" help="Search PROXY Logs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Call-ID)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
zgrep "${grepstring}" /var/log/ngcp/old/kamailio-proxy*.gz
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log lb grep-old" lock="false" help="Search LB Logs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Call-ID)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
zgrep "${grepstring}" /var/log/ngcp/old/lb-proxy*.gz
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log sems grep-old" lock="false" help="Search SEMS Logs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Call-ID)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
zgrep "${grepstring}" /var/log/ngcp/old/sems-log*.gz
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log rate grep-old" lock="false" help="Search RATE Logs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Call-ID)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
zgrep "${grepstring}" /var/log/ngcp/old/rate-o-mat*.gz
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log rtpengine grep-old" lock="false" help="Search RTPENGINE Logs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Call-ID)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
zgrep "${grepstring}" /var/log/ngcp/old/rtp*.gz
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp log oss grep-old" lock="false" help="Search OSS Logs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Call-ID)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
zgrep "${grepstring}" /var/log/ngcp/old/oss*.gz
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- EXTRA STUFF -->
|
||||
|
||||
<COMMAND name="show ngcp banned users" lock="false" help="Show NGCP Banned users" interrupt="true">
|
||||
<ACTION>
|
||||
ngcp-kamctl lb fifo htable.dump auth
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp banned users search" lock="false" help="Search NGCP Banned Users" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the Username)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
ngcp-kamctl lb fifo htable.dump auth | grep "${grepstring}"
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp banned ips" lock="false" help="Show NGCP Banned IPs" interrupt="true">
|
||||
<ACTION>
|
||||
ngcp-kamctl lb fifo htable.dump ipban
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp banned ips search" lock="false" help="Search NGCP Banned IPs" interrupt="true">
|
||||
<PARAM name="grepstring"
|
||||
optional="false"
|
||||
help="Specify a string to search (i.e. the IP)"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
ngcp-kamctl lb fifo htable.dump ipban | grep "${grepstring}"
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
<!-- END LOGS -->
|
||||
|
||||
|
||||
|
||||
</VIEW>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,492 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<VIEW name="utils-view">
|
||||
|
||||
<!-- UTILS PROCESSING -->
|
||||
|
||||
|
||||
|
||||
<!-- COMMAND CONTAINERS -->
|
||||
|
||||
<COMMAND name="notify" help="Notify Services" interrupt="true" />
|
||||
<COMMAND name="notify siptrace" help="SIP Trace Element (PCAP)" interrupt="true"/>
|
||||
<COMMAND name="notify siplog" help="SIP Log Element (TXT)" interrupt="true"/>
|
||||
|
||||
|
||||
<!-- TCPDUMP -->
|
||||
|
||||
<COMMAND name="notify siptrace on" lock="false" help="Start SIP Tracer in PCAP Mode" interrupt="true">
|
||||
<!-- command options -->
|
||||
<PARAM name="ptype"
|
||||
help="Switch Port or Range"
|
||||
ptype="STRING"
|
||||
optional="true"
|
||||
default="null"
|
||||
mode="switch">
|
||||
<PARAM name="port"
|
||||
help="port number"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="psel"
|
||||
help="value"
|
||||
ptype="UINT"/>
|
||||
</PARAM>
|
||||
<PARAM name="portrange"
|
||||
help="port range"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="psel"
|
||||
help="value"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
<ACTION>
|
||||
case "${ptype}" in
|
||||
"port")
|
||||
param="port ${psel}"
|
||||
;;
|
||||
"portrange")
|
||||
param="portrange ${psel}"
|
||||
;;
|
||||
*)
|
||||
param="portrange 5060-5090"
|
||||
;;
|
||||
esac
|
||||
|
||||
user=$(whoami)
|
||||
pid=$(ps aux | grep "tcpdump" | grep -v "grep tcpdump" | awk '$2!=0{print $2}')
|
||||
if [ ! -z $pid ]; then
|
||||
echo "ERROR: SIP Trace to file is already running for $user ($pid)"
|
||||
else
|
||||
echo "Starting SIP Tracer $$ for $user..."
|
||||
tcpdump -ni any -s0 $param -w /tmp/siptrace$$.pcap &
|
||||
#tcpdump -ni any -s0 portrange 5060-5090 -w /tmp/siptrace$$.pcap &
|
||||
echo "SIP Trace to PCAP is running (saving to: /tmp/siptrace$$.pcap)"
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="notify siptrace off" lock="false" help="Stop SIP Tracer in PCAP Mode" interrupt="true">
|
||||
<ACTION>
|
||||
user=$(whoami)
|
||||
pid=$(ps aux | grep "tcpdump" | grep -v "grep tcpdump" | awk '$2!=0{print $2}')
|
||||
#echo $pid
|
||||
if [ ! -z $pid ]; then
|
||||
echo "Stopping SIP Tracer $pid..."
|
||||
kill $pid
|
||||
echo "Done."
|
||||
else
|
||||
echo "ERROR: SIP Trace is not running."
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="notify siptrace kill all" lock="false" help="Kill ALL SIP Logrs" interrupt="true">
|
||||
<ACTION>
|
||||
killall tcpdump
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="notify siptrace kill" lock="false" help="Kill SIP Tracer by PID" interrupt="true">
|
||||
<PARAM name="npid"
|
||||
optional="true"
|
||||
help="Specify the PID to kill"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
if test -n "${npid}"; then
|
||||
kill "${npid}"
|
||||
else
|
||||
pid=$(ps aux | grep "tcpdump" | grep -v "grep tcpdump" | awk '$2!=0{print $2}')
|
||||
#echo $pid
|
||||
if [ ! -z $pid ]; then
|
||||
echo "Choose a PID to terminate:"
|
||||
echo $pid; echo
|
||||
else
|
||||
echo "No Tracers running."
|
||||
fi
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="notify siptrace list" lock="false" help="Kill ALL SIP Tracers" interrupt="true">
|
||||
<ACTION>
|
||||
pid=$(ps aux | grep "tcpdump" | grep -v "grep tcpdump" | awk '$2!=0{print $2}')
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="notify siptrace on timed" lock="false" help="Start SIP Logr with timer" interrupt="false" >
|
||||
<PARAM name="tlimit"
|
||||
optional="true"
|
||||
default="10"
|
||||
help="Specify the length of tracer is seconds"
|
||||
ptype="STRING"/>
|
||||
<!-- command options -->
|
||||
<PARAM name="ptype"
|
||||
help="Switch Port or Range"
|
||||
ptype="STRING"
|
||||
optional="true"
|
||||
default="null"
|
||||
mode="switch">
|
||||
<PARAM name="port"
|
||||
help="port number"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="psel"
|
||||
help="value"
|
||||
ptype="UINT"/>
|
||||
</PARAM>
|
||||
<PARAM name="portrange"
|
||||
help="port range"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="psel"
|
||||
help="value"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
|
||||
<ACTION>
|
||||
case "${ptype}" in
|
||||
"port")
|
||||
param="port ${psel}"
|
||||
;;
|
||||
"portrange")
|
||||
param="portrange ${psel}"
|
||||
;;
|
||||
*)
|
||||
param="portrange 5060-5090"
|
||||
;;
|
||||
esac
|
||||
|
||||
user=$(whoami)
|
||||
if test -n "${tlimit}"; then
|
||||
timeout "${tlimit}" tcpdump -ni any -s0 $param -w /tmp/siptrace_timed_$$.pcap &
|
||||
#timeout "${tlimit}" tcpdump -ni any -s0 portrange 5060-5090 -w /tmp/siptrace_timed_$$.pcap &
|
||||
echo "SIP Tracer timed capturing started for "${tlimit}" seconds, saving to: /tmp/siptrace_timed_$$.pcap"
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- NGREP -->
|
||||
|
||||
<COMMAND name="notify siplog on screen" lock="false" help="Start SIP Tracer in Text Mode" interrupt="true">
|
||||
<!-- command options -->
|
||||
<PARAM name="ptype"
|
||||
help="Switch Port or Range"
|
||||
ptype="STRING"
|
||||
optional="true"
|
||||
default="null"
|
||||
mode="switch">
|
||||
<PARAM name="port"
|
||||
help="port number"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="psel"
|
||||
help="value"
|
||||
ptype="UINT"/>
|
||||
</PARAM>
|
||||
<PARAM name="portrange"
|
||||
help="port range"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="psel"
|
||||
help="value"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
<PARAM name="filter"
|
||||
help="SIP filter"
|
||||
ptype="STRING"
|
||||
optional="true"
|
||||
default="null"
|
||||
mode="switch">
|
||||
<PARAM name="grep"
|
||||
help="port number"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="pfil"
|
||||
help="value"
|
||||
default=""
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
|
||||
<ACTION>
|
||||
case "${ptype}" in
|
||||
"port")
|
||||
param="port ${psel}"
|
||||
;;
|
||||
"portrange")
|
||||
param="portrange ${psel}"
|
||||
;;
|
||||
*)
|
||||
param="portrange 5060-5090"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Starting SIP Tracer... (CTRL-C to Stop)"
|
||||
ngrep-sip ${pfil} $param
|
||||
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="notify siplog on" lock="false" help="Start SIP Tracer in Text Mode" interrupt="true">
|
||||
<!-- command options -->
|
||||
<PARAM name="ptype"
|
||||
help="Switch Port or Range"
|
||||
ptype="STRING"
|
||||
optional="true"
|
||||
default="null"
|
||||
mode="switch">
|
||||
<PARAM name="port"
|
||||
help="port number"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="psel"
|
||||
help="value"
|
||||
ptype="UINT"/>
|
||||
</PARAM>
|
||||
<PARAM name="portrange"
|
||||
help="port range"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="psel"
|
||||
help="value"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
<PARAM name="filter"
|
||||
help="SIP filter"
|
||||
ptype="STRING"
|
||||
optional="true"
|
||||
default="null"
|
||||
mode="switch">
|
||||
<PARAM name="grep"
|
||||
help="port number"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="pfil"
|
||||
help="filter string"
|
||||
default=""
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
|
||||
<ACTION>
|
||||
case "${ptype}" in
|
||||
"port")
|
||||
param="port ${psel}"
|
||||
;;
|
||||
"portrange")
|
||||
param="portrange ${psel}"
|
||||
;;
|
||||
*)
|
||||
param="portrange 5060-5090"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "${pfil}"; then
|
||||
param=" -T -i -t -q ${pfil} $param"
|
||||
fi
|
||||
|
||||
#echo "STRING: $param"
|
||||
user=$(whoami)
|
||||
pid=$(ps aux | grep "ngrep" | grep "P $user" | grep -v "grep ngrep" | awk '$2!=0{print $2}')
|
||||
#echo $pid
|
||||
if [ ! -z $pid ]; then
|
||||
echo "ERROR: SIP Log to file is already running for $user ($pid)"
|
||||
else
|
||||
echo "Starting SIP Logr $$ for $user..."
|
||||
ngrep -d any -W byline $param -P $user > /tmp/siplog$$.log &
|
||||
#ngrep -W byline portrange 5060-5090 -P $user > /tmp/siplog$$.log &
|
||||
echo "SIP Log to file is running (saving to: /tmp/siplog$$.log)"
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="notify siplog off" lock="false" help="Stop SIP Logr in Text Mode" interrupt="true">
|
||||
<ACTION>
|
||||
user=$(whoami)
|
||||
pid=$(ps aux | grep "ngrep" | grep "P $user" | grep -v "grep ngrep" | awk '$2!=0{print $2}')
|
||||
#echo $pid
|
||||
if [ ! -z $pid ]; then
|
||||
echo "Stopping SIP Logr $pid..."
|
||||
kill $pid
|
||||
echo "Done."
|
||||
else
|
||||
echo "ERROR: SIP Log is not running."
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="notify siplog kill all" lock="false" help="Kill ALL SIP Logrs" interrupt="true">
|
||||
<ACTION>
|
||||
killall ngrep
|
||||
rm -rf /tmp/siplog*.pid
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="notify siplog kill" lock="false" help="Kill SIP Logrs by PID" interrupt="true">
|
||||
<PARAM name="npid"
|
||||
optional="true"
|
||||
help="Specify the PID to kill"
|
||||
ptype="STRING"/>
|
||||
<ACTION>
|
||||
if test -n "${npid}"; then
|
||||
kill "${npid}"
|
||||
else
|
||||
pid=$(ps aux | grep "ngrep" | grep "P $user" | grep -v "grep ngrep" | awk '$2!=0{print $2}')
|
||||
#echo $pid
|
||||
if [ ! -z $pid ]; then
|
||||
echo "Choose a PID to terminate:"
|
||||
echo $pid; echo
|
||||
else
|
||||
echo "No Tracers runninng."
|
||||
fi
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="notify siplog list" lock="false" help="Kill ALL SIP Logrs" interrupt="true">
|
||||
<ACTION>
|
||||
ps aux | grep "ngrep" | grep "P $user" | grep -v "grep ngrep" | awk '$2!=0{print $2}'
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="notify siplog on timed" lock="false" help="Start SIP Logr with timer" interrupt="false" >
|
||||
<PARAM name="tlimit"
|
||||
optional="true"
|
||||
default="10"
|
||||
help="Specify the length of tracer is seconds"
|
||||
ptype="STRING"/>
|
||||
<!-- command options -->
|
||||
<PARAM name="ptype"
|
||||
help="Switch Port or Range"
|
||||
ptype="STRING"
|
||||
optional="true"
|
||||
default="null"
|
||||
mode="switch">
|
||||
<PARAM name="port"
|
||||
help="port number"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="psel"
|
||||
help="value"
|
||||
ptype="UINT"/>
|
||||
</PARAM>
|
||||
<PARAM name="portrange"
|
||||
help="port range"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="psel"
|
||||
help="value"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
<PARAM name="filter"
|
||||
help="SIP filter"
|
||||
ptype="STRING"
|
||||
optional="true"
|
||||
default="null"
|
||||
mode="switch">
|
||||
<PARAM name="grep"
|
||||
help="port number"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="pfil"
|
||||
help="filter string"
|
||||
default=""
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
</PARAM>
|
||||
|
||||
<ACTION>
|
||||
case "${ptype}" in
|
||||
"port")
|
||||
param="port ${psel}"
|
||||
;;
|
||||
"portrange")
|
||||
param="portrange ${psel}"
|
||||
;;
|
||||
*)
|
||||
param="portrange 5060-5090"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "${pfil}"; then
|
||||
param=" -T -i -t -q ${pfil} $param"
|
||||
fi
|
||||
|
||||
user=$(whoami)
|
||||
if test -n "${tlimit}"; then
|
||||
timeout "${tlimit}" ngrep -d any -W byline $param -P $user > /tmp/siplog_timed_$$.log &
|
||||
#timeout "${tlimit}" ngrep -W byline portrange 5060-5090 -P $user > /tmp/siplog_timed_$$.log &
|
||||
echo "SIP Logr timed capturing started for "${tlimit}" seconds, saving to: /tmp/siplog_timed_$$.txt"
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- DEBUG LEVELS -->
|
||||
|
||||
<COMMAND name="notify debug" help="Notify Set Debug Levels (menu)" />
|
||||
|
||||
<!-- DEBUG PROXY -->
|
||||
|
||||
<COMMAND name="notify debug proxy" lock="false" help="Notify Proxy Debug level" interrupt="true"/>
|
||||
<COMMAND name="notify debug proxy get" lock="false" help="Get PROXY Debug level" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy fifo corex.debug | jq -r '.debug' </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="notify debug proxy set" lock="false" help="Set PROXY Debug level" interrupt="true">
|
||||
<PARAM name="debuglevel"
|
||||
optional="false"
|
||||
help="Debug level to set"
|
||||
ptype="STRING"/>
|
||||
|
||||
<ACTION>ngcp-kamctl proxy fifo corex.debug "${debuglevel}" | jq -r '.new' </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- DEBUG LB -->
|
||||
|
||||
<COMMAND name="notify debug lb" lock="false" help="Notify LB Debug level" interrupt="true"/>
|
||||
<COMMAND name="notify debug lb get" lock="false" help="Get LB Debug level" interrupt="true">
|
||||
<ACTION>ngcp-kamctl lb fifo corex.debug | jq -r '.debug' </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="notify debug lb set" lock="false" help="Set LB Debug level" interrupt="true">
|
||||
<PARAM name="debuglevel"
|
||||
optional="false"
|
||||
help="Debug level to set"
|
||||
ptype="STRING"/>
|
||||
|
||||
<ACTION>ngcp-kamctl lb fifo corex.debug "${debuglevel}" | jq -r '.new' </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="notify debug sems" lock="false" help="Notify SEMS Debug level" interrupt="true"/>
|
||||
<COMMAND name="notify debug sems get" lock="false" help="Get SEMS Debug level" interrupt="true">
|
||||
<ACTION>sems-stats -c "get_loglevel"</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- DEBUG SEMS -->
|
||||
|
||||
<COMMAND name="notify debug sems set" lock="false" help="Set SEMS Debug level" interrupt="true">
|
||||
<PARAM name="debuglevel"
|
||||
optional="false"
|
||||
help="Debug level to set"
|
||||
ptype="STRING"/>
|
||||
<ACTION>sems-stats -c "set_loglevel ${debuglevel}" </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
|
||||
<!-- END UTILS -->
|
||||
|
||||
|
||||
|
||||
</VIEW>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,223 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<VIEW name="enable-view">
|
||||
<COMMAND name="show ngcp calls" help="Show calls info"></COMMAND>
|
||||
|
||||
<!-- NGCP LUA MAGIC -->
|
||||
|
||||
<COMMAND name="show ngcp calls concurrent-calls" help="Show concurrent calls stats" lock="false" interrupt="true">
|
||||
<ACTION>echo 'cc_stats()' | lua -lngcp-klish.ngcp</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp calls concurrent-calls details" help="Show concurrent calls details" lock="false" interrupt="true">
|
||||
<PARAM name="callid" optional="true" ptype="STRING" help="callid"/>
|
||||
<ACTION >echo 'cc_details("${callid}")' | lua -lngcp-klish.ngcp</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp registrations" help="Show registrations" lock="false" interrupt="true">
|
||||
<ACTION >echo 'reg_stats()' | lua -lngcp-klish.ngcp</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp registrations subscriber" help="Show registration" lock="false" interrupt="true">
|
||||
<PARAM name="aor" optional="false" ptype="STRING" help="AOR user@domain"/>
|
||||
<ACTION>echo 'reg_info("${aor}")' | lua -lngcp-klish.ngcp</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- OLD COMMANDS -->
|
||||
|
||||
<COMMAND name="show ngcp service" help="Display NGCP Elements information (menu)" />
|
||||
|
||||
<!-- NGCP Proxy -->
|
||||
|
||||
|
||||
<COMMAND name="show ngcp service proxy" help="Display NGCP Proxy information (menu)" />
|
||||
|
||||
<!-- NGCP Proxy DB -->
|
||||
|
||||
<COMMAND name="show ngcp service proxy db" help="Display NGCP Proxy DB information (menu)" />
|
||||
|
||||
<COMMAND name="show ngcp service proxy db trusted" lock="false" help="Show Proxy Routes" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy db show trusted</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service proxy db lcr_gw" lock="false" help="Show Proxy Routes" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy db show lcr_gw</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service proxy db lcr_rule" lock="false" help="Show Proxy Routes" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy db show lcr_rule</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service proxy db lcr_rule_target" lock="false" help="Show Proxy Routes" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy db show lcr_rule_target</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service proxy db dialplan" lock="false" help="Show Proxy Routes" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy db show dialplan</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service proxy db location" lock="false" help="Show Proxy Routes" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy db show location</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service proxy db sems_registrations" lock="false" help="Show Proxy Routes" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy db show sems_registrations</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service proxy db watchers" lock="false" help="Show Proxy Routes" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy db show active_watchers</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
<!-- PROXY MISC -->
|
||||
|
||||
<COMMAND name="show ngcp service proxy uptime" lock="false" help="Show Server Uptime" interrupt="true">
|
||||
<ACTION>ngcp-kamcmd proxy core.uptime </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy version" lock="false" help="Show Server Version" interrupt="true">
|
||||
<ACTION>ngcp-kamcmd proxy core.info </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy sockets" lock="false" help="Show Server Uptime" interrupt="true">
|
||||
<ACTION>ngcp-kamcmd proxy core.sockets_list </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy dialog" lock="false" help="Show Proxy Routes" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy fifo stats.get_statistics dialog:</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy routes" lock="false" help="Show Proxy Routes" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy dialplan show</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy stats" lock="false" help="Show TM Stats" interrupt="true">
|
||||
<ACTION>ngcp-kamcmd proxy tm.stats </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy list-dispatcher" lock="false" help="Show Dispatcher List" interrupt="true">
|
||||
<ACTION>ngcp-kamcmd proxy dispatcher.list </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy list-users" help="Display NGCP Proxy information" />
|
||||
|
||||
<COMMAND name="show ngcp service proxy list-users count" lock="false" help="Count Registered UL" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy fifo stats.get_statistics usrloc registered_users | jq '.[0]' </ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service proxy list-users online" lock="false" help="Show Registered UL" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy online </ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service proxy list-users full" lock="false" help="Show Registered UL" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy ul show </ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service proxy list-users brief" lock="false" help="Show Registered UL" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy ul show --brief </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy find-userid" lock="false" help="Find Registered UL" interrupt="true">
|
||||
<PARAM name="userloc"
|
||||
help="This subscriber id name"
|
||||
ptype="STRING"/>
|
||||
<ACTION>ngcp-kamcmd proxy ul.lookup location "${userloc}"</ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service proxy find-URI" lock="false" help="Find Registered UL" interrupt="true">
|
||||
<PARAM name="useruri"
|
||||
help="This subscriber USER@DOMAIN"
|
||||
ptype="STRING"/>
|
||||
<ACTION>ngcp-kamctl proxy ul show "${useruri}"</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy domains" help="Show DOMAINS (menu)" />
|
||||
<COMMAND name="show ngcp service proxy domains database" help="Show DOMAINS" interrupt="true" lock="false">
|
||||
<ACTION> ngcp-kamctl proxy domain show showdb </ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service proxy domains memory" help="Show DOMAINS" interrupt="true" lock="false">
|
||||
<ACTION> ngcp-kamctl proxy domain show </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy gateways" help="Show GATEWAYS" interrupt="true" lock="false">
|
||||
<ACTION>ngcp-kamcmd proxy lcr.dump_gws </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy rules" help="Show GATEWAYS" interrupt="true" lock="false">
|
||||
<ACTION>ngcp-kamcmd proxy lcr.dump_rules </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy logs" lock="false" help="Show PROXY Logs" interrupt="true">
|
||||
<ACTION>echo "Please use 'show ngcp log' command"</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy calls" lock="false" help="Show PROXY concurrent calls" interrupt="true">
|
||||
<ACTION>ngcp-kamctl proxy fifo dlg.list </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service proxy calls account" lock="false" help="Show PROXY concurrent calls per account" interrupt="true">
|
||||
<PARAM name="account"
|
||||
help="Specify the account ID"
|
||||
ptype="STRING"/>
|
||||
<ACTION>ngcp-kamctl proxy fifo dlg.profile_get_size account ${account} </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
<!-- NGCP LB -->
|
||||
|
||||
<COMMAND name="show ngcp service lb" help="Display NGCP Load-Balancer information (menu)" />
|
||||
|
||||
<COMMAND name="show ngcp service lb version" lock="false" help="Show Server Version" interrupt="true">
|
||||
<ACTION>ngcp-kamcmd lb server </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service lb stats" lock="false" help="Show TM Stats" interrupt="true">
|
||||
<ACTION>ngcp-kamcmd lb sl.stats </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service lb list-dispatcher" lock="false" help="Show TM Stats" interrupt="true">
|
||||
<ACTION>ngcp-kamcmd lb dispatcher.list </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
<COMMAND name="show ngcp service lb tls" help="Display NGCP Load-Balancer TLS information" />
|
||||
<COMMAND name="show ngcp service lb tls info" lock="false" help="Show LB TLS Info" interrupt="true">
|
||||
<ACTION>ngcp-kamcmd lb tls.info </ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service lb tls list" lock="false" help="Show LB TLS List" interrupt="true">
|
||||
<ACTION>ngcp-kamcmd lb tls.list </ACTION>
|
||||
</COMMAND>
|
||||
<COMMAND name="show ngcp service lb tls options" lock="false" help="Show LB TLS Options" interrupt="true">
|
||||
<ACTION>ngcp-kamcmd lb tls.options </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
|
||||
<COMMAND name="show ngcp service lb logs" lock="false" help="Show LB Logs" interrupt="true">
|
||||
<ACTION>tail /var/log/ngcp/kamailio-lb.log </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- NGCP B2BUA -->
|
||||
|
||||
<COMMAND name="show ngcp service sems" help="Display NGCP SEMS/B2BUA information (menu)" />
|
||||
|
||||
<COMMAND name="show ngcp service sems stats" lock="false" help="Show Server Version" interrupt="true">
|
||||
<ACTION>sems-stats </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service sems logs" lock="false" help="Show Server Version" interrupt="true">
|
||||
<ACTION>tail /var/log/ngcp/sems.log </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
|
||||
<!-- NGCP RTPENGINE -->
|
||||
|
||||
<COMMAND name="show ngcp service rtpengine" help="Display Rtpengine information (menu)" />
|
||||
|
||||
<COMMAND name="show ngcp service rtpengine stats" lock="false" help="Show Rtpengine Stats" interrupt="true">
|
||||
<ACTION>sems-stats </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show ngcp service rtpengine logs" lock="false" help="Show Rtpengine Logs" interrupt="true">
|
||||
<ACTION>tail /var/log/ngcp/rtp.log </ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
</VIEW>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,234 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<VIEW name="ping-view"
|
||||
prompt="${SYSTEM_NAME}# ">
|
||||
|
||||
<!-- commands set: ping, ping6, arping, traceroute, traceroute6 -->
|
||||
<!-- ping, ping6, arping -->
|
||||
<COMMAND name="ping"
|
||||
help="Send messages to network hosts"
|
||||
lock="false"
|
||||
interrupt="true">
|
||||
<PARAM name="proto"
|
||||
help="Protocol to use for the ping"
|
||||
optional="true"
|
||||
mode="switch"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="ip"
|
||||
help="Send ICMP IPv4 messages to network hosts (default)"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="ipv6"
|
||||
help="Send ICMP IPv6 messages to network hosts"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="sip"
|
||||
help="Send SIP Options messages to network hosts"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="arp"
|
||||
help="Send ARP requests to a neighbour host"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
</PARAM>
|
||||
<PARAM name="dst"
|
||||
help="Hostname or IP-address to ping"
|
||||
ptype="STRING"/>
|
||||
<PARAM name="source"
|
||||
help="Source IP-address (ip) or interface (ip and arp)"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="src"
|
||||
help="Source IP-address (ip) or interface name (ip and arp)"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
<PARAM name="repeat"
|
||||
help="Requests to send count, default is 5"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="count"
|
||||
help="Requests count"
|
||||
ptype="UINT"/>
|
||||
</PARAM>
|
||||
<PARAM name="resolve"
|
||||
test='"${proto}"!="arp"'
|
||||
help="Resolve names"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="broadcast"
|
||||
test='"${proto}"!="arp"'
|
||||
help="Ping broadcast address"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="size"
|
||||
test='"${proto}"!="arp"'
|
||||
help="Packet size"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="psize"
|
||||
help="Number of data bytes to send"
|
||||
ptype="UINT"/>
|
||||
</PARAM>
|
||||
<PARAM name="interval"
|
||||
test='"${proto}"!="arp"'
|
||||
help="The time interval between packets, default is 1"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="period"
|
||||
help="Interval between packets"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
<PARAM name="flood"
|
||||
test='"${proto}"!="arp"'
|
||||
help="Flood ping"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="duplicate-detect"
|
||||
test='"${proto}"="arp"'
|
||||
help="Duplicate address detection mode"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<ACTION>
|
||||
case "${proto}" in
|
||||
"ipv6")
|
||||
cmd="ping6"
|
||||
;;
|
||||
"arp")
|
||||
cmd="arping"
|
||||
;;
|
||||
"sip")
|
||||
cmd="sipsak -vv -s "
|
||||
;;
|
||||
*)
|
||||
cmd="ping"
|
||||
;;
|
||||
esac
|
||||
if test "${proto}" = "sip"; then
|
||||
# if [[ ${dst} =~ 'sip:(.+)@(.+)' ]] ; then
|
||||
cmd=$cmd
|
||||
elif test "${proto}" != "arp"; then
|
||||
# Resolve names
|
||||
if test -z "${resolve}"; then
|
||||
cmd=$cmd" -n"
|
||||
fi
|
||||
# Ping broadcast
|
||||
cmd=$cmd"`expr substr '${ -b :broadcast}' 1 3`"
|
||||
# Packet size
|
||||
cmd=$cmd"${ -s :psize}"
|
||||
# Interval between packets
|
||||
if test -n "${period}"; then
|
||||
cmd=$cmd"${ -i :period}"
|
||||
else
|
||||
cmd=$cmd" -i 1"
|
||||
fi
|
||||
# Flood ping
|
||||
cmd=$cmd"`expr substr '${ -f :flood}' 1 3`"
|
||||
else
|
||||
# Detect MAC duplicate
|
||||
cmd=$cmd"`expr substr '${ -D :duplicate-detect}' 1 3`"
|
||||
fi
|
||||
|
||||
# Interface or address
|
||||
cmd=$cmd"${ -I :src}"
|
||||
# Request count
|
||||
if test -z "${count}"; then
|
||||
# cmd=$cmd" -c 5"
|
||||
cmd=$cmd
|
||||
else
|
||||
cmd=$cmd"${ -c :count}"
|
||||
fi
|
||||
#
|
||||
cmd=$cmd" ${dst}"
|
||||
$cmd
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- traceroute, traceroute6 -->
|
||||
<COMMAND name="traceroute"
|
||||
help="Print the route packets trace to network host"
|
||||
lock="false"
|
||||
interrupt="true">
|
||||
<PARAM name="proto"
|
||||
help="Protocol to use"
|
||||
optional="true"
|
||||
mode="switch"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="ip"
|
||||
help="IPv4"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="ipv6"
|
||||
help="IPv6"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="sip"
|
||||
help="SIP"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
</PARAM>
|
||||
<PARAM name="dst"
|
||||
help="Hostname or IP-address to trace the route"
|
||||
ptype="STRING"/>
|
||||
<PARAM name="resolve"
|
||||
help="Resolve names"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand"
|
||||
optional="true"/>
|
||||
<PARAM name="source"
|
||||
help="Source IP-address"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="src"
|
||||
help="IP-address"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
<PARAM name="interface"
|
||||
help="Source interface"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="if"
|
||||
help="Interface name"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
<ACTION>
|
||||
if test -n "${sip}"; then
|
||||
cmd="sipsak -T -s"
|
||||
else
|
||||
if test -n "${ipv6}"; then
|
||||
cmd="traceroute6"
|
||||
else
|
||||
cmd="traceroute"
|
||||
fi
|
||||
#Resolve names
|
||||
if test -z "${resolve}"; then
|
||||
cmd=$cmd" -n"
|
||||
fi
|
||||
# Source address
|
||||
cmd=$cmd"${ -s :src}"
|
||||
# Source interface
|
||||
cmd=$cmd"${ -i :if}"
|
||||
#
|
||||
fi
|
||||
cmd=$cmd" ${dst}"
|
||||
$cmd
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
</VIEW>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,111 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<VIEW name="enable-view">
|
||||
|
||||
<!-- Show routing information -->
|
||||
|
||||
<COMMAND name="show ip route"
|
||||
help="IP routing table"
|
||||
lock="false"
|
||||
interrupt="true">
|
||||
<ACTION>ip route show</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
</VIEW>
|
||||
|
||||
|
||||
<VIEW name="configure-view">
|
||||
|
||||
<!-- Enable/Disable routing -->
|
||||
|
||||
<COMMAND name="ip routing"
|
||||
help="Enable IP routing">
|
||||
<CONFIG operation="unset" pattern="^no ip routing"/>
|
||||
<ACTION>
|
||||
echo "1" > /proc/sys/net/ipv4/ip_forward
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="no ip routing"
|
||||
help="Disable IP routing">
|
||||
<CONFIG priority="0x1500"/>
|
||||
<ACTION>
|
||||
echo "0" > /proc/sys/net/ipv4/ip_forward
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- Default gateway -->
|
||||
|
||||
<COMMAND name="ip default-gateway"
|
||||
help="Specify default gateway (if not routing IP)">
|
||||
<PARAM name="ip"
|
||||
help="IP address of default gateway"
|
||||
ptype="IP_ADDR"/>
|
||||
<CONFIG priority="0x9000" splitter="false"/>
|
||||
<ACTION>
|
||||
ip route replace to default via ${ip}
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="no ip default-gateway"
|
||||
help="Specify default gateway (if not routing IP)">
|
||||
<CONFIG operation="unset" pattern="^ip default-gateway"/>
|
||||
<ACTION>
|
||||
ip route delete to default
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- Set/Unset static route -->
|
||||
|
||||
<COMMAND name="ip route"
|
||||
help="Establish static routes">
|
||||
<PARAM name="ip"
|
||||
help="Destination prefix"
|
||||
ptype="IP_ADDR_MASK"/>
|
||||
<PARAM name="route_target"
|
||||
help="Route target"
|
||||
ptype="STRING"
|
||||
mode="switch">
|
||||
<PARAM name="ethernet"
|
||||
help="Ethernet IEEE 802.3"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand">
|
||||
<PARAM name="iface_num"
|
||||
help="Ethernet interface number"
|
||||
ptype="IFACE_NUM"/>
|
||||
</PARAM>
|
||||
<PARAM name="forward"
|
||||
help="Forwarding router's address"
|
||||
ptype="IP_ADDR"/>
|
||||
</PARAM>
|
||||
<CONFIG priority="0x9002" pattern="^ip route ${ip} " splitter="false"/>
|
||||
<ACTION>
|
||||
if test "${route_target}" = "ethernet"; then
|
||||
ip route replace to ${ip} dev eth${iface_num}
|
||||
exit $?
|
||||
elif test "${route_target}" = "forward"; then
|
||||
ip route replace to ${ip} via ${forward}
|
||||
exit $?
|
||||
fi
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="no ip route"
|
||||
help="Establish static routes">
|
||||
<PARAM name="ip"
|
||||
help="Destination prefix"
|
||||
ptype="IP_ADDR_MASK"/>
|
||||
<CONFIG operation="unset" pattern="^ip route ${ip} "/>
|
||||
<ACTION>
|
||||
ip route delete to ${ip}
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
</VIEW>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
|
||||
<STARTUP view="enable-view" >
|
||||
</STARTUP>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<VIEW name="enable-view">
|
||||
|
||||
<!-- OS MISC -->
|
||||
|
||||
<COMMAND name="show system" lock="false" help="Show OS Information" interrupt="true"/>
|
||||
|
||||
<COMMAND name="show system memory" lock="false" help="Show Memory usage" interrupt="true"/>
|
||||
<COMMAND name="show system memory hogs" lock="false" help="Show Memory Hoggers" interrupt="true">
|
||||
<ACTION>ps -A --sort -rss -o comm,pmem | head -n 11</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show system disk" lock="false" help="Show Memory usage" interrupt="true"/>
|
||||
<COMMAND name="show system disk usage" lock="false" help="Show Memory Hoggers" interrupt="true">
|
||||
<ACTION>df -h</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="show system processes" lock="false" help="Show Memory usage" interrupt="true"/>
|
||||
<COMMAND name="show system processes top" lock="false" help="Show Memory Hoggers" interrupt="true">
|
||||
<ACTION>top</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
|
||||
</VIEW>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="VLAN_ID"
|
||||
pattern="(409[0-5]|40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[1-9])"
|
||||
help="Number in the range 1-4095"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="IP_ADDR"
|
||||
pattern="(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))"
|
||||
help="A.B.C.D"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="UINT"
|
||||
pattern="[0-9]+"
|
||||
help="Unsigned integer"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="STRING"
|
||||
pattern=".+"
|
||||
help="String"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="SUBCOMMAND"
|
||||
pattern="[^\]+"
|
||||
help="String"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="BOOL"
|
||||
method="select"
|
||||
pattern="true(1) false(0)"
|
||||
help="Boolean choice"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="IFACE_NUM"
|
||||
pattern="[0-9]+"
|
||||
help="Interface number"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="PROTO"
|
||||
method="select"
|
||||
pattern="ip(ip) ipencap(ipencap) icmp(icmp) igmp(igmp) tcp(tcp) udp(udp)"
|
||||
help="Protocol choice"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="SERVICE"
|
||||
pattern="((ftp)|(telnet)|(sntp)|(smtp)|(http)|([0-9]+))"
|
||||
help="Port"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="IP_ADDR_MASK"
|
||||
pattern="(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(/(1[0-9]|2[0-9]|3[0-2]|[0-9]))?"
|
||||
help="A.B.C.D[/mask]"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="IP_ADDR_ANY"
|
||||
pattern="(((((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(/(1[0-9]|2[0-9]|3[0-2]|[0-9]))?)|any)"
|
||||
help="A.B.C.D[/mask] or any"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="PORT_MASK_ANY"
|
||||
pattern="^(([0-9]+(/0x[0-9a-f]+)?)|(any))$"
|
||||
help="Port[/mask]" />
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="SEQ"
|
||||
pattern="^[0-9]*[1-9][0-9]*"
|
||||
help="Entry number"/>
|
||||
<!--=======================================================-->
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<COMMAND name="exit"
|
||||
help="Exit from the CLI"
|
||||
lock="false">
|
||||
<ACTION builtin="clish_close"/>
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="!"
|
||||
help="Comments"
|
||||
args="comment"
|
||||
args_help="ignored comment text">
|
||||
<ACTION builtin="clish_nop"/>
|
||||
</COMMAND>
|
||||
|
||||
</CLISH_MODULE>
|
||||
|
||||
|
@ -1,41 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<HOTKEY key="^Z" cmd="exit"/>
|
||||
|
||||
<VIEW name="info-view"
|
||||
prompt="${SYSTEM_NAME}> ">
|
||||
|
||||
<!-- Simple non-priveledged mode commands -->
|
||||
|
||||
<COMMAND name="enable"
|
||||
help="Turn on privileged commands"
|
||||
lock="false"
|
||||
interrupt="true">
|
||||
<ACTION>
|
||||
sudo clish -x /etc/clish/clish-enable
|
||||
#su -l -c "clish -x /etc/clish/clish-enable"
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
<!-- Inheritance -->
|
||||
|
||||
<NAMESPACE ref="ping-view"
|
||||
help="true"
|
||||
interrupt="true"
|
||||
completion="true"/>
|
||||
|
||||
<NAMESPACE ref="utils-view"
|
||||
help="true"
|
||||
interrupt="true"
|
||||
completion="true"/>
|
||||
|
||||
|
||||
</VIEW>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
<OVERVIEW>
|
||||
CONTEXT SENSITIVE HELP
|
||||
[?] - Display context sensitive help. This is either a list of possible
|
||||
command completions with summaries, or the full syntax of the
|
||||
current command. A subsequent repeat of this key, when a command
|
||||
has been resolved, will display a detailed reference.
|
||||
|
||||
AUTO-COMPLETION
|
||||
The following keys both perform auto-completion for the current command line.
|
||||
If the command prefix is not unique then the bell will ring and a subsequent
|
||||
repeat of the key will display possible completions.
|
||||
|
||||
[enter] - Auto-completes, syntax-checks then executes a command. If there is
|
||||
a syntax error then offending part of the command line will be
|
||||
highlighted and explained.
|
||||
|
||||
[space] - Auto-completes, or if the command is already resolved inserts a space.
|
||||
|
||||
MOVEMENT KEYS
|
||||
[CTRL-A] - Move to the start of the line
|
||||
[CTRL-E] - Move to the end of the line.
|
||||
[up] - Move to the previous command line held in history.
|
||||
[down] - Move to the next command line held in history.
|
||||
[left] - Move the insertion point left one character.
|
||||
[right] - Move the insertion point right one character.
|
||||
|
||||
DELETION KEYS
|
||||
[CTRL-C] - Delete and abort the current line
|
||||
[CTRL-D] - Delete the character to the right on the insertion point.
|
||||
[CTRL-K] - Delete all the characters to the right of the insertion point.
|
||||
[CTRL-U] - Delete the whole line.
|
||||
[backspace] - Delete the character to the left of the insertion point.
|
||||
|
||||
ESCAPE SEQUENCES
|
||||
!! - Substitute the last command line.
|
||||
!N - Substitute the Nth command line (absolute as per 'history' command)
|
||||
!-N - Substitute the command line entered N lines before (relative)
|
||||
</OVERVIEW>
|
||||
</CLISH_MODULE>
|
@ -1,234 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
|
||||
<VIEW name="ping-view"
|
||||
prompt="${SYSTEM_NAME}# ">
|
||||
|
||||
<!-- commands set: ping, ping6, arping, traceroute, traceroute6 -->
|
||||
<!-- ping, ping6, arping -->
|
||||
<COMMAND name="ping"
|
||||
help="Send messages to network hosts"
|
||||
lock="false"
|
||||
interrupt="true">
|
||||
<PARAM name="proto"
|
||||
help="Protocol to use for the ping"
|
||||
optional="true"
|
||||
mode="switch"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="ip"
|
||||
help="Send ICMP IPv4 messages to network hosts (default)"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="ipv6"
|
||||
help="Send ICMP IPv6 messages to network hosts"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="sip"
|
||||
help="Send SIP Options messages to network hosts"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="arp"
|
||||
help="Send ARP requests to a neighbour host"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
</PARAM>
|
||||
<PARAM name="dst"
|
||||
help="Hostname or IP-address to ping"
|
||||
ptype="STRING"/>
|
||||
<PARAM name="source"
|
||||
help="Source IP-address (ip) or interface (ip and arp)"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="src"
|
||||
help="Source IP-address (ip) or interface name (ip and arp)"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
<PARAM name="repeat"
|
||||
help="Requests to send count, default is 5"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="count"
|
||||
help="Requests count"
|
||||
ptype="UINT"/>
|
||||
</PARAM>
|
||||
<PARAM name="resolve"
|
||||
test='"${proto}"!="arp"'
|
||||
help="Resolve names"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="broadcast"
|
||||
test='"${proto}"!="arp"'
|
||||
help="Ping broadcast address"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="size"
|
||||
test='"${proto}"!="arp"'
|
||||
help="Packet size"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="psize"
|
||||
help="Number of data bytes to send"
|
||||
ptype="UINT"/>
|
||||
</PARAM>
|
||||
<PARAM name="interval"
|
||||
test='"${proto}"!="arp"'
|
||||
help="The time interval between packets, default is 1"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="period"
|
||||
help="Interval between packets"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
<PARAM name="flood"
|
||||
test='"${proto}"!="arp"'
|
||||
help="Flood ping"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="duplicate-detect"
|
||||
test='"${proto}"="arp"'
|
||||
help="Duplicate address detection mode"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<ACTION>
|
||||
case "${proto}" in
|
||||
"ipv6")
|
||||
cmd="ping6"
|
||||
;;
|
||||
"arp")
|
||||
cmd="arping"
|
||||
;;
|
||||
"sip")
|
||||
cmd="sipsak -vv -s "
|
||||
;;
|
||||
*)
|
||||
cmd="ping"
|
||||
;;
|
||||
esac
|
||||
if test "${proto}" = "sip"; then
|
||||
# if [[ ${dst} =~ 'sip:(.+)@(.+)' ]] ; then
|
||||
cmd=$cmd
|
||||
elif test "${proto}" != "arp"; then
|
||||
# Resolve names
|
||||
if test -z "${resolve}"; then
|
||||
cmd=$cmd" -n"
|
||||
fi
|
||||
# Ping broadcast
|
||||
cmd=$cmd"`expr substr '${ -b :broadcast}' 1 3`"
|
||||
# Packet size
|
||||
cmd=$cmd"${ -s :psize}"
|
||||
# Interval between packets
|
||||
if test -n "${period}"; then
|
||||
cmd=$cmd"${ -i :period}"
|
||||
else
|
||||
cmd=$cmd" -i 1"
|
||||
fi
|
||||
# Flood ping
|
||||
cmd=$cmd"`expr substr '${ -f :flood}' 1 3`"
|
||||
else
|
||||
# Detect MAC duplicate
|
||||
cmd=$cmd"`expr substr '${ -D :duplicate-detect}' 1 3`"
|
||||
fi
|
||||
|
||||
# Interface or address
|
||||
cmd=$cmd"${ -I :src}"
|
||||
# Request count
|
||||
if test -z "${count}"; then
|
||||
# cmd=$cmd" -c 5"
|
||||
cmd=$cmd
|
||||
else
|
||||
cmd=$cmd"${ -c :count}"
|
||||
fi
|
||||
#
|
||||
cmd=$cmd" ${dst}"
|
||||
$cmd
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
<!-- traceroute, traceroute6 -->
|
||||
<COMMAND name="traceroute"
|
||||
help="Print the route packets trace to network host"
|
||||
lock="false"
|
||||
interrupt="true">
|
||||
<PARAM name="proto"
|
||||
help="Protocol to use"
|
||||
optional="true"
|
||||
mode="switch"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="ip"
|
||||
help="IPv4"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="ipv6"
|
||||
help="IPv6"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
<PARAM name="sip"
|
||||
help="SIP"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND"/>
|
||||
</PARAM>
|
||||
<PARAM name="dst"
|
||||
help="Hostname or IP-address to trace the route"
|
||||
ptype="STRING"/>
|
||||
<PARAM name="resolve"
|
||||
help="Resolve names"
|
||||
ptype="SUBCOMMAND"
|
||||
mode="subcommand"
|
||||
optional="true"/>
|
||||
<PARAM name="source"
|
||||
help="Source IP-address"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="src"
|
||||
help="IP-address"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
<PARAM name="interface"
|
||||
help="Source interface"
|
||||
optional="true"
|
||||
mode="subcommand"
|
||||
ptype="SUBCOMMAND">
|
||||
<PARAM name="if"
|
||||
help="Interface name"
|
||||
ptype="STRING"/>
|
||||
</PARAM>
|
||||
<ACTION>
|
||||
if test -n "${sip}"; then
|
||||
cmd="sipsak -T -s"
|
||||
else
|
||||
if test -n "${ipv6}"; then
|
||||
cmd="traceroute6"
|
||||
else
|
||||
cmd="traceroute"
|
||||
fi
|
||||
#Resolve names
|
||||
if test -z "${resolve}"; then
|
||||
cmd=$cmd" -n"
|
||||
fi
|
||||
# Source address
|
||||
cmd=$cmd"${ -s :src}"
|
||||
# Source interface
|
||||
cmd=$cmd"${ -i :if}"
|
||||
#
|
||||
fi
|
||||
cmd=$cmd" ${dst}"
|
||||
$cmd
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
</VIEW>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
<VIEW name="root-view"
|
||||
prompt="${SYSTEM_NAME}> ">
|
||||
<!--===================================================-->
|
||||
<COMMAND name="exit"
|
||||
lock="false"
|
||||
interrupt="true"
|
||||
help="Exit this CLI session">
|
||||
<ACTION builtin="clish_close"/>
|
||||
</COMMAND>
|
||||
<!--=======================================================-->
|
||||
</VIEW>
|
||||
</CLISH_MODULE>
|
@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
|
||||
<STARTUP view="info-view">
|
||||
<DETAIL>
|
||||
|
||||
#######
|
||||
#################
|
||||
###### ######
|
||||
#### ####
|
||||
### ###
|
||||
## EEEEEEEE
|
||||
## EEEEE EEEEE
|
||||
## EEE EEE
|
||||
## EE EED
|
||||
### EEE EE
|
||||
### EEE EE
|
||||
## #### ##EE EEE
|
||||
##################EE EEE
|
||||
##### ##### EEEEEE EEEE
|
||||
#### EEEEEEEE
|
||||
### EEEEEE
|
||||
## EEE
|
||||
#### ## ##### E E E EE EEE EEEEEE
|
||||
###### ### ####### ## EE EE EEE EEE EEEEEE EEEEEEE
|
||||
###### ## ######## ## EE EE EEE EEE EEEEED EEEEEEE
|
||||
#### ## ### ## ## EE EE EEE EEE EEE EEE
|
||||
###### ## ### ## EE EE EEE EEE EEEEEE EEEEEE
|
||||
#### ## ### ## EE EE EEE EEE EEE EEE
|
||||
##### ## ######## ## EEEEEEEEEEE EEE EEEE EEEEEEE
|
||||
###### ## ####### ## EEEEEEEEEEE EEE EEEEEE EEEEEE
|
||||
### # ### EEEEEEEE E EEE DEEEE
|
||||
###
|
||||
|
||||
SIPWISE SP:CE Command Line [SPCLI]
|
||||
</DETAIL>
|
||||
<ACTION>echo "Welcome `whoami` it is `date`";echo</ACTION>
|
||||
</STARTUP>
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
|
||||
http://clish.sourceforge.net/XMLSchema/clish.xsd">
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="VLAN_ID"
|
||||
pattern="(409[0-5]|40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[1-9])"
|
||||
help="Number in the range 1-4095"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="IP_ADDR"
|
||||
pattern="(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))"
|
||||
help="A.B.C.D"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="UINT"
|
||||
pattern="[0-9]+"
|
||||
help="Unsigned integer"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="STRING"
|
||||
pattern=".+"
|
||||
help="String"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="SUBCOMMAND"
|
||||
pattern="[^\]+"
|
||||
help="String"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="BOOL"
|
||||
method="select"
|
||||
pattern="true(1) false(0)"
|
||||
help="Boolean choice"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="IFACE_NUM"
|
||||
pattern="[0-9]+"
|
||||
help="Interface number"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="PROTO"
|
||||
method="select"
|
||||
pattern="ip(ip) ipencap(ipencap) icmp(icmp) igmp(igmp) tcp(tcp) udp(udp)"
|
||||
help="Protocol choice"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="SERVICE"
|
||||
pattern="((ftp)|(telnet)|(sntp)|(smtp)|(http)|([0-9]+))"
|
||||
help="Port"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="IP_ADDR_MASK"
|
||||
pattern="(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(/(1[0-9]|2[0-9]|3[0-2]|[0-9]))?"
|
||||
help="A.B.C.D[/mask]"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="IP_ADDR_ANY"
|
||||
pattern="(((((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(/(1[0-9]|2[0-9]|3[0-2]|[0-9]))?)|any)"
|
||||
help="A.B.C.D[/mask] or any"/>
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="PORT_MASK_ANY"
|
||||
pattern="^(([0-9]+(/0x[0-9a-f]+)?)|(any))$"
|
||||
help="Port[/mask]" />
|
||||
<!--=======================================================-->
|
||||
<PTYPE name="SEQ"
|
||||
pattern="^[0-9]*[1-9][0-9]*"
|
||||
help="Entry number"/>
|
||||
<!--=======================================================-->
|
||||
|
||||
</CLISH_MODULE>
|
@ -1,208 +0,0 @@
|
||||
--[[
|
||||
All files in the source distribution of lua-bencode may be copied under the
|
||||
same terms as Lua 5.0, 5.1, and 5.2. These terms are also known as the "MIT/X
|
||||
Consortium License".
|
||||
|
||||
For reasons of clarity, a copy of these terms is included below.
|
||||
|
||||
Copyright (c) 2009, 2010, 2011, 2012 by Moritz Wilhelmy
|
||||
Copyright (c) 2009 by Kristofer Karlsson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
public domain lua-module for handling bittorrent-bencoded data.
|
||||
This module includes both a recursive decoder and a recursive encoder.
|
||||
|
||||
]]--
|
||||
|
||||
local sort, concat, insert = table.sort, table.concat, table.insert
|
||||
local pairs, ipairs, type, tonumber = pairs, ipairs, type, tonumber
|
||||
local sub, find = string.sub, string.find
|
||||
|
||||
local bencode = {
|
||||
encode_rec = nil -- encode_list/dict and encode_rec are mutually recursive...
|
||||
}
|
||||
|
||||
-- helpers
|
||||
|
||||
local function islist(t)
|
||||
local n = #t
|
||||
for k, _ in pairs(t) do
|
||||
if type(k) ~= "number"
|
||||
or k % 1 ~= 0 -- integer?
|
||||
or k < 1
|
||||
or k > n
|
||||
then
|
||||
return false
|
||||
end
|
||||
end
|
||||
for i = 1, n do
|
||||
if t[i] == nil then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- encoder functions
|
||||
|
||||
local function encode_list(t, x)
|
||||
|
||||
insert(t, "l")
|
||||
|
||||
for _,v in ipairs(x) do
|
||||
local err,ev = bencode.encode_rec(t, v); if err then return err,ev end
|
||||
end
|
||||
|
||||
insert(t, "e")
|
||||
end
|
||||
|
||||
local function encode_dict(t, x)
|
||||
insert(t, "d")
|
||||
-- bittorrent requires the keys to be sorted.
|
||||
local sortedkeys = {}
|
||||
for k, v in pairs(x) do
|
||||
if type(k) ~= "string" then
|
||||
return "bencoding requires dictionary keys to be strings", k
|
||||
end
|
||||
insert(sortedkeys, k)
|
||||
end
|
||||
sort(sortedkeys)
|
||||
|
||||
for k, v in ipairs(sortedkeys) do
|
||||
local err,ev = bencode.encode_rec(t, v); if err then return err,ev end
|
||||
err,ev = bencode.encode_rec(t, x[v]); if err then return err,ev end
|
||||
end
|
||||
insert(t, "e")
|
||||
end
|
||||
|
||||
local function encode_int(t, x)
|
||||
|
||||
if x % 1 ~= 0 then return "number is not an integer", x end
|
||||
insert(t, "i" )
|
||||
insert(t, x )
|
||||
insert(t, "e" )
|
||||
end
|
||||
|
||||
local function encode_str(t, x)
|
||||
|
||||
insert(t, #x )
|
||||
insert(t, ":" )
|
||||
insert(t, x )
|
||||
end
|
||||
|
||||
bencode.encode_rec = function(t, x)
|
||||
|
||||
local typx = type(x)
|
||||
if typx == "string" then return encode_str (t, x)
|
||||
elseif typx == "number" then return encode_int (t, x)
|
||||
elseif typx == "table" then
|
||||
|
||||
if islist(x) then return encode_list (t, x)
|
||||
else return encode_dict (t, x)
|
||||
end
|
||||
else
|
||||
return "type cannot be converted to an acceptable type for bencoding", typx
|
||||
end
|
||||
end
|
||||
|
||||
-- call recursive bencoder function with empty table, stringify that table.
|
||||
-- this is the only encode* function visible to module users.
|
||||
function bencode.encode(x)
|
||||
|
||||
local t = {}
|
||||
local err, val = bencode.encode_rec(t,x)
|
||||
if not err then
|
||||
return concat(t)
|
||||
else
|
||||
return nil, err, val
|
||||
end
|
||||
end
|
||||
|
||||
-- decoder functions
|
||||
|
||||
local function decode_integer(s, index)
|
||||
local _, b, int = find(s, "^(%-?%d+)e", index)
|
||||
if not int then return nil, "not a number", nil end
|
||||
int = tonumber(int)
|
||||
if not int then return nil, "not a number", int end
|
||||
return int, b + 1
|
||||
end
|
||||
|
||||
local function decode_list(s, index)
|
||||
local t = {}
|
||||
while sub(s, index, index) ~= "e" do
|
||||
local obj, ev
|
||||
obj, index, ev = bencode.decode(s, index)
|
||||
if not obj then return obj, index, ev end
|
||||
insert(t, obj)
|
||||
end
|
||||
index = index + 1
|
||||
return t, index
|
||||
end
|
||||
|
||||
local function decode_dictionary(s, index)
|
||||
local t = {}
|
||||
while sub(s, index, index) ~= "e" do
|
||||
local obj1, obj2, ev
|
||||
|
||||
obj1, index, ev = bencode.decode(s, index)
|
||||
if not obj1 then return obj1, index, ev end
|
||||
|
||||
obj2, index, ev = bencode.decode(s, index)
|
||||
if not obj2 then return obj2, index, ev end
|
||||
|
||||
t[obj1] = obj2
|
||||
end
|
||||
index = index + 1
|
||||
return t, index
|
||||
end
|
||||
|
||||
local function decode_string(s, index)
|
||||
local _, b, len = find(s, "^([0-9]+):", index)
|
||||
if not len then return nil, "not a length", len end
|
||||
index = b + 1
|
||||
|
||||
local v = sub(s, index, index + len - 1)
|
||||
if #v < len - 1 then return nil, "truncated string at end of input", v end
|
||||
index = index + len
|
||||
return v, index
|
||||
end
|
||||
|
||||
|
||||
function bencode.decode(s, index)
|
||||
if not s then return nil, "no data", nil end
|
||||
index = index or 1
|
||||
local t = sub(s, index, index)
|
||||
if not t then return nil, "truncation error", nil end
|
||||
|
||||
if t == "i" then
|
||||
return decode_integer(s, index + 1)
|
||||
elseif t == "l" then
|
||||
return decode_list(s, index + 1)
|
||||
elseif t == "d" then
|
||||
return decode_dictionary(s, index + 1)
|
||||
elseif t >= '0' and t <= '9' then
|
||||
return decode_string(s, index)
|
||||
else
|
||||
return nil, "invalid type", t
|
||||
end
|
||||
end
|
||||
|
||||
return bencode
|
@ -1,73 +0,0 @@
|
||||
--
|
||||
-- Copyright 2013-2020 SipWise Team <development@sipwise.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This package is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-- .
|
||||
-- On Debian systems, the complete text of the GNU General
|
||||
-- Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
--
|
||||
local yaml = require "lyaml"
|
||||
local constants
|
||||
local DBI = require "DBI"
|
||||
local io = require "io"
|
||||
|
||||
local configs = {}
|
||||
|
||||
-- return the content of file
|
||||
function configs.readAll(file)
|
||||
local f = io.open(file, "rb")
|
||||
local content = f:read("*all")
|
||||
f:close()
|
||||
return content
|
||||
end
|
||||
|
||||
-- return the ngcp constants as table
|
||||
function configs.get_constants(force)
|
||||
if not constants or force then
|
||||
constants = yaml.load(configs.readAll('/etc/ngcp-config/constants.yml'))
|
||||
end
|
||||
return constants
|
||||
end
|
||||
|
||||
-- connection for provisioning
|
||||
function configs.get_connection()
|
||||
configs.get_constants()
|
||||
local config = {
|
||||
dbname = constants.ossbss.provisioning.database.name,
|
||||
dbuser = constants.ossbss.provisioning.database.user,
|
||||
dbpassword = constants.ossbss.provisioning.database.pass,
|
||||
dbhost = constants.database.dbhost,
|
||||
dbport = constants.database.dbport
|
||||
}
|
||||
local dbh,err = assert(DBI.Connect('MySQL', config.dbname, config.dbuser,
|
||||
config.dbpassword, config.dbhost, config.dbport))
|
||||
if err then
|
||||
error(err)
|
||||
end
|
||||
return dbh
|
||||
end
|
||||
|
||||
function configs.get_users()
|
||||
local dbc = configs.get_connection()
|
||||
local res, err = DBI.Do(dbc,
|
||||
"select * from voip_subscribers where account_id is not null")
|
||||
dbc:close()
|
||||
if err then
|
||||
error(err)
|
||||
end
|
||||
--affected_rows
|
||||
return res
|
||||
end
|
||||
|
||||
return configs
|
@ -1,158 +0,0 @@
|
||||
-- Code from: http://lua-users.org/wiki/TextTemplate
|
||||
-- http://lua-users.org/files/wiki_insecure/users/pshook/template/Expand.lua
|
||||
local strfind = string.find
|
||||
local strsub = string.sub
|
||||
local gmatch = string.gmatch
|
||||
local push = table.insert
|
||||
local pop = table.remove
|
||||
local concat = table.concat
|
||||
|
||||
local statements = {}
|
||||
for w in gmatch('do if for while repeat', '%a+') do
|
||||
statements[w] = true
|
||||
end
|
||||
|
||||
return function (str, ...)
|
||||
assert(type(str)=='string', 'expecting string')
|
||||
local searchlist = ...
|
||||
local estring,evar
|
||||
|
||||
function estring(_str)
|
||||
local b,e,i
|
||||
b,i = strfind(_str, '%$.')
|
||||
if not b then return str end
|
||||
|
||||
local R, pos = {}, 1
|
||||
repeat
|
||||
b,e = strfind(_str, '^%b{}', i)
|
||||
if b then
|
||||
push(R, strsub(_str, pos, b-2))
|
||||
push(R, evar(strsub(_str, b+1, e-1)))
|
||||
i = e+1
|
||||
pos = i
|
||||
else
|
||||
b,e = strfind(_str, '^%b()', i)
|
||||
if b then
|
||||
push(R, strsub(_str, pos, b-2))
|
||||
push(R, evar(strsub(_str, b+1, e-1)))
|
||||
i = e+1
|
||||
pos = i
|
||||
elseif strfind(_str, '^%a', i) then
|
||||
push(R, strsub(_str, pos, i-2))
|
||||
push(R, evar(strsub(_str, i, i)))
|
||||
i = i+1
|
||||
pos = i
|
||||
elseif strfind(_str, '^%$', i) then
|
||||
push(R, strsub(_str, pos, i))
|
||||
i = i+1
|
||||
pos = i
|
||||
end
|
||||
end
|
||||
b,i = strfind(_str, '%$.', i)
|
||||
until not b
|
||||
|
||||
push(R, strsub(_str, pos))
|
||||
return concat(R)
|
||||
end
|
||||
|
||||
local function search(index)
|
||||
for _,symt in ipairs(searchlist) do
|
||||
local ts = type(symt)
|
||||
local value
|
||||
if ts == 'function' then value = symt(index)
|
||||
elseif ts == 'table'
|
||||
or ts == 'userdata' then value = symt[index]
|
||||
if type(value)=='function' then value = value(symt) end
|
||||
else error'search item must be a function, table or userdata' end
|
||||
if value ~= nil then return value end
|
||||
end
|
||||
error('unknown variable: '.. index)
|
||||
end
|
||||
|
||||
local function elist(var, v, _str, sep)
|
||||
local tab = search(v)
|
||||
if tab then
|
||||
assert(type(tab)=='table', 'expecting table from: '.. var)
|
||||
local R = {}
|
||||
push(searchlist, 1, tab)
|
||||
push(searchlist, 1, false)
|
||||
for _,elem in ipairs(tab) do
|
||||
searchlist[1] = elem
|
||||
push(R, estring(_str))
|
||||
end
|
||||
pop(searchlist, 1)
|
||||
pop(searchlist, 1)
|
||||
return concat(R, sep)
|
||||
else
|
||||
return ''
|
||||
end
|
||||
end
|
||||
|
||||
local function get(tab,index)
|
||||
for _,symt in ipairs(searchlist) do
|
||||
local ts = type(symt)
|
||||
local value
|
||||
if ts == 'function' then value = symt(index)
|
||||
elseif ts == 'table'
|
||||
or ts == 'userdata' then value = symt[index]
|
||||
else error'search item must be a function, table or userdata' end
|
||||
if value ~= nil then
|
||||
tab[index] = value -- caches value and prevents changing elements
|
||||
return value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function evar(var)
|
||||
if strfind(var, '^[_%a][_%w]*$') then -- ${vn}
|
||||
return estring(tostring(search(var)))
|
||||
end
|
||||
local _,e,cmd = strfind(var, '^(%a+)%s.')
|
||||
if cmd == 'foreach' then -- ${foreach vn xxx} or ${foreach vn/sep/xxx}
|
||||
local vn,s
|
||||
_,e,vn,s = strfind(var, '^([_%a][_%w]*)([%s%p]).', e)
|
||||
if vn then
|
||||
if strfind(s, '%s') then
|
||||
return elist(var, vn, strsub(var, e), '')
|
||||
end
|
||||
local b = strfind(var, s, e, true)
|
||||
if b then
|
||||
return elist(var, vn, strsub(var, b+1), strsub(var,e,b-1))
|
||||
end
|
||||
end
|
||||
error('syntax error in: '.. var, 2)
|
||||
elseif cmd == 'when' then -- $(when vn xxx)
|
||||
local vn
|
||||
_,e,vn = strfind(var, '^([_%a][_%w]*)%s.', e)
|
||||
if vn then
|
||||
local t = search(vn)
|
||||
if not t then
|
||||
return ''
|
||||
end
|
||||
local s = strsub(var,e)
|
||||
if type(t)=='table' or type(t)=='userdata' then
|
||||
push(searchlist, 1, t)
|
||||
s = estring(s)
|
||||
pop(searchlist, 1)
|
||||
return s
|
||||
else
|
||||
return estring(s)
|
||||
end
|
||||
end
|
||||
error('syntax error in: '.. var, 2)
|
||||
else
|
||||
if statements[cmd] then -- do if for while repeat
|
||||
var = 'local OUT="" '.. var ..' return OUT'
|
||||
else -- expression
|
||||
var = 'return '.. var
|
||||
end
|
||||
local f = assert(loadstring(var))
|
||||
local t = searchlist[1]
|
||||
assert(type(t)=='table' or type(t)=='userdata', 'expecting table')
|
||||
setfenv(f, setmetatable({}, {__index=get, __newindex=t}))
|
||||
return estring(tostring(f()))
|
||||
end
|
||||
end
|
||||
|
||||
return estring(str)
|
||||
end
|
@ -1,298 +0,0 @@
|
||||
--
|
||||
-- Copyright 2013-2020 SipWise Team <development@sipwise.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This package is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-- .
|
||||
-- On Debian systems, the complete text of the GNU General
|
||||
-- Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
--
|
||||
local expand = require 'ngcp-klish.expand'
|
||||
local cfg = require 'ngcp-klish.configs'
|
||||
local MP = require 'ngcp-klish.rtpengine'
|
||||
local ut = require 'ngcp-klish.utils'
|
||||
|
||||
-- This is not a module!! list of commands:
|
||||
-- luacheck: globals cc_stats cc_list cc_details reg_stats reg_info
|
||||
|
||||
-- templates
|
||||
local templates = {
|
||||
cc_stats=[[
|
||||
Total Concurrent Calls: $(total)
|
||||
Total Concurrent Outgoing Calls: $(peerout)
|
||||
Total Concurrent Incoming Calls: $(incoming)
|
||||
Total Concurrent Internal Calls: $(internal)
|
||||
Total Concurrent Calls with RTP: $(rtp)
|
||||
Average Amount of Calls (last hour): $(average)]],
|
||||
cc_list=[[
|
||||
| $(callid) | $(caller) | $(callee) | $(date) | $(peer) | $(rtp_ports) | $(hash) |]],
|
||||
cc_rtp_info=[[$(from_local)($(from_ip):$(from))->$(to_local)($(to_ip):$(to))]],
|
||||
reg_stats=[[
|
||||
Users: $(users)
|
||||
Users online: $(reg_users)
|
||||
Users offline: $(users-reg_users)]],
|
||||
reg_info=[[
|
||||
Address: ${address}
|
||||
Expires: ${expires}
|
||||
Call-ID: ${callid}
|
||||
CSeq: ${'cseq'}
|
||||
User-Agent: ${agent}
|
||||
Received: ${received}
|
||||
Path: ${path}
|
||||
State: ${state}
|
||||
Socket: ${socket}]]
|
||||
}
|
||||
|
||||
local patterns = {
|
||||
cc_stats = {
|
||||
total='profile:: name=total value= count=(%d+)',
|
||||
peerout='profile:: name=peerout value= count=(%d+)',
|
||||
internal='profile:: name=type value=internal count=(%d+)',
|
||||
incoming='profile:: name=type value=incoming count=(%d+)'
|
||||
},
|
||||
cc_list = {
|
||||
[1]={{'hash','state','timestart'},
|
||||
'hash:(%d+:%d+) state:(%d) ref_count:%d+ timestart:(%d+) timeout:%d+$'},
|
||||
[2]={{'callid','from_tag','to_tag'},
|
||||
'callid:([%w-%.]+) from_tag:([%w-%.]+) to_tag:([%w-%.]+)$'},
|
||||
[3]={{'from_uri','to_uri'},
|
||||
'from_uri:(sip:%w+@[%w%.]+) to_uri:(sip:%w+@[%w%.]+)$'},
|
||||
[4]={{'caller_contact'},
|
||||
'caller_contact:(sip:%w+@[%w%.]+:%d+) caller_cseq:%d+$'},
|
||||
[6]={{'callee_contact'},
|
||||
'callee_contact:(sip:%w+@%[%w%.]+:%d+) callee_cseq:%d+$'},
|
||||
},
|
||||
reg_stats = {
|
||||
reg_users='usrloc:registered_users = (%d+)'
|
||||
},
|
||||
reg_lookup = {
|
||||
[3]={address='Address: (.+)$'},
|
||||
[4]={expires='Expires: (%d+)$'},
|
||||
[6]={callid='Call%-ID: (.*)$'},
|
||||
[7]={cseq='CSeq: (%d+)$'},
|
||||
[8]={agent='User%-Agent: (.*)$'},
|
||||
[9]={received='Received: (.*)$'},
|
||||
[10]={path='Path: (.*)$'},
|
||||
[11]={state='State: (.*)$'},
|
||||
[14]={socket='Socket: (.*)$'}
|
||||
}
|
||||
}
|
||||
|
||||
-- get the stats info
|
||||
local function cc_stats_info()
|
||||
local prog_call='ngcp-kamctl proxy fifo dlg.profile_get_size'
|
||||
local args = { total="", peerout="", internal="type", incoming="type" }
|
||||
local stats = {
|
||||
rtp=-1, average=-1,
|
||||
total=-1, peerout=-1,
|
||||
internal=-1, incoming=-1
|
||||
}
|
||||
|
||||
-- get a temporary file name
|
||||
local foutput_name = os.tmpname()
|
||||
|
||||
for k,v in pairs(args) do
|
||||
local cmd = string.format('%s %s %s > %s', prog_call, v, k, foutput_name)
|
||||
if(os.execute(cmd) ~= 0) then
|
||||
os.remove(foutput_name)
|
||||
error(string.format("error executing command %s", cmd))
|
||||
end
|
||||
local foutput = io.open(foutput_name, 'r')
|
||||
for line in foutput:lines() do
|
||||
for val in string.gmatch(line, patterns.cc_stats[k]) do
|
||||
stats[k] = tonumber(val)
|
||||
end
|
||||
end
|
||||
foutput:close()
|
||||
end
|
||||
os.remove(foutput_name)
|
||||
return stats
|
||||
end
|
||||
|
||||
-- prints concurrent calls stats
|
||||
-- if result <0 it's an error
|
||||
function cc_stats()
|
||||
local stats = cc_stats_info()
|
||||
print(expand(templates.cc_stats, stats))
|
||||
end
|
||||
|
||||
-- formats the values of rtp
|
||||
-- @param t table with all the info of the call + rtp_info
|
||||
-- @return string
|
||||
local function rtp_info_prepare(t)
|
||||
local result, temp = '', {}
|
||||
if t.rtp_info then
|
||||
temp.from_local = t.rtp_info[t.from_tag]["local port"]
|
||||
temp.from = t.rtp_info[t.from_tag]["peer address"].port
|
||||
temp.from_ip = t.rtp_info[t.from_tag]["peer address"].address
|
||||
temp.to_local = t.rtp_info[t.to_tag]["local port"]
|
||||
temp.to = t.rtp_info[t.to_tag]["peer address"].port
|
||||
temp.to_ip = t.rtp_info[t.to_tag]["peer address"].address
|
||||
result = expand(templates.cc_rtp_info, temp)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
-- formats the values before output them
|
||||
-- @param t table
|
||||
-- @return table with the fields formatted
|
||||
local function cc_list_prepare(t)
|
||||
local f = {
|
||||
callid=t.callid,
|
||||
caller=ut.uri_get_username(t.from_uri),
|
||||
callee=ut.uri_get_username(t.to_uri),
|
||||
date=os.date('%Y/%m/%d %H:%M:%S', t.timestart),
|
||||
peer='',
|
||||
rtp_ports=rtp_info_prepare(t),
|
||||
hash=t.hash
|
||||
}
|
||||
return f
|
||||
end
|
||||
|
||||
-- get dlg info
|
||||
local function dlg_info(foutput)
|
||||
local result = {}
|
||||
local temp,count
|
||||
for line in foutput:lines() do
|
||||
if ut.string.starts(line,'hash') then
|
||||
if temp then result[temp.callid] = temp end
|
||||
temp = {}; count = 0
|
||||
end
|
||||
count = count + 1
|
||||
-- just parse the lines we want some info
|
||||
if patterns.cc_list[count] then
|
||||
for a,b,c in string.gmatch(line, patterns.cc_list[count][2]) do
|
||||
local temp_line = {a,b,c}
|
||||
local j = 1
|
||||
-- set the result line values with proper key
|
||||
for _,k in pairs(patterns.cc_list[count][1]) do
|
||||
temp[k] = temp_line[j]
|
||||
j = j + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
foutput:close()
|
||||
-- last item
|
||||
if temp then result[temp.callid] = temp end
|
||||
return result
|
||||
end
|
||||
|
||||
--prints concurrent calls list
|
||||
function cc_list()
|
||||
local prog_call='ngcp-kamcmd proxy dlg.list'
|
||||
local foutput = io.popen (string.format('%s', prog_call), 'r')
|
||||
local result = dlg_info(foutput)
|
||||
-- header
|
||||
print("| Call-ID | Caller | Callee | Time | Peer | RTP ports | Dialog hash |")
|
||||
for _,v in pairs(result) do
|
||||
print(expand(templates.cc_list, cc_list_prepare(v)))
|
||||
end
|
||||
end
|
||||
|
||||
-- gets the info for the callid
|
||||
local function cc_rtp_info(info)
|
||||
local result = {}
|
||||
|
||||
if info.streams then
|
||||
for _,s in ipairs(info.streams) do
|
||||
for _,s2 in ipairs(s) do
|
||||
if s2.tag and s2.tag ~= "" then
|
||||
result[s2.tag]=s2.stats.rtp
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
--get the dlg info for the callid
|
||||
local function call_info(callid, rtp_info)
|
||||
local prog_call='ngcp-kamcmd proxy dlg.dlg_list'
|
||||
local result = {}
|
||||
for k,_ in pairs(rtp_info) do
|
||||
local foutput = io.popen (string.format('%s %s %s', prog_call, callid, k), 'r')
|
||||
result = dlg_info(foutput)
|
||||
if result[callid] then
|
||||
result[callid]["rtp_info"] = rtp_info
|
||||
break
|
||||
end
|
||||
end
|
||||
if result then
|
||||
-- header
|
||||
print("| Call-ID | Caller | Callee | Time | Peer | RTP ports | Dialog hash |")
|
||||
for _,v in pairs(result) do
|
||||
print(expand(templates.cc_list, cc_list_prepare(v)))
|
||||
end
|
||||
else
|
||||
print(string.format("No callid:%s found", callid))
|
||||
end
|
||||
end
|
||||
|
||||
function cc_details(callid)
|
||||
if not callid or callid == "" then
|
||||
local stats = cc_stats_info()
|
||||
-- TODO: kamailio has to have a num offset parameter on dlg.list
|
||||
if stats.total <= 50 then
|
||||
cc_list()
|
||||
else
|
||||
print('Total concurrent calls exceed 50')
|
||||
end
|
||||
else
|
||||
local mp = MP:new()
|
||||
local rtp_info = mp:query(callid)
|
||||
if rtp_info then
|
||||
call_info(callid, cc_rtp_info(rtp_info))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function reg_stats()
|
||||
local prog_call="ngcp-kamctl proxy fifo stats.get_statistics usrloc registered_users | jq '.[0]'"
|
||||
local stats = {}
|
||||
|
||||
local foutput = io.popen (string.format('%s', prog_call), 'r')
|
||||
for line in foutput:lines() do
|
||||
for val in string.gmatch(line, patterns.reg_stats.reg_users) do
|
||||
stats.reg_users = tonumber(val)
|
||||
end
|
||||
end
|
||||
foutput:close()
|
||||
stats.users = cfg.get_users()
|
||||
print(expand(templates.reg_stats, stats))
|
||||
end
|
||||
|
||||
function reg_info(aor)
|
||||
local prog_call='ngcp-kamcmd proxy ul.lookup location'
|
||||
local result = {}
|
||||
local count = 0
|
||||
local foutput = io.popen (string.format('%s %s', prog_call, aor), 'r')
|
||||
|
||||
for line in foutput:lines() do
|
||||
count = count + 1
|
||||
-- just parse the lines we want some info
|
||||
if patterns.reg_lookup[count] then
|
||||
for k,p in pairs(patterns.reg_lookup[count]) do
|
||||
for val in string.gmatch(line, p) do
|
||||
result[k] = val
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
foutput:close()
|
||||
if not result.address then
|
||||
print("Not found")
|
||||
else
|
||||
print(expand(templates.reg_info, result))
|
||||
end
|
||||
end
|
@ -1,110 +0,0 @@
|
||||
--
|
||||
-- Copyright 2013-2020 SipWise Team <development@sipwise.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This package is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-- .
|
||||
-- On Debian systems, the complete text of the GNU General
|
||||
-- Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
--
|
||||
-- module setup
|
||||
local M = {}
|
||||
|
||||
-- importing
|
||||
local math = math
|
||||
local string = string
|
||||
|
||||
local socket = require "socket"
|
||||
local bencode = require "ngcp-klish.bencode"
|
||||
|
||||
|
||||
function M:new(o)
|
||||
o = o or {_ip='127.0.0.1', _port=2223}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
math.randomseed( os.time() )
|
||||
self._seq = 0
|
||||
self._uniq = math.random()
|
||||
return o
|
||||
end
|
||||
|
||||
function M:server(host)
|
||||
-- convert host name to ip address
|
||||
self._ip = assert(socket.dns.toip(host))
|
||||
end
|
||||
|
||||
function M:port(port)
|
||||
self._port = assert(tonumber(port))
|
||||
end
|
||||
|
||||
function M:cookie()
|
||||
self._seq = self._seq + 1
|
||||
return string.format("%s_%d", self._uniq, self._seq)
|
||||
end
|
||||
|
||||
local function _send(self, command, param)
|
||||
local message = {command=command}
|
||||
if not param then param = {} end
|
||||
for k,v in pairs(param) do
|
||||
message[k]=v
|
||||
end
|
||||
message = assert(bencode.encode(message))
|
||||
if not self._udp then
|
||||
-- create a new UDP object
|
||||
self._udp = assert(socket.udp())
|
||||
end
|
||||
|
||||
local cookie = self:cookie()
|
||||
message = string.format('%s %s', cookie, message)
|
||||
assert(self._udp:sendto(message, self._ip, self._port))
|
||||
|
||||
local res = self._udp:receive()
|
||||
local _,q = string.find(res, '^([^_]+_%d+)')
|
||||
local seq = res:sub(1,q)
|
||||
if not q or seq ~= cookie then
|
||||
error('cookie not match')
|
||||
end
|
||||
message = res:sub(q+2)
|
||||
return bencode.decode(message)
|
||||
end
|
||||
|
||||
function M:ping()
|
||||
local result = _send(self, 'ping')
|
||||
if result.result == 'pong' then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function M.offer()
|
||||
end
|
||||
|
||||
function M.answer()
|
||||
end
|
||||
|
||||
function M.delete()
|
||||
end
|
||||
|
||||
function M:query(callid, from_tag, to_tag)
|
||||
local param = {}
|
||||
param['call-id'] = callid
|
||||
param['from-tag'] = from_tag
|
||||
param['to-tag'] = to_tag
|
||||
return _send(self, 'query', param)
|
||||
end
|
||||
|
||||
function M.start_recording()
|
||||
end
|
||||
|
||||
-- end module
|
||||
return M
|
@ -1,270 +0,0 @@
|
||||
--
|
||||
-- Copyright 2013-2020 SipWise Team <development@sipwise.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This package is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-- .
|
||||
-- On Debian systems, the complete text of the GNU General
|
||||
-- Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
--
|
||||
|
||||
local utils = { table = {}, string = {}}
|
||||
|
||||
-- copy a table
|
||||
function utils.table.deepcopy(object)
|
||||
local lookup_table = {}
|
||||
local function _copy(obj)
|
||||
if type(obj) ~= "table" then
|
||||
return obj
|
||||
elseif lookup_table[obj] then
|
||||
return lookup_table[obj]
|
||||
end
|
||||
local new_table = {}
|
||||
lookup_table[obj] = new_table
|
||||
for index, value in pairs(obj) do
|
||||
new_table[_copy(index)] = _copy(value)
|
||||
end
|
||||
return setmetatable(new_table, getmetatable(obj))
|
||||
end
|
||||
return _copy(object)
|
||||
end
|
||||
|
||||
function utils.table.contains(table, element)
|
||||
if table then
|
||||
for _, value in pairs(table) do
|
||||
if value == element then
|
||||
return true
|
||||
end
|
||||
end --for
|
||||
end --if
|
||||
return false
|
||||
end
|
||||
|
||||
-- add if element is not in table
|
||||
function utils.table.add(t, element)
|
||||
if not utils.table.contains(t, element) then
|
||||
table.insert(t, element)
|
||||
end
|
||||
end
|
||||
|
||||
function utils.table.val_to_str( v )
|
||||
if "string" == type( v ) then
|
||||
v = string.gsub( v, "\n", "\\n" )
|
||||
if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then
|
||||
return "'" .. v .. "'"
|
||||
end
|
||||
return '"' .. string.gsub(v,'"', '\\"' ) .. '"'
|
||||
else
|
||||
return "table" == type( v ) and utils.table.tostring( v ) or
|
||||
tostring( v )
|
||||
end
|
||||
end
|
||||
|
||||
function utils.table.key_to_str ( k )
|
||||
if "string" == type( k ) and string.match( k, "^[_%a][_%a%d]*$" ) then
|
||||
return k
|
||||
else
|
||||
return "[" .. utils.table.val_to_str( k ) .. "]"
|
||||
end
|
||||
end
|
||||
|
||||
function utils.table.tostring( tbl )
|
||||
local result, done = {}, {}
|
||||
for k, v in ipairs( tbl ) do
|
||||
table.insert( result, utils.table.val_to_str( v ) )
|
||||
done[ k ] = true
|
||||
end
|
||||
for k, v in pairs( tbl ) do
|
||||
if not done[ k ] then
|
||||
table.insert( result,
|
||||
utils.table.key_to_str( k ) .. "=" .. utils.table.val_to_str( v ) )
|
||||
end
|
||||
end
|
||||
return "{" .. table.concat( result, "," ) .. "}"
|
||||
end
|
||||
|
||||
-- from table to string
|
||||
-- t = {'a','b'}
|
||||
-- implode(",",t,"'")
|
||||
-- "'a','b'"
|
||||
-- implode("#",t)
|
||||
-- "a#b"
|
||||
function utils.implode(delimiter, list, quoter)
|
||||
local len = #list
|
||||
if not delimiter then
|
||||
error("delimiter is nil")
|
||||
end
|
||||
if len == 0 then
|
||||
return nil
|
||||
end
|
||||
if not quoter then
|
||||
quoter = ""
|
||||
end
|
||||
local string = quoter .. list[1] .. quoter
|
||||
for i = 2, len do
|
||||
string = string .. delimiter .. quoter .. list[i] .. quoter
|
||||
end
|
||||
return string
|
||||
end
|
||||
|
||||
-- from string to table
|
||||
function utils.explode(delimiter, text)
|
||||
local list = {}
|
||||
local pos = 1
|
||||
|
||||
if not delimiter then
|
||||
error("delimiter is nil")
|
||||
end
|
||||
if not text then
|
||||
error("text is nil")
|
||||
end
|
||||
if string.find("", delimiter, 1) then
|
||||
-- We'll look at error handling later!
|
||||
error("delimiter matches empty string!")
|
||||
end
|
||||
while 1 do
|
||||
local first, last = string.find(text, delimiter, pos)
|
||||
-- print (first, last)
|
||||
if first then
|
||||
table.insert(list, string.sub(text, pos, first-1))
|
||||
pos = last+1
|
||||
else
|
||||
table.insert(list, string.sub(text, pos))
|
||||
break
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
function utils.string.starts(String,Start)
|
||||
return string.sub(String,1,string.len(Start))==Start
|
||||
end
|
||||
|
||||
function utils.string.ends(String,End)
|
||||
return End=='' or string.sub(String,-string.len(End))==End
|
||||
end
|
||||
|
||||
function utils.uri_get_username(str)
|
||||
return str:match('sip:([^@]+)')
|
||||
end
|
||||
|
||||
-- Stack Table
|
||||
-- Uses a table as stack, use <table>:push(value) and <table>:pop()
|
||||
-- Lua 5.1 compatible
|
||||
|
||||
utils.Stack = {
|
||||
__class__ = 'Stack'
|
||||
}
|
||||
local Stack_MT = {
|
||||
__tostring = function(t)
|
||||
return utils.table.tostring(utils.Stack.list(t))
|
||||
end,
|
||||
-- this works only on Lua5.2
|
||||
__len = function(t)
|
||||
return utils.Stack.size(t)
|
||||
end,
|
||||
__index = function(t,k)
|
||||
if type(k) == 'number' then
|
||||
return utils.Stack.get(t,k)
|
||||
end
|
||||
return rawget(utils.Stack,k)
|
||||
end,
|
||||
__newindex = function(t,k,v)
|
||||
if type(k) == 'number' then
|
||||
utils.Stack.set(t,k,v)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
-- Create a Table with stack functions
|
||||
function utils.Stack.new()
|
||||
local t = { _et = {} }
|
||||
setmetatable(t, Stack_MT)
|
||||
return t
|
||||
end
|
||||
|
||||
-- push a value on to the stack
|
||||
function utils.Stack:push(...)
|
||||
if ... then
|
||||
local targs = {...}
|
||||
-- add values
|
||||
for _,v in pairs(targs) do
|
||||
table.insert(self._et, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- pop a value from the stack
|
||||
function utils.Stack:pop(num)
|
||||
-- get num values from stack
|
||||
local _num = num or 1
|
||||
|
||||
-- return table
|
||||
local entries = {}
|
||||
|
||||
-- get values into entries
|
||||
for _ = 1, _num do
|
||||
-- get last entry
|
||||
if #self._et ~= 0 then
|
||||
table.insert(entries, self._et[#self._et])
|
||||
-- remove last value
|
||||
table.remove(self._et)
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
-- return unpacked entries
|
||||
return unpack(entries)
|
||||
end
|
||||
|
||||
-- get pos ( starts on 0)
|
||||
function utils.Stack:get(pos)
|
||||
assert(pos)
|
||||
assert(pos>=0)
|
||||
local indx = #self._et - pos
|
||||
if indx>0 then
|
||||
return self._et[indx]
|
||||
end
|
||||
end
|
||||
|
||||
-- set a value in a pos (stars on 0)
|
||||
function utils.Stack:set(pos, value)
|
||||
assert(pos)
|
||||
assert(pos>=0)
|
||||
local indx = #self._et - pos
|
||||
if indx>0 then
|
||||
if self._et[indx] then
|
||||
self._et[indx] = value
|
||||
else
|
||||
error("No pos:"..pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- get entries
|
||||
function utils.Stack:size()
|
||||
return #self._et
|
||||
end
|
||||
|
||||
-- list values
|
||||
function utils.Stack:list()
|
||||
local entries = {}
|
||||
for i = #self._et, 1, -1 do
|
||||
table.insert(entries, self._et[i])
|
||||
end
|
||||
return entries
|
||||
end
|
||||
-- end class
|
||||
|
||||
return utils
|
||||
--EOF
|
@ -1,65 +0,0 @@
|
||||
--
|
||||
-- Copyright 2020 SipWise Team <development@sipwise.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This package is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-- .
|
||||
-- On Debian systems, the complete text of the GNU General
|
||||
-- Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
--
|
||||
|
||||
describe("bencode", function()
|
||||
local bencode
|
||||
|
||||
setup(function()
|
||||
bencode = require("ngcp-klish.bencode")
|
||||
end)
|
||||
|
||||
it("should encode a number", function()
|
||||
assert.same('i345e', bencode.encode(345))
|
||||
end)
|
||||
|
||||
it("should encode a string", function()
|
||||
assert.same('7:g5323_1', bencode.encode('g5323_1'))
|
||||
end)
|
||||
|
||||
it("should encode a list of numbers", function()
|
||||
assert.same('li1ei2ei3ee', bencode.encode({1,2,3}))
|
||||
end)
|
||||
|
||||
it("should encode a dict with mixed values",function()
|
||||
assert.same(
|
||||
'd3:dosi2e4:tres5:three3:unoi1ee',
|
||||
bencode.encode({uno=1,dos=2,tres='three'})
|
||||
)
|
||||
end)
|
||||
|
||||
it("should decode a number", function()
|
||||
assert.same(345, bencode.decode('i345e'))
|
||||
end)
|
||||
|
||||
it("should decode a string", function()
|
||||
assert.same('g5323_1', bencode.decode('7:g5323_1'))
|
||||
end)
|
||||
|
||||
it("should decode a list of numbers", function()
|
||||
assert.same({1,2,3}, bencode.decode('li1ei2ei3ee'))
|
||||
end)
|
||||
|
||||
it("should decode a dict with mixed values",function()
|
||||
assert.same(
|
||||
{uno=1,dos=2,tres='three'},
|
||||
bencode.decode('d3:dosi2e4:tres5:three3:unoi1ee')
|
||||
)
|
||||
end)
|
||||
end)
|
@ -1,156 +0,0 @@
|
||||
--
|
||||
-- Copyright 2020 SipWise Team <development@sipwise.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This package is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-- .
|
||||
-- On Debian systems, the complete text of the GNU General
|
||||
-- Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
--
|
||||
|
||||
local assert = require("luassert")
|
||||
local say = require("say")
|
||||
|
||||
-- https://github.com/bluebird75/luaunit/blob/master/luaunit.lua
|
||||
local function _is_table_equals(actual, expected, cycleDetectTable)
|
||||
local type_a, type_e = type(actual), type(expected)
|
||||
|
||||
if type_a ~= type_e then
|
||||
return false -- different types won't match
|
||||
end
|
||||
|
||||
if type_a ~= 'table' then
|
||||
-- other typtes compare directly
|
||||
return actual == expected
|
||||
end
|
||||
|
||||
cycleDetectTable = cycleDetectTable or { actual={}, expected={} }
|
||||
if cycleDetectTable.actual[ actual ] then
|
||||
-- oh, we hit a cycle in actual
|
||||
if cycleDetectTable.expected[ expected ] then
|
||||
-- uh, we hit a cycle at the same time in expected
|
||||
-- so the two tables have similar structure
|
||||
return true
|
||||
end
|
||||
|
||||
-- cycle was hit only in actual, the structure differs from expected
|
||||
return false
|
||||
end
|
||||
|
||||
if cycleDetectTable.expected[ expected ] then
|
||||
-- no cycle in actual, but cycle in expected
|
||||
-- the structure differ
|
||||
return false
|
||||
end
|
||||
|
||||
-- at this point, no table cycle detected, we are
|
||||
-- seeing this table for the first time
|
||||
|
||||
-- mark the cycle detection
|
||||
cycleDetectTable.actual[ actual ] = true
|
||||
cycleDetectTable.expected[ expected ] = true
|
||||
|
||||
|
||||
local actualKeysMatched = {}
|
||||
for k, v in pairs(actual) do
|
||||
actualKeysMatched[k] = true -- Keep track of matched keys
|
||||
if not _is_table_equals(v, expected[k], cycleDetectTable) then
|
||||
-- table differs on this key
|
||||
-- clear the cycle detection before returning
|
||||
cycleDetectTable.actual[ actual ] = nil
|
||||
cycleDetectTable.expected[ expected ] = nil
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
for k, _ in pairs(expected) do
|
||||
if not actualKeysMatched[k] then
|
||||
-- Found a key that we did not see in "actual" -> mismatch
|
||||
-- clear the cycle detection before returning
|
||||
cycleDetectTable.actual[ actual ] = nil
|
||||
cycleDetectTable.expected[ expected ] = nil
|
||||
return false
|
||||
end
|
||||
-- Otherwise actual[k] was already matched against v = expected[k].
|
||||
end
|
||||
|
||||
-- all key match, we have a match !
|
||||
cycleDetectTable.actual[ actual ] = nil
|
||||
cycleDetectTable.expected[ expected ] = nil
|
||||
return true
|
||||
end
|
||||
local is_equal = _is_table_equals
|
||||
|
||||
local function table_findkeyof(t, element)
|
||||
-- Return the key k of the given element in table t, so that t[k] == element
|
||||
-- (or `nil` if element is not present within t). Note that we use our
|
||||
-- 'general' is_equal comparison for matching, so this function should
|
||||
-- handle table-type elements gracefully and consistently.
|
||||
if type(t) == "table" then
|
||||
for k, v in pairs(t) do
|
||||
if is_equal(v, element) then
|
||||
return k
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local function _is_table_items_equals(actual, expected )
|
||||
local type_a, type_e = type(actual), type(expected)
|
||||
|
||||
if type_a ~= type_e then
|
||||
return false
|
||||
|
||||
elseif (type_a == 'table') --[[and (type_e == 'table')]] then
|
||||
for _, v in pairs(actual) do
|
||||
if table_findkeyof(expected, v) == nil then
|
||||
return false -- v not contained in expected
|
||||
end
|
||||
end
|
||||
for _, v in pairs(expected) do
|
||||
if table_findkeyof(actual, v) == nil then
|
||||
return false -- v not contained in actual
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
||||
elseif actual ~= expected then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
--- end
|
||||
|
||||
local function set_failure_message(state, message)
|
||||
if message ~= nil then
|
||||
state.failure_message = message
|
||||
end
|
||||
end
|
||||
|
||||
local function equal_items(state, arguments)
|
||||
if _is_table_items_equals(arguments[1], arguments[2]) then
|
||||
return true
|
||||
end
|
||||
set_failure_message(state, arguments[3])
|
||||
return false
|
||||
end
|
||||
|
||||
say:set_namespace("en")
|
||||
say:set("assertion.equal_items.positive",
|
||||
"Expected objects have same items.\nPassed in:\n%s\nExpected:\n%s")
|
||||
say:set("assertion.equal_items.negative",
|
||||
"Expected objects don't have same items.\nPassed in:\n%s\nDid not expect:\n%s")
|
||||
assert:register("assertion", "equal_items", equal_items,
|
||||
"assertion.equal_items.positive", "assertion.equal_items.negative")
|
@ -1,140 +0,0 @@
|
||||
--
|
||||
-- Copyright 2020 SipWise Team <development@sipwise.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This package is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-- .
|
||||
-- On Debian systems, the complete text of the GNU General
|
||||
-- Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
--
|
||||
local bencode = require 'ngcp-klish.bencode'
|
||||
|
||||
local function msg_decode(received)
|
||||
local _,q = string.find(received, '^([^_]+_%d+)')
|
||||
local seq, message
|
||||
if q then
|
||||
seq = received:sub(1,q)
|
||||
message = received:sub(q+2)
|
||||
end
|
||||
return seq, assert(bencode.decode(message))
|
||||
end
|
||||
|
||||
local function msg_encode(seq, type, command, param)
|
||||
local message = {}
|
||||
message[type] = command
|
||||
if not param then param = {} end
|
||||
for k,v in pairs(param) do
|
||||
message[k]=v
|
||||
end
|
||||
message = assert(bencode.encode(message))
|
||||
return string.format('%s %s', seq, message)
|
||||
end
|
||||
|
||||
describe("helper functions", function()
|
||||
it("should encode", function()
|
||||
assert.same(
|
||||
'5323_1 d7:command4:pinge',
|
||||
msg_encode("5323_1", 'command', 'ping')
|
||||
)
|
||||
end)
|
||||
|
||||
it("should decode", function()
|
||||
local seq, msg = msg_decode('5323_1 d6:result4:ponge')
|
||||
assert.same('5323_1', seq)
|
||||
assert.same({result='pong'}, msg)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("rtpengine", function()
|
||||
local rtp, mp
|
||||
local socket
|
||||
|
||||
setup(function()
|
||||
end)
|
||||
|
||||
before_each(function()
|
||||
socket = {
|
||||
dns = {
|
||||
toip = true
|
||||
},
|
||||
udp = true
|
||||
}
|
||||
package.loaded['ngcp-klish.rtpengine'] = nil
|
||||
package.loaded.socket = nil
|
||||
package.preload['socket'] = function ()
|
||||
return socket
|
||||
end
|
||||
rtp = require("ngcp-klish.rtpengine")
|
||||
mp = rtp:new()
|
||||
end)
|
||||
|
||||
it("should provide uniq cookies", function()
|
||||
assert.same(tostring(mp._uniq).."_1", mp:cookie())
|
||||
assert.same(tostring(mp._uniq).."_2", mp:cookie())
|
||||
end)
|
||||
|
||||
it("should resolve host when server is called", function()
|
||||
socket.dns.toip = function(server)
|
||||
assert.same("fake.local", server)
|
||||
return "172.0.0.1"
|
||||
end
|
||||
assert.same('127.0.0.1', mp._ip)
|
||||
mp:server("fake.local")
|
||||
assert.same('172.0.0.1', mp._ip)
|
||||
end)
|
||||
|
||||
it("should have a default port", function()
|
||||
assert.same(2223, mp._port)
|
||||
end)
|
||||
|
||||
it("should support ping command", function()
|
||||
local cookie = tostring(mp._uniq).."_1"
|
||||
local message = msg_encode(cookie, 'command', 'ping')
|
||||
local response = msg_encode(cookie, 'result', 'pong')
|
||||
|
||||
local t = {
|
||||
sendto = function(_, msg, ip, port)
|
||||
assert.same(message, msg)
|
||||
assert.same(mp._ip, ip)
|
||||
assert.same(mp._port, port)
|
||||
return true
|
||||
end,
|
||||
receive = function(_) return(response) end
|
||||
}
|
||||
socket.udp = function() return t end
|
||||
assert.is_true(mp:ping())
|
||||
end)
|
||||
|
||||
it("should support query command", function()
|
||||
local cookie = tostring(mp._uniq).."_1"
|
||||
local param = {}
|
||||
param['call-id'] = 'callid1'
|
||||
local message = msg_encode(cookie, 'command', 'query', param)
|
||||
-- luacheck: ignore
|
||||
local respose_param = {created=1381997760,totals={input={rtcp={bytes=11054,packets=113,errors=0},rtp={bytes=3909179,packets=26195,errors=0}},output={rtcp={bytes=9048,packets=116,errors=0},rtp={bytes=0,packets=0,errors=0}}},streams={{{status="confirmed peer address",codec="unknown",stats={rtcp={counters={bytes=10976,packets=112,errors=0},["local port"]=30001,["advertised peer address"]={family="IPv4",port=50005,address="10.15.20.191"},["peer address"]={family="IPv4",port=50005,address="10.15.20.191"}},rtp={counters={bytes=3908936,packets=26194,errors=0},["local port"]=30000,["advertised peer address"]={family="IPv4",port=50004,address="10.15.20.191"},["peer address"]={family="IPv4",port=50004,address="10.15.20.191"}}},
|
||||
tag="callid1"},{status="known but unconfirmed peer address",stats={rtcp={counters={bytes=8970,packets=115,errors=0},["local port"]=30003,["advertised peer address"]={family="IPv4",port=50007,address="10.15.20.191"},["peer address"]={family="IPv4",port=50007,address="10.15.20.191"}},rtp={counters={bytes=0,packets=0,errors=0},["local port"]=30002,["advertised peer address"]={family="IPv4",port=50006,address="10.15.20.191"},["peer address"]={family="IPv4",port=50006,address="10.15.20.191"}}},tag="7A4FE68B-525F9CC000060653-E28A0700"}},{{status="known but unconfirmed peer address",codec="unknown",stats={rtcp={counters={bytes=78,packets=1,errors=0},["local port"]=0,["advertised peer address"]={family="IPv6",port=0,address="::"},["peer address"]={family="IPv6",port=0,address="::"}},rtp={counters={bytes=243,packets=1,errors=0},["local port"]=0,["advertised peer address"]={family="IPv6",port=0,address="::"},["peer address"]={family="IPv6",port=0,address="::"}}},tag=""},{status="known but unconfirmed peer address",stats={rtcp={counters={bytes=78,packets=1,errors=0},["local port"]=0,["advertised peer address"]={family="IPv6",port=0,address="::"},["peer address"]={family="IPv6",port=0,address="::"}},rtp={counters={bytes=0,packets=0,errors=0},["local port"]=0,["advertised peer address"]={family="IPv6",port=0,address="::"},["peer address"]={family="IPv6",port=0,address="::"}}},tag=""}}}}
|
||||
local response = msg_encode(cookie, 'result', 'ok', respose_param)
|
||||
|
||||
local t = {
|
||||
sendto = function(_, msg, ip, port)
|
||||
assert.same(message, msg)
|
||||
assert.same(mp._ip, ip)
|
||||
assert.same(mp._port, port)
|
||||
return true
|
||||
end,
|
||||
receive = function(_) return(response) end
|
||||
}
|
||||
socket.udp = function() return t end
|
||||
assert.same('ok', mp:query('callid1').result)
|
||||
end)
|
||||
end)
|
@ -1,172 +0,0 @@
|
||||
--
|
||||
-- Copyright 2020 SipWise Team <development@sipwise.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This package is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-- .
|
||||
-- On Debian systems, the complete text of the GNU General
|
||||
-- Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
--
|
||||
|
||||
describe("utils", function()
|
||||
local ut
|
||||
local simple_hash
|
||||
local simple_list
|
||||
local complex_hash
|
||||
|
||||
setup(function()
|
||||
ut = require("ngcp-klish.utils")
|
||||
end)
|
||||
|
||||
before_each(function()
|
||||
simple_hash = {
|
||||
one = 1, two = 2, three = 3
|
||||
}
|
||||
simple_list = {
|
||||
1, 2, 3
|
||||
}
|
||||
complex_hash = {
|
||||
cone = simple_list,
|
||||
ctwo = simple_hash
|
||||
}
|
||||
end)
|
||||
|
||||
describe("table", function()
|
||||
it("deepcopy", function()
|
||||
local res = ut.table.deepcopy(simple_hash)
|
||||
assert.same(res, simple_hash)
|
||||
assert.is_not(res, simple_hash)
|
||||
end)
|
||||
|
||||
it("contains should find the value", function()
|
||||
assert.True(ut.table.contains(simple_hash, 3))
|
||||
end)
|
||||
|
||||
it("contains should not find the value", function()
|
||||
assert.False(ut.table.contains(simple_hash, 4))
|
||||
end)
|
||||
|
||||
it("contains should not find anything in nil", function()
|
||||
assert.False(ut.table.contains(nil))
|
||||
end)
|
||||
|
||||
it("contains should throw an error with a string", function()
|
||||
local f = function()
|
||||
ut.table.contains("hola", 1)
|
||||
end
|
||||
assert.has_error(f,
|
||||
"bad argument #1 to 'pairs' (table expected, got string)")
|
||||
end)
|
||||
|
||||
it("add", function ()
|
||||
assert.same(simple_list, {1,2,3})
|
||||
ut.table.add(simple_list, 1)
|
||||
assert.same(simple_list, {1,2,3})
|
||||
ut.table.add(simple_list, 5)
|
||||
assert.same(simple_list, {1,2,3,5})
|
||||
ut.table.add(simple_list, 4)
|
||||
assert.same(simple_list, {1,2,3,5,4})
|
||||
end)
|
||||
|
||||
it("tostring", function()
|
||||
local f = function()
|
||||
ut.table.tostring("nil")
|
||||
end
|
||||
assert.has_error(f)
|
||||
assert.same(ut.table.tostring(simple_list), "{1,2,3}")
|
||||
assert.not_nil(ut.table.tostring(simple_hash))
|
||||
assert.not_nil(ut.table.tostring(complex_hash))
|
||||
end)
|
||||
end) -- end table
|
||||
|
||||
it("implode", function()
|
||||
assert.same(ut.implode(',', simple_list, "'"), "'1','2','3'")
|
||||
end)
|
||||
|
||||
it("implode should error with nil string", function()
|
||||
local f = function()
|
||||
ut.implode(nil, simple_list, "'")
|
||||
end
|
||||
assert.has_error(f)
|
||||
end)
|
||||
|
||||
it("implode should error with nil table", function()
|
||||
local f = function()
|
||||
ut.implode(',', nil, "'")
|
||||
end
|
||||
assert.has_error(f)
|
||||
end)
|
||||
|
||||
it("explode", function()
|
||||
assert.equal_items(ut.explode(',',"1,2,3"), {'1','2','3'})
|
||||
assert.equal_items(ut.explode('=>',"1=>2=>3"), {'1','2','3'})
|
||||
end)
|
||||
|
||||
describe("string", function()
|
||||
|
||||
it("starts should error with nil", function()
|
||||
local f = function()
|
||||
ut.string.stats(nil, "g")
|
||||
end
|
||||
assert.has_error(f)
|
||||
assert.has_error(function() ut.string.stats("goga", nil) end)
|
||||
end)
|
||||
|
||||
it("starts", function()
|
||||
assert.True(ut.string.starts("goga", "g"))
|
||||
assert.True(ut.string.starts("goga", "go"))
|
||||
assert.True(ut.string.starts("goga", "gog"))
|
||||
assert.True(ut.string.starts("goga", "goga"))
|
||||
assert.False(ut.string.starts("goga", "a"))
|
||||
assert.True(ut.string.starts("$goga", "$"))
|
||||
assert.True(ut.string.starts("(goga)", "("))
|
||||
end)
|
||||
|
||||
it("ends should error with nil", function()
|
||||
assert.has_error(function() ut.string.ends(nil, "g") end)
|
||||
assert.has_error(function() ut.string.ends("goga", nil) end)
|
||||
end)
|
||||
|
||||
it("ends", function()
|
||||
assert.True(ut.string.ends("goga", "a"))
|
||||
assert.True(ut.string.ends("goga", "ga"))
|
||||
assert.True(ut.string.ends("goga", "oga"))
|
||||
assert.True(ut.string.ends("goga", "goga"))
|
||||
assert.False(ut.string.ends("goga", "f"))
|
||||
end)
|
||||
end) -- end string
|
||||
|
||||
describe("uri_get_username", function()
|
||||
it("should wotk with dns", function()
|
||||
assert.same(
|
||||
'vseva',
|
||||
ut.uri_get_username('sip:vseva@fake.local')
|
||||
)
|
||||
end)
|
||||
|
||||
it("should wotk with ipv4", function()
|
||||
assert.same(
|
||||
'vseva',
|
||||
ut.uri_get_username('sip:vseva@127.0.0.1:50602')
|
||||
)
|
||||
end)
|
||||
|
||||
it("should wotk with ipv6", function()
|
||||
local t = 'sip:vseva@[2620:0:2ef0:7070:250:60ff:fe03:32b7]:5060;transport=tcp'
|
||||
assert.same(
|
||||
'vseva',
|
||||
ut.uri_get_username(t)
|
||||
)
|
||||
end)
|
||||
end)
|
||||
end)
|
@ -1,42 +0,0 @@
|
||||
# DOCKER_NAME=ngcp-klish-config-bullseye
|
||||
FROM docker.mgm.sipwise.com/sipwise-bullseye:latest
|
||||
|
||||
# Important! Update this no-op ENV variable when this Dockerfile
|
||||
# is updated with the current date. It will force refresh of all
|
||||
# of the base images and things like `apt-get update` won't be using
|
||||
# old cached versions when the Dockerfile is built.
|
||||
ENV REFRESHED_AT 2021-05-03
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install --assume-yes \
|
||||
jq \
|
||||
lua-busted \
|
||||
lua-dbi-mysql \
|
||||
lua-socket \
|
||||
lua-yaml \
|
||||
lua5.2
|
||||
|
||||
RUN echo './t/testrunner' >>/root/.bash_history
|
||||
|
||||
WORKDIR /code/
|
||||
|
||||
################################################################################
|
||||
# Instructions for usage
|
||||
# ----------------------
|
||||
# To build the base image from scratch (or jump to the next section if
|
||||
# you do not want to build it yourself):
|
||||
#
|
||||
# % docker build --tag="ngcp-klish-config-bullseye" -f t/Dockerfile .
|
||||
# % docker run --rm -i -t -v $(pwd):/code:rw ngcp-klish-config-bullseye:latest bash
|
||||
#
|
||||
# To use the existing docker image:
|
||||
#
|
||||
# % docker pull docker.mgm.sipwise.com/ngcp-klish-config-bullseye
|
||||
# NOTE: run the following command from the root folder of the git repository:
|
||||
# % docker run --rm -i -t -v $(pwd):/code:rw \
|
||||
# docker.mgm.sipwise.com/ngcp-klish-config-bullseye:latest bash
|
||||
#
|
||||
# Inside docker (the command is in the history, just press the UP button):
|
||||
# ./t/testrunner
|
||||
#
|
||||
################################################################################
|
@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
# This script is used for running the tests with proper arguments
|
||||
# from within Jenkins
|
||||
|
||||
set -e
|
||||
set -u
|
||||
set -x
|
||||
|
||||
if [ -d /results ] ; then
|
||||
# Running from Jenkins (RW)
|
||||
RESULTS="/results"
|
||||
cd "/code"
|
||||
else
|
||||
# Running locally in Docker
|
||||
RESULTS="./results"
|
||||
mkdir -p "${RESULTS}"
|
||||
fi
|
||||
|
||||
busted -o junit > ${RESULTS}/test_busted.xml
|
Loading…
Reference in new issue