openbsc[master]: Make BTS type and variant converters shareable
Patch Set 6: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/2286/6/openbsc/src/libcommon/gsm_data_shared.c File openbsc/src/libcommon/gsm_data_shared.c: Line 74:{ BTS_OSMO_SYSMO, "Sysmo" }, should be "sysmoBTS" -- To view, visit https://gerrit.osmocom.org/2286 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ida94725a6fce968443541e3526f48f13758031fd Gerrit-PatchSet: 6 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes
openbsc[master]: Make BTS type and variant converters shareable
Patch Set 7: (1 comment) https://gerrit.osmocom.org/#/c/2286/7/openbsc/src/libcommon/gsm_data_shared.c File openbsc/src/libcommon/gsm_data_shared.c: Line 70: const struct value_string bts_variant_names[_NUM_BTS_VARIANT + 1] = { BikeShedding: * bts_variant.. they are all osmo-bts variants. Reflect that in the name? * In fact some of them are not BTS variants but more the Phy. So all of them are osmo-bts but have various limitations/features in the Phy (dual-trx, single-trx, no HR1, higher latency due Ethernet?) Maybe do it based on features? Have a name enable/unlock features? So something like.. can_have_multiple_sdcch8, can_be_multi_trx? -- To view, visit https://gerrit.osmocom.org/2286 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ida94725a6fce968443541e3526f48f13758031fd Gerrit-PatchSet: 7 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes
openbsc[master]: Make BTS type and variant converters shareable
Patch Set 9: > So all of them are osmo-bts but have various limitations/features in the Phy Well, yes - that's the motivation behind it - see 1614 for details. The thing to keep in mind though is that different phys might have different features enabled depending on sw/fw version. > Maybe do it based on features? Have a name enable/unlock features? That's why we have gsm_btsmodel_set_feature() and gsm_bts_has_feature(). The features supported by particular version of a given bts variant (trx, octphy etc) will be reported via oml by osmo-bts-*, corresponding feature flags would set and can be later queried via those functions. This will be in follow-up patches. -- To view, visit https://gerrit.osmocom.org/2286 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ida94725a6fce968443541e3526f48f13758031fd Gerrit-PatchSet: 9 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No
openbsc[master]: Make BTS type and variant converters shareable
Patch Set 9: definitely we want to report individual features to the BSC, that's what I jokingly described as "abis oml bts classmark". But I guess that's going to be a follow-up patch and is unrelated to the bSC being able to show the properties such as the BTS variant and software version on the vty / via ctrl_if. -- To view, visit https://gerrit.osmocom.org/2286 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ida94725a6fce968443541e3526f48f13758031fd Gerrit-PatchSet: 9 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No
openbsc[master]: Make BTS type and variant converters shareable
Patch Set 9: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/2286/9/openbsc/src/libcommon/gsm_data_shared.c File openbsc/src/libcommon/gsm_data_shared.c: Line 72:{ BTS_OSMO_LITECELL15, "Litecell15" }, if we ever want to use any of those in the VTY (which we probably will sooner or later), they should be all lower-case, and probably reflect the naming of the program, like 'osmo-bts-sysmo', 'osmo-bts-lc15', 'omso-bts-trx', ... -- To view, visit https://gerrit.osmocom.org/2286 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ida94725a6fce968443541e3526f48f13758031fd Gerrit-PatchSet: 9 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: Yes
openbsc[master]: Make BTS type and variant converters shareable
Patch Set 11: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/2286 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ida94725a6fce968443541e3526f48f13758031fd Gerrit-PatchSet: 11 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Holger Freyther Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No
[PATCH] openbsc[master]: Make BTS type and variant converters shareable
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2286 to look at the new patch set (#5). Make BTS type and variant converters shareable * move value_string definition and corresponding functions for BTS type to shared header to make it re-usable by OsmoBTS * use consistent function naming * add similar functions for BTS variant * add enum to be used by OML Attribute Reporting to distinguish between type, variant and other info Change-Id: Ida94725a6fce968443541e3526f48f13758031fd Related: OS#1614 --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/bsc_vty.c M openbsc/src/libcommon/gsm_data.c M openbsc/src/libcommon/gsm_data_shared.c 4 files changed, 70 insertions(+), 21 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/86/2286/5 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 242889a..e016dd9 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -504,6 +504,12 @@ _NUM_BTS_VARIANT }; +/* Used by OML layer for BTS Attribute reporting */ +enum bts_attribute { + BTS_TYPE_VARIANT, + BTS_SUB_MODEL, +}; + struct vty; struct gsm_bts_model { @@ -859,6 +865,14 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num); +enum gsm_bts_type str2btstype(const char *arg); +const char *btstype2str(enum gsm_bts_type type); + +enum bts_attribute str2btsattr(const char *s); +const char *btsatttr2str(enum bts_attribute v); + +enum gsm_bts_type_variant str2btsvariant(const char *arg); +const char *btsvariant2str(enum gsm_bts_type_variant v); const struct value_string gsm_pchant_names[13]; const struct value_string gsm_pchant_descs[13]; diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index c1882fc..702af4a 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -1615,7 +1615,7 @@ struct gsm_bts *bts = vty->index; int rc; - rc = gsm_set_bts_type(bts, parse_btstype(argv[0])); + rc = gsm_set_bts_type(bts, str2btstype(argv[0])); if (rc < 0) return CMD_WARNING; diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index fd34793..8ec0be5 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -90,16 +90,6 @@ return NULL; } -const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE+1] = { - { GSM_BTS_TYPE_UNKNOWN, "unknown" }, - { GSM_BTS_TYPE_BS11,"bs11" }, - { GSM_BTS_TYPE_NANOBTS, "nanobts" }, - { GSM_BTS_TYPE_RBS2000, "rbs2000" }, - { GSM_BTS_TYPE_NOKIA_SITE, "nokia_site" }, - { GSM_BTS_TYPE_OSMOBTS, "sysmobts" }, - { 0,NULL } -}; - const struct value_string bts_type_descs[_NUM_GSM_BTS_TYPE+1] = { { GSM_BTS_TYPE_UNKNOWN, "Unknown BTS Type" }, { GSM_BTS_TYPE_BS11,"Siemens BTS (BS-11 or compatible)" }, @@ -109,16 +99,6 @@ { GSM_BTS_TYPE_OSMOBTS, "sysmocom sysmoBTS" }, { 0,NULL } }; - -enum gsm_bts_type parse_btstype(const char *arg) -{ - return get_string_value(bts_type_names, arg); -} - -const char *btstype2str(enum gsm_bts_type type) -{ - return get_value_string(bts_type_names, type); -} struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr) { diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 387af70..1df92e7 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -51,6 +51,61 @@ gsm_abis_mo_reset(mo); } +const struct value_string bts_attribute_names[] = { + OSMO_VALUE_STRING(BTS_TYPE_VARIANT), + OSMO_VALUE_STRING(BTS_SUB_MODEL), + { 0, NULL } +}; + +enum bts_attribute str2btsattr(const char *s) +{ + return get_string_value(bts_attribute_names, s); +} + +const char *btsatttr2str(enum bts_attribute v) +{ + return get_value_string(bts_attribute_names, v); +} + +const struct value_string bts_variant_names[_NUM_BTS_VARIANT + 1] = { + { BTS_UNKNOWN, "unknown" }, + { BTS_OSMO_LITECELL15, "Litecell15" }, + { BTS_OSMO_OCTPHY, "OctPHY" }, + { BTS_OSMO_SYSMO, "Sysmo" }, + { BTS_OSMO_TRX, "TRX" }, + { 0, NULL } +}; + +enum gsm_bts_type_variant str2btsvariant(const char *arg) +{ + return get_string_value(bts_variant_names, arg); +} + +const char *btsvariant2str(enum gsm_bts_type_variant v) +{ + return get_value_string(bts_variant_names, v); +} + +const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE + 1] = { + { GSM_BTS_TYPE_UNKNOWN, "unknown" }, + { GSM_BTS_TYPE_BS11,"bs11" }, + { GSM_BTS_TYPE_NANOBTS,
[PATCH] openbsc[master]: Make BTS type and variant converters shareable
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2286 to look at the new patch set (#7). Make BTS type and variant converters shareable * move value_string definition and corresponding functions for BTS type to shared header to make it re-usable by OsmoBTS * use consistent function naming * add similar functions for BTS variant * add enum to be used by OML Attribute Reporting to distinguish between type, variant and other info Change-Id: Ida94725a6fce968443541e3526f48f13758031fd Related: OS#1614 --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/bsc_vty.c M openbsc/src/libcommon/gsm_data.c M openbsc/src/libcommon/gsm_data_shared.c 4 files changed, 70 insertions(+), 21 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/86/2286/7 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 242889a..e016dd9 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -504,6 +504,12 @@ _NUM_BTS_VARIANT }; +/* Used by OML layer for BTS Attribute reporting */ +enum bts_attribute { + BTS_TYPE_VARIANT, + BTS_SUB_MODEL, +}; + struct vty; struct gsm_bts_model { @@ -859,6 +865,14 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num); +enum gsm_bts_type str2btstype(const char *arg); +const char *btstype2str(enum gsm_bts_type type); + +enum bts_attribute str2btsattr(const char *s); +const char *btsatttr2str(enum bts_attribute v); + +enum gsm_bts_type_variant str2btsvariant(const char *arg); +const char *btsvariant2str(enum gsm_bts_type_variant v); const struct value_string gsm_pchant_names[13]; const struct value_string gsm_pchant_descs[13]; diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index c1882fc..702af4a 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -1615,7 +1615,7 @@ struct gsm_bts *bts = vty->index; int rc; - rc = gsm_set_bts_type(bts, parse_btstype(argv[0])); + rc = gsm_set_bts_type(bts, str2btstype(argv[0])); if (rc < 0) return CMD_WARNING; diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index fd34793..8ec0be5 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -90,16 +90,6 @@ return NULL; } -const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE+1] = { - { GSM_BTS_TYPE_UNKNOWN, "unknown" }, - { GSM_BTS_TYPE_BS11,"bs11" }, - { GSM_BTS_TYPE_NANOBTS, "nanobts" }, - { GSM_BTS_TYPE_RBS2000, "rbs2000" }, - { GSM_BTS_TYPE_NOKIA_SITE, "nokia_site" }, - { GSM_BTS_TYPE_OSMOBTS, "sysmobts" }, - { 0,NULL } -}; - const struct value_string bts_type_descs[_NUM_GSM_BTS_TYPE+1] = { { GSM_BTS_TYPE_UNKNOWN, "Unknown BTS Type" }, { GSM_BTS_TYPE_BS11,"Siemens BTS (BS-11 or compatible)" }, @@ -109,16 +99,6 @@ { GSM_BTS_TYPE_OSMOBTS, "sysmocom sysmoBTS" }, { 0,NULL } }; - -enum gsm_bts_type parse_btstype(const char *arg) -{ - return get_string_value(bts_type_names, arg); -} - -const char *btstype2str(enum gsm_bts_type type) -{ - return get_value_string(bts_type_names, type); -} struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr) { diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 387af70..73cb9f1 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -51,6 +51,61 @@ gsm_abis_mo_reset(mo); } +const struct value_string bts_attribute_names[] = { + OSMO_VALUE_STRING(BTS_TYPE_VARIANT), + OSMO_VALUE_STRING(BTS_SUB_MODEL), + { 0, NULL } +}; + +enum bts_attribute str2btsattr(const char *s) +{ + return get_string_value(bts_attribute_names, s); +} + +const char *btsatttr2str(enum bts_attribute v) +{ + return get_value_string(bts_attribute_names, v); +} + +const struct value_string bts_variant_names[_NUM_BTS_VARIANT + 1] = { + { BTS_UNKNOWN, "unknown" }, + { BTS_OSMO_LITECELL15, "Litecell15" }, + { BTS_OSMO_OCTPHY, "OctPHY" }, + { BTS_OSMO_SYSMO, "sysmoBTS" }, + { BTS_OSMO_TRX, "TRX" }, + { 0, NULL } +}; + +enum gsm_bts_type_variant str2btsvariant(const char *arg) +{ + return get_string_value(bts_variant_names, arg); +} + +const char *btsvariant2str(enum gsm_bts_type_variant v) +{ + return get_value_string(bts_variant_names, v); +} + +const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE + 1] = { + { GSM_BTS_TYPE_UNKNOWN, "unknown" }, + { GSM_BTS_TYPE_BS11,"bs11" }, + { GSM_BTS_TYPE
[PATCH] openbsc[master]: Make BTS type and variant converters shareable
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2286 to look at the new patch set (#9). Make BTS type and variant converters shareable * move value_string definition and corresponding functions for BTS type to shared header to make it re-usable by OsmoBTS * use consistent function naming * add similar functions for BTS variant * add enum to be used by OML Attribute Reporting to distinguish between type, variant and other info Change-Id: Ida94725a6fce968443541e3526f48f13758031fd Related: OS#1614 --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/bsc_vty.c M openbsc/src/libcommon/gsm_data.c M openbsc/src/libcommon/gsm_data_shared.c 4 files changed, 70 insertions(+), 21 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/86/2286/9 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 8f566d2..0586d8a 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -505,6 +505,12 @@ _NUM_BTS_VARIANT }; +/* Used by OML layer for BTS Attribute reporting */ +enum bts_attribute { + BTS_TYPE_VARIANT, + BTS_SUB_MODEL, +}; + struct vty; struct gsm_bts_model { @@ -864,6 +870,14 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num); +enum gsm_bts_type str2btstype(const char *arg); +const char *btstype2str(enum gsm_bts_type type); + +enum bts_attribute str2btsattr(const char *s); +const char *btsatttr2str(enum bts_attribute v); + +enum gsm_bts_type_variant str2btsvariant(const char *arg); +const char *btsvariant2str(enum gsm_bts_type_variant v); const struct value_string gsm_pchant_names[13]; const struct value_string gsm_pchant_descs[13]; diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 195fd6a..2794d85 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -1614,7 +1614,7 @@ struct gsm_bts *bts = vty->index; int rc; - rc = gsm_set_bts_type(bts, parse_btstype(argv[0])); + rc = gsm_set_bts_type(bts, str2btstype(argv[0])); if (rc < 0) return CMD_WARNING; diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index fd34793..8ec0be5 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -90,16 +90,6 @@ return NULL; } -const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE+1] = { - { GSM_BTS_TYPE_UNKNOWN, "unknown" }, - { GSM_BTS_TYPE_BS11,"bs11" }, - { GSM_BTS_TYPE_NANOBTS, "nanobts" }, - { GSM_BTS_TYPE_RBS2000, "rbs2000" }, - { GSM_BTS_TYPE_NOKIA_SITE, "nokia_site" }, - { GSM_BTS_TYPE_OSMOBTS, "sysmobts" }, - { 0,NULL } -}; - const struct value_string bts_type_descs[_NUM_GSM_BTS_TYPE+1] = { { GSM_BTS_TYPE_UNKNOWN, "Unknown BTS Type" }, { GSM_BTS_TYPE_BS11,"Siemens BTS (BS-11 or compatible)" }, @@ -109,16 +99,6 @@ { GSM_BTS_TYPE_OSMOBTS, "sysmocom sysmoBTS" }, { 0,NULL } }; - -enum gsm_bts_type parse_btstype(const char *arg) -{ - return get_string_value(bts_type_names, arg); -} - -const char *btstype2str(enum gsm_bts_type type) -{ - return get_value_string(bts_type_names, type); -} struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr) { diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 387af70..2cbc740 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -51,6 +51,61 @@ gsm_abis_mo_reset(mo); } +const struct value_string bts_attribute_names[] = { + OSMO_VALUE_STRING(BTS_TYPE_VARIANT), + OSMO_VALUE_STRING(BTS_SUB_MODEL), + { 0, NULL } +}; + +enum bts_attribute str2btsattr(const char *s) +{ + return get_string_value(bts_attribute_names, s); +} + +const char *btsatttr2str(enum bts_attribute v) +{ + return get_value_string(bts_attribute_names, v); +} + +const struct value_string osmo_bts_variant_names[_NUM_BTS_VARIANT + 1] = { + { BTS_UNKNOWN, "unknown" }, + { BTS_OSMO_LITECELL15, "Litecell15" }, + { BTS_OSMO_OCTPHY, "OctPHY" }, + { BTS_OSMO_SYSMO, "sysmoBTS" }, + { BTS_OSMO_TRX, "TRX" }, + { 0, NULL } +}; + +enum gsm_bts_type_variant str2btsvariant(const char *arg) +{ + return get_string_value(osmo_bts_variant_names, arg); +} + +const char *btsvariant2str(enum gsm_bts_type_variant v) +{ + return get_value_string(osmo_bts_variant_names, v); +} + +const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE + 1] = { + { GSM_BTS_TYPE_UNKNOWN, "unknown" }, + { GSM_BTS_TYPE_BS11,"bs11" }, +
[PATCH] openbsc[master]: Make BTS type and variant converters shareable
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2286 to look at the new patch set (#10). Make BTS type and variant converters shareable * move value_string definition and corresponding functions for BTS type to shared header to make it re-usable by OsmoBTS * use consistent function naming * add similar functions for BTS variant * add enum to be used by OML Attribute Reporting to distinguish between type, variant and other info Change-Id: Ida94725a6fce968443541e3526f48f13758031fd Related: OS#1614 --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/bsc_vty.c M openbsc/src/libcommon/gsm_data.c M openbsc/src/libcommon/gsm_data_shared.c 4 files changed, 70 insertions(+), 21 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/86/2286/10 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 8f566d2..0586d8a 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -505,6 +505,12 @@ _NUM_BTS_VARIANT }; +/* Used by OML layer for BTS Attribute reporting */ +enum bts_attribute { + BTS_TYPE_VARIANT, + BTS_SUB_MODEL, +}; + struct vty; struct gsm_bts_model { @@ -864,6 +870,14 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num); +enum gsm_bts_type str2btstype(const char *arg); +const char *btstype2str(enum gsm_bts_type type); + +enum bts_attribute str2btsattr(const char *s); +const char *btsatttr2str(enum bts_attribute v); + +enum gsm_bts_type_variant str2btsvariant(const char *arg); +const char *btsvariant2str(enum gsm_bts_type_variant v); const struct value_string gsm_pchant_names[13]; const struct value_string gsm_pchant_descs[13]; diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 195fd6a..2794d85 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -1614,7 +1614,7 @@ struct gsm_bts *bts = vty->index; int rc; - rc = gsm_set_bts_type(bts, parse_btstype(argv[0])); + rc = gsm_set_bts_type(bts, str2btstype(argv[0])); if (rc < 0) return CMD_WARNING; diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index fd34793..8ec0be5 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -90,16 +90,6 @@ return NULL; } -const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE+1] = { - { GSM_BTS_TYPE_UNKNOWN, "unknown" }, - { GSM_BTS_TYPE_BS11,"bs11" }, - { GSM_BTS_TYPE_NANOBTS, "nanobts" }, - { GSM_BTS_TYPE_RBS2000, "rbs2000" }, - { GSM_BTS_TYPE_NOKIA_SITE, "nokia_site" }, - { GSM_BTS_TYPE_OSMOBTS, "sysmobts" }, - { 0,NULL } -}; - const struct value_string bts_type_descs[_NUM_GSM_BTS_TYPE+1] = { { GSM_BTS_TYPE_UNKNOWN, "Unknown BTS Type" }, { GSM_BTS_TYPE_BS11,"Siemens BTS (BS-11 or compatible)" }, @@ -109,16 +99,6 @@ { GSM_BTS_TYPE_OSMOBTS, "sysmocom sysmoBTS" }, { 0,NULL } }; - -enum gsm_bts_type parse_btstype(const char *arg) -{ - return get_string_value(bts_type_names, arg); -} - -const char *btstype2str(enum gsm_bts_type type) -{ - return get_value_string(bts_type_names, type); -} struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr) { diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 387af70..156167d 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -51,6 +51,61 @@ gsm_abis_mo_reset(mo); } +const struct value_string bts_attribute_names[] = { + OSMO_VALUE_STRING(BTS_TYPE_VARIANT), + OSMO_VALUE_STRING(BTS_SUB_MODEL), + { 0, NULL } +}; + +enum bts_attribute str2btsattr(const char *s) +{ + return get_string_value(bts_attribute_names, s); +} + +const char *btsatttr2str(enum bts_attribute v) +{ + return get_value_string(bts_attribute_names, v); +} + +const struct value_string osmo_bts_variant_names[_NUM_BTS_VARIANT + 1] = { + { BTS_UNKNOWN, "unknown" }, + { BTS_OSMO_LITECELL15, "osmo-bts-lc15" }, + { BTS_OSMO_OCTPHY, "osmo-bts-octphy" }, + { BTS_OSMO_SYSMO, "osmo-bts-sysmo" }, + { BTS_OSMO_TRX, "omso-bts-trx" }, + { 0, NULL } +}; + +enum gsm_bts_type_variant str2btsvariant(const char *arg) +{ + return get_string_value(osmo_bts_variant_names, arg); +} + +const char *btsvariant2str(enum gsm_bts_type_variant v) +{ + return get_value_string(osmo_bts_variant_names, v); +} + +const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE + 1] = { + { GSM_BTS_TYPE_UNKNOWN, "unknown" }, + { GSM_BTS_TYPE_BS11,
[MERGED] openbsc[master]: Make BTS type and variant converters shareable
Max has submitted this change and it was merged. Change subject: Make BTS type and variant converters shareable .. Make BTS type and variant converters shareable * move value_string definition and corresponding functions for BTS type to shared header to make it re-usable by OsmoBTS * use consistent function naming * add similar functions for BTS variant * add enum to be used by OML Attribute Reporting to distinguish between type, variant and other info Change-Id: Ida94725a6fce968443541e3526f48f13758031fd Related: OS#1614 --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libbsc/bsc_vty.c M openbsc/src/libcommon/gsm_data.c M openbsc/src/libcommon/gsm_data_shared.c 4 files changed, 70 insertions(+), 21 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 8f566d2..0586d8a 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -505,6 +505,12 @@ _NUM_BTS_VARIANT }; +/* Used by OML layer for BTS Attribute reporting */ +enum bts_attribute { + BTS_TYPE_VARIANT, + BTS_SUB_MODEL, +}; + struct vty; struct gsm_bts_model { @@ -864,6 +870,14 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num); +enum gsm_bts_type str2btstype(const char *arg); +const char *btstype2str(enum gsm_bts_type type); + +enum bts_attribute str2btsattr(const char *s); +const char *btsatttr2str(enum bts_attribute v); + +enum gsm_bts_type_variant str2btsvariant(const char *arg); +const char *btsvariant2str(enum gsm_bts_type_variant v); const struct value_string gsm_pchant_names[13]; const struct value_string gsm_pchant_descs[13]; diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 195fd6a..2794d85 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -1614,7 +1614,7 @@ struct gsm_bts *bts = vty->index; int rc; - rc = gsm_set_bts_type(bts, parse_btstype(argv[0])); + rc = gsm_set_bts_type(bts, str2btstype(argv[0])); if (rc < 0) return CMD_WARNING; diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index fd34793..8ec0be5 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -90,16 +90,6 @@ return NULL; } -const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE+1] = { - { GSM_BTS_TYPE_UNKNOWN, "unknown" }, - { GSM_BTS_TYPE_BS11,"bs11" }, - { GSM_BTS_TYPE_NANOBTS, "nanobts" }, - { GSM_BTS_TYPE_RBS2000, "rbs2000" }, - { GSM_BTS_TYPE_NOKIA_SITE, "nokia_site" }, - { GSM_BTS_TYPE_OSMOBTS, "sysmobts" }, - { 0,NULL } -}; - const struct value_string bts_type_descs[_NUM_GSM_BTS_TYPE+1] = { { GSM_BTS_TYPE_UNKNOWN, "Unknown BTS Type" }, { GSM_BTS_TYPE_BS11,"Siemens BTS (BS-11 or compatible)" }, @@ -109,16 +99,6 @@ { GSM_BTS_TYPE_OSMOBTS, "sysmocom sysmoBTS" }, { 0,NULL } }; - -enum gsm_bts_type parse_btstype(const char *arg) -{ - return get_string_value(bts_type_names, arg); -} - -const char *btstype2str(enum gsm_bts_type type) -{ - return get_value_string(bts_type_names, type); -} struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr) { diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 387af70..156167d 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -51,6 +51,61 @@ gsm_abis_mo_reset(mo); } +const struct value_string bts_attribute_names[] = { + OSMO_VALUE_STRING(BTS_TYPE_VARIANT), + OSMO_VALUE_STRING(BTS_SUB_MODEL), + { 0, NULL } +}; + +enum bts_attribute str2btsattr(const char *s) +{ + return get_string_value(bts_attribute_names, s); +} + +const char *btsatttr2str(enum bts_attribute v) +{ + return get_value_string(bts_attribute_names, v); +} + +const struct value_string osmo_bts_variant_names[_NUM_BTS_VARIANT + 1] = { + { BTS_UNKNOWN, "unknown" }, + { BTS_OSMO_LITECELL15, "osmo-bts-lc15" }, + { BTS_OSMO_OCTPHY, "osmo-bts-octphy" }, + { BTS_OSMO_SYSMO, "osmo-bts-sysmo" }, + { BTS_OSMO_TRX, "omso-bts-trx" }, + { 0, NULL } +}; + +enum gsm_bts_type_variant str2btsvariant(const char *arg) +{ + return get_string_value(osmo_bts_variant_names, arg); +} + +const char *btsvariant2str(enum gsm_bts_type_variant v) +{ + return get_value_string(osmo_bts_variant_names, v); +} + +const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE + 1] = { + { GSM_BTS_TYPE_UNKNOWN, "unknown"