Configure HNB-Identity over VTY and use it in HnbRegisterRequest

Change-Id: Ida47bbb85b5438a2ec9805005bc2ab834c79b765
This commit is contained in:
Pau Espin 2021-10-28 19:28:14 +02:00
parent e2c17101be
commit c475158e0c
4 changed files with 17 additions and 3 deletions

View File

@ -55,6 +55,7 @@ struct hnb_chan {
};
struct hnb {
char *identity; /* HNB-Identity */
struct osmo_plmn_id plmn;
uint16_t cell_identity;
uint16_t lac;

View File

@ -116,6 +116,7 @@ struct hnb *hnb_alloc(void *tall_ctx)
if (!hnb)
return NULL;
hnb->identity = talloc_strdup(hnb, "OsmoHNodeB");
hnb->plmn = (struct osmo_plmn_id){
.mcc = 1,
.mnc = 1,

View File

@ -157,7 +157,6 @@ void hnb_send_register_req(struct hnb *hnb)
uint8_t rac;
uint32_t cid;
uint8_t plmn[3];
char identity[50] = "ATestHNB@";
HNBAP_HNBRegisterRequestIEs_t request;
memset(&request, 0, sizeof(request));
@ -167,8 +166,8 @@ void hnb_send_register_req(struct hnb *hnb)
asn1_u8_to_str(&request.rac, &rac, hnb->rac);
asn1_u28_to_bitstring(&request.cellIdentity, &cid, hnb->cell_identity);
request.hnB_Identity.hNB_Identity_Info.buf = (uint8_t*) identity;
request.hnB_Identity.hNB_Identity_Info.size = strlen(identity);
request.hnB_Identity.hNB_Identity_Info.buf = (uint8_t*) hnb->identity;
request.hnB_Identity.hNB_Identity_Info.size = strlen(hnb->identity);
osmo_plmn_to_bcd(plmn, &hnb->plmn);
request.plmNidentity.buf = plmn;

View File

@ -83,6 +83,17 @@ DEFUN(cfg_hnodeb,
return CMD_SUCCESS;
}
DEFUN_USRATTR(cfg_hnodeb_identity,
cfg_hnodeb_identity_cmd,
0,
"identity TEXT",
"Set the HNB-identity of this HnodeB\n" "HNB-Identity\n")
{
struct hnb *hnb = (struct hnb *)vty->index;
osmo_talloc_replace_string(g_hnb, &hnb->identity, argv[0]);
return CMD_SUCCESS;
}
DEFUN_USRATTR(cfg_hnodeb_ncc,
cfg_hnodeb_ncc_cmd,
0,
@ -239,6 +250,7 @@ DEFUN(cfg_hnodeb_iuh_remote_port, cfg_hnodeb_iuh_remote_port_cmd,
static int config_write_hnodeb(struct vty *vty)
{
vty_out(vty, "hnodeb%s", VTY_NEWLINE);
vty_out(vty, " identity %s%s", g_hnb->identity, VTY_NEWLINE);
vty_out(vty, " network country code %s%s", osmo_mcc_name(g_hnb->plmn.mcc), VTY_NEWLINE);
vty_out(vty, " mobile network code %s%s",
osmo_mnc_name(g_hnb->plmn.mnc, g_hnb->plmn.mnc_3_digits), VTY_NEWLINE);
@ -361,6 +373,7 @@ void hnb_vty_init(void)
{
install_element(CONFIG_NODE, &cfg_hnodeb_cmd);
install_node(&hnodeb_node, config_write_hnodeb);
install_element(HNODEB_NODE, &cfg_hnodeb_identity_cmd);
install_element(HNODEB_NODE, &cfg_hnodeb_ncc_cmd);
install_element(HNODEB_NODE, &cfg_hnodeb_mnc_cmd);
install_element(HNODEB_NODE, &cfg_hnodeb_ci_cmd);