mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-04 05:53:26 +00:00 
			
		
		
		
	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
This commit is contained in:
		@@ -505,6 +505,12 @@ enum gsm_bts_type_variant {
 | 
				
			|||||||
	_NUM_BTS_VARIANT
 | 
						_NUM_BTS_VARIANT
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Used by OML layer for BTS Attribute reporting */
 | 
				
			||||||
 | 
					enum bts_attribute {
 | 
				
			||||||
 | 
						BTS_TYPE_VARIANT,
 | 
				
			||||||
 | 
						BTS_SUB_MODEL,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct vty;
 | 
					struct vty;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct gsm_bts_model {
 | 
					struct gsm_bts_model {
 | 
				
			||||||
@@ -864,6 +870,14 @@ struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
 | 
				
			|||||||
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
 | 
					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);
 | 
					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_names[13];
 | 
				
			||||||
const struct value_string gsm_pchant_descs[13];
 | 
					const struct value_string gsm_pchant_descs[13];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1614,7 +1614,7 @@ DEFUN(cfg_bts_type,
 | 
				
			|||||||
	struct gsm_bts *bts = vty->index;
 | 
						struct gsm_bts *bts = vty->index;
 | 
				
			||||||
	int rc;
 | 
						int rc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
 | 
						rc = gsm_set_bts_type(bts, str2btstype(argv[0]));
 | 
				
			||||||
	if (rc < 0)
 | 
						if (rc < 0)
 | 
				
			||||||
		return CMD_WARNING;
 | 
							return CMD_WARNING;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -90,16 +90,6 @@ struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts,
 | 
				
			|||||||
	return NULL;
 | 
						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] = {
 | 
					const struct value_string bts_type_descs[_NUM_GSM_BTS_TYPE+1] = {
 | 
				
			||||||
	{ GSM_BTS_TYPE_UNKNOWN,		"Unknown BTS Type" },
 | 
						{ GSM_BTS_TYPE_UNKNOWN,		"Unknown BTS Type" },
 | 
				
			||||||
	{ GSM_BTS_TYPE_BS11,		"Siemens BTS (BS-11 or compatible)" },
 | 
						{ GSM_BTS_TYPE_BS11,		"Siemens BTS (BS-11 or compatible)" },
 | 
				
			||||||
@@ -110,16 +100,6 @@ const struct value_string bts_type_descs[_NUM_GSM_BTS_TYPE+1] = {
 | 
				
			|||||||
	{ 0,				NULL }
 | 
						{ 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)
 | 
					struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct gsm_bts_trx *trx;
 | 
						struct gsm_bts_trx *trx;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,6 +51,61 @@ static void gsm_mo_init(struct gsm_abis_mo *mo, struct gsm_bts *bts,
 | 
				
			|||||||
	gsm_abis_mo_reset(mo);
 | 
						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,		"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 }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum gsm_bts_type str2btstype(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);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const struct value_string gsm_pchant_names[13] = {
 | 
					const struct value_string gsm_pchant_names[13] = {
 | 
				
			||||||
	{ GSM_PCHAN_NONE,	"NONE" },
 | 
						{ GSM_PCHAN_NONE,	"NONE" },
 | 
				
			||||||
	{ GSM_PCHAN_CCCH,	"CCCH" },
 | 
						{ GSM_PCHAN_CCCH,	"CCCH" },
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user