Add vty commands "no gprs nsvc ..."
A switch (bool) is used to enable or disable NSVC 0 or 1. It is enabled via any "gprs nsvc 0|1" command and disabled via "no gprs nsvc 0|1" command. If it is disabled, it is treated as unconfigured, similar when no remote IP or port has been defined. Related: OS#6006 Change-Id: Ia112e86aa35f6a245d98ef1b3720c18835faeda6
This commit is contained in:
parent
38df74bb5f
commit
c3f3e3c613
|
@ -40,6 +40,7 @@ struct gsm_gprs_nsvc {
|
||||||
/* data read via VTY config file, to configure the BTS
|
/* data read via VTY config file, to configure the BTS
|
||||||
* via OML from BSC */
|
* via OML from BSC */
|
||||||
int id;
|
int id;
|
||||||
|
bool enabled;
|
||||||
uint16_t nsvci;
|
uint16_t nsvci;
|
||||||
uint16_t local_port; /* on the BTS */
|
uint16_t local_port; /* on the BTS */
|
||||||
struct osmo_sockaddr remote;
|
struct osmo_sockaddr remote;
|
||||||
|
|
|
@ -1564,6 +1564,22 @@ DEFUN_USRATTR(cfg_bts_gprs_nsei,
|
||||||
#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
|
#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
|
||||||
"NSVC Logical Number\n"
|
"NSVC Logical Number\n"
|
||||||
|
|
||||||
|
DEFUN_USRATTR(cfg_no_bts_gprs_nsvc,
|
||||||
|
cfg_no_bts_gprs_nsvc_cmd,
|
||||||
|
X(BSC_VTY_ATTR_RESTART_ABIS_OML_LINK),
|
||||||
|
"no gprs nsvc <0-1>",
|
||||||
|
NO_STR GPRS_TEXT NSVC_TEXT)
|
||||||
|
{
|
||||||
|
struct gsm_bts *bts = vty->index;
|
||||||
|
int idx = atoi(argv[0]);
|
||||||
|
|
||||||
|
GPRS_CHECK_ENABLED(bts);
|
||||||
|
|
||||||
|
bts->site_mgr->gprs.nsvc[idx].enabled = false;
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN_USRATTR(cfg_bts_gprs_nsvci,
|
DEFUN_USRATTR(cfg_bts_gprs_nsvci,
|
||||||
cfg_bts_gprs_nsvci_cmd,
|
cfg_bts_gprs_nsvci_cmd,
|
||||||
X(BSC_VTY_ATTR_RESTART_ABIS_OML_LINK),
|
X(BSC_VTY_ATTR_RESTART_ABIS_OML_LINK),
|
||||||
|
@ -1578,6 +1594,7 @@ DEFUN_USRATTR(cfg_bts_gprs_nsvci,
|
||||||
GPRS_CHECK_ENABLED(bts);
|
GPRS_CHECK_ENABLED(bts);
|
||||||
|
|
||||||
bts->site_mgr->gprs.nsvc[idx].nsvci = atoi(argv[1]);
|
bts->site_mgr->gprs.nsvc[idx].nsvci = atoi(argv[1]);
|
||||||
|
bts->site_mgr->gprs.nsvc[idx].enabled = true;
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1598,6 +1615,7 @@ DEFUN_USRATTR(cfg_bts_gprs_nsvc_lport,
|
||||||
GPRS_CHECK_ENABLED(bts);
|
GPRS_CHECK_ENABLED(bts);
|
||||||
|
|
||||||
bts->site_mgr->gprs.nsvc[idx].local_port = atoi(argv[1]);
|
bts->site_mgr->gprs.nsvc[idx].local_port = atoi(argv[1]);
|
||||||
|
bts->site_mgr->gprs.nsvc[idx].enabled = true;
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1619,6 +1637,7 @@ DEFUN_USRATTR(cfg_bts_gprs_nsvc_rport,
|
||||||
|
|
||||||
/* sockaddr_in and sockaddr_in6 have the port at the same position */
|
/* sockaddr_in and sockaddr_in6 have the port at the same position */
|
||||||
bts->site_mgr->gprs.nsvc[idx].remote.u.sin.sin_port = htons(atoi(argv[1]));
|
bts->site_mgr->gprs.nsvc[idx].remote.u.sin.sin_port = htons(atoi(argv[1]));
|
||||||
|
bts->site_mgr->gprs.nsvc[idx].enabled = true;
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1651,9 +1670,11 @@ DEFUN_USRATTR(cfg_bts_gprs_nsvc_rip,
|
||||||
switch (remote.af) {
|
switch (remote.af) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
osmo_sockaddr_str_to_in_addr(&remote, &bts->site_mgr->gprs.nsvc[idx].remote.u.sin.sin_addr);
|
osmo_sockaddr_str_to_in_addr(&remote, &bts->site_mgr->gprs.nsvc[idx].remote.u.sin.sin_addr);
|
||||||
|
bts->site_mgr->gprs.nsvc[idx].enabled = true;
|
||||||
break;
|
break;
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
osmo_sockaddr_str_to_in6_addr(&remote, &bts->site_mgr->gprs.nsvc[idx].remote.u.sin6.sin6_addr);
|
osmo_sockaddr_str_to_in6_addr(&remote, &bts->site_mgr->gprs.nsvc[idx].remote.u.sin6.sin6_addr);
|
||||||
|
bts->site_mgr->gprs.nsvc[idx].enabled = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4251,6 +4272,11 @@ static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
|
||||||
const struct gsm_gprs_nsvc *nsvc = &bts_sm->gprs.nsvc[i];
|
const struct gsm_gprs_nsvc *nsvc = &bts_sm->gprs.nsvc[i];
|
||||||
struct osmo_sockaddr_str remote;
|
struct osmo_sockaddr_str remote;
|
||||||
|
|
||||||
|
if (!nsvc->enabled) {
|
||||||
|
vty_out(vty, " no gprs nsvc %u%s", i, VTY_NEWLINE);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
|
vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
|
||||||
nsvc->nsvci, VTY_NEWLINE);
|
nsvc->nsvci, VTY_NEWLINE);
|
||||||
|
|
||||||
|
@ -4951,6 +4977,7 @@ int bts_vty_init(void)
|
||||||
install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
|
install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
|
||||||
install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
|
install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
|
||||||
install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
|
install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
|
||||||
|
install_element(BTS_NODE, &cfg_no_bts_gprs_nsvc_cmd);
|
||||||
install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
|
install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
|
||||||
install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
|
install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
|
||||||
install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
|
install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
|
||||||
|
|
|
@ -96,6 +96,10 @@ static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event
|
||||||
|
|
||||||
static bool has_valid_nsvc(const struct gsm_gprs_nsvc *nsvc)
|
static bool has_valid_nsvc(const struct gsm_gprs_nsvc *nsvc)
|
||||||
{
|
{
|
||||||
|
/* If not configured (enabled) at all. */
|
||||||
|
if (!nsvc->enabled)
|
||||||
|
return false;
|
||||||
|
|
||||||
/* remote address must be valid */
|
/* remote address must be valid */
|
||||||
if (osmo_sockaddr_is_any(&nsvc->remote))
|
if (osmo_sockaddr_is_any(&nsvc->remote))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -41,10 +41,8 @@ OsmoBSC(config-net-bts)# show running-config
|
||||||
gprs ns timer tns-test 30
|
gprs ns timer tns-test 30
|
||||||
gprs ns timer tns-alive 3
|
gprs ns timer tns-alive 3
|
||||||
gprs ns timer tns-alive-retries 10
|
gprs ns timer tns-alive-retries 10
|
||||||
gprs nsvc 0 nsvci 0
|
no gprs nsvc 0
|
||||||
gprs nsvc 0 local udp port 0
|
no gprs nsvc 1
|
||||||
gprs nsvc 1 nsvci 0
|
|
||||||
gprs nsvc 1 local udp port 0
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,13 +102,12 @@ OsmoBSC(config-net-bts)# show running-config
|
||||||
...
|
...
|
||||||
|
|
||||||
OsmoBSC(config-net-bts)# ### Disable secondary NSVC
|
OsmoBSC(config-net-bts)# ### Disable secondary NSVC
|
||||||
OsmoBSC(config-net-bts)# gprs nsvc 1 remote udp port 0
|
OsmoBSC(config-net-bts)# no gprs nsvc 1
|
||||||
OsmoBSC(config-net-bts)# show running-config
|
OsmoBSC(config-net-bts)# show running-config
|
||||||
...
|
...
|
||||||
bts 0
|
bts 0
|
||||||
...
|
...
|
||||||
gprs nsvc 0 nsvci 4242
|
gprs nsvc 0 nsvci 4242
|
||||||
gprs nsvc 0 local udp port 0
|
gprs nsvc 0 local udp port 0
|
||||||
gprs nsvc 1 nsvci 2424
|
no gprs nsvc 1
|
||||||
gprs nsvc 1 local udp port 23023
|
|
||||||
...
|
...
|
||||||
|
|
Loading…
Reference in New Issue