From 57c2e68da2425340852b9e7ea2f38c1c1c4f7e1f Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 14 Sep 2022 19:43:54 +0200 Subject: [PATCH] vty: Allow setting LAC as hexadecimal value The LAC value currently configured is now printed as hexadecimal value too. It can still be entered as a decimal value in order to keep backward compatibility, though the hexadecimal one is now preferred. Related: OS#5631 Depends: libosmocore.git Ia2b7fbbf5502c28374c21dbff548232680da27d4 Change-Id: I9090d73ae9d39244b79b9dbafa1b164faebabc52 --- TODO-RELEASE | 1 + .../ericsson/osmo-bsc.dug20-rus01-4trx.cfg | 2 +- .../ericsson/osmo-bsc.dug20-rus02-4trx.cfg | 2 +- .../ericsson/osmo-bsc.dug20-rus02-8trx.cfg | 2 +- .../osmo-bsc/ericsson/osmo-bsc.rbs2308.cfg | 2 +- .../osmo-bsc/nokia/osmo-bsc.insite.cfg | 2 +- doc/examples/osmo-bsc/osmo-bsc-4trx.cfg | 2 +- doc/examples/osmo-bsc/osmo-bsc-minimal.cfg | 2 +- doc/examples/osmo-bsc/osmo-bsc.cfg | 2 +- .../osmo-bsc/osmo-bsc_custom-sccp.cfg | 2 +- .../osmo-bsc/siemens/osmo-bsc.bs11.cfg | 2 +- doc/manuals/chapters/bts-examples.adoc | 6 ++--- doc/manuals/chapters/bts.adoc | 2 +- doc/manuals/chapters/handover.adoc | 24 +++++++++---------- src/osmo-bsc/bts_vty.c | 16 ++++++------- tests/ctrl/osmo-bsc-apply-config-file.cfg | 2 +- tests/ctrl/osmo-bsc-neigh-test.cfg | 4 ++-- tests/handover/handover_test.c | 2 +- tests/nanobts_omlattr/nanobts_omlattr_test.c | 2 +- tests/neighbor_ident.vty | 12 +++++----- 20 files changed, 45 insertions(+), 46 deletions(-) diff --git a/TODO-RELEASE b/TODO-RELEASE index f172501ae..532f154f6 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -8,3 +8,4 @@ # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line libosmogsm >1.7.0 BTS_FEAT_OSMUX, RSL_IE_OSMO_OSMUX_CID +libosmocore >1.7.0 vty hexadecimal range support (location_area_code) diff --git a/doc/examples/osmo-bsc/ericsson/osmo-bsc.dug20-rus01-4trx.cfg b/doc/examples/osmo-bsc/ericsson/osmo-bsc.dug20-rus01-4trx.cfg index 8ef161990..7d676d64c 100644 --- a/doc/examples/osmo-bsc/ericsson/osmo-bsc.dug20-rus01-4trx.cfg +++ b/doc/examples/osmo-bsc/ericsson/osmo-bsc.dug20-rus01-4trx.cfg @@ -33,7 +33,7 @@ network band GSM900 om2000 version-limit oml gen 12 rev 10 cell_identity 0 - location_area_code 1 + location_area_code 0x0001 training_sequence_code 7 base_station_id_code 63 ms max power 15 diff --git a/doc/examples/osmo-bsc/ericsson/osmo-bsc.dug20-rus02-4trx.cfg b/doc/examples/osmo-bsc/ericsson/osmo-bsc.dug20-rus02-4trx.cfg index 7c9b84739..464b37f03 100644 --- a/doc/examples/osmo-bsc/ericsson/osmo-bsc.dug20-rus02-4trx.cfg +++ b/doc/examples/osmo-bsc/ericsson/osmo-bsc.dug20-rus02-4trx.cfg @@ -33,7 +33,7 @@ network band GSM900 om2000 version-limit oml gen 12 rev 10 cell_identity 0 - location_area_code 1 + location_area_code 0x0001 training_sequence_code 7 base_station_id_code 63 ms max power 15 diff --git a/doc/examples/osmo-bsc/ericsson/osmo-bsc.dug20-rus02-8trx.cfg b/doc/examples/osmo-bsc/ericsson/osmo-bsc.dug20-rus02-8trx.cfg index 6db88b541..844bf05ba 100644 --- a/doc/examples/osmo-bsc/ericsson/osmo-bsc.dug20-rus02-8trx.cfg +++ b/doc/examples/osmo-bsc/ericsson/osmo-bsc.dug20-rus02-8trx.cfg @@ -33,7 +33,7 @@ network band GSM900 om2000 version-limit oml gen 12 rev 10 cell_identity 0 - location_area_code 1 + location_area_code 0x0001 training_sequence_code 7 base_station_id_code 63 ms max power 15 diff --git a/doc/examples/osmo-bsc/ericsson/osmo-bsc.rbs2308.cfg b/doc/examples/osmo-bsc/ericsson/osmo-bsc.rbs2308.cfg index a90cfa107..82283c8e1 100644 --- a/doc/examples/osmo-bsc/ericsson/osmo-bsc.rbs2308.cfg +++ b/doc/examples/osmo-bsc/ericsson/osmo-bsc.rbs2308.cfg @@ -39,7 +39,7 @@ network type rbs2000 band PCS1900 cell_identity 0 - location_area_code 1 + location_area_code 0x0001 training_sequence_code 7 base_station_id_code 63 ms max power 33 diff --git a/doc/examples/osmo-bsc/nokia/osmo-bsc.insite.cfg b/doc/examples/osmo-bsc/nokia/osmo-bsc.insite.cfg index a8e8e5c3f..0b0afa8a8 100644 --- a/doc/examples/osmo-bsc/nokia/osmo-bsc.insite.cfg +++ b/doc/examples/osmo-bsc/nokia/osmo-bsc.insite.cfg @@ -27,7 +27,7 @@ network type nokia_site band GSM1900 cell_identity 1 - location_area_code 1 + location_area_code 0x0001 base_station_id_code 63 training_sequence_code 7 diff --git a/doc/examples/osmo-bsc/osmo-bsc-4trx.cfg b/doc/examples/osmo-bsc/osmo-bsc-4trx.cfg index 206a3c7b8..f2fcf7795 100644 --- a/doc/examples/osmo-bsc/osmo-bsc-4trx.cfg +++ b/doc/examples/osmo-bsc/osmo-bsc-4trx.cfg @@ -11,7 +11,7 @@ network type osmo-bts band DCS1800 cell_identity 6969 - location_area_code 1 + location_area_code 0x0001 base_station_id_code 63 ms max power 15 cell reselection hysteresis 4 diff --git a/doc/examples/osmo-bsc/osmo-bsc-minimal.cfg b/doc/examples/osmo-bsc/osmo-bsc-minimal.cfg index 2258495d0..5e1ac11fb 100644 --- a/doc/examples/osmo-bsc/osmo-bsc-minimal.cfg +++ b/doc/examples/osmo-bsc/osmo-bsc-minimal.cfg @@ -4,7 +4,7 @@ network bts 0 type osmo-bts band GSM-1800 - location_area_code 23 + location_area_code 0x0017 ipa unit-id 1800 0 trx 0 rf_locked 0 diff --git a/doc/examples/osmo-bsc/osmo-bsc.cfg b/doc/examples/osmo-bsc/osmo-bsc.cfg index 22afa0740..17ca15287 100644 --- a/doc/examples/osmo-bsc/osmo-bsc.cfg +++ b/doc/examples/osmo-bsc/osmo-bsc.cfg @@ -23,7 +23,7 @@ network type osmo-bts band DCS1800 cell_identity 6969 - location_area_code 1 + location_area_code 0x0001 base_station_id_code 63 ms max power 15 cell reselection hysteresis 4 diff --git a/doc/examples/osmo-bsc/osmo-bsc_custom-sccp.cfg b/doc/examples/osmo-bsc/osmo-bsc_custom-sccp.cfg index 21187c79a..a053dbe08 100644 --- a/doc/examples/osmo-bsc/osmo-bsc_custom-sccp.cfg +++ b/doc/examples/osmo-bsc/osmo-bsc_custom-sccp.cfg @@ -22,7 +22,7 @@ network type osmo-bts band DCS1800 cell_identity 0 - location_area_code 1 + location_area_code 0x0001 base_station_id_code 63 ms max power 15 cell reselection hysteresis 4 diff --git a/doc/examples/osmo-bsc/siemens/osmo-bsc.bs11.cfg b/doc/examples/osmo-bsc/siemens/osmo-bsc.bs11.cfg index a308db5be..8d7529628 100644 --- a/doc/examples/osmo-bsc/siemens/osmo-bsc.bs11.cfg +++ b/doc/examples/osmo-bsc/siemens/osmo-bsc.bs11.cfg @@ -39,7 +39,7 @@ network type bs11 band GSM900 cell_identity 1 - location_area_code 1 + location_area_code 0x0001 training_sequence_code 7 base_station_id_code 63 oml e1 line 2 timeslot 1 sub-slot full diff --git a/doc/manuals/chapters/bts-examples.adoc b/doc/manuals/chapters/bts-examples.adoc index 2afc8ff55..1f3652bbe 100644 --- a/doc/manuals/chapters/bts-examples.adoc +++ b/doc/manuals/chapters/bts-examples.adoc @@ -26,7 +26,7 @@ network type nanobts <2> band DCS1800 <3> cell_identity 0 - location_area_code 1 + location_area_code 0x0001 training_sequence_code 7 base_station_id_code 63 ms max power 15 @@ -104,7 +104,7 @@ network type nanobts band DCS1800 cell_identity 0 - location_area_code 1 + location_area_code 0x0001 training_sequence_code 7 base_station_id_code 63 ms max power 15 @@ -197,7 +197,7 @@ network band GSM900 om2000 version-limit oml gen 12 rev 10 <2> cell_identity 0 - location_area_code 1 + location_area_code 0x0001 training_sequence_code 7 base_station_id_code 63 ms max power 15 diff --git a/doc/manuals/chapters/bts.adoc b/doc/manuals/chapters/bts.adoc index 4662c1a0c..177d1c5f7 100644 --- a/doc/manuals/chapters/bts.adoc +++ b/doc/manuals/chapters/bts.adoc @@ -108,7 +108,7 @@ network type osmo-bts band DCS1800 description The new BTS in Baikonur - location_area_code 2342 + location_area_code 0x0926 cell_identity 5 base_station_id_code 63 ip.access unit_id 8888 0 diff --git a/doc/manuals/chapters/handover.adoc b/doc/manuals/chapters/handover.adoc index f56725977..4affe3b41 100644 --- a/doc/manuals/chapters/handover.adoc +++ b/doc/manuals/chapters/handover.adoc @@ -223,15 +223,15 @@ network network bts 0 - # this cell's LAC=23 CI=5 - location_area_code 23 + # this cell's LAC=0x0017 CI=5 + location_area_code 0x0017 cell_identity 5 # reference bts 1 neighbor lac-ci 23 6 bts 1 - # this cell's LAC=23 CI=6 - location_area_code 23 + # this cell's LAC=0x0017 CI=6 + location_area_code 0x0017 cell_identity 6 # reference bts 0 neighbor lac-ci 23 5 @@ -252,8 +252,8 @@ desirable to use the `neighbor bts <0-255>` format, or omit the redundant network bts 0 - # this cell's LAC=23 CI=5 - location_area_code 23 + # this cell's LAC=0x0017 CI=5 + location_area_code 0x0017 cell_identity 5 # this cell's ARFCN=1 BSIC=1 trx 0 @@ -263,8 +263,8 @@ network neighbor lac-ci 23 6 arfcn 2 bsic 2 bts 1 - # LAC=23 CI=6 - location_area_code 23 + # LAC=0x0017 CI=6 + location_area_code 0x0017 cell_identity 6 # this cell's ARFCN=2 BSIC=2 trx 0 @@ -286,8 +286,8 @@ Indication and 3.2.1.9 HANDOVER REQUIRED). # BSC Alpha's osmo-bsc.cfg network bts 0 - # this cell's LAC=23 CI=6 - location_area_code 23 + # this cell's LAC=0x0017 CI=6 + location_area_code 0x0017 cell_identity 6 # this cell's ARFCN=2 BSIC=2 trx 0 @@ -299,8 +299,8 @@ network # BSC Beta's osmo-bsc.cfg network bts 0 - # this cell's LAC=42 CI=3 - location_area_code 42 + # this cell's LAC=0x002A CI=3 + location_area_code 0x002A cell_identity 3 # this cell's ARFCN=1 BSIC=3 trx 0 diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c index 39007685f..c473e9409 100644 --- a/src/osmo-bsc/bts_vty.c +++ b/src/osmo-bsc/bts_vty.c @@ -276,17 +276,15 @@ DEFUN_USRATTR(cfg_bts_ci, DEFUN_USRATTR(cfg_bts_lac, cfg_bts_lac_cmd, X(BSC_VTY_ATTR_RESTART_ABIS_RSL_LINK), - "location_area_code <0-65535>", - "Set the Location Area Code (LAC) of this BTS\n" "LAC\n") + "location_area_code (<0-65535>|<0x0000-0xffff>)", + "Set the Location Area Code (LAC) of this BTS\n" + "LAC in decimal format\n" + "LAC in hexadecimal format\n") { struct gsm_bts *bts = vty->index; - int lac = atoi(argv[0]); - - if (lac < 0 || lac > 0xffff) { - vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s", - lac, VTY_NEWLINE); + int lac; + if (osmo_str_to_int(&lac, argv[0], 0, 0, 0xffff) < 0) return CMD_WARNING; - } if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) { vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s", @@ -4307,7 +4305,7 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE); vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE); vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE); - vty_out(vty, " location_area_code %u%s", bts->location_area_code, + vty_out(vty, " location_area_code 0x%04x%s", bts->location_area_code, VTY_NEWLINE); if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED) vty_out(vty, " dtx uplink%s%s", diff --git a/tests/ctrl/osmo-bsc-apply-config-file.cfg b/tests/ctrl/osmo-bsc-apply-config-file.cfg index 0094cd70d..5f274658d 100644 --- a/tests/ctrl/osmo-bsc-apply-config-file.cfg +++ b/tests/ctrl/osmo-bsc-apply-config-file.cfg @@ -3,7 +3,7 @@ network type osmo-bts band DCS1800 cell_identity 123 - location_area_code 1 + location_area_code 0x0001 base_station_id_code 55 ms max power 15 cell reselection hysteresis 4 diff --git a/tests/ctrl/osmo-bsc-neigh-test.cfg b/tests/ctrl/osmo-bsc-neigh-test.cfg index baf5f36d5..b1c5bdf7b 100644 --- a/tests/ctrl/osmo-bsc-neigh-test.cfg +++ b/tests/ctrl/osmo-bsc-neigh-test.cfg @@ -20,7 +20,7 @@ network type osmo-bts band DCS1800 cell_identity 6969 - location_area_code 1 + location_area_code 0x0001 base_station_id_code 63 ms max power 15 cell reselection hysteresis 4 @@ -77,7 +77,7 @@ network type osmo-bts band DCS1800 cell_identity 123 - location_area_code 1 + location_area_code 0x0001 base_station_id_code 55 ms max power 15 cell reselection hysteresis 4 diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c index d237ab781..6830b48be 100644 --- a/tests/handover/handover_test.c +++ b/tests/handover/handover_test.c @@ -257,7 +257,7 @@ static struct gsm_bts *_create_bts(int num_trx, const char * const *ts_args, int return NULL; } - bts->location_area_code = 23; + bts->location_area_code = 0x0017; bts->cell_identity = ci++; bts->c0->arfcn = arfcn++; diff --git a/tests/nanobts_omlattr/nanobts_omlattr_test.c b/tests/nanobts_omlattr/nanobts_omlattr_test.c index 32e2c5353..83b6c5e14 100644 --- a/tests/nanobts_omlattr/nanobts_omlattr_test.c +++ b/tests/nanobts_omlattr/nanobts_omlattr_test.c @@ -160,7 +160,7 @@ int main(int argc, char **argv) bts->c0->arfcn = 866; bts->cell_identity = 1337; bts->network->plmn = (struct osmo_plmn_id){ .mcc=1, .mnc=1 }; - bts->location_area_code = 1; + bts->location_area_code = 0x0001; bts->gprs.rac = 0; uint8_t attr_bts_expected[] = { 0x19, 0x73, 0x6d, 0x67, 0x61, 0x5b, 0x55, 0x18, 0x06, 0x0e, 0x00, diff --git a/tests/neighbor_ident.vty b/tests/neighbor_ident.vty index 950d85235..211159cdd 100644 --- a/tests/neighbor_ident.vty +++ b/tests/neighbor_ident.vty @@ -21,7 +21,7 @@ OsmoBSC(config-net)# neighbor-resolution bind 1.2.3.4 ? OsmoBSC(config-net)# bts 0 OsmoBSC(config-net-bts)# type osmo-bts OsmoBSC(config-net-bts)# base_station_id_code 10 -OsmoBSC(config-net-bts)# location_area_code 20 +OsmoBSC(config-net-bts)# location_area_code 0x0014 OsmoBSC(config-net-bts)# cell_identity 30 OsmoBSC(config-net-bts)# trx 0 OsmoBSC(config-net-bts-trx)# arfcn 40 @@ -31,7 +31,7 @@ OsmoBSC(config-net-bts)# exit OsmoBSC(config-net)# bts 1 OsmoBSC(config-net-bts)# type osmo-bts OsmoBSC(config-net-bts)# base_station_id_code 11 -OsmoBSC(config-net-bts)# location_area_code 21 +OsmoBSC(config-net-bts)# location_area_code 0x0015 OsmoBSC(config-net-bts)# cell_identity 31 OsmoBSC(config-net-bts)# trx 0 OsmoBSC(config-net-bts-trx)# arfcn 41 @@ -41,7 +41,7 @@ OsmoBSC(config-net-bts)# exit OsmoBSC(config-net)# bts 2 OsmoBSC(config-net-bts)# type osmo-bts OsmoBSC(config-net-bts)# base_station_id_code 12 -OsmoBSC(config-net-bts)# location_area_code 22 +OsmoBSC(config-net-bts)# location_area_code 0x0016 OsmoBSC(config-net-bts)# cell_identity 65535 OsmoBSC(config-net-bts)# trx 0 OsmoBSC(config-net-bts-trx)# arfcn 42 @@ -53,7 +53,7 @@ OsmoBSC(config-net)# show running-config bts 0 ... cell_identity 30 - location_area_code 20 + location_area_code 0x0014 base_station_id_code 10 ... trx 0 @@ -63,7 +63,7 @@ OsmoBSC(config-net)# show running-config bts 1 ... cell_identity 31 - location_area_code 21 + location_area_code 0x0015 base_station_id_code 11 ... trx 0 @@ -73,7 +73,7 @@ OsmoBSC(config-net)# show running-config bts 2 ... cell_identity 65535 - location_area_code 22 + location_area_code 0x0016 base_station_id_code 12 ... trx 0