sgsn: Add easy APN commands with just the name
For most configurations we don't address multiple GGSNs but only want to enforce a list of APNs. In the future we might add a special global GGSN context but not right now. Fixes: SYS#593
This commit is contained in:
parent
ca69b0f68d
commit
9c20a5f45c
|
@ -784,6 +784,27 @@ DEFUN(cfg_gsup_remote_port, cfg_gsup_remote_port_cmd,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_apn_name, cfg_apn_name_cmd,
|
||||
"access-point-name NAME",
|
||||
"Configure a global list of allowed APNs\n"
|
||||
"Add this NAME to the list\n")
|
||||
{
|
||||
return add_apn_ggsn_mapping(vty, argv[0], "", 0);
|
||||
}
|
||||
|
||||
DEFUN(cfg_no_apn_name, cfg_no_apn_name_cmd,
|
||||
"no access-point-name NAME",
|
||||
NO_STR "Configure a global list of allowed APNs\n"
|
||||
"Remove entry with NAME\n")
|
||||
{
|
||||
struct apn_ctx *apn_ctx = sgsn_apn_ctx_by_name(argv[0], "");
|
||||
if (!apn_ctx)
|
||||
return CMD_SUCCESS;
|
||||
|
||||
sgsn_apn_ctx_free(apn_ctx);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
int sgsn_vty_init(void)
|
||||
{
|
||||
install_element_ve(&show_sgsn_cmd);
|
||||
|
@ -813,6 +834,8 @@ int sgsn_vty_init(void)
|
|||
install_element(SGSN_NODE, &cfg_gsup_remote_port_cmd);
|
||||
install_element(SGSN_NODE, &cfg_apn_ggsn_cmd);
|
||||
install_element(SGSN_NODE, &cfg_apn_imsi_ggsn_cmd);
|
||||
install_element(SGSN_NODE, &cfg_apn_name_cmd);
|
||||
install_element(SGSN_NODE, &cfg_no_apn_name_cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -815,6 +815,24 @@ class TestVTYSGSN(TestVTYGenericBSC):
|
|||
self.assert_(res.find('apn apn1.test imsi-prefix 123456 ggsn 0') >= 0)
|
||||
self.assert_(res.find('apn apn2.test imsi-prefix 123456 ggsn 0') >= 0)
|
||||
|
||||
def testVtyEasyAPN(self):
|
||||
self.vty.enable()
|
||||
self.assertTrue(self.vty.verify('configure terminal', ['']))
|
||||
self.assertEquals(self.vty.node(), 'config')
|
||||
self.assertTrue(self.vty.verify('sgsn', ['']))
|
||||
self.assertEquals(self.vty.node(), 'config-sgsn')
|
||||
|
||||
res = self.vty.command("show running-config")
|
||||
self.assertEquals(res.find("apn internet"), -1)
|
||||
|
||||
self.assertTrue(self.vty.verify("access-point-name internet.apn", ['']))
|
||||
res = self.vty.command("show running-config")
|
||||
self.assert_(res.find("apn internet.apn ggsn 0") >= 0)
|
||||
|
||||
self.assertTrue(self.vty.verify("no access-point-name internet.apn", ['']))
|
||||
res = self.vty.command("show running-config")
|
||||
self.assertEquals(res.find("apn internet"), -1)
|
||||
|
||||
def add_nat_test(suite, workdir):
|
||||
if not os.path.isfile(os.path.join(workdir, "src/osmo-bsc_nat/osmo-bsc_nat")):
|
||||
print("Skipping the NAT test")
|
||||
|
|
Loading…
Reference in New Issue