Commit Graph

27 Commits

Author SHA1 Message Date
Harald Welte 7c083af2d2 remsim: server: TC_connect_{client,bankd}_duplicate
Add two new tests for the remsim-server, which simulate what happens
if a client or bankd with identical ID connects twice.  We expect
the second connection to get rejected at RSPRO level, and to be closed.

Change-Id: I29023f6b5ba430338c77bf01508c81bd6d8c99fa
Ralated: OS#5527
2022-05-04 10:08:44 +00:00
Harald Welte 67881aef23 Avoid generating zero-length packets
I used the construct like f_rnd_octstring(f_rnd_int(100)) in a number
of places to generate random-length packets with randomized length.

The problem I didn't realize is that f_rnd_int() of course can also
return '0', which would generate zero-length packets.  This may be
permitted in some protocols, but it leads to problems e.g. when trying
to send a UDP packet of zero length (which the kernel will not do).

So let's introduce
* f_rnd_int_nonzero() for returning non-zero randomized integers
* f_rnd_octstring_rnd_len() for returning a random-length random payload
  octet string
* replace all f_rnd_octstring(f_rnd_int()) call sites with the new
  function.

Change-Id: I818a113ff8d2a2f7cab2ec7d9c8661607c6331d6
Closes: OS#5528
2022-04-12 22:52:47 +02:00
Oliver Smith 28029ffe50 treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: I8ab8f1e79fcc38d889cce4eac2e90cd4e5582b1b
2021-12-14 12:23:26 +01:00
Oliver Smith f8fe1329e2 regen_makefile.sh: set executable name explicitly
Set the executable name in each regen_makefile.sh explicitly with -e,
instead of having it set indirectly from the first .ttcn file. Make it
consistent by placing the name on top of each of these files.

