Add test case for testing PUAN

This test case is for testing generation of
EGPRS PUAN. Corresponding log files .ok and .err
are modified.

Change-Id: I18e6d4a9e90fd6453fe14187beab27dfeae8dbe9
This commit is contained in:
sivasankari 2017-01-24 15:53:35 +05:30
parent 8adfcd06a1
commit 1d8744ce96
4 changed files with 2390 additions and 0 deletions

View File

@ -341,6 +341,9 @@ struct gprs_rlc_ul_window: public gprs_rlc_window {
const uint16_t v_r() const;
const uint16_t v_q() const;
const void set_v_r(int);
const void set_v_q(int);
const uint16_t ssn() const;
bool is_in_window(uint16_t bsn) const;
@ -571,6 +574,16 @@ inline bool gprs_rlc_ul_window::is_received(uint16_t bsn) const
return is_in_window(bsn) && m_v_n.is_received(bsn) && offset_v_r < ws();
}
inline const void gprs_rlc_ul_window::set_v_r(int v_r)
{
m_v_r = v_r;
}
inline const void gprs_rlc_ul_window::set_v_q(int v_q)
{
m_v_q = v_q;
}
inline const uint16_t gprs_rlc_ul_window::v_r() const
{
return m_v_r;

View File

@ -1215,6 +1215,348 @@ static gprs_rlcmac_ul_tbf *establish_ul_tbf_two_phase_spb(BTS *the_bts,
return ul_tbf;
}
static gprs_rlcmac_ul_tbf *establish_ul_tbf(BTS *the_bts,
uint8_t ts_no, uint32_t tlli, uint32_t *fn, uint16_t qta,
uint8_t ms_class, uint8_t egprs_ms_class)
{
GprsMs *ms;
uint32_t rach_fn = *fn - 51;
uint32_t sba_fn = *fn + 52;
uint8_t trx_no = 0;
int tfi = 0, i = 0;
gprs_rlcmac_ul_tbf *ul_tbf;
struct gprs_rlcmac_pdch *pdch;
gprs_rlcmac_bts *bts;
RlcMacUplink_t ulreq = {0};
struct pcu_l1_meas meas;
struct gprs_rlc_ul_header_egprs_3 *egprs3 = NULL;
GprsCodingScheme cs;
meas.set_rssi(31);
bts = the_bts->bts_data();
/* needed to set last_rts_fn in the PDCH object */
request_dl_rlc_block(bts, trx_no, ts_no, fn);
/*
* simulate RACH, this sends an Immediate
* Assignment Uplink on the AGCH
*/
the_bts->rcv_rach(0x73, rach_fn, qta, 0, GSM_L1_BURST_TYPE_ACCESS_0);
/* get next free TFI */
tfi = the_bts->tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1);
/* fake a resource request */
ulreq.u.MESSAGE_TYPE = MT_PACKET_RESOURCE_REQUEST;
ulreq.u.Packet_Resource_Request.PayloadType = GPRS_RLCMAC_CONTROL_BLOCK;
ulreq.u.Packet_Resource_Request.ID.UnionType = 1; /* != 0 */
ulreq.u.Packet_Resource_Request.ID.u.TLLI = tlli;
ulreq.u.Packet_Resource_Request.Exist_MS_Radio_Access_capability = 1;
ulreq.u.Packet_Resource_Request.MS_Radio_Access_capability.
Count_MS_RA_capability_value = 1;
ulreq.u.Packet_Resource_Request.MS_Radio_Access_capability.
MS_RA_capability_value[0].u.Content.
Exist_Multislot_capability = 1;
ulreq.u.Packet_Resource_Request.MS_Radio_Access_capability.
MS_RA_capability_value[0].u.Content.Multislot_capability.
Exist_GPRS_multislot_class = 1;
ulreq.u.Packet_Resource_Request.MS_Radio_Access_capability.
MS_RA_capability_value[0].u.Content.Multislot_capability.
GPRS_multislot_class = ms_class;
if (egprs_ms_class) {
ulreq.u.Packet_Resource_Request.MS_Radio_Access_capability.
MS_RA_capability_value[0].u.Content.
Multislot_capability.Exist_EGPRS_multislot_class = 1;
ulreq.u.Packet_Resource_Request.MS_Radio_Access_capability.
MS_RA_capability_value[0].u.Content.
Multislot_capability.EGPRS_multislot_class = ms_class;
}
send_ul_mac_block(the_bts, trx_no, ts_no, &ulreq, sba_fn);
/* check the TBF */
ul_tbf = the_bts->ul_tbf_by_tfi(tfi, trx_no, ts_no);
/* send packet uplink assignment */
*fn = sba_fn;
request_dl_rlc_block(ul_tbf, fn);
/* send real acknowledgement */
send_control_ack(ul_tbf);
check_tbf(ul_tbf);
return ul_tbf;
}
static gprs_rlcmac_ul_tbf *establish_ul_tbf_two_phase_puan_URBB_no_length(BTS *the_bts,
uint8_t ts_no, uint32_t tlli, uint32_t *fn, uint16_t qta,
uint8_t ms_class, uint8_t egprs_ms_class, gprs_rlcmac_ul_tbf *ul_tbf)
{
OSMO_ASSERT(ul_tbf);
OSMO_ASSERT(ul_tbf->ta() == qta / 4);
GprsMs *ms;
uint32_t rach_fn = *fn - 51;
uint32_t sba_fn = *fn + 52;
uint8_t trx_no = 0;
int tfi = 0, i = 0;
struct gprs_rlcmac_pdch *pdch;
gprs_rlcmac_bts *bts;
RlcMacUplink_t ulreq = {0};
struct pcu_l1_meas meas;
struct gprs_rlc_ul_header_egprs_3 *egprs3 = NULL;
GprsCodingScheme cs;
/* send fake data with cv=0*/
struct gprs_rlc_ul_header_egprs_3 *hdr3 = NULL;
uint8_t data[49] = {0};
hdr3 = (struct gprs_rlc_ul_header_egprs_3 *)data;
/*header_construction */
memset(data, 0x2b, sizeof(data));
/* Message with CRBB */
for (int i = 0 ; i < 80; i++) {
hdr3->r = 0;
hdr3->si = 0;
hdr3->cv = 10;
hdr3->tfi_hi = (tfi >> 3) & 0x3;
hdr3->tfi_lo = tfi & 0x7;
hdr3->bsn1_hi = ((i * 2)&0x1f);
hdr3->bsn1_lo = ((i * 2)/32);
hdr3->cps_hi = 0;
hdr3->cps_lo = 0;
hdr3->spb = 0;
hdr3->rsb = 0;
hdr3->pi = 0;
hdr3->spare = 0;
hdr3->dummy = 1;
data[4] = 0x0;
data[5] = 0x0;
data[6] = 0x2b;
data[7] = 0x2b;
pdch = &the_bts->bts_data()->trx[trx_no].pdch[ts_no];
pdch->rcv_block(&data[0], sizeof(data), *fn, &meas);
}
ul_tbf->create_ul_ack(*fn, ts_no);
memset(data, 0x2b, sizeof(data));
hdr3 = (struct gprs_rlc_ul_header_egprs_3 *)data;
hdr3->r = 0;
hdr3->si = 0;
hdr3->cv = 0;
hdr3->tfi_hi = (tfi >> 3) & 0x3;
hdr3->tfi_lo = tfi & 0x7;
hdr3->bsn1_hi = 0;
hdr3->bsn1_lo = 2;
hdr3->cps_hi = 0;
hdr3->cps_lo = 0;
hdr3->spb = 0;
hdr3->rsb = 0;
hdr3->pi = 0;
hdr3->spare = 0;
hdr3->dummy = 1;
data[4] = 0x0;
data[5] = 0x2b;
data[6] = 0x2b;
data[7] = 0x2b;
pdch = &the_bts->bts_data()->trx[trx_no].pdch[ts_no];
pdch->rcv_block(&data[0], sizeof(data), *fn, &meas);
request_dl_rlc_block(ul_tbf, fn);
check_tbf(ul_tbf);
OSMO_ASSERT(ul_tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_NONE);
ms = the_bts->ms_by_tlli(tlli);
OSMO_ASSERT(ms != NULL);
OSMO_ASSERT(ms->ta() == qta/4);
OSMO_ASSERT(ms->ul_tbf() == ul_tbf);
return ul_tbf;
}
static gprs_rlcmac_ul_tbf *establish_ul_tbf_two_phase_puan_URBB_with_length(BTS *the_bts,
uint8_t ts_no, uint32_t tlli, uint32_t *fn, uint16_t qta,
uint8_t ms_class, uint8_t egprs_ms_class, gprs_rlcmac_ul_tbf *ul_tbf)
{
OSMO_ASSERT(ul_tbf);
OSMO_ASSERT(ul_tbf->ta() == qta / 4);
GprsMs *ms;
uint32_t rach_fn = *fn - 51;
uint32_t sba_fn = *fn + 52;
uint8_t trx_no = 0;
int tfi = 0, i = 0;
struct gprs_rlcmac_pdch *pdch;
gprs_rlcmac_bts *bts;
RlcMacUplink_t ulreq = {0};
struct pcu_l1_meas meas;
struct gprs_rlc_ul_header_egprs_3 *egprs3 = NULL;
GprsCodingScheme cs;
check_tbf(ul_tbf);
/* send fake data with cv=0*/
struct gprs_rlc_ul_header_egprs_3 *hdr3 = NULL;
uint8_t data[49] = {0};
hdr3 = (struct gprs_rlc_ul_header_egprs_3 *)data;
/*header_construction */
memset(data, 0x2b, sizeof(data));
/* Message with URBB & URBB length */
for (int i = 0 ; i < 20; i++) {
hdr3->r = 0;
hdr3->si = 0;
hdr3->cv = 10;
hdr3->tfi_hi = (tfi >> 3) & 0x3;
hdr3->tfi_lo = tfi & 0x7;
hdr3->bsn1_hi = ((i * 2)&0x1f);
hdr3->bsn1_lo = ((i * 2)/32);
hdr3->cps_hi = 0;
hdr3->cps_lo = 0;
hdr3->spb = 0;
hdr3->rsb = 0;
hdr3->pi = 0;
hdr3->spare = 0;
hdr3->dummy = 1;
data[4] = 0x0;
data[5] = 0x0;
data[6] = 0x2b;
data[7] = 0x2b;
pdch = &the_bts->bts_data()->trx[trx_no].pdch[ts_no];
pdch->rcv_block(&data[0], sizeof(data), *fn, &meas);
}
ul_tbf->create_ul_ack(*fn, ts_no);
memset(data, 0x2b, sizeof(data));
hdr3 = (struct gprs_rlc_ul_header_egprs_3 *)data;
hdr3->r = 0;
hdr3->si = 0;
hdr3->cv = 0;
hdr3->tfi_hi = (tfi >> 3) & 0x3;
hdr3->tfi_lo = tfi & 0x7;
hdr3->bsn1_hi = 0;
hdr3->bsn1_lo = 2;
hdr3->cps_hi = 0;
hdr3->cps_lo = 0;
hdr3->spb = 0;
hdr3->rsb = 0;
hdr3->pi = 0;
hdr3->spare = 0;
hdr3->dummy = 1;
data[4] = 0x0;
data[5] = 0x2b;
data[6] = 0x2b;
data[7] = 0x2b;
pdch = &the_bts->bts_data()->trx[trx_no].pdch[ts_no];
pdch->rcv_block(&data[0], sizeof(data), *fn, &meas);
request_dl_rlc_block(ul_tbf, fn);
check_tbf(ul_tbf);
OSMO_ASSERT(ul_tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_NONE);
ms = the_bts->ms_by_tlli(tlli);
OSMO_ASSERT(ms != NULL);
OSMO_ASSERT(ms->ta() == qta/4);
OSMO_ASSERT(ms->ul_tbf() == ul_tbf);
return ul_tbf;
}
static gprs_rlcmac_ul_tbf *establish_ul_tbf_two_phase_puan_CRBB(BTS *the_bts,
uint8_t ts_no, uint32_t tlli, uint32_t *fn, uint16_t qta,
uint8_t ms_class, uint8_t egprs_ms_class)
{
GprsMs *ms;
uint32_t rach_fn = *fn - 51;
uint32_t sba_fn = *fn + 52;
uint8_t trx_no = 0;
int tfi = 0, i = 0;
gprs_rlcmac_ul_tbf *ul_tbf;
struct gprs_rlcmac_pdch *pdch;
gprs_rlcmac_bts *bts;
RlcMacUplink_t ulreq = {0};
struct pcu_l1_meas meas;
struct gprs_rlc_ul_header_egprs_3 *egprs3 = NULL;
GprsCodingScheme cs;
/* check the TBF */
ul_tbf = the_bts->ul_tbf_by_tfi(tfi, trx_no, ts_no);
OSMO_ASSERT(ul_tbf);
OSMO_ASSERT(ul_tbf->ta() == qta / 4);
/* send fake data with cv=0*/
struct gprs_rlc_ul_header_egprs_3 *hdr3 = NULL;
uint8_t data[49] = {0};
hdr3 = (struct gprs_rlc_ul_header_egprs_3 *)data;
/*header_construction */
memset(data, 0x2b, sizeof(data));
/* Message with CRBB */
for (int i = 80 ; i < 160; i++) {
hdr3->r = 0;
hdr3->si = 0;
hdr3->cv = 10;
hdr3->tfi_hi = (tfi >> 3) & 0x3;
hdr3->tfi_lo = tfi & 0x7;
hdr3->bsn1_hi = ((i)&0x1f);
hdr3->bsn1_lo = ((i)/32);
hdr3->cps_hi = 0;
hdr3->cps_lo = 0;
hdr3->spb = 0;
hdr3->rsb = 0;
hdr3->pi = 0;
hdr3->spare = 0;
hdr3->dummy = 1;
data[4] = 0x0;
data[5] = 0x0;
data[6] = 0x2b;
data[7] = 0x2b;
pdch = &the_bts->bts_data()->trx[trx_no].pdch[ts_no];
pdch->rcv_block(&data[0], sizeof(data), *fn, &meas);
}
ul_tbf->create_ul_ack(*fn, ts_no);
memset(data, 0x2b, sizeof(data));
hdr3 = (struct gprs_rlc_ul_header_egprs_3 *)data;
hdr3->r = 0;
hdr3->si = 0;
hdr3->cv = 0;
hdr3->tfi_hi = (tfi >> 3) & 0x3;
hdr3->tfi_lo = tfi & 0x7;
hdr3->bsn1_hi = 0;
hdr3->bsn1_lo = 2;
hdr3->cps_hi = 0;
hdr3->cps_lo = 0;
hdr3->spb = 0;
hdr3->rsb = 0;
hdr3->pi = 0;
hdr3->spare = 0;
hdr3->dummy = 1;
data[4] = 0x0;
data[5] = 0x2b;
data[6] = 0x2b;
data[7] = 0x2b;
pdch = &the_bts->bts_data()->trx[trx_no].pdch[ts_no];
pdch->rcv_block(&data[0], sizeof(data), *fn, &meas);
request_dl_rlc_block(ul_tbf, fn);
check_tbf(ul_tbf);
OSMO_ASSERT(ul_tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_NONE);
ms = the_bts->ms_by_tlli(tlli);
OSMO_ASSERT(ms != NULL);
OSMO_ASSERT(ms->ta() == qta/4);
OSMO_ASSERT(ms->ul_tbf() == ul_tbf);
return ul_tbf;
}
static gprs_rlcmac_ul_tbf *establish_ul_tbf_two_phase(BTS *the_bts,
uint8_t ts_no, uint32_t tlli, uint32_t *fn, uint16_t qta,
uint8_t ms_class, uint8_t egprs_ms_class)
@ -1372,6 +1714,73 @@ static void test_tbf_single_phase()
printf("=== end %s ===\n", __func__);
}
static void test_tbf_egprs_two_phase_puan(void)
{
BTS the_bts;
int ts_no = 7;
uint32_t fn = 2654218;
uint16_t qta = 31;
uint32_t tlli = 0xf1223344;
const char *imsi = "0011223344";
uint8_t ms_class = 1;
gprs_rlcmac_bts *bts;
uint8_t egprs_ms_class = 1;
gprs_rlcmac_ul_tbf *ul_tbf;
GprsMs *ms;
uint8_t test_data[256];
printf("=== start %s ===\n", __func__);
memset(test_data, 1, sizeof(test_data));
setup_bts(&the_bts, ts_no, 4);
the_bts.bts_data()->initial_mcs_dl = 9;
the_bts.bts_data()->egprs_enabled = 1;
bts = the_bts.bts_data();
bts->ws_base = 128;
bts->ws_pdch = 64;
ul_tbf = establish_ul_tbf(&the_bts, ts_no, tlli, &fn, qta, ms_class, egprs_ms_class);
/* Function to generate URBB with no length */
ul_tbf = establish_ul_tbf_two_phase_puan_URBB_no_length(&the_bts, ts_no, tlli, &fn,
qta, ms_class, egprs_ms_class, ul_tbf);
ms = ul_tbf->ms();
fprintf(stderr, "Got '%s', TA=%d\n", ul_tbf->name(), ul_tbf->ta());
fprintf(stderr,
"Got MS: TLLI = 0x%08x, TA = %d\n", ms->tlli(), ms->ta());
send_dl_data(&the_bts, tlli, imsi, test_data, sizeof(test_data));
ul_tbf->m_window.set_v_r(0);
ul_tbf->m_window.set_v_q(0);
/* Function to generate URBB with length */
ul_tbf = establish_ul_tbf_two_phase_puan_URBB_with_length(&the_bts, ts_no, tlli, &fn,
qta, ms_class, egprs_ms_class, ul_tbf);
ms = ul_tbf->ms();
fprintf(stderr, "Got '%s', TA=%d\n", ul_tbf->name(), ul_tbf->ta());
fprintf(stderr,
"Got MS: TLLI = 0x%08x, TA = %d\n", ms->tlli(), ms->ta());
send_dl_data(&the_bts, tlli, imsi, test_data, sizeof(test_data));
ul_tbf->m_window.set_v_r(0);
ul_tbf->m_window.set_v_q(0);
/* Function to generate CRBB */
bts->ws_base = 128;
bts->ws_pdch = 64;
ul_tbf = establish_ul_tbf_two_phase_puan_CRBB(&the_bts, ts_no, tlli, &fn,
qta, ms_class, egprs_ms_class);
ms = ul_tbf->ms();
fprintf(stderr, "Got '%s', TA=%d\n", ul_tbf->name(), ul_tbf->ta());
fprintf(stderr,
"Got MS: TLLI = 0x%08x, TA = %d\n", ms->tlli(), ms->ta());
send_dl_data(&the_bts, tlli, imsi, test_data, sizeof(test_data));
printf("=== end %s ===\n", __func__);
}
/*
* Trigger rach for single block
*/
@ -2899,6 +3308,7 @@ int main(int argc, char **argv)
test_tbf_li_decoding();
test_tbf_epdan_out_of_rx_window();
test_immediate_assign_rej();
test_tbf_egprs_two_phase_puan();
test_packet_access_rej_epdan();
if (getenv("TALLOC_REPORT_FULL"))

File diff suppressed because it is too large Load Diff

View File

@ -72,6 +72,8 @@ Testing retx for MCS 6 to reseg_mcs 3
=== end test_immediate_assign_rej_multi_block ===
=== start test_immediate_assign_rej_single_block ===
=== end test_immediate_assign_rej_single_block ===
=== start test_tbf_egprs_two_phase_puan ===
=== end test_tbf_egprs_two_phase_puan ===
=== start test_packet_access_rej_epdan ===
packet reject: 40 84 7f f7 6e e6 41 4b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
=== end test_packet_access_rej_epdan ===