blob: 3a0cb0e3c34600a26fb2a6f827e59805906dc7dd [file] [log] [blame]
Pau Espin Pedrola6ab8ce2020-07-15 20:53:52 +02001/* GSM Network Management messages on the A-bis interface
Harald Welte52b1f982008-12-23 20:25:15 +00002 * 3GPP TS 12.21 version 8.0.0 Release 1999 / ETSI TS 100 623 V8.0.0 */
3
Harald Welte4724f992009-01-18 18:01:49 +00004/* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org>
Harald Welte52b1f982008-12-23 20:25:15 +00005 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
Harald Welte9af6ddf2011-01-01 15:25:50 +01008 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
Harald Welte52b1f982008-12-23 20:25:15 +000010 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Harald Welte9af6ddf2011-01-01 15:25:50 +010015 * GNU Affero General Public License for more details.
Harald Welte52b1f982008-12-23 20:25:15 +000016 *
Harald Welte9af6ddf2011-01-01 15:25:50 +010017 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Harald Welte52b1f982008-12-23 20:25:15 +000019 *
20 */
21
22#ifndef _NM_H
23#define _NM_H
24
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010025#include <osmocom/gsm/tlv.h>
Harald Welte472e7e92011-06-05 11:24:08 +020026#include <osmocom/gsm/abis_nm.h>
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010027#include <osmocom/gsm/protocol/gsm_12_21.h>
Harald Welte0f255852009-11-12 14:48:42 +010028
Neels Hofmeyrc0164792017-09-04 15:15:32 +020029#include <osmocom/bsc/gsm_data.h>
Oliver Smithcd1df992020-03-24 13:37:17 +010030#include <osmocom/bsc/signal.h>
Neels Hofmeyr2d521a02016-05-14 00:57:04 +020031
Max1ebf23b2017-05-10 12:21:17 +020032/* max number of attributes represented as 3GPP TS 52.021 ยง9.4.62 SW Description array */
33#define MAX_BTS_ATTR 5
34
Harald Welte0f255852009-11-12 14:48:42 +010035/* The BCCH info from an ip.access test, in host byte order
36 * and already parsed... */
37struct ipac_bcch_info {
Harald Welteb40a38f2009-11-13 11:56:05 +010038 struct llist_head list;
39
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020040 uint16_t info_type;
41 uint8_t freq_qual;
42 uint16_t arfcn;
43 uint8_t rx_lev;
44 uint8_t rx_qual;
Harald Welteaff237d2009-11-13 14:41:52 +010045 int16_t freq_err;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020046 uint16_t frame_offset;
47 uint32_t frame_nr_offset;
48 uint8_t bsic;
Neels Hofmeyrda5b09a2018-03-21 16:04:30 +010049 struct osmo_cell_global_id cgi;
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020050 uint8_t ba_list_si2[16];
51 uint8_t ba_list_si2bis[16];
52 uint8_t ba_list_si2ter[16];
53 uint8_t ca_list_si1[16];
Harald Welte0f255852009-11-12 14:48:42 +010054};
55
Harald Welte52b1f982008-12-23 20:25:15 +000056/* PUBLIC */
57
58struct msgb;
59
60struct abis_nm_cfg {
61 /* callback for unidirectional reports */
62 int (*report_cb)(struct msgb *,
63 struct abis_om_fom_hdr *);
64 /* callback for software activate requests from BTS */
65 int (*sw_act_req)(struct msgb *);
66};
67
Harald Welte8470bf22008-12-25 23:28:35 +000068extern int abis_nm_rcvmsg(struct msgb *msg);
Harald Welte52b1f982008-12-23 20:25:15 +000069
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020070int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const uint8_t *buf, int len);
Pau Espin Pedrol1cdf1d72018-11-08 16:43:09 +010071int abis_nm_tlv_attr_primary_oml(struct tlv_parsed *tp, struct in_addr *ia, uint16_t *oml_port);
72int abis_nm_tlv_attr_unit_id(struct tlv_parsed *tp, char* unit_id, size_t buf_len);
Harald Welte52b1f982008-12-23 20:25:15 +000073int abis_nm_rx(struct msgb *msg);
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020074int abis_nm_opstart(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, uint8_t i1, uint8_t i2);
75int abis_nm_chg_adm_state(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0,
76 uint8_t i1, uint8_t i2, enum abis_nm_adm_state adm_state);
77int abis_nm_establish_tei(struct gsm_bts *bts, uint8_t trx_nr,
78 uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot,
79 uint8_t tei);
Harald Welte52b1f982008-12-23 20:25:15 +000080int abis_nm_conn_terr_sign(struct gsm_bts_trx *trx,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020081 uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot);
Harald Welte52b1f982008-12-23 20:25:15 +000082int abis_nm_conn_terr_traf(struct gsm_bts_trx_ts *ts,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020083 uint8_t e1_port, uint8_t e1_timeslot,
84 uint8_t e1_subslot);
Harald Weltefe568f22012-08-14 19:15:57 +020085int abis_nm_get_attr(struct gsm_bts *bts, uint8_t obj_class,
86 uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
Max1ebf23b2017-05-10 12:21:17 +020087 const uint8_t *attr, uint8_t attr_len);
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020088int abis_nm_set_bts_attr(struct gsm_bts *bts, uint8_t *attr, int attr_len);
89int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, uint8_t *attr, int attr_len);
90int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, uint8_t chan_comb);
91int abis_nm_sw_act_req_ack(struct gsm_bts *bts, uint8_t obj_class, uint8_t i1,
92 uint8_t i2, uint8_t i3, int nack, uint8_t *attr, int att_len);
93int abis_nm_raw_msg(struct gsm_bts *bts, int len, uint8_t *msg);
Harald Welte52b1f982008-12-23 20:25:15 +000094int abis_nm_event_reports(struct gsm_bts *bts, int on);
95int abis_nm_reset_resource(struct gsm_bts *bts);
Holger Hans Peter Freyther64278ed2010-05-12 23:51:46 +080096int abis_nm_software_load(struct gsm_bts *bts, int trx_nr, const char *fname,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020097 uint8_t win_size, int forced,
Harald Welte3ffd1372009-02-01 22:15:49 +000098 gsm_cbfn *cbfn, void *cb_data);
99int abis_nm_software_load_status(struct gsm_bts *bts);
Harald Welte5e4d1b32009-02-01 13:36:56 +0000100int abis_nm_software_activate(struct gsm_bts *bts, const char *fname,
101 gsm_cbfn *cbfn, void *cb_data);
Harald Welte47d88ae2009-01-04 12:02:08 +0000102
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200103int abis_nm_conn_mdrop_link(struct gsm_bts *bts, uint8_t e1_port0, uint8_t ts0,
104 uint8_t e1_port1, uint8_t ts1);
Harald Welte1989c082009-08-06 17:58:31 +0200105
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200106int abis_nm_perform_test(struct gsm_bts *bts, uint8_t obj_class,
107 uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
108 uint8_t test_nr, uint8_t auton_report, struct msgb *msg);
Harald Weltec7310382009-08-08 00:02:36 +0200109
Harald Welte47d88ae2009-01-04 12:02:08 +0000110/* Siemens / BS-11 specific */
Holger Freyther245c5342009-01-27 19:00:44 +0000111int abis_nm_bs11_reset_resource(struct gsm_bts *bts);
Harald Welte05188ee2009-01-18 11:39:08 +0000112int abis_nm_bs11_db_transmission(struct gsm_bts *bts, int begin);
113int abis_nm_bs11_create_object(struct gsm_bts *bts, enum abis_bs11_objtype type,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200114 uint8_t idx, uint8_t attr_len, const uint8_t *attr);
115int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, uint8_t idx);
116int abis_nm_bs11_create_bport(struct gsm_bts *bts, uint8_t idx);
Harald Welte78fc0d42009-02-19 02:50:57 +0000117int abis_nm_bs11_delete_object(struct gsm_bts *bts,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200118 enum abis_bs11_objtype type, uint8_t idx);
119int abis_nm_bs11_delete_bport(struct gsm_bts *bts, uint8_t idx);
120int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, uint8_t e1_port,
121 uint8_t e1_timeslot, uint8_t e1_subslot, uint8_t tei);
Harald Welte78fc0d42009-02-19 02:50:57 +0000122int abis_nm_bs11_get_oml_tei_ts(struct gsm_bts *bts);
123int abis_nm_bs11_get_serno(struct gsm_bts *bts);
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200124int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, uint8_t level);
Harald Welte78fc0d42009-02-19 02:50:57 +0000125int abis_nm_bs11_get_trx_power(struct gsm_bts_trx *trx);
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200126int abis_nm_bs11_logon(struct gsm_bts *bts, uint8_t level, const char *name, int on);
Harald Welte1bc09062009-01-18 14:17:52 +0000127int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on);
Daniel Willmann4b054c82010-01-07 00:46:26 +0100128int abis_nm_bs11_infield_logon(struct gsm_bts *bts, int on);
Harald Welte1bc09062009-01-18 14:17:52 +0000129int abis_nm_bs11_set_trx1_pw(struct gsm_bts *bts, const char *password);
Harald Weltee69f5fb2009-04-28 16:31:38 +0000130int abis_nm_bs11_set_pll_locked(struct gsm_bts *bts, int locked);
Harald Welteef061952009-05-17 12:43:42 +0000131int abis_nm_bs11_get_pll_mode(struct gsm_bts *bts);
Daniel Willmann7b1dd742010-01-07 00:54:01 +0100132int abis_nm_bs11_set_pll(struct gsm_bts *bts, int value);
Harald Welteef061952009-05-17 12:43:42 +0000133int abis_nm_bs11_get_cclk(struct gsm_bts *bts);
Harald Welte1bc09062009-01-18 14:17:52 +0000134int abis_nm_bs11_get_state(struct gsm_bts *bts);
Harald Welte5e4d1b32009-02-01 13:36:56 +0000135int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200136 uint8_t win_size, int forced, gsm_cbfn *cbfn);
Harald Welte268bb402009-02-01 19:11:56 +0000137int abis_nm_bs11_set_ext_time(struct gsm_bts *bts);
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200138int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, uint8_t bport);
139int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, uint8_t bport, enum abis_bs11_line_cfg line_cfg);
Harald Welte3ffd1372009-02-01 22:15:49 +0000140int abis_nm_bs11_bsc_disconnect(struct gsm_bts *bts, int reconnect);
Harald Welte1fa60c82009-02-09 18:13:26 +0000141int abis_nm_bs11_restart(struct gsm_bts *bts);
Harald Welte52b1f982008-12-23 20:25:15 +0000142
Harald Welte5c1e4582009-02-15 11:57:29 +0000143/* ip.access nanoBTS specific commands */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200144int abis_nm_ipaccess_msg(struct gsm_bts *bts, uint8_t msg_type,
145 uint8_t obj_class, uint8_t bts_nr,
146 uint8_t trx_nr, uint8_t ts_nr,
147 uint8_t *attr, int attr_len);
148int abis_nm_ipaccess_set_nvattr(struct gsm_bts_trx *trx, uint8_t *attr,
Harald Welte193fefc2009-04-30 15:16:27 +0000149 int attr_len);
Holger Hans Peter Freyther52fd4e42010-05-12 23:34:51 +0800150int abis_nm_ipaccess_restart(struct gsm_bts_trx *trx);
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200151int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, uint8_t obj_class,
152 uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
153 uint8_t *attr, uint8_t attr_len);
Pau Espin Pedrola6ab8ce2020-07-15 20:53:52 +0200154int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200155 uint32_t ip, uint16_t port, uint8_t stream);
156void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts);
157int ipac_parse_bcch_info(struct ipac_bcch_info *binf, uint8_t *buf);
158const char *ipacc_testres_name(uint8_t res);
Harald Welte5c1e4582009-02-15 11:57:29 +0000159
Harald Weltee0590df2009-02-15 03:34:15 +0000160/* Functions calling into other code parts */
Maxaa954cd2017-11-29 12:18:02 +0100161bool all_trx_rsl_connected_unlocked(const struct gsm_bts *bts);
Maxd0ff6942017-11-29 12:45:34 +0100162bool nm_is_running(const struct gsm_nm_state *s);
Harald Welte81c9b9c2010-05-31 16:40:40 +0200163
164int abis_nm_vty_init(void);
165
Holger Hans Peter Freyther6f615552010-11-15 20:50:42 +0100166void abis_nm_clear_queue(struct gsm_bts *bts);
167
Harald Welte15eae8d2011-09-26 23:43:23 +0200168int _abis_nm_sendmsg(struct msgb *msg);
Pablo Neira Ayusoed5cacb2011-08-17 22:44:07 +0200169
170void abis_nm_queue_send_next(struct gsm_bts *bts); /* for bs11_config. */
Holger Hans Peter Freyther6f615552010-11-15 20:50:42 +0100171
Maxfd2c1f92017-03-24 21:04:57 +0100172int abis_nm_select_newest_sw(const struct abis_nm_sw_desc *sw, const size_t len);
Holger Hans Peter Freytherbce56752012-11-22 14:59:46 +0100173
Oliver Smithcd1df992020-03-24 13:37:17 +0100174struct nm_fail_rep_signal_data *abis_nm_fail_evt_rep_parse(struct msgb *mb, struct gsm_bts *bts);
175
Holger Hans Peter Freyther8a158bb2014-03-26 14:24:42 +0100176/* Helper functions for updating attributes */
177int abis_nm_update_max_power_red(struct gsm_bts_trx *trx);
178
Neels Hofmeyrf0ff9a62018-06-15 20:39:58 +0200179struct gsm_bts_trx_ts *abis_nm_get_ts(const struct msgb *oml_msg);
180
Harald Welte52b1f982008-12-23 20:25:15 +0000181#endif /* _NM_H */