aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests
AgeCommit message (Collapse)AuthorFilesLines
2013-07-31nat: Implement a post-routing for the NAT softwareHolger Hans Peter Freyther3-0/+70
* The post-routing is applied after the first re-writing. To do this the new number is copied back into the called data structure. * Add a testcase that goes from 0172 to 0049 and then back to 0049 using the post rule with a table lookup.
2013-07-31nat: Fix some memory leaks in the testcases.Holger Hans Peter Freyther1-0/+5
The test cases did not free some of the resources it allocated. Improve the situation a bit. There is still data allocated that is not freed at exit.
2013-07-31nat: Allow to use the prefix lookup to rewrite numbersHolger Hans Peter Freyther5-1/+76
* Increase the rewritten rule to five digits (this is the easiest for the unit test). This will add another 40kb to the runtime size. * Create a unit test that tests adding and removing the prefix rules. * Use the regexp match to replace from one package
2013-07-31nat: Introduce a prefix lookup tree (trie) for number rewritingHolger Hans Peter Freyther6-1/+159
* It is a trie. The max depth of the trie is the length of the longest prefix. The lookup is O(lookuped_prefix), but as the prefix length is limited, the lookup time is constant. * Each node can hold the entire prefix, has place for the rewrite rule with up to three digits. * A trie with 20k entries will take about 3MB ram. * Filling the trie 100 times takes ~800ms on my i7 laptop * 10.000.000 lookups take 315ms.. (for the same prefix). * 93/99 lines are tested, 6/6 functions are tested, 49 of 54 branches are tested. Only memory allocation failures are not covered * A late addition is to handle the '+' sign and to increase the number of chars in the rewrite prefix. The timing/line coverage has not been updated after this change.
2013-07-31nat: Add a no number-rewrite command and call it through a VTY testHolger Hans Peter Freyther1-2/+6
The test is just testing the invocation but does not verify that the side effect of this call. It is good enought for now.
2013-07-27tests: TestCase.assertGreater is not available on Python 2.5Holger Hans Peter Freyther1-2/+2
The jenkins build node has Python 2.5.X installed and the assertGreater method is not available. Use assert_ until we can use newer versions of Python.
2013-07-27expiration: Allow to disable the periodic location updating procedureHolger Hans Peter Freyther1-0/+32
Disable the periodic LU using "no periodic location update" VTY command. In that case set the expire_lu to 0 which will then be translated to a NULL in the database layer. This leads to a bit of copy and paste in the db_sync_subscriber method but I don't see how we could easily use 'datetime(%i, 'unixepoch')' and 'NULL' at the same time. Change the query to find expired queries to check for NOT NULL and the time being in the past. This means if there are still old subscribers in the database they might not be expired. One would need to execute a query like "UPATE Subscriber SET expire_lu = 0 WHERE expire_lu is null". The same applies when disabling the periodic LU. One would need to update the database by hand. Manual tests executed/passed: 1.) periodic LU enabled: * use gst LUTest.st to do a LU * UPDATE Subscriber SET expire_lu=datetime('now'); * observe the subscriber being expired (it was) 2.) periodic LU disabled: * use gst LUTest.st to do a LU * verify that the expire_lu is NULL in the database
2013-07-27expiration: Speculative fixes for the periodic expiring handlingHolger Hans Peter Freyther1-0/+1
We were expiring subscribers during active calls. This is because the T3212 is stopped under certain conditions but we didn't stop that timer at all. Remember if T3212 timer was stopped due something done by NITB and update the expiration time at the end of the radio connection, as the phone should restart it when returning to MM Idle. It is a bit difficult to decide when we should set the flag. E.g. in a CM Service Request we don't know if we accept the service and during a LU we already send MM messages before we accept or reject the subscriber. The easiest is to set the flag when receiving a paging response on known subscribers and at the end of the authentication process. Do not expire a subscriber that has an active connection that is marked with the flag, e.g. we would still expire a subscriber that is being paged. Manual tests executed/passed: * gst LUTest.st verified that a expiration date was set * gst SMSTest.st (doing another LU but forcing a timeout on the SMS sending). Verified that the expire_lu was updated.
2013-07-27smpp: Move the coding/mode detection into a utils fileHolger Hans Peter Freyther7-0/+101
Make sure to not ever have issues with this code again, move the utility code to a new file and create a basic testcase. The method currently has 100% line and branch coverage. My initial patched missed the smpp_utils.c file and I re-did the copying (and verifying the branch coverage)
2013-07-04nat: The second call didn't really add anything to the test.Holger Hans Peter Freyther1-3/+0
Avoid: Coverity CID 1042323
2013-06-24tests: Add a custom test runner to test the VTY functionality.Holger Hans Peter Freyther2-1/+112
Begin with the NAT code. It is not clear yet if we will have one file with all the tests or will have a sub directory with *.py files. In the long run the base class will move to the osmo-python-tests module.
2013-06-24Introduced support for external python testsKaterina Barone-Adesi1-0/+11
The test scripts warn about missing documentation, untested configs, check common errors, and stub out testing individual VTY commands. The scripts have been moved to the another osmocom repository, python/osmo-python-tests The features were requested by zecke.
2013-06-12Makefile.am: Use AM_CPPFLAGSAlexander Huemer8-8/+8
Since automake 1.13 INCLUDES is depricates and causes a warning
2013-04-16nat: Extract the LAC/CI from the Complete Layer3 InformationHolger Hans Peter Freyther2-0/+36
Find the Cell Identifier from the Complete Layer3 Information and store it for future reference. We could begin to verify that the LAC/CI used really belongs to the BSC.
2013-04-16nat: Rename "struct sccp_connections" to "struct nat_sccp_connection"Holger Hans Peter Freyther1-7/+7
The name sccp_connection is used in the osmo-sccp code, sccp_connections was used in the NAT for tracking a sccp_connection. Rename it so it is obvious that the struct belongs to the nat. The rename was done with sed: $ sed -i s,"struct sccp_connections","struct nat_sccp_connection",g \ include/openbsc/*.h src/osmo-bsc_nat/* tests/*/*
2013-04-16nat: Allow to re-write international numbers in the CC Setup messagesHolger Hans Peter Freyther2-2/+75
Prepend the international number with a '+' and then do the normal re-writing on it. There are a couple of ways to handle this: \+([0-9]), \+[0-9][0-9]([0-9]), \+49([0-9]) Add a test case for the international re-write based on an already internationalized number.
2013-04-16nat: We want the remote to respond to our DLCX requestHolger Hans Peter Freyther4-0/+30
We want to send a TRAP with the MGCP statistics from the NAT and the connected BSC. The BSC endpoint can be either released because of a DLCX from the MGCP CallAgent or the SCCP Connection release on the A-link. This is why we need to queue the statistics when the deleting the endpoint on the BSC. The processing is continued once the response arrives. This code assumes that the response of the DLCX will be sent by the remote side. The current amount of outstanding responses can be seen on the VTY. This assumption is based on the fact that the BSC has already responded to the CRCX and maybe to the MDCX. The MGCP RFC is bended to prefix the transaction identifier with "nat-" to easily detect the response and hand it to the handler. This will then parse the response and generate the TRAP. The current version is v1. We assume that the transaction space is big enough and we will not re-assign the transaction identifier too early.
2013-04-16nat: Make it possible to send MGCP messages through the IPA multiplexHolger Hans Peter Freyther1-0/+6
Instead of handling MGCP through the UDP socket, read and write messages through the ipa connection to the MSC.
2013-03-21db: Link to the VTY library for the vty_config_unlock symbolHolger Hans Peter Freyther1-1/+1
Linking started to fail for me due the symbol coming from the vty library and the db code not linking to it.
2013-01-07nat: Introduce a global IMSI barr list using red-black treesHolger Hans Peter Freyther6-1/+97
2013-01-07nat: Allow the filter to select the reject causeHolger Hans Peter Freyther1-5/+10
In preparation for another kind of black-list allow the filter code to decide how the connection should be rejected. Introduce a new struct that will carry the reject causes for certain operations.
2013-01-07nat: Move the IMSI/TMSI filtering to a new and dedicated fileHolger Hans Peter Freyther1-0/+1
Move all routines related to filtering to a separate file.
2013-01-07nat: Extract the message re-writing from the utils to a dedicated fileHolger Hans Peter Freyther1-0/+1
Move the code around to make it more clear what the routines should do.
2012-12-26tests: Don't delete atconfig in cleanDaniel Willmann1-1/+1
This file is created in ./configure so we shouldn't remove it with make. Otherwise ./configure && make clean && make check fails with: make[3]: *** No rule to make target `atconfig', needed by `check-local'. Stop.
2012-12-26abis_test: Fix the test case and calculate the right offsetHolger Hans Peter Freyther2-4/+4
We parse the load_config, take the ptrdiff_t from start and load_config and from the previous array as the alignment can differ on different ABIs. This was found by Daniel when executing the tests on a 64 bit userspace.
2012-12-19abis: Activate the newest available installed on the BTSHolger Hans Peter Freyther2-8/+67
Select thew newest software from all available file versions.
2012-12-19abis: Create a routine that can parse all SW Descriptions of a SW ConfigHolger Hans Peter Freyther5-1/+151
Be able to parse the entire SW Config IE. Parse the SW Descruption into a struct provided by the caller.
2012-12-10mgcp: Test and implement re-transmission handlingHolger Hans Peter Freyther2-5/+64
MGCP is used over UDP and a response might be lost. The MGCP RFC asks for keeping a list of responses and then using the previous response to answer a duplicate request. I tried to conserve memory and just wanted to remember the last transaction identifier and result-code and re-generate the result from that. This made the code look bad and this is why the entire response will now be stored. It sadly increases the memory usage but can not be avoided at this time. Remove the msg->l3h pointer for the RQNT callback as strtok has modified the content of it.
2012-12-10mgcp: Add testdata for MDCX handlingHolger Hans Peter Freyther2-0/+21
2012-12-10mgcp: Test the second CRCX as a CRCX and not as a re-transmissionHolger Hans Peter Freyther2-2/+14
The second CRCX would be mostly ignored and be handled by the retransmission layer of MGCP.
2012-11-29mgcp: Begin handling of the RQNT message as needed for DTMFHolger Hans Peter Freyther2-0/+60
Introduce a callback for the request and forward the signalrequest to the callback. This is not a full implementation of MGCP RQNT.
2012-11-24tests: Fix build of 'db' test after smpp mergeHarald Welte1-2/+2
2012-11-12mgcp: Send the jitter statistics at the end of the callHolger Hans Peter Freyther1-1/+1
2012-11-12mgcp: Calculate the packet loss as of Appendix A of RFC 3550Holger Hans Peter Freyther2-3/+58
Calculate the expected packages and packet loss as of RFC 3550. The values should be clamped but our packet loss counter is 32 bits and not 24 and we should clamp at other values but I am waiting for some issues first before dealing with that.
2012-11-12mgcp: Include statistics at the end of a connectionHolger Hans Peter Freyther2-0/+9
Follow the MGCP specification and send the collected statistics at the end of a call. Right now this does not include jitter, packet loss and delay.
2012-11-07nat: Inject a a=fmtp:%d to force the right AMR codeHolger Hans Peter Freyther1-3/+3
This assumes that AMR is used and/or the mode-set is ignored for other codecs by the remote end.
2012-10-22si: Partially implement the range encoding for the SI.Holger Hans Peter Freyther5-1/+195
I saw the old copy of the "Appendix J" code too late and I have discovered some quirks and I am more familar with my implementation. Most noticable 'w' only needs to be as big as the input arfcn but requires the 'w' to be initialized. The power_of_2 implementation differs as well (mine matches the output of wirehsark). The f0 could be chosen in a better way but right now picking the lower bound is the easiest. It is not clear if to use modulo if the range is chosen in the middle. This can be improved in the future. Right now I have no bit fiddling for range128, 256 and 1024 as I was running out of time.
2012-10-04tests: Remove the debug/logging test as it is in libosmocore nowHolger Hans Peter Freyther3-50/+1
2012-03-26nat: Add another test case for TP-SRR clearing and number rewriteHolger Hans Peter Freyther2-3/+42
2012-03-16mgcp: implement a more tolerant parser based on strtok_r()Harald Welte1-2/+0
Instead of building complex manual byte-wise parsers, we simply use two strtok_r loops: one iterating over all the lines, the next one iterating over the invididual space-separated elements in the first line. The benefit is that we now accept \r, \n or \r\n, or any multiple of them as line ending. This works around incompliant MGCP implementations like that of Zynetix MSC. Addition: mgcp_analyze_header returns 0 when all out parameters have been set. Signed-off-by: Holger Hans Peter Freyther <zecke@selfish.org>
2012-03-16mgcp_test: Add wrong messages as input and check what happensHolger Hans Peter Freyther2-2/+30
Test parsing some invalid messages and see if we start to crash.
2012-03-16mgcp_test: Rename method as it now operates on an array of messagesHolger Hans Peter Freyther1-2/+2
This code was cleaned up, catch up and rename the method.
2012-01-27MGCP: Add CRCX test casesHarald Welte1-0/+29
The second test case (CRCX_ZYN) fails as the message is not compliant with the spec. However, our parer should be more tolerant, just in case...
2012-01-27further generalize mgcp testing codeHarald Welte1-19/+30
use a data-structure driven approach
2012-01-27mgcp_test: remove duplicate codeHarald Welte1-13/+6
2012-01-18nat: Internationalize the TP-DA if it starts with a 00Holger Hans Peter Freyther1-4/+4
Internationalize the number like we do it for Call Control. Update the test result to match this new behavior.
2012-01-18nat: Prepare to rewrite the TP-DA number of a SMS submit.Holger Hans Peter Freyther3-2/+56
Introduce number rewriting of SMS-SUBMIT. Introduce a new list, move code around to help with finding a new number, somehow the number encoding for TP-DA is borked, 03.40 references 04.11 but the length appears to be strlen(number) without taken the type field into account.
2012-01-18nat: Print the sizes and the offending data in case of a failureHolger Hans Peter Freyther1-1/+5
2012-01-15nat: Add the bsc_data.c file to the EXTRA_DISTHolger Hans Peter Freyther1-1/+1
2012-01-15abis: gsm_data_shared.h includes libosmo-abis header, add abis to cflagsHolger Hans Peter Freyther2-2/+2
gsm_data_shared.h includes e1_input.h of libosmo-abis, add the LIBOSMOABIS_CFLAGS to Makefile.am, remove AM_LDFLAGS at the same time as we only build .a archives.