Created attachment 14146 [details] [review] Bug 9288 - Add a script to test SIP from the command line This is a very basic start to a sip server testing script. I imagine we will want to make it interactive in end, essentially replicating what a SIP based self-checkout machine does.
Created attachment 14147 [details] [review] Bug 9288 - Add a script to test SIP from the command line This is a very basic start to a sip server testing script. I imagine we will want to make it interactive in end, essentially replicating what a SIP based self-checkout machine does.
Created attachment 14148 [details] [review] Bug 9288 - Add a script to test SIP from the command line This is a very basic start to a sip server testing script. I imagine we will want to make it interactive in end, essentially replicating what a SIP based self-checkout machine does.
Created attachment 14149 [details] [review] Bug 9288 - Add a script to test SIP from the command line This is a very basic start to a sip server testing script. I imagine we will want to make it interactive in end, essentially replicating what a SIP based self-checkout machine does.
Created attachment 14150 [details] [review] Bug 9288 - Add a script to test SIP from the command line This is a very basic start to a sip server testing script. I imagine we will want to make it interactive in end, essentially replicating what a SIP based self-checkout machine does.
Created attachment 14635 [details] [review] Bug 9288 - Add a script to test SIP from the command line This is a very basic start to a sip server testing script. I imagine we will want to make it interactive in end, essentially replicating what a SIP based self-checkout machine does.
Created attachment 14640 [details] [review] Bug 9288 - Add a script to test SIP from the command line This is a very basic start to a sip server testing script. I imagine we will want to make it interactive in end, essentially replicating what a SIP based self-checkout machine does.
I tried the script and managed to have a successfull connection. An interactive script simulating a self checkout machine will indeed be very useful! Still, I have a few remarks : 1/ I had to manually set the file as executable, the patch should include the exec permission. 2/ At firt, I executed the script without argument, this results in an error message, it would be nice to have a little help display (like with cleanup_database.pl for example). 3/ If a help text is included, maybe should it also be related to the -h and --help options? But that would mean changing the --host parameter (maybe it could become -a --address?) The 1st point seems mandatory to me for a sign off, I'd sign without pts 2 and 3 being included but it could give a better consistency to our scripts.
It may be good also to give this script a more explicit name. Something like "sip_sc_emulator.pl" or anything explaining exactly what it is intented to be. Saying this because I developped a small testing script too. They won't do the same thing so we may end up using both of them. The script I'm working on will simply send/receive SIP messages based on a list of commands stored in a text file. Useful when I want to quickly test several time the same command chain.
Created attachment 18203 [details] [review] Bug 9288 - Add a script to test SIP from the command line This is a very basic start to a sip server testing script. I imagine we will want to make it interactive in end, essentially replicating what a SIP based self-checkout machine does.
Created attachment 18268 [details] [review] Bug 9288 - Add a script to test SIP from the command line Tested OK for me.
Created attachment 19106 [details] [review] Bug 9288 - Add a script to test SIP from the command line This is a very basic start to a sip server testing script. I imagine we will want to make it interactive in end, essentially replicating what a SIP based self-checkout machine does. Signed-off-by: Adrien Saurat <adrien.saurat@biblibre.com> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
This looks like this could become the core of a Nagios check for the SIP server. However, it doesn't work for me, as it hangs after sending the 93 login message, never receiving the response. I tested with both an Evergreen SIP server and a Koha one. Tacking on the following line will probably make it work: $/ = "\r"; However, since not all SIP devices agree on the terminator character, even better would be to use something other than <$socket> to fetch from the socket. Also, this patch would introduce new code that violates PERL2: http://wiki.koha-community.org/wiki/Coding_Guidelines#PERL2:_Modern::Perl. While perhaps a little laxity on the coding guidelines might be OK for test code, I'm drawing a firm line in the sand regarding PERL2: all new code *must* have strictures and warnings enabled. Or be accompanied by a note signed by Larry Wall _and_ Damien Conway explaining in detail why strictures and warnings should be turned off. :)
Created attachment 19476 [details] [review] Bug 9288 - Add a script to test SIP from the command line - QA Followup
Galen, is this what you are looking for? I have no idea why strictures weren't enabled, my bad! I've also made the message terminator configurable from the command line, defaulting to CRLF.
Hi Kyle, i am trying to figure out SIP right now and was hoping to use your script. But I am running into problems - with your follow up, it looks like this: patron admin --password admin main::help() called too early to check prototype at ./sip_cli_emulator.pl line 46. Use of uninitialized value $terminator in string eq at ./sip_cli_emulator.pl line 50. OUTBOUND: 9300CNsip|COsip|CPMPL| Use of uninitialized value $data in concatenation (.) or string at ./sip_cli_emulator.pl line 69. INBOUND: Use of uninitialized value $data in pattern match (m//) at ./sip_cli_emulator.pl line 71. Login Failed! Without, the warns are gone, but my login still fails?
Katrin, it looks like the full set of parameters you passed to the script didn't get pasted in correctly. Can you please repost your parameters? Kyle
Ah, I see. I used the same paraemters with and without the follow up - one time with errors, the other now. I had all parameters in the sequence suggested and always the long form -- as the short form seemed to give me some trouble.
Kyle, could you give an example on how to call the script that works for you?
Setting to failed to get Kyle's attention to comment#18
Try it like this: misc/sip_cli_emulator.pl --address my.library.org --port 6001 --sip_user my_sip_user --sip_pass MyPassw0rd --location MPL --patron kylemhall --password letmein --terminator CRLF
Created attachment 21278 [details] [review] Bug 9288 - Add a script to test SIP from the command line - QA Followup 2
Hi Kyle, it works now - using this line: misc/sip_cli_emulator.pl --a localhost --port 6001 --sip_user xxx --sip_pass xxx --location CPL --patron xxx --password xxx But I see 2 warnings, could you please fix those? main::help() called too early to check prototype at misc/sip_cli_emulator.pl line 46. Use of uninitialized value $terminator in string eq at misc/sip_cli_emulator.pl line 50.
Created attachment 22286 [details] [review] Bug 9288 - Add a script to test SIP from the command line - QA Followup 3
Created attachment 22443 [details] [review] [PASSED QA] Bug 9288 - Add a script to test SIP from the command line This is a very basic start to a sip server testing script. I imagine we will want to make it interactive in end, essentially replicating what a SIP based self-checkout machine does. Signed-off-by: Adrien Saurat <adrien.saurat@biblibre.com> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Passes all tests and QA script.
Created attachment 22444 [details] [review] [PASSED QA] Bug 9288 - Add a script to test SIP from the command line - QA Followup Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Created attachment 22445 [details] [review] [PASSED QA] Bug 9288 - Add a script to test SIP from the command line - QA Followup 2 Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Created attachment 22446 [details] [review] [PASSED QA] Bug 9288 - Add a script to test SIP from the command line - QA Followup 3 Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works now ok for me, no more warnings. Started SIP server and used: misc/sip_cli_emulator.pl --a 127.0.0.1 --port 6001 --sip_user sip --sip_pass sip --location MPL --patron sip --password sip
Sorry Kyle, I missed this from the QA script: FAIL misc/sip_cli_emulator.pl OK pod OK forbidden patterns OK valid FAIL critic Subroutine prototypes used at line 115, column 1. See page 194 of PBP.
That's odd. I'm not getting that fail! 08:01 ~/kohaclone (bug9288-qa $% u+4)$ koha-qa.pl -v 2 -c 1 testing 1 commit(s) (applied to 4d3558a 'Bug 9288 - Add a script to test SIP f') OK misc/sip_cli_emulator.pl OK pod OK forbidden patterns OK valid 0 OK critic (In reply to Katrin Fischer from comment #30) > Sorry Kyle, I missed this from the QA script: > > FAIL misc/sip_cli_emulator.pl > OK pod > OK forbidden patterns > OK valid > FAIL critic > Subroutine prototypes used at line 115, column 1. See page 194 of PBP.
Hi Kyle, I reran the test, the result is the same: testing 4 commit(s) (applied to e815131 'Bug 10138: (follow-up) FIX sql errors') FAIL misc/sip_cli_emulator.pl OK pod OK forbidden patterns OK valid FAIL critic Subroutine prototypes used at line 115, column 1. See page 194 of PBP. Maybe someone else can test - did you check line 115?
Created attachment 23873 [details] [review] Bug 9288 - Add a script to test SIP from the command line - QA Followup 4
Setting to passed qa on the assumption that this was the only remaining issue. If I am wrong please update the status!
The QA script passes now for me.
Pushed to master. You may be amused to hear that I tested it successfully with an Evergreen SIP server. Thanks, Kyle!
Pushed to 3.14.x, will be in 3.14.10
Picked for 3.12.15!
This is very cool!