summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_vty.c17
-rw-r--r--openbsc/tests/vty_test_runner.py8
2 files changed, 21 insertions, 4 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
index 46dc38e14..6774a420f 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
@@ -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);
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index 778cde04c..456573d74 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -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):