This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/22814 ) Change subject: Fix neigh resolution service on local neighbours ...................................................................... Fix neigh resolution service on local neighbours Change-Id: I217e3550aa6d7f3c3cab4e545641d790ae12b23f Related: SYS#4909 --- M src/osmo-bsc/neighbor_ident.c M tests/ctrl/osmo-bsc-neigh-test.cfg M tests/ctrl_test_runner.py 3 files changed, 109 insertions(+), 6 deletions(-) Approvals: laforge: Looks good to me, approved daniel: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/osmo-bsc/neighbor_ident.c b/src/osmo-bsc/neighbor_ident.c index 335091e..3235508 100644 --- a/src/osmo-bsc/neighbor_ident.c +++ b/src/osmo-bsc/neighbor_ident.c @@ -276,6 +276,19 @@ CTRL_CMD_DEFINE_RO(neighbor_resolve_cgi_ps_from_lac_ci, "neighbor_resolve_cgi_ps_from_lac_ci"); +static int gsm_bts_get_cgi_ps(const struct gsm_bts *bts, struct osmo_cell_global_id_ps *cgi_ps) +{ + if (bts->gprs.mode == BTS_GPRS_NONE) + return -ENOTSUP; + + cgi_ps->rai.lac.plmn = bts->network->plmn; + cgi_ps->rai.lac.lac = bts->location_area_code; + cgi_ps->rai.rac = bts->gprs.rac; + cgi_ps->cell_identity = bts->cell_identity; + + return 0; +} + static int get_neighbor_resolve_cgi_ps_from_lac_ci(struct ctrl_cmd *cmd, void *data) { struct gsm_network *net = (struct gsm_network *)data; @@ -284,7 +297,9 @@ char *tmp = NULL, *tok, *saveptr; struct neighbor_ident_key ni; unsigned lac, cell_id; - const struct osmo_cell_global_id_ps *cgi_ps; + struct osmo_cell_global_id_ps local_cgi_ps; + const struct osmo_cell_global_id_ps *cgi_ps = NULL; + struct gsm_bts_ref *neigh; if (!cmd->variable) goto fmt_err; @@ -335,10 +350,26 @@ if (!neighbor_ident_key_valid(&ni)) goto fmt_err; - tgt_cell_li = neighbor_ident_get(net->neighbor_bss_cells, &ni); - if (!tgt_cell_li || tgt_cell_li->id_discr != CELL_IDENT_WHOLE_GLOBAL_PS || tgt_cell_li->id_list_len < 1) - goto notfound_err; - cgi_ps = &tgt_cell_li->id_list[0].global_ps; + /* Is there a local BTS that matches the key? */ + llist_for_each_entry(neigh, &bts_found->local_neighbors, entry) { + struct gsm_bts *neigh_bts = neigh->bts; + struct neighbor_ident_key *neigh_bts_key = bts_ident_key(neigh_bts); + neigh_bts_key->from_bts = ni.from_bts; + if (!neighbor_ident_key_match(neigh_bts_key, &ni, true)) + continue; + if (gsm_bts_get_cgi_ps(neigh->bts, &local_cgi_ps) < 0) + continue; /* Not supporting GPRS */ + cgi_ps = &local_cgi_ps; + break; + } + + /* No local neighbor found, looking for remote neighbors */ + if (!cgi_ps) { + tgt_cell_li = neighbor_ident_get(net->neighbor_bss_cells, &ni); + if (!tgt_cell_li || tgt_cell_li->id_discr != CELL_IDENT_WHOLE_GLOBAL_PS || tgt_cell_li->id_list_len < 1) + goto notfound_err; + cgi_ps = &tgt_cell_li->id_list[0].global_ps; + } ctrl_cmd_reply_printf(cmd, "%s", osmo_cgi_ps_name(cgi_ps)); talloc_free(tmp); diff --git a/tests/ctrl/osmo-bsc-neigh-test.cfg b/tests/ctrl/osmo-bsc-neigh-test.cfg index f1e71b6..2fbc8f8 100644 --- a/tests/ctrl/osmo-bsc-neigh-test.cfg +++ b/tests/ctrl/osmo-bsc-neigh-test.cfg @@ -46,6 +46,8 @@ oml ipa stream-id 255 line 0 codec-support fr gprs mode gprs + gprs routing area 5 + ! remote neigh: neighbor cgi-ps 23 42 423 2 5 arfcn 23 bsic 32 trx 0 rf_locked 0 @@ -78,6 +80,63 @@ timeslot 7 phys_chan_config TCH/F hopping enabled 0 + bts 1 + type sysmobts + band DCS1800 + cell_identity 123 + location_area_code 1 + base_station_id_code 55 + ms max power 15 + cell reselection hysteresis 4 + rxlev access min 0 + radio-link-timeout 32 + channel allocator ascending + rach tx integer 9 + rach max transmission 7 + channel-description attach 1 + channel-description bs-pa-mfrms 5 + channel-description bs-ag-blks-res 1 + early-classmark-sending forbidden + ipa unit-id 55 0 + oml ipa stream-id 255 line 0 + codec-support fr + gprs mode gprs + gprs routing area 6 + neighbor bts 0 + trx 0 + rf_locked 0 + arfcn 880 + nominal power 23 + ! to use full TRX power, set max_power_red 0 + max_power_red 20 + rsl e1 tei 0 + timeslot 0 + phys_chan_config CCCH+SDCCH4 + hopping enabled 0 + timeslot 1 + phys_chan_config TCH/F + hopping enabled 0 + timeslot 2 + phys_chan_config TCH/F + hopping enabled 0 + timeslot 3 + phys_chan_config TCH/F + hopping enabled 0 + timeslot 4 + phys_chan_config TCH/F + hopping enabled 0 + timeslot 5 + phys_chan_config TCH/F + hopping enabled 0 + timeslot 6 + phys_chan_config TCH/F + hopping enabled 0 + timeslot 7 + phys_chan_config TCH/F + hopping enabled 0 + bts 0 + ! local neigh, refers to bts 1: + neighbor cgi-ps 1 1 1 6 123 msc 0 type normal allow-emergency allow diff --git a/tests/ctrl_test_runner.py b/tests/ctrl_test_runner.py index fb983c9..501b917 100755 --- a/tests/ctrl_test_runner.py +++ b/tests/ctrl_test_runner.py @@ -501,11 +501,24 @@ def ctrl_app(self): return (4248, "./src/osmo-bsc/osmo-bsc", "OsmoBSC", "bsc") - def testCtrlNeighborResolution(self): + def testCtrlNeighborResolutionLocalBtsNr(self): + r = self.do_get('neighbor_resolve_cgi_ps_from_lac_ci.1.123.871.63') + self.assertEqual(r['mtype'], 'GET_REPLY') + self.assertEqual(r['var'], 'neighbor_resolve_cgi_ps_from_lac_ci.1.123.871.63') + self.assertEqual(r['value'], '001-01-1-5-6969') + + def testCtrlNeighborResolutionLocalWithoutArfcnBsic(self): + r = self.do_get('neighbor_resolve_cgi_ps_from_lac_ci.1.6969.880.55') + self.assertEqual(r['mtype'], 'GET_REPLY') + self.assertEqual(r['var'], 'neighbor_resolve_cgi_ps_from_lac_ci.1.6969.880.55') + self.assertEqual(r['value'], '001-01-1-6-123') + + def testCtrlNeighborResolutionWrongSyntax(self): r = self.do_get('neighbor_resolve_cgi_ps_from_lac_ci') self.assertEqual(r['mtype'], 'ERROR') self.assertEqual(r['error'], 'The format is <src_lac>,<src_cell_id>,<dst_arfcn>,<dst_bsic>') + def testCtrlNeighborResolutionRemote(self): r = self.do_get('neighbor_resolve_cgi_ps_from_lac_ci.1.6969.23.32') self.assertEqual(r['mtype'], 'GET_REPLY') self.assertEqual(r['var'], 'neighbor_resolve_cgi_ps_from_lac_ci.1.6969.23.32') -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/22814 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I217e3550aa6d7f3c3cab4e545641d790ae12b23f Gerrit-Change-Number: 22814 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210213/46018392/attachment.htm>