fr: Randomize packet size used in TC_ul2dl_ud()

This allows us to test with a variety of packet sizes up to [close to]
the MTU of the underlying transport (configurable by modulepar)

Change-Id: I8e38ecf6b270c81bd73ee43b1fa0b259a999c14b
This commit is contained in:
Harald Welte 2021-02-04 14:56:36 +01:00
parent 27119672d2
commit 7504c4dc4b
1 changed files with 15 additions and 1 deletions

View File

@ -10,6 +10,8 @@ import from LLC_Types all;
import from LLC_Templates all;
modulepar {
/* NS transport layer MTU (NS header and anything after it) */
integer mp_ns_mtu := 1500;
/* number of BVCs to bring up in one Gb instance */
integer mp_num_bvc := 10;
/* number of UEs to start in each PTP BVC */
@ -59,6 +61,15 @@ modulepar {
};
}
/* 4 bytes NS-UNITDATA,
* >= 12 Bytes DL-UNITDATA or 18 bytes BSSGP UL-UNITDATA
* 3 bytes LLC UI header
* 3 bytes LLC FCS
* <= 3 bytes optional padding
* --> at least 31 bytes required
*/
const integer c_LLC_BSSGP_NS_overhead := 40;
type record GbInstance {
NS_CT vc_NS,
BSSGP_CT vc_BSSGP,
@ -259,15 +270,18 @@ testcase TC_bvc_bringup() runs on test_CT
private function f_ul2dl_ud(charstring id) runs on UE_CT
{
var integer max_llc_payload_len := mp_ns_mtu - c_LLC_BSSGP_NS_overhead;
for (var integer num_pkts := 0; num_pkts < 50; num_pkts := num_pkts + 1) {
var integer ran_index := 0;
var template (value) PDU_LLC llc_tx;
var template (present) PDU_LLC llc_rx_exp;
var octetstring llc_payload := f_rnd_octstring(f_rnd_int(max_llc_payload_len));
var PDU_LLC llc_rx;
timer T := 5.0;
/* SAPI '0010'B is looped back by FRNET_Tests.ttcn */
llc_tx := ts_LLC_UI(f_rnd_octstring(512), '0010'B, '1'B, 0);
llc_tx := ts_LLC_UI(llc_payload, '0010'B, '1'B, 0);
llc_rx_exp := llc_tx;
llc_rx_exp.pDU_LLC_UI.fCS := ?;