summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2018-03-11trxcon/scheduler: transmit dummy frames on CBTX lchansVadim Yanitskiy4-0/+118
If at the moment of transmission there are no frames in TX buffer, then either a dummy LAPDm frame (0x01, 0x03, 0x01, 0x2b ...) or a silence frame (depending on a codec in use) shall be transmitted. This is required for proper measurements on the BTS side. Change-Id: Ie590990f2274ea476678f6b2079f90eeadab6501
2018-03-11trxcon/scheduler: introduce a new CBTX lchan flagVadim Yanitskiy2-30/+32
This new flag is intended to indicate that continuous burst transmission is assumed on particular logical channel. In other words, if a logical channel has this flag, but there is nothing to transmit in a TX buffer, then either a dummy LAPDm frame or a silence frame shall be sent. Change-Id: I25fcf9eeb787ffe5378d92532439e67d7d42fa65
2018-03-11trxcon/sched_trx.h: clarify lchan flags meaningVadim Yanitskiy1-1/+3
Change-Id: I51b663dd16e46a4523488c3d3000922a7c3640d1
2018-03-11trxcon/sched_trx.c: fix: omit inactive logical channelsVadim Yanitskiy1-0/+4
The sched_frame_clck_cb() is responsible for UL burst transmission. Iterating over each timeslot, it chooses a proper lchan handler according to a current frame number and a multiframe layout in use, takes a L2 UL frame from a TX buffer, and finally calls the chosen handler in order to to encode and transmit a taken frame. A handler should be called only for activated logical channels... but for some long time, there was a bug, so each lchan was processed, including inactive ones. It's time to fix this. Change-Id: I33e3ecc14be3ae64dfd02789c7f0970c945582c9
2018-03-11trxcon/sched_trx.c: fix: properly deallocate lchansVadim Yanitskiy1-2/+4
The llist_for_each_entry_safe() should be used instead of the llist_for_each_entry(), because it's safe against removal of llist entry. Found using Valgrind's memcheck tool. Change-Id: I65234971ec152df038c5388da537a503060c215b
2018-03-11trxcon/configure.ac: add --enable-sanitize optionVadim Yanitskiy1-0/+11
Change-Id: I099de726f9d67213c56d996039b4207f80a727c6
2018-03-06fake_trx/ctrl_cmd.py: use a random bind port by defaultVadim Yanitskiy1-4/+13
Since it is not required to specify a bind port to the UDPLink constructor manually, let's use a random one by default, and also allow user to set it from command line. Change-Id: Ib4965ebeec83d9a99b2f026156eb5f5cb20875bf
2018-03-06fake_trx/udp_link.py: use a random bind port by defaultVadim Yanitskiy1-4/+5
This allows one to obtain a random available port from the OS, instead of enforcing to pick a static value manually. Change-Id: Ie8b60134239c5447d0b4373c6cca2f3a6ee3ec73
2018-03-06fake_trx/ctrl_if.py: remove incorrect isdigit() checkVadim Yanitskiy1-5/+0
Previously, we used to check if all arguments of a command are numeric. This was done in a wrong way, so parsing a *valid* command with at least one negative argument could fail. Let's remove this check, allowing the command handlers to deal with argument types themselves. Change-Id: If31295274a09102c414b5a7aec5dd85d88b2e514
2018-03-06fake_trx/ctrl_if.py: reduce code branch nastingVadim Yanitskiy1-8/+10
Let's use the inverted condition to avoid additional code nasting. Change-Id: I8a62b39d9d9a597c612f9a576e98dc05e37cd25b
2018-03-06fake_trx/ctrl_if.py: remove forgotten debug printVadim Yanitskiy1-1/+0
Change-Id: I4886828fb0f927c59c5eb1945a3c2873687de7b3
2018-03-02host/trxcon: use integer math for ToA (Timing of Arrival)Vadim Yanitskiy7-21/+23
There's no need to express ToA value as a float. Let's turn it into an int16_t with 1/256 symbol period accuracy throughout the code to avoid both float arithmetic as well as loosing any precision. Inspired by Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec. Change-Id: I99c0f38db08a530d5846c474aba352aa0b68fe86
2018-03-02fake_trx/ctrl_if_(bb|bts).py: log link info at start-upHarald Welte3-2/+7
Change-Id: I4ebeed7271d91ab2e45199e0fb59776c00ad833c
2018-03-01trxcon: Fix '-i' to specify the "TRX IP address"Harald Welte3-35/+15
The command line help states '-i' is for 'TRX IP address', which is the remote IP address at which the TRX is to be found. Hoewever, it was used as the local (bind) IP address of the socket used towards the TRX. This is my attempt at fixing this. A more complete solution probably allows to specify both local (bind) and remote (connect) address, just to be clear. Change-Id: If0252b15e9c7942687c6dc470951d777f7af651c
2018-03-01fake_trx: Increase TOA256 value rangesHarald Welte1-2/+2
In theory, the maximum TA value is 63 symbols, i.e. 63*256 in this context. However, our test cases want to test the BTS behavior is correct if ever a larger timing offset is reported from TRX to the BTS, to ensure it is rejected in the BTS. Let's hence increase the values to rather large min/max limits. We could also remove them completely. Change-Id: I691d081256e8c6d18ef2836299ed8f7d502da3ee
2018-03-01fake_trx: Send positive response to FAKE_TOA commandsHarald Welte2-8/+4
Now that ctrl_if.py is capable of sending back the response to where the command originated from, we can just as well send a positive response back after executing the related commands. Change-Id: Icba138835149a7264f4db3a6b05f54ca501c4d54
2018-03-01fake_trx: Always send control responses to where commands are fromHarald Welte3-7/+13
fake_trx is using locally bound and not connected UDP sockets for control commands. When we receive a control command, we should not simply send the response to the default destination, but send it back to the exact ip+prt from which the command originated. This ensures correct routing of responses even in case multiple programs are interfacing concurrently with a control socket. Change-Id: I24a0bba6eed059b101af95dac7d059f34dd715fc
2018-02-28trxcon: Define event names for osmo_fsm'sHarald Welte3-0/+19
Change-Id: Id3279e99966a0ab236923c497ac0abbc9ed2c93c
2018-03-01fake_trx/burst_fwd.py: FIX: apply TA value correctlyVadim Yanitskiy1-4/+6
If field randomization is disabled, Timing Advance value indicated by MS would be ignored. Let's fix this by separating the TA calculation code. Change-Id: If43d5823fc33efc2f1649ea941ab6f619bb6f5e7
2018-03-01fake_trx/ctrl_if_(bb|bts).py: add FAKE_TOA commandHarald Welte2-0/+46
FAKE_TOA is an auxilary CTRL command, which may be used to update the ToA (Timing of Arrival) value of forwarded bursts at runtime. This is useful for testing the measurement processing code in OsmoBTS. The command is implemented for both BTS and BB CTRL interfaces in two absolute and relative forms: CMD FAKE_TOA <BASE> <THRESH> CMD FAKE_TOA <+-BASE_DELTA> The first form overwrites both ToA value and its treshold. The second one is relative, and applies a delta to the current ToA value. The command affects Downlink bursts if sent on BTS CTRL interface, and Uplink bursts if sent on the BB CTRL. Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
2018-02-28fake_trx/fake_trx.py: add options to enable field randomizationVadim Yanitskiy1-4/+37
By default, both RSSI and ToA fields randomization is disabled. Let's add command line options, which allow one to enable it. Change-Id: Ieac63cc3aadef397906479a6179ba54a53a5311a
2018-02-28fake_trx/burst_fwd.py: disable field randomization by defaultVadim Yanitskiy1-0/+24
Both RSSI and ToA fields randomization is only required in some specific test / use cases, so let's disable it by default. Change-Id: I94835a840b6239f2c05197292825cb26977d0216
2018-02-28fake_trx/burst_fwd.py: calculate both RSSI and ToA separatelyVadim Yanitskiy1-29/+61
In order to be able to simulate and randomize both RSSI and ToA values for Uplink and Downlink separately, let's calculate them in separate methods of the BurstForwarder. Change-Id: Ia2031f22f2b549c799c782d0c8c8d0691fb6f18c
2018-02-28fake_trx: handle SETTA (Timing Advance) indicated by MSVadim Yanitskiy2-0/+33
Timing Advance value is a timing correction value, indicated by the network to MS, which is used to compensate UL signal delay. In other words, the network instructs a phone to transmit bursts N=TA symbol periods earlier than expected. Since we are in virtual environment, let's use TA value to calculate the ToA (Timing of Arrival) value for BTS. Change-Id: Ie5833a9f221587bbcac10f0b223ead9c1cbda72b
2018-02-28fake_trx/data_msg.py: implement ToA parsing supportVadim Yanitskiy3-31/+3
This change implements ToA (Timing of Arrival) parsing, which was missing in the DATAMSG_TRX2L1. Since we use integer math, a ToA value is represented in units of 1/256 symbol periods. Change-Id: Ib11482c06b977c4cf01b0644f5845a2e49d059fb
2018-02-28fake_trx/data_msg.py: use integer math for ToAVadim Yanitskiy5-45/+47
In order to avoid both float arithmetic as well as loosing any precision, let's use integer math fot ToA (Timing of Arrival), i.e. let's express ToA values in units of 1/256 symbol periods. Change-Id: I56b88740f4d782ac7591fc096d1969514784a4e1
2018-02-28fake_trx/burst_fwd.py: drop useless set_slot() methodVadim Yanitskiy1-6/+0
Change-Id: I721c87758f04a1962427341eb1b2d47cfdd3f780
2018-02-28fake_trx/data_msg.py: use a single unified constructorVadim Yanitskiy1-18/+5
There are no message specific initialization parts, excepting the header specific fields setting. Let's us a common constructor, dropping custom fields from its arguments. Change-Id: I13a3e4b2f6a1f443ebe7d809df62736e3c43f56f
2018-02-28fake_trx/data_dump.py: fix python3 compatibilityVadim Yanitskiy1-6/+6
There is no 'file' type in Python3 anymore, so let's reverse the condition in DATADumpFile constructor. Also, the tag definition was incorrect: both '\x01' and b'\x01' aren't the same. Change-Id: Ib00c7f0bd5871fcfce931a4bfa501ae5bf797c45
2018-02-28fake_trx/data_msg.py: fix python3 compatibility in testsVadim Yanitskiy1-2/+2
In Python3 a range has it's own type, so its comparasion with a list is incorrect. Let's explicitly convert both bit ranges to lists in the bit conversation tests. Change-Id: I98c40d3d63cbcdc3e5dc840ebf8d7310c5c08e56
2018-02-27fake_trx/burst_fwd.py: use DATAMSG transformation APIVadim Yanitskiy1-18/+65
As the DATAMSG classes were introduced, let's use them. This approach abstracts one from dealing with raw bytes. Also, now BurstForwarder randomizes both RSSI and ToA values, as this feature is supported from-the-box by the DATAMSG_TRX2L1. Change-Id: Ib15018eab749150e244914dab4b6e433ce0c9209
2018-02-27fake_trx/data_msg.py: implement message transformation APIVadim Yanitskiy1-0/+37
This change introduces two new methods, which allow to perform L12TRX <-> TRX2L1 message type transformations. Change-Id: Ic99cf74baa1864bf20a8fc0fc025604bc160084c
2018-02-27fake_trx/udp_link.py: set SO_REUSEADDR socket optionVadim Yanitskiy1-0/+1
Setting this option allows one to reuse existing connections, for example, by injecting CTRL commands or DATA bursts into existing connections between fake_trx.py and trxcon. Change-Id: I0882c76affa9a668a12d10967081054d2b666ed1
2018-02-27fake_trx/udp_link.py: drop useless UDPLink.loop() APIVadim Yanitskiy1-12/+0
So far, this API is not used anywhere. Let's drop it. Change-Id: I87ea2436f0b6bbeb62fe17700af48a048be143bb
2018-02-27fake_trx/udp_link.py: close socket in destructorVadim Yanitskiy8-38/+3
Previously it was required to call the UDPLink.shutdown() method manually in order to close a socket. Let's do this automatically using the destructor of UDPLink. Change-Id: I59c3dc61ec58cd9effeb789947d28fd602ca91f4
2018-02-23trxcon|fake_trx: change default TRX port number to 6700Harald Welte2-3/+3
In order to avoid clashes with OsmoTRX, which may be also running on the same host, let's use a different port range starting from 6700 by default. This idea was introduced as a result of OS#2984. Change-Id: I66b5f25aaba3b836448ed29839c39869b5622bed Related: OS#2984
2018-02-20fake_trx/data_dump.py: use 2 bytes to store message lengthVadim Yanitskiy1-4/+7
One byte may store a value in range [0x00, 0xff]. The maximal 0xff value is 255 in dec, so a message length is limited to 255 bytes. This is enough for GSM bursts, but not for EDGE. Since this change, two bytes of header are used to store the pending message length. All captures created before are not supported anymore... Change-Id: I5a69d5cf2914fe56b2f9acca6054c9470627f91e
2018-02-20fake_trx/burst_send.py: implement DATA capture supportVadim Yanitskiy2-108/+103
Previously, this tool was only able to read a hand-crafted text file with bursts and send them via the DATA interface. This is not so useful... This change implements support of reading DATA capture files, which can be generated e.g. by trx_sniff.py or burst_gen.py. Both standart input (stdio) and text-files are not supported anymore. Usage example: ./burst_send.py -m L1 -i capture.bin --timeslot 2 Change-Id: I626662bd1897c874421ab5178970ec19325f8a47
2018-02-20fake_trx/burst_gen.py: add burst capture supportVadim Yanitskiy1-1/+15
Now all generated bursts can be also written to a capture file, using a new option called '--output-file'. If a file already exists, bursts would be appended to the end. Otherwise a new capture file is created. Change-Id: I074ff7dbc4d6beecdecce20de9dade5939e707f2
2018-02-20fake_trx/trx_sniff.py: use DATADumpFile for capture writingVadim Yanitskiy1-22/+8
Since we have a separate class for DATA capture management now, no need to implement the wheel - let's just use it! Change-Id: I7c30bcea294ce7270bf905ae5420a06dbc2e46f1
2018-02-20fake_trx: implement classes for DATA capture menagementVadim Yanitskiy1-0/+379
This change introduces the following classes: - DATADump - basic class, which contains methods to generate and parse the a message header, and some constants. - DATADumpFile - a child class, which contains methods to write and parse DATA messages from capture files. Usage example: # Open a capture file ddf = DATADumpFile("capture.bin") # Parse the 10th message msg = ddf.parse_msg(10) msg.fn = 100 msg.tn = 0 # Append one to the end of the capture ddf.append_msg(msg) Change-Id: I1b31183bd7bcca94de089847ee0b2f4ec88a7f1d
2018-01-29fake_trx/burst_send.py: handle both GSM and EDGE burstsVadim Yanitskiy1-2/+2
Previously, it was expected that burst length should be equal to 148. Let's also handle EDGE bursts and use GSM constants. Change-Id: Iab13dd06f175556137c5e25d2cbddb9bea403b09
2018-01-29fake_trx/burst_send.py: also handle RSSI and ToA valuesVadim Yanitskiy1-7/+29
Change-Id: Idb9a5ae4a8980a320f6e620c66add7c7393d3ecb
2018-01-29fake_trx/burst_gen.py: also handle RSSI and ToA valuesVadim Yanitskiy1-7/+29
Change-Id: I7c9441c1154c925dcb5c743e39445495233c123e
2018-01-29fake_trx: use DATAMSG classes for DATA messagesVadim Yanitskiy4-159/+116
The DATAMSG API, that was introduced and extended a few commits before, provides all required methods to create, validate, generate and parse DATA messages. Let's use it now. Change-Id: Ibc99126dc05d873c1ba538a5f4e74866de563f56
2018-01-29fake_trx/burst_gen.py: don't store RandBurstGenVadim Yanitskiy1-5/+5
No need to keep it as a class member. Change-Id: I5bf5846c2b8fa1211cf5150545b9d001c17fa0eb
2018-01-29fake_trx/burst_gen.py: check argv separatelyVadim Yanitskiy1-7/+12
Change-Id: I35b5475d3b6df6dc92a1981c693afb63df866c87
2018-01-29fake_trx/data_msg.py: implement header descriptionVadim Yanitskiy1-0/+37
This change introduces a new method for both types of messages called 'desc_hdr', that generates human-readable header description. Examples: TRX -> L1: fn=571353 tn=1 rssi=-108 toa=-0.53 L1 -> TRX: fn=1777477 tn=3 pwr=161 Change-Id: Iafe63e39ad68f4ff373ae098424d76ca9f83c8fc
2018-01-29fake_trx/data_msg.py: handle bursts properlyVadim Yanitskiy1-13/+65
One L1 -> TRX message carries one to be transmitted burst encoded as regular bits (0 or 1). One TRX -> L1 message carries one received burst encoded as unsigned soft-bits (0..254). This shall be noted during message encoding and decoding process. Also, we shall distinguish between GSM and EDGE bursts. Change-Id: I909b7a4dc70e8c632987bde07f00281a6595c4cb
2018-01-29fake_trx/data_msg.py: implement header randomizationVadim Yanitskiy1-0/+64
This feature could be used by both burst_gen.py and burst_send.py. Change-Id: I724e267382ff32ef1f964b1ee6cbe99069139867