Fix for warning:
ttcn3_makefilegen: warning: File `BSC_Tests.ttcn' was given more than once for the Makefile.

Related: OS#5252
Change-Id: I5ed03f8f3ed905483620dc7bae33b617bbb8507f
2021-10-13 11:12:22 +02:00
Oliver Smith 2e0e624060 regen_makefile.sh: files/flags in separate lines
Make all regen_makefile.sh more readable and diff friendly by moving
each entry in FILES and CPPFLAGS_TTCN3 into separate lines. Order
entries alphabetically.

Related: OS#5252
Change-Id: I6b6866eb9f6ec6232e4ae434517457a4c8c1c050
2021-10-12 16:35:01 +02:00
Vadim Yanitskiy 0df27dc669 remsim: add the guard timeout to all test cases
As can be seen [1], it happens quite often that a test case gets
stuck and runs forever.  Most of the existing test suites have
the guard timeout to prevent this.  Let's make use of it here too.

[1] https://jenkins.osmocom.org/jenkins/view/TTCN3/job/ttcn3-remsim-test-latest/190/
	Build has been executing for 1 day 23 hr!

Change-Id: I3897efd2a97c3e0d487057aa7bdc2967f3424dd8
2021-02-28 17:12:32 +01:00
Vadim Yanitskiy 7d30c57305 remsim: TC_connect_and_nothing() runs on test_CT
Change-Id: Ie94bf52e57a964b9f280c7626f354c5feee5c165
2021-02-28 16:46:13 +01:00
Harald Welte 205b537f6f HTTP_Adapter: split into f_http_tx_request() / f_http_rx_response()
There are some use cases in which we don't want a blocking wait for the
full HTTP request to complete.  Let's split it up in two parts, and
make the existing f_http_transact() a wrapper around them.

Also, enable the generation of the Connect_result primitive to detect
connection failures.

Change-Id: I5c7575c0b58c3606d25d8f8cfccd47cfb7a8c400
2021-02-22 10:41:29 +00:00
Harald Welte 55e879c647 remsim: factor-out HTTP_Adapter.ttcn
There are other test suites (like osmo-cbc) which can reuse some of
the HTTP utility code that was developed within the remsim test suite

Change-Id: I87a728272d47649e4faa628fad44d6f8673c8169
2021-02-22 10:41:29 +00:00
Harald Welte 06f0949316 RSPRO_Server: Ignore any ID RESP messages from the client for now
More recent clients start to send ID RESP, which was not the case at the
time the TTCN3 test suite was written.

As we don't really want to test the IPA CCM behavior, but we want to
test the actual remsim functionality, we can simply ignore any such
responses.

Change-Id: Id557ea9c540bf96465e7f18da87719888dd7a318
2020-12-01 12:06:33 +00:00
Vadim Yanitskiy a2afacc905 library/IPA: use tr_ASP_IPA_EV instead of inline templates
This way we can easily add new parameters to ASP_IPA_Event.

Change-Id: Icc37286fcb4d43836d56a26424ecb9dcba58d1f1
2020-05-18 21:16:35 +07:00
Vadim Yanitskiy 61564be045 library/IPA: split t_ASP_IPA_EVT_UD into send / receive templates
Change-Id: Ib5494bff3f9aa0ac396b729c326e7b4a64c5a5dd
2020-05-18 20:47:14 +07:00
Harald Welte b12a0ffc03 remsim: Add RemsimServer_Tests.TC_slotmap_add_out_of_range()
Validate if osmo-remsim-server permits out-of-range integers in REST.

Change-Id: I449541420a15826ed0d2f1460e3ca4b3468662c3
2020-02-20 18:48:22 +01:00
Harald Welte 3993c81b79 remsim: Add TC_slotmap_del_nonexistant()
Let's test that deleting a non-existant slotmap from server renders
HTTP status 404.

Change-Id: Ib74fea146017ffc68b75ec175472842b689891c3
2020-02-20 10:12:28 +01:00
Harald Welte b79bc601da remsim: Update TODO list
Change-Id: I1c6b1c7c1ced88db56940d2cef78193a13a15af6
2020-02-20 10:06:15 +01:00
Harald Welte 15be5d6866 remsim: Add global guard timer to client+bankd tests
Change-Id: I85d436a91d1c805f2fb66138ef7e2fb73107f2d1
2020-02-19 20:09:02 +01:00
Harald Welte 34b9da299c remsim: Add tests using stdin/stdout of osmo-remsim-client-shell
osmo-remsim-client-shell allows to send C-APDU via STDIN of the program
and receive R-APDU via STDOUT.  We can attach to that using the PIPEasp
TTCN3 port, and hence test a [local] osmo-remsim-client-shell
transceiving APDUs from/to a simulated bankd in the test case.

The only sad part about this is that we now will need to have the
implementation under test (osmo-remsim-client-shell binary) in the
same container as the TTCN-3 test, as it will fork/exec it.

This is why we disable it by default and a modulepar must be used to
enable those particular tests.

Change-Id: I3a69c692cf3e6bbe04ce58594050b20da0c37d16
2020-02-19 19:56:30 +01:00
Harald Welte 9073295230 remsim: Integrate VPCD test port into RemsimBankd_Tests.ttcn
VPCD (specifically ifd-vpcd) is an ifd-handler (reader driver)
for a virtual smart card reader integrated with pcsc-lite.  It is
part of the virtualsmartcard project.   Using this ifd-vpcd, we
can implementa virtual smart card reader beneath osmo-remsim-bankd,
which allows us to implement both the smart card [reader] below
osmo-remsim-bankd as well as the osmo-remsim-server + client above
osmo-remsim-bankd - in other words a fully virtualized test fixture for
bankd.

Change-Id: I967f2d526f4ef1278bd2ac1d590a8dce732379d5
2020-02-17 22:47:11 +01:00
Harald Welte 776b0e5444 remsim: Add client TC_bank_disconnect + TC_bank_disconnect_reconnect
This extends remsim-client test coverage to situations where the
server removes an existing/established mapping, and possibly later
establishes a new mapping.

Change-Id: I8df29a91718b6b2829415fc040b647a58eb71292
Related: OS#4399
2020-02-16 16:33:06 +01:00
Harald Welte c7b496cd06 remsim: More comments in RemsimClient_Tests
Change-Id: I02363eaaaae6d7b849cd2a1d2b07f1343d58c2f2
2020-02-16 16:33:06 +01:00
Harald Welte 77cde21fb5 remsim: New TC_slotmap_del_active_client() test
This test verifies that a slotmap delete via REST will not only
delete it from the bankd, but also from the client.

Change-Id: I8c4e53231b5386b00fe2938cde2091aa8b2e2027
Related: OS#4399
2020-02-16 15:35:59 +01:00
Harald Welte beba4e56a0 remsim: Two new bankd test cases about slotmap re-creation
If a slotmap is re-created with identical client+bankd, we expect
no change and the client-bankd connection to persist.

If a slotmap is overwritten with a create for a different client
than the currently connected one, we expect the client connection
to be closed.

Change-Id: If81e1511521fe478d2367104cd1c7eba254d6450
Related: OS#4278
2019-12-04 22:10:58 +01:00
Harald Welte bca0ecd282 resmim: Adjust TC_createMapping_busySlot to current bankd code
Since osmo-remsim Change-Id I83e319d22896b881c0d882542842f500075aa546
createMapping will overwrite any existing mappings that may already
exist for that bank-slot.  We need to adjust our test expectations
accordingly.

Change-Id: Ia8de9edd7edb0437cd783b7d045571ff69820c42
Related: OS#4278
2019-12-04 22:10:53 +01:00
Harald Welte d14ad4ccba remsim: Reset the bankd-side state at start of test
In general we don't want that bankd retains state from one test
case to another.  Let's issue the new RSPRO ResetStateReq at the
start of each relevant test

Change-Id: If810ccbbc848dd2448a4eaea20c80f60f15a2e84
2019-12-04 21:55:05 +01:00
Harald Welte eb172b3942 remsim: Update RSPRO for ResetState{Req,Res} messages
Change-Id: Ia9520b50c4ec2e703cc876cc7f79f3aeda90dba3
2019-12-04 21:55:05 +01:00
Harald Welte 04c7a3d669 REMSIM_Tests: Fix REMSIM_Tests.cfg
Change-Id: Ia31c5e440fc8daec92a620c9aea7432b6cf7ea17
2019-11-22 00:40:15 +01:00
Harald Welte faa4292444 Initial TTCN-3 test suite for osmo-remsim
This adds shared infrastructure and initial test suites for
osmo-remsim-{server,client,bankd}.

Change-Id: I00034d3a991f0f881cfd8ff0bfc4557113daf830
2019-09-13 11:45:45 +00:00