Change in osmo-bsc[master]: MSC pooling: add 'no allow-attach' for MSC off-loading

2020-06-18 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/18778 )

Change subject: MSC pooling: add 'no allow-attach' for MSC off-loading
..

MSC pooling: add 'no allow-attach' for MSC off-loading

As in 3GPP TS 23.236, to offload an MSC, the BSC must be able to avoid
attaching new subscribers to it:

4.5a.1: "UEs being moved from one CN node are stopped from registering to the
same CN node again by an O&M command in BSCs and RNCs connected to the pool."

Change-Id: I6249201c15d0f6565aca643c21d2375c9ca58584
---
M include/osmocom/bsc/bsc_msc_data.h
M src/osmo-bsc/gsm_08_08.c
M src/osmo-bsc/osmo_bsc_msc.c
M src/osmo-bsc/osmo_bsc_vty.c
M tests/nri_cfg.vty
5 files changed, 55 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve



diff --git a/include/osmocom/bsc/bsc_msc_data.h 
b/include/osmocom/bsc/bsc_msc_data.h
index 6e29bfe..f19b9a0 100644
--- a/include/osmocom/bsc/bsc_msc_data.h
+++ b/include/osmocom/bsc/bsc_msc_data.h
@@ -181,6 +181,7 @@
} mgcp_ipa;

struct osmo_nri_ranges *nri_ranges;
+   bool allow_attach;
 };

 int osmo_bsc_msc_init(struct bsc_msc_data *msc);
diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index 46ef9af..c002ebb 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -280,7 +280,18 @@

/* Figure out the next round-robin MSC. The MSCs may appear 
unsorted in net->mscs. Make sure to linearly
 * round robin the MSCs by number: pick the lowest msc->nr >= 
round_robin_next_nr, and also remember the
-* lowest available msc->nr to wrap back to that in case no 
next MSC is left. */
+* lowest available msc->nr to wrap back to that in case no 
next MSC is left.
+*
+* MSCs configured with `no allow-attach` do not accept new 
subscribers and hence must not be picked by
+* round-robin. Such an MSC still provides service for already 
attached subscribers: those that
+* successfully performed IMSI-Attach and have a TMSI with an 
NRI pointing at that MSC. We only avoid
+* adding IMSI-Attach of new subscribers. The idea is that the 
MSC is in a mode of off-loading
+* subscribers, and the MSC decides when each subscriber is 
off-loaded, by assigning the NULL-NRI in a
+* new TMSI (at the next periodical LU). So until the MSC 
decides to offload, an attached subscriber
+* remains attached to that MSC and is free to use its services.
+*/
+   if (!msc->allow_attach)
+   continue;
if (!msc_round_robin_first || msc->nr < 
msc_round_robin_first->nr)
msc_round_robin_first = msc;
if (msc->nr >= round_robin_next_nr
diff --git a/src/osmo-bsc/osmo_bsc_msc.c b/src/osmo-bsc/osmo_bsc_msc.c
index ce07518..157808e 100644
--- a/src/osmo-bsc/osmo_bsc_msc.c
+++ b/src/osmo-bsc/osmo_bsc_msc.c
@@ -230,6 +230,7 @@
msc_data->mgcp_ipa.local_port = 0; /* dynamic */

msc_data->nri_ranges = osmo_nri_ranges_alloc(msc_data);
+   msc_data->allow_attach = true;

return msc_data;
 }
diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c
index c860cfe..5c624dd 100644
--- a/src/osmo-bsc/osmo_bsc_vty.c
+++ b/src/osmo-bsc/osmo_bsc_vty.c
@@ -177,6 +177,9 @@
}

msc_write_nri(vty, msc, false);
+
+   if (!msc->allow_attach)
+   vty_out(vty, " no allow-attach%s", VTY_NEWLINE);
 }

 static int config_write_msc(struct vty *vty)
@@ -860,6 +863,28 @@
return CMD_SUCCESS;
 }

+DEFUN(cfg_msc_allow_attach, cfg_msc_allow_attach_cmd,
+  "allow-attach",
+  "Allow this MSC to attach new subscribers (default).\n")
+{
+   struct bsc_msc_data *msc = bsc_msc_data(vty);
+   msc->allow_attach = true;
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_msc_no_allow_attach, cfg_msc_no_allow_attach_cmd,
+  "no allow-attach",
+  NO_STR
+  "Do not assign new subscribers to this MSC."
+  " Useful if an MSC in an MSC pool is configured to off-load subscribers."
+  " The MSC will still be operational for already IMSI-Attached 
subscribers,"
+  " but the NAS node selection function will skip this MSC for new 
subscribers\n")
+{
+   struct bsc_msc_data *msc = bsc_msc_data(vty);
+   msc->allow_attach = false;
+   return CMD_SUCCESS;
+}
+
 static void msc_write_nri(struct vty *vty, struct bsc_msc_data *msc, bool 
verbose)
 {
struct osmo_nri_range *r;
@@ -963,6 +988,8 @@
install_element(MSC_NODE, &cfg_msc_nri_add_cmd);
install_element(MSC_NODE, &cfg_msc_nri_del_cmd);
install_element(MSC_NODE, &cfg_msc_show_nri_cmd);
+   install_element(MSC_NODE, &cfg_msc_allow_attach_cmd);
+

Change in osmo-bsc[master]: MSC pooling: add 'no allow-attach' for MSC off-loading

2020-06-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/18778 )

Change subject: MSC pooling: add 'no allow-attach' for MSC off-loading
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18778
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I6249201c15d0f6565aca643c21d2375c9ca58584
Gerrit-Change-Number: 18778
Gerrit-PatchSet: 4
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 16 Jun 2020 13:25:21 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: MSC pooling: add 'no allow-attach' for MSC off-loading

2020-06-15 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/18778 )

