gprs_ns2: ensure the NSE becomes dead when FR link went down

The FR code is using force unconfigured to change the state of the NSVC
when the FR link goes down. The force unconfigured state didn't
notified the NSE when changing into this state.

Related: SYS#5533
Change-Id: I4d7bbbbce26f7cde99eebe96995c50b1e812e5bd
This commit is contained in:
Alexander Couzens 2021-07-12 16:42:32 +02:00 committed by daniel
parent efa64f9429
commit a140d44a4f
3 changed files with 61 additions and 0 deletions

View File

@ -254,7 +254,10 @@ static void alive_timeout_handler(void *data)
static void ns2_st_unconfigured_onenter(struct osmo_fsm_inst *fi, uint32_t old_state)
{
struct gprs_ns2_vc_priv *priv = fi->priv;
stop_test_procedure(fi->priv);
ns2_nse_notify_unblocked(priv->nsvc, false);
}
static void ns2_st_unconfigured(struct osmo_fsm_inst *fi, uint32_t event, void *data)

View File

@ -592,6 +592,56 @@ void test_mtu(void *ctx)
printf("--- Finish unitdata test\n");
}
void test_unconfigured(void *ctx)
{
struct gprs_ns2_inst *nsi;
struct gprs_ns2_vc_bind *bind[2];
struct gprs_ns2_vc_bind *loopbind;
struct gprs_ns2_nse *nse;
struct gprs_ns2_vc *nsvc[2];
struct gprs_ns2_vc *loop[2];
char idbuf[32];
int i;
printf("--- Testing force unconfigured\n");
osmo_wqueue_clear(unitdata);
printf("---- Create NSE + Binds\n");
nsi = gprs_ns2_instantiate(ctx, ns_prim_cb, NULL);
bind[0] = dummy_bind(nsi, "bblock1");
bind[1] = dummy_bind(nsi, "bblock2");
loopbind = loopback_bind(nsi, "loopback");
nse = gprs_ns2_create_nse(nsi, 1004, GPRS_NS2_LL_UDP, GPRS_NS2_DIALECT_STATIC_RESETBLOCK);
OSMO_ASSERT(nse);
for (i=0; i<2; i++) {
printf("---- Create NSVC[%d]\n", i);
snprintf(idbuf, sizeof(idbuf), "NSE%05u-dummy-%i", nse->nsei, i);
nsvc[i] = ns2_vc_alloc(bind[i], nse, false, GPRS_NS2_VC_MODE_BLOCKRESET, idbuf);
loop[i] = loopback_nsvc(loopbind, nsvc[i]);
OSMO_ASSERT(nsvc[i]);
ns2_vc_fsm_start(nsvc[i]);
OSMO_ASSERT(!ns2_vc_is_unblocked(nsvc[i]));
ns2_tx_reset(loop[i], NS_CAUSE_OM_INTERVENTION);
ns2_tx_unblock(loop[i]);
OSMO_ASSERT(ns2_vc_is_unblocked(nsvc[i]));
}
/* both nsvcs are unblocked and alive */
printf("---- Check if NSE is alive\n");
OSMO_ASSERT(nse->alive);
ns2_vc_force_unconfigured(nsvc[0]);
OSMO_ASSERT(nse->alive);
ns2_vc_force_unconfigured(nsvc[1]);
printf("---- Check if NSE is dead\n");
OSMO_ASSERT(!nse->alive);
gprs_ns2_free(nsi);
printf("--- Finish force unconfigured test\n");
}
int main(int argc, char **argv)
{
void *ctx = talloc_named_const(NULL, 0, "gprs_ns2_test");
@ -611,6 +661,7 @@ int main(int argc, char **argv)
test_block_unblock_nsvc2(ctx);
test_unitdata(ctx);
test_unitdata_weights(ctx);
test_unconfigured(ctx);
test_mtu(ctx);
printf("===== NS2 protocol test END\n\n");

View File

@ -33,6 +33,13 @@
---- Send UNITDATA to all NSVCs
---- Send BSSGP data to the NSE to test unitdata over NSVC[1]
--- Finish unitdata weight test
--- Testing force unconfigured
---- Create NSE + Binds
---- Create NSVC[0]
---- Create NSVC[1]
---- Check if NSE is alive
---- Check if NSE is dead
--- Finish force unconfigured test
--- Testing mtu test
---- Create NSE + Binds
---- Create NSVC[0]