nat: Add a no number-rewrite command and call it through a VTY test

The test is just testing the invocation but does not verify that
the side effect of this call. It is good enought for now.
This commit is contained in:
Holger Hans Peter Freyther 2013-06-25 09:08:02 +02:00 committed by Holger Hans Peter Freyther
parent aa93bac34b
commit b718ad397e
2 changed files with 21 additions and 4 deletions

View File

@ -1,6 +1,6 @@
/* OpenBSC NAT interface to quagga VTY */
/* (C) 2010-2012 by Holger Hans Peter Freyther
* (C) 2010-2012 by On-Waves
/* (C) 2010-2013 by Holger Hans Peter Freyther
* (C) 2010-2013 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@ -554,6 +554,18 @@ DEFUN(cfg_nat_number_rewrite,
&_nat->num_rewr, argv[0]);
}
DEFUN(cfg_nat_no_number_rewrite,
cfg_nat_no_number_rewrite_cmd,
"no number-rewrite",
NO_STR "Set the file with rewriting rules.\n")
{
talloc_free(_nat->num_rewr_name);
_nat->num_rewr_name = NULL;
bsc_nat_num_rewr_entry_adapt(NULL, &_nat->num_rewr, NULL);
return CMD_SUCCESS;
}
DEFUN(cfg_nat_smsc_addr,
cfg_nat_smsc_addr_cmd,
"rewrite-smsc addr FILENAME",
@ -1112,6 +1124,7 @@ int bsc_nat_vty_init(struct bsc_nat *nat)
/* number rewriting */
install_element(NAT_NODE, &cfg_nat_number_rewrite_cmd);
install_element(NAT_NODE, &cfg_nat_no_number_rewrite_cmd);
install_element(NAT_NODE, &cfg_nat_smsc_addr_cmd);
install_element(NAT_NODE, &cfg_nat_smsc_tpdest_cmd);
install_element(NAT_NODE, &cfg_nat_sms_clear_tpsrr_cmd);

View File

@ -96,8 +96,12 @@ class TestVTYNAT(TestVTYBase):
def vty_app(self):
return (4244, "src/osmo-bsc_nat/osmo-bsc_nat", "OsmoBSCNAT", "nat")
def testMoo(self):
pass
def testRewriteNoRewrite(self):
self.vty.enable()
res = self.vty.command("configure terminal")
res = self.vty.command("nat")
res = self.vty.command("number-rewrite rewrite.cfg")
res = self.vty.command("no number-rewrite")
def add_nat_test(suite, workdir):