Change subject: MSC pooling: add 'no allow-attach' for MSC off-loading
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18778
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I6249201c15d0f6565aca643c21d2375c9ca58584
Gerrit-Change-Number: 18778
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 15 Jun 2020 08:50:54 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: MSC pooling: add 'no allow-attach' for MSC off-loading

2020-06-14 Thread neels
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-bsc/+/18778

to look at the new patch set (#3).

Change subject: MSC pooling: add 'no allow-attach' for MSC off-loading
..

MSC pooling: add 'no allow-attach' for MSC off-loading

As in 3GPP TS 23.236, to offload an MSC, the BSC must be able to avoid
attaching new subscribers to it:

4.5a.1: "UEs being moved from one CN node are stopped from registering to the
same CN node again by an O&M command in BSCs and RNCs connected to the pool."

Change-Id: I6249201c15d0f6565aca643c21d2375c9ca58584
---
M include/osmocom/bsc/bsc_msc_data.h
M src/osmo-bsc/gsm_08_08.c
M src/osmo-bsc/osmo_bsc_msc.c
M src/osmo-bsc/osmo_bsc_vty.c
M tests/nri_cfg.vty
5 files changed, 55 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/78/18778/3
-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18778
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I6249201c15d0f6565aca643c21d2375c9ca58584
Gerrit-Change-Number: 18778
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels 
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset


Change in osmo-bsc[master]: MSC pooling: add 'no allow-attach' for MSC off-loading

2020-06-14 Thread neels
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/18778 )

Change subject: MSC pooling: add 'no allow-attach' for MSC off-loading
..


Patch Set 2:

(2 comments)

https://gerrit.osmocom.org/c/osmo-bsc/+/18778/2/src/osmo-bsc/gsm_08_08.c
File src/osmo-bsc/gsm_08_08.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/18778/2/src/osmo-bsc/gsm_08_08.c@286
PS2, Line 286:  if (!msc->allow_attach)
> Should you check this above? Otherwise if NRI matches it will still use it 
> even if administratively  […]
that is exactly what is supposed to happen. explaining in a comment in the next 
patch set


https://gerrit.osmocom.org/c/osmo-bsc/+/18778/2/src/osmo-bsc/osmo_bsc_vty.c
File src/osmo-bsc/osmo_bsc_vty.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/18778/2/src/osmo-bsc/osmo_bsc_vty.c@882
PS2, Line 882:   " but the NAS node selection function will skip this MSC 
for new subscribers\n")
...also explained here.



--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18778
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I6249201c15d0f6565aca643c21d2375c9ca58584
Gerrit-Change-Number: 18778
Gerrit-PatchSet: 2
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Mon, 15 Jun 2020 01:57:41 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in osmo-bsc[master]: MSC pooling: add 'no allow-attach' for MSC off-loading

2020-06-11 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/18778 )

Change subject: MSC pooling: add 'no allow-attach' for MSC off-loading
..


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/c/osmo-bsc/+/18778/2/src/osmo-bsc/gsm_08_08.c
File src/osmo-bsc/gsm_08_08.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/18778/2/src/osmo-bsc/gsm_08_08.c@286
PS2, Line 286:  if (!msc->allow_attach)
Should you check this above? Otherwise if NRI matches it will still use it even 
if administratively disabled.



--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18778
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I6249201c15d0f6565aca643c21d2375c9ca58584
Gerrit-Change-Number: 18778
Gerrit-PatchSet: 2
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-Comment-Date: Thu, 11 Jun 2020 12:15:38 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in osmo-bsc[master]: MSC pooling: add 'no allow-attach' for MSC off-loading

2020-06-10 Thread neels
neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/18778 )


Change subject: MSC pooling: add 'no allow-attach' for MSC off-loading
..

MSC pooling: add 'no allow-attach' for MSC off-loading

As in 3GPP TS 23.236, to offload an MSC, the BSC must be able to avoid
attaching new subscribers to it:

4.5a.1: "UEs being moved from one CN node are stopped from registering to the
same CN node again by an O&M command in BSCs and RNCs connected to the pool."

