<p>pespin <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-hnodeb/+/26021">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Configure CI,LAC,RAC,SAC over VTY and use it in HnbRegisterRequest<br><br>Change-Id: I06f21758e361b7d4d7141086d758893bee434e5c<br>---<br>M include/osmocom/hnodeb/hnodeb.h<br>M src/osmo-hnodeb/hnbap.c<br>M src/osmo-hnodeb/vty.c<br>3 files changed, 69 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/hnodeb/hnodeb.h b/include/osmocom/hnodeb/hnodeb.h</span><br><span>index 77430d6..a82c662 100644</span><br><span>--- a/include/osmocom/hnodeb/hnodeb.h</span><br><span>+++ b/include/osmocom/hnodeb/hnodeb.h</span><br><span>@@ -56,6 +56,10 @@</span><br><span> </span><br><span> struct hnb {</span><br><span>         struct osmo_plmn_id plmn;</span><br><span style="color: hsl(120, 100%, 40%);">+     uint16_t cell_identity;</span><br><span style="color: hsl(120, 100%, 40%);">+       uint16_t lac;</span><br><span style="color: hsl(120, 100%, 40%);">+ uint8_t rac;</span><br><span style="color: hsl(120, 100%, 40%);">+  uint16_t sac;</span><br><span>        struct {</span><br><span>             char *local_addr;</span><br><span>            uint16_t local_port;</span><br><span>diff --git a/src/osmo-hnodeb/hnbap.c b/src/osmo-hnodeb/hnbap.c</span><br><span>index 58fec85..167ec50 100644</span><br><span>--- a/src/osmo-hnodeb/hnbap.c</span><br><span>+++ b/src/osmo-hnodeb/hnbap.c</span><br><span>@@ -162,15 +162,10 @@</span><br><span>        HNBAP_HNBRegisterRequestIEs_t request;</span><br><span>       memset(&request, 0, sizeof(request));</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   lac = 0xc0fe;</span><br><span style="color: hsl(0, 100%, 40%);">-   sac = 0xabab;</span><br><span style="color: hsl(0, 100%, 40%);">-   rac = 0x42;</span><br><span style="color: hsl(0, 100%, 40%);">-     cid = 0xadceaab;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-        asn1_u16_to_str(&request.lac, &lac, lac);</span><br><span style="color: hsl(0, 100%, 40%);">-       asn1_u16_to_str(&request.sac, &sac, sac);</span><br><span style="color: hsl(0, 100%, 40%);">-       asn1_u8_to_str(&request.rac, &rac, rac);</span><br><span style="color: hsl(0, 100%, 40%);">-        asn1_u28_to_bitstring(&request.cellIdentity, &cid, cid);</span><br><span style="color: hsl(120, 100%, 40%);">+      asn1_u16_to_str(&request.lac, &lac, hnb->lac);</span><br><span style="color: hsl(120, 100%, 40%);">+     asn1_u16_to_str(&request.sac, &sac, hnb->sac);</span><br><span style="color: hsl(120, 100%, 40%);">+     asn1_u8_to_str(&request.rac, &rac, hnb->rac);</span><br><span style="color: hsl(120, 100%, 40%);">+      asn1_u28_to_bitstring(&request.cellIdentity, &cid, hnb->cell_identity);</span><br><span> </span><br><span>       request.hnB_Identity.hNB_Identity_Info.buf = (uint8_t*) identity;</span><br><span>    request.hnB_Identity.hNB_Identity_Info.size = strlen(identity);</span><br><span>diff --git a/src/osmo-hnodeb/vty.c b/src/osmo-hnodeb/vty.c</span><br><span>index f4623ad..1adc7ba 100644</span><br><span>--- a/src/osmo-hnodeb/vty.c</span><br><span>+++ b/src/osmo-hnodeb/vty.c</span><br><span>@@ -27,6 +27,8 @@</span><br><span> #include <osmocom/vty/command.h></span><br><span> #include <osmocom/core/msgb.h></span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#include <osmocom/gsm/protocol/gsm_04_08.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #include <osmocom/rua/rua_msg_factory.h></span><br><span> </span><br><span> #include <osmocom/ranap/ranap_common.h></span><br><span>@@ -127,6 +129,57 @@</span><br><span>        return CMD_SUCCESS;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN_USRATTR(cfg_hnodeb_ci,</span><br><span style="color: hsl(120, 100%, 40%);">+          cfg_hnodeb_ci_cmd,</span><br><span style="color: hsl(120, 100%, 40%);">+            0,</span><br><span style="color: hsl(120, 100%, 40%);">+            "cell_identity <0-65535>",</span><br><span style="color: hsl(120, 100%, 40%);">+            "Set the Cell identity of this HnodeB\n" "Cell Identity\n")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      struct hnb *hnb = (struct hnb *)vty->index;</span><br><span style="color: hsl(120, 100%, 40%);">+        hnb->cell_identity = atoi(argv[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+        return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN_USRATTR(cfg_hnodeb_lac,</span><br><span style="color: hsl(120, 100%, 40%);">+             cfg_hnodeb_lac_cmd,</span><br><span style="color: hsl(120, 100%, 40%);">+           0,</span><br><span style="color: hsl(120, 100%, 40%);">+            "location_area_code <0-65535>",</span><br><span style="color: hsl(120, 100%, 40%);">+       "Set the Location Area Code (LAC) of this HnodeB\n" "LAC\n")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+     struct hnb *hnb = (struct hnb *)vty->index;</span><br><span style="color: hsl(120, 100%, 40%);">+        int lac = atoi(argv[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {</span><br><span style="color: hsl(120, 100%, 40%);">+            vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",</span><br><span style="color: hsl(120, 100%, 40%);">+                        lac, VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+            return CMD_WARNING;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+     hnb->lac = lac;</span><br><span style="color: hsl(120, 100%, 40%);">+    return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN_USRATTR(cfg_hnodeb_rac,</span><br><span style="color: hsl(120, 100%, 40%);">+             cfg_hnodeb_rac_cmd,</span><br><span style="color: hsl(120, 100%, 40%);">+           0,</span><br><span style="color: hsl(120, 100%, 40%);">+            "routing_area_code <0-255>",</span><br><span style="color: hsl(120, 100%, 40%);">+          "Set the Routing Area Code (RAC) of this HnodeB\n" "RAC\n")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      struct hnb *hnb = (struct hnb *)vty->index;</span><br><span style="color: hsl(120, 100%, 40%);">+        hnb->rac = atoi(argv[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+  return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN_USRATTR(cfg_hnodeb_sac,</span><br><span style="color: hsl(120, 100%, 40%);">+             cfg_hnodeb_sac_cmd,</span><br><span style="color: hsl(120, 100%, 40%);">+           0,</span><br><span style="color: hsl(120, 100%, 40%);">+            "service_area_code <0-255>",</span><br><span style="color: hsl(120, 100%, 40%);">+          "Set the Service Area Code (RAC) of this HnodeB\n" "SAC\n")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      struct hnb *hnb = (struct hnb *)vty->index;</span><br><span style="color: hsl(120, 100%, 40%);">+        hnb->sac = atoi(argv[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+  return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static struct cmd_node iuh_node = {</span><br><span>      IUH_NODE,</span><br><span>    "%s(config-iuh)# ",</span><br><span>@@ -189,6 +242,10 @@</span><br><span>         vty_out(vty, " network country code %s%s", osmo_mcc_name(g_hnb->plmn.mcc), VTY_NEWLINE);</span><br><span>        vty_out(vty, " mobile network code %s%s",</span><br><span>          osmo_mnc_name(g_hnb->plmn.mnc, g_hnb->plmn.mnc_3_digits), VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+ vty_out(vty, " cell_identity %u%s", g_hnb->cell_identity, VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+  vty_out(vty, " location_area_code %u%s", g_hnb->lac, VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+       vty_out(vty, " routing_area_code %u%s", g_hnb->rac, VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+        vty_out(vty, " service_area_code %u%s", g_hnb->sac, VTY_NEWLINE);</span><br><span>       vty_out(vty, " iuh%s", VTY_NEWLINE);</span><br><span>       if (g_hnb->iuh.local_addr)</span><br><span>                vty_out(vty, "  local-ip %s%s", g_hnb->iuh.local_addr, VTY_NEWLINE);</span><br><span>@@ -306,6 +363,10 @@</span><br><span>     install_node(&hnodeb_node, config_write_hnodeb);</span><br><span>         install_element(HNODEB_NODE, &cfg_hnodeb_ncc_cmd);</span><br><span>       install_element(HNODEB_NODE, &cfg_hnodeb_mnc_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+        install_element(HNODEB_NODE, &cfg_hnodeb_ci_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+ install_element(HNODEB_NODE, &cfg_hnodeb_lac_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+        install_element(HNODEB_NODE, &cfg_hnodeb_rac_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+        install_element(HNODEB_NODE, &cfg_hnodeb_sac_cmd);</span><br><span>       install_element(HNODEB_NODE, &cfg_hnodeb_iuh_cmd);</span><br><span>       install_node(&iuh_node, NULL);</span><br><span>   install_element(IUH_NODE, &cfg_hnodeb_iuh_local_ip_cmd);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-hnodeb/+/26021">change 26021</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-hnodeb/+/26021"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-hnodeb </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I06f21758e361b7d4d7141086d758893bee434e5c </div>
<div style="display:none"> Gerrit-Change-Number: 26021 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>