This commit fixes combination of resources containing lists.
For lists containing complex types, it has been decided to handle them
as sorted list, where position in list matters. In this case, combine is
called recursively for each element in dest and src sharing position in
the list, and assumes that if one list is shorter than the other, then
it has to be combined against empty set for that tye.
For instance this is useful when defining trx_list properties, where a
BTS can have a different amount of TRX but we may be interested in
restricting the first TRX and don't care about extra TRX.
For lists containing simple types (eg. integers or strings), we just want
to merge both lists and we only need to check if the value is already there,
ie. handle them as unsortered sets. This case won't work if we call combine
for each element of the list because for a simple case it will just end up
checking if a[i] == b[i].
This kind of operation for simple types is needed in later commits where
cipher attribute is introduced. Without this patch, having following 2
scenarios and trying them to use together "-s foosuite:cipher-a50+ciphera51"
will fail:
cipher_a50.conf:
bts:
- ciphers:
- 'a5 0'
cipher_a51.conf
bts:
- ciphers:
- 'a5 1'
ValueError: cannot combine dicts, conflicting items (values 'a5 0' and 'a5 1')
Change-Id: Ib7a38f10eb9de338a77bf1fa3afceb9df1532015
As suite.conf and scenarios need to match 1-to-1 in lists, it's important to
extend the dictionaries by replicating the objects with a 'times' values
higher than 1 in order to match the objects correctly.
Since dictionanries are expanded at combine time, there's no need to
expand them during reserve() time because they are already expanded.
As a result, this commit reworks the kind of schema applied in each
place (and takes the change to start validating scenario files, which
were neglected previously).
Two unit tests are added as a show case. Unfortunately output showing
scenario dictionaries needs to be ignored while verifying because it was
encountered that different versions of python print dictionary elements
in different order.
Change-Id: I25eb639c7e3cf3b4c67a205422808bffbdd791e6
Before this commit, only max_power_red was specified and it could only
be used as a defaults and could not be set per object. Together with
nominal_power, it can be useful to be able to set them to different
values for different objects, as for example different osmo-bts-trx
objects can require different values.
Change-Id: I472742e98052cc39686d38c945be76d7f50eeebd
In the following suite.conf, position matters when matching against scenarios:
[suite.conf]
resources:
bts:
- type: sysmo
times: 2
- type: osmo-bts-trx
times: 1
[scenario]
resources:
bts:
-
- ip_addr: 1.2.3.4
In this case, for instance, we make it clear that we want the second
sysmo bts which has IP 1.2.3.4. With old behaviour, the replicated sysmo
would have been created at the end (3rd position), and the ip_addr would
match against the osmo-bts-trx BTS.
Change-Id: Id78e2326db964d5efb6648854b57d8addce4deb0
This is a first step to add support for osmo-bts-octpy to
osmo-gsm-tester.
There's no point in building separate insts for different osmo-bts
variants which run on the main unit and which come from the same git
repository, this we make the osmo-bts-trx one generic to handle all
variants which fall into the description above.
Tested locally on my laptop that it builds susccessfully.
Once this patch is applied, jenkins jobs need to be adjusted:
- RnD: osmo-gsm-tester_manual-build-all
- Prod: osmo-gsm-tester_build-osmo-bts-trx (and rename it)
Change-Id: Ib8814e4ce49596b586990f20d7d625a719852e90
An issue was spotted recently in tests run in production which call
modem.connect() twice, first time to check that we are unable to connect
with a wrong KI, then that we can connect with the correct KI.
As there's no current easy way to wait for "rejected" signal, we
basically wait for some time before checking if we were unable to
connect. It seems that sometimes waiting for 30 seconds is not enough,
and then a scan() async method is still in progress when we decide to
call connect() again, which will powercycle the modem. If the scan()
method returns at that time, then we try to access interfaces of the
modem which are no longer available because the modem is powered off at
that time. This triggers an exception and test fails.
To correct way to fix this is to make sure we disable pending Scan()
dbus method before powercycling the modem and starting a new Scan()
method.
The sleep time is also increased to make sure we let enough time to
register. It seems it can take about 15 seconds to do a full scan, and
sometimes during first scan iteration the BTS is still not found,
probably because it's still starting.
Related: OS#2510
Change-Id: Ic4bb1c6b72c23cd860c33bee7851bca3d0ac0e1b
Do not pass os.O_TRUNC to open(), that immediately empties out the lock file.
Fix lock_test to be able to catch this error. So far things were happening too
fast to notice it.
Caught by running 'make check' on a main unit APU that has different timing
behavior.
Change-Id: I872a3d2548ac84097ac7acf13cb12c36822e076e
We are currently seeing this issues in prod setup, which uses python
3.4:
File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/bts_osmotrx.py", line 44, in __init__
self.pcu_sk_tmp_dir = tempfile.mkdtemp(None, 'ogtpcusk', None)
File "/usr/lib/python3.4/tempfile.py", line 432, in mkdtemp
file = _os.path.join(dir, prefix + name + suffix)
TypeError: Can't convert 'NoneType' object to str implicitly
Acording to mkdtemp man in python3:
"Changed in version 3.5: suffix, prefix, and dir may now be supplied in
bytes in order to obtain a bytes return value. Prior to this, only str
was allowed. suffix and prefix now accept and default to None to cause
an appropriate default value to be used."
This issue went unnoticed because the RnD env is running debian 9, which
probably has python version >= 3.5.
Change-Id: If3226183fe21b4820149b1d03207193dc6f139e2
In commit 329b6f4 pcu-socket path was moved to run inside the test run
dir to avoid issues between different tests creating a socket in the
same place.
However, it seems unix sockets paths are limited to 108 bytes (with Null
char included). In some cases, the run dir for a test can be quite long,
as it contains suite name, test name, etc. and the path can be longer
that the limit defined above.
In order to fix this issue, create a tmp dir using mkdtemp to ensure the
path to be used for the pcu-socket doesn't collide between different
instances of osmo-bts-trx.
Clean up of tmp dir and pcu socket is done inside the cleanup() method
called by suite.py.
method pcu_socket_path() is added to help with new implementation, and
it will be used as well as a public API later soon to be used by OsmoPcu
classes.
Related: OS#2507
Change-Id: I0c53a0a3ccc5eb2823265fe14c0f7b8f4adb1038
In following commits, cipher attribute containing a list of supported
ciphers is introdued in osmo-gsm-tester. While developing the feature,
it was found that resources containing lists are not being handled
correctly.
Previous implementation regarding lists in several ways:
- In the list coe path, both item and wanted_item are expected to be
lists. Python doesn't support to check for sublists using the "in"
operand.
- want_item basically contains the scenario dic, and item is each of the
items available as resource of a given type. Thus, we want to check that
item supports the subset of features requested by the scenario, ie. that
the list in the scenario is a subset of the ones in the3 item and not
the opposite.
The following failing scenario is going to be checked during "make check"
when the cipher attribute is added: BTS supporting cipher a50 and a51,
and scenario requesting a50 succeeds. If this commit is remove, the test
no longer passes, and it fails with:
osmo_gsm_tester.resource.NoResourceExn: No matching resource available for
bts = {'type': 'osmo-bts-sysmo', 'ciphers': ['a5 1']}
Change-Id: I27b372aa5906feac2843f24f5cdd0d9578d44b4d
The purpose of this patch is to make sure we output to the extended log
some information regarding the firwmare version of the modem being used,
even if the test being run doesn't call print(modem.info) explicitly.
Printing self.info() just after waiting for Powered==true doesn't always
work, because the properties are not populated after a while after.
Calling Modem.GetProperties() immediately after receiving Powered==true,
will provide with empty strings on properties such as Revision.
18:59:55.747412 bus /sierra_1: Setting Powered True
18:59:55.938889 bus /sierra_1: DBG: 'org.ofono.Modem'.PropertyChanged() -> Powered=True
18:59:55.964694 bus /sierra_1: DBG: Powered == True
18:59:55.987777 bus /sierra_1: DBG: interface enabled: org.ofono.VoiceCallManager
18:59:56.006278 bus /sierra_1: DBG: 'org.ofono.Modem'.PropertyChanged() -> Features=[]
18:59:56.027366 bus /sierra_1: Setting Online True
18:59:56.189991 bus /sierra_1: DBG: 'org.ofono.Modem'.PropertyChanged() -> Manufacturer=Sierra Wireless, Incorporated
18:59:56.210935 bus /sierra_1: DBG: interface enabled: org.ofono.LocationReporting
18:59:56.233217 bus /sierra_1: DBG: 'org.ofono.Modem'.PropertyChanged() -> Features=['gps']
18:59:56.255807 bus /sierra_1: DBG: 'org.ofono.Modem'.PropertyChanged() -> Model=MC7304
18:59:56.279374 bus /sierra_1: DBG: 'org.ofono.Modem'.PropertyChanged() -> Online=True
18:59:56.315008 bus /sierra_1: DBG: Online == True
18:59:56.338779 bus /sierra_1: DBG: interface enabled: org.ofono.SimManager
18:59:56.357744 bus /sierra_1: DBG: 'org.ofono.Modem'.PropertyChanged() -> Features=['sim', 'gps']
18:59:56.379532 bus /sierra_1: DBG: 'org.ofono.Modem'.PropertyChanged() -> Revision=SWI9X15C_06.03.32.04 r28324 CNSHZ-AR-BUILD 2015/05/25 01:09:15
18:59:56.401241 bus /sierra_1: DBG: 'org.ofono.Modem'.PropertyChanged() -> Serial=356853054230919
Change-Id: If215c7d63ce1b86314ed25f8e76413b15676b7f5
The idea is to build each binary separately: even though osmo-msc requires
libosmo-sccp, which already includes the osmo-stp binary, we still want
osmo-stp to be built from a separate script. The reason: to track down
regressions, we can change the versions each binary is built from separately.
The additional build effort and jenkins script multitude is acceptable.
Change-Id: I194ad5169dbe013c8e1cf9d631033cb2576744dd
Register() method returned today this error which is expected acording
to ofono documentation API. In this case it probably happens because the
modem internally starts registering at some point between the time
Scan() is finished and we call Register(). In this case it is fine for
us and we should just ignore the error.
A helper method is added to check for this as so far it seems tricky to
check error information coming from pydbus. I could not reproduce this
issue locally so I could not test that the helper function is going to
handle it correctly when it is triggered. That's why I added extra debug
information to be able to fix it next time it is triggered.
File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py", line 489, in scan_cb_register
dbus_op.Register()
File "/usr/local/lib/python3.4/dist-packages/pydbus/proxy_method.py", line 75, in __call__
0, timeout_to_glib(timeout), None).unpack()
GLib.Error: g-io-error-quark: GDBus.Error:org.ofono.Error.InProgress: Operation already in progress (36)
Change-Id: I58dda09416ee7328812431220fd3d239c5c2980a
Attribute trx_remote_ip is actually using IPv4 validate type, thus this
validate type is not needed.
Change-Id: Ia8e154ac5fe33932935ba049f08eb5af15195d99
Algorithm to use to generate response for the challenge during
authentication time is hardcoded in the sim card and cannot be easily
changed. Thus specify in the config of each modem the algorithm used by
the SIM Card. This attribute is used add subscriber_add() time, when the
IMSI, KI and algorithm to use in the MSC to authenticate a given
subscriber is stored in the database. This way we can easily set up
a specific algorithm for each SimCard/Modem, in case different SimCards
are configured with different algorithms.
This can be used to specificially test different algorithms too. For
instance, let's imagine we have 2 simcards, one configured to use comp128v1
and another one with xor, and we create a test which ckecks that XOR is
algo is working fine. We don't want to accidentally select the modem
with comp128v1 in this case. Thus we can use this attribute to create a
scenario file matching 'auth_algo: xor' to ensure always the correct
modem is picked.
Change-Id: Ifdf74630afeb05452994bbc9eb62a745a1d745ce
Nowadays encryption parameter in bsc needs to be set to the same cipher as
the one specified in msc, otherwise the cipher negotation will fail.
See OS#2461 for more information on the matter.
Change-Id: I857b3860fb771b36fb3d587d4e92b320f0685a19
We may want to support running a device which runs its own TRX
(osmo-trx or different implementation). Furthermore, this TRX may be
available in some specific hwardare rather than on the main unit.
This makes it easy to configure OsmoBtsTrx to launch it's own
osmo-trx or not. In case it is launched, all IPs are configured correctly
to ensure connection can be established.
Before this commit, osmo-trx was binding to 127.0.0.1. Now we can
support multiple osmo-trx being launched on the main unit.
Change-Id: I825ed1fc0c3fe75d196db90c1508283fbd04acf8
This is useful for tests that wants to fake a bad KI to test if auth and
encryption are working correctly.
Change-Id: I40cfed6f6b9239eea2b97ffa010b98c78f0cb9cb
This is useful to see for instance the returned values from NITB when
asked for active subscribers.
Change-Id: I5c616646da360457930888b54d9019b76f05fe2f
The log levels changed are useful to understand clock failures we see
from time to time in osmo-gsm-tester. See OS-2325.
Change-Id: Id74af3ccb2f3db3c1793c7ff7b7a60a534e78e81
When splitting osmo-trx to its own class the env injection part was
removed because it seemed not needed as it has no dependencies included
by default in the trial.
However, it may still be required by the osmo-gsm-tester main unit to
launch osmo-gsm-tester with LD_PRELOAD_PATH to point to specific
versions of libuhd, so let's add the env injection back in there.
Change-Id: I069ba69f4207665c8c575fed0fc8ff164c571e36
Openbsc has SMS Delivery Reports since recently, which means we are now
receiving deliver_sm messages and this workaround introduced in commit
db0d8ab4fc is not required anymore.
Closes OS-#2353.
Change-Id: Iecf3983bfc24fec8023ba5d589c2d7620ec5d921
In the future, some environments/products may come with a trx interface
pre-installed. Start work to easily disable launching it.
Change-Id: I556c3e2ba16753393c7e70800c533a18122daeaa
SMPP specs say message reference is 16 bits field.
However, message reference field in GSM03.40 spec is only 8 bits.
Change-Id: I52968a10089d14e0e3b0f9be678c261e3f92939c
I take the chance to also swap the two log parameters, because they are
included into a dictionary and shown in swapped order in the log anyway,
which distracts me every time I look at the values.
Change-Id: I6e6ec5b9980958de82ade40e4cd898dc6f1b889f
In the following example setup, if osmo-nitb is listening
on 10.42.42.2, we want to return eth1:0 instead of eth1.
ip addr show eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0d:b9:35:3a:41 brd ff:ff:ff:ff:ff:ff
inet 10.42.42.1/24 brd 10.42.42.255 scope global eth1
valid_lft forever preferred_lft forever
inet 10.42.42.2/24 brd 10.42.42.255 scope global secondary eth1:0
valid_lft forever preferred_lft forever
inet 10.42.42.3/24 brd 10.42.42.255 scope global secondary eth1:1
valid_lft forever preferred_lft forever
Change-Id: Ia66e6fd8138fc11a70437a573128aacf6a01b8ff
In commit 6100b629e5 I assumed esme
already had a cleanup function, which doesn't seem to be the case. This
means if a test calls esme.connect() and fails afterwards without
calling esme.disconnect(), the connection will be kept but as the test
will finish and the NITB is closed, then the connection will be kept
forever in an erroneous state. With the cleanup function we ensure we
will close the connection after the test.
Change-Id: Ia3a23bb8bbccfe7ac5c544521b5566164609f0a5
In osmo-bts change I51aeb17661dfd63ff347f7b2c0d7ffa383ec814c the settsc config
item is being removed. To be able to test it, drop the settsc option from the
config.
Change-Id: I58002a84b6b0104de4fb5c7cade27b263e375c1f
Otherwise osmo-bts stores the socket file in /tmp. If an earlier
instance doesn't finish cleanly, the file is left there and a new
instance will fail to start because it cannot create a new socket file
in the same place.
Change-Id: I5a1da23c45a4ac496fe765e0d78c52dae3e7808b
Let's accept that during cleanup time some stuff may not be in a good
state, specially in case of a failure, but let's keep harder to clean
up everything as much as possible.
This should fix an issue in which after a test failure using an esme object,
an smpp connection is kept in a buggy state and never removed/cleaned up, and
makes all tests after it fail too because the conn is triggered at
poll() time:
File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/suite.py", line 260, in run_tests
self.objects_cleanup()
File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/suite.py", line 199, in objects_cleanup
obj.cleanup()
File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py", line 345, in cleanup
self.dbus.cleanup()
File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py", line 170, in cleanup
self.set_powered(False)
File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py", line 304, in set_powered
self.set_bool('Powered', powered)
File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py", line 295, in set_bool
event_loop.poll()
File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/event_loop.py", line 39, in poll
func()
File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/esme.py", line 78, in poll
self.client.poll()
File "/usr/local/lib/python3.4/dist-packages/smpplib/client.py", line 321, in poll
self.read_once(ignore_error_codes)
File "/usr/local/lib/python3.4/dist-packages/smpplib/client.py", line 279, in read_once
p = self.read_pdu()
File "/usr/local/lib/python3.4/dist-packages/smpplib/client.py", line 206, in read_pdu
raise exceptions.ConnectionError()
smpplib.exceptions.ConnectionError
Change-Id: Ie7ef9284490f12f5cfd76c35b33b57eefab20eb6
Sometimes in test esme_ms_sms_transaction.py we get the following error:
esme_ms_sms_transaction.py:54: ERR: ValueError: list.remove(x): x not in list
This appears due to a race condition because sms_send is used several times,
which means we don't wait or sync until we receive the response before calling
sms_send_wait_resp. That means when we wait for response of message with
seqnum X, we may receive response from message seqnum X-1 which was
initiated by sms_send and thus was not stored in the self.pdus_pending
array. As it's not there, trying to remove it triggers an exception.
Change-Id: Idf49f40eb46be1448b328a5c338ddbc4547148ff
esme: Add several bits to handle logic required by tests:
- Allow specifying the mode used to send an sms
- Add a parameter to ask to receive a Delivery receipt for that message
- Add sms_send_wait_resp API, which waits until the response message for
a given smpp message is received when sending an sms.
- Add receipt_was_received API, which together with
message_received_handler maintains state of the delivery receipts we
asked for and were still not received. However, the check needs to be
disabled for now because OsmoNITB doens't seem to be sending stuff
properly, see OsmoNITB #2353.
- On message_received_handler, also print alert_notification messages,
to show that there's actually a bug in OsmoNITB, see #2352.
Move old esme_ms_sms to esme_ms_sms_transaction, and explicitly state
that we are using that mode. On the same test, we can now enable the
part which asserts that sending an SMS to an msisdn with unknown
destination triggers an error. The issue was mainly that the error had
to come from the SMSC server response, not from the sent message, so
we have to wait for the response to have the failure triggered.
Finally, add esme_ms_sms_storeforward, which tests features for sms sent
using that mode, and uses the APIs described above.
Change-Id: Ia2c0c325fee14143deca8310312fc530cd9ce92e
As described in https://osmocom.org/issues/2380 and related gerrit
patch https://gerrit.osmocom.org/#/c/3306 the config files currently
contain timers with a 'zero' value, leading to issues.
The config file templates used in osmo-gsm-tester suffer actually
from exactly the same issue: They basically contain values that were
written back to the file based on the default initialization in libbsc,
which unfortunately was zero in some cases.
Let's remove those values, they are the (bad) default anyway.
libbsc patches in the pipeline will introduce reasonable defaults
and forbid the use of zero for timers.
Change-Id: I8cde29a597a17c2659b3b87268be4b12975f4bef