Change-Id: I6249201c15d0f6565aca643c21d2375c9ca58584
---
M include/osmocom/bsc/bsc_msc_data.h
M src/osmo-bsc/gsm_08_08.c
M src/osmo-bsc/osmo_bsc_msc.c
M src/osmo-bsc/osmo_bsc_vty.c
M tests/nri_cfg.vty
5 files changed, 48 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/78/18778/1

diff --git a/include/osmocom/bsc/bsc_msc_data.h 
b/include/osmocom/bsc/bsc_msc_data.h
index 3df2774..fc6c2d6 100644
--- a/include/osmocom/bsc/bsc_msc_data.h
+++ b/include/osmocom/bsc/bsc_msc_data.h
@@ -181,6 +181,7 @@
} mgcp_ipa;

struct osmo_nri_ranges *nri_ranges;
+   bool allow_attach;
 };

 int osmo_bsc_msc_init(struct bsc_msc_data *msc);
diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index 0707c65..0064b41 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -231,7 +231,11 @@

/* Figure out the next round-robin MSC. The MSCs may appear 
unsorted in net->mscs. Make sure to linearly
 * round robin the MSCs by number: pick the lowest msc->nr >= 
round_robin_next_nr, and also remember the
-* lowest available msc->nr to wrap back to that in case no 
next MSC is left. */
+* lowest available msc->nr to wrap back to that in case no 
next MSC is left.
+* MSCs configured with `no allow-attach` do not accept new 
subscribers and hence must not be picked by
+* round-robin. */
+   if (!msc->allow_attach)
+   continue;
if (!msc_round_robin_first || msc->nr < 
msc_round_robin_first->nr)
msc_round_robin_first = msc;
if (msc->nr >= round_robin_next_nr
diff --git a/src/osmo-bsc/osmo_bsc_msc.c b/src/osmo-bsc/osmo_bsc_msc.c
index ce07518..157808e 100644
--- a/src/osmo-bsc/osmo_bsc_msc.c
+++ b/src/osmo-bsc/osmo_bsc_msc.c
@@ -230,6 +230,7 @@
msc_data->mgcp_ipa.local_port = 0; /* dynamic */

msc_data->nri_ranges = osmo_nri_ranges_alloc(msc_data);
+   msc_data->allow_attach = true;

return msc_data;
 }
diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c
index 7db7c94..dbdd807 100644
--- a/src/osmo-bsc/osmo_bsc_vty.c
+++ b/src/osmo-bsc/osmo_bsc_vty.c
@@ -177,6 +177,9 @@
}

msc_write_nri(vty, msc, false);
+
+   if (!msc->allow_attach)
+   vty_out(vty, " no allow-attach%s", VTY_NEWLINE);
 }

 static int config_write_msc(struct vty *vty)
@@ -861,6 +864,28 @@
return CMD_SUCCESS;
 }

+DEFUN(cfg_msc_allow_attach, cfg_msc_allow_attach_cmd,
+  "allow-attach",
+  "Allow this MSC to attach new subscribers (default).\n")
+{
+   struct bsc_msc_data *msc = bsc_msc_data(vty);
+   msc->allow_attach = true;
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_msc_no_allow_attach, cfg_msc_no_allow_attach_cmd,
+  "no allow-attach",
+  NO_STR
+  "Do not assign new subscribers to this MSC."
+  " Useful if an MSC in an MSC pool is configured to off-load subscribers."
+  " The MSC will still be operational for already attached subscribers,"
+  " but the NAS node selection function will skip this MSC for new 
subscribers\n")
+{
+   struct bsc_msc_data *msc = bsc_msc_data(vty);
+   msc->allow_attach = false;
+   return CMD_SUCCESS;
+}
+
 static void msc_write_nri(struct vty *vty, struct bsc_msc_data *msc, bool 
verbose)
 {
struct osmo_nri_range *r;
@@ -964,6 +989,8 @@
install_element(MSC_NODE, &cfg_msc_nri_add_cmd);
install_element(MSC_NODE, &cfg_msc_nri_del_cmd);
install_element(MSC_NODE, &cfg_msc_show_nri_cmd);
+   install_element(MSC_NODE, &cfg_msc_allow_attach_cmd);
+   install_element(MSC_NODE, &cfg_msc_no_allow_attach_cmd);

/* Deprecated: ping time config, kept to support legacy config files. */
install_element(MSC_NODE, &cfg_net_msc_no_ping_time_cmd);
diff --git a/tests/nri_cfg.vty b/tests/nri_cfg.vty
index 2b38ec4..3ab7bf2 100644
--- a/tests/nri_cfg.vty
+++ b/tests/nri_cfg.vty
@@ -159,3 +159,17 @@
 OsmoBSC(config-msc)# show nri
 msc 0
  nri add 0 1000
+
+OsmoBSC(config-msc)# show running-config
+... ! no allow-attach
+OsmoBSC(config-msc)# no allow-attach
+OsmoBSC(config-msc)# show running-config
+...
+msc 0
+...
+ nri add 0 1000
+ no allow-attach
+... ! no allow-attach
+OsmoBSC(config-msc)# allow-attach
+OsmoBSC(config-msc)# show running-config
+... ! n