neels submitted this change.

View Change


Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve neels: Looks good to me, approved
add startup config tests

Get a handle on how osmo-hnbgw currently auto-configures itself, by
running vty tests with a couple of config files that have various levels
of omitted config items that are to be auto-configured.

These tests serve to ensure continuity and compatibility by upcoming
cnpool patches. They will show how the configuration changes / doesn't
change in all the right ways.

Uncover one bug in osmo-hnbgw: local point-code setting is discarded by
osmo-hnbgw startup when there are no SCCP address book entries in use.
The error is fixed as side effect of an upcoming patch:
Iea1824f1c586723d989c80a909bae16bd2866e08

Related: SYS#6412
Change-Id: Ic8bb30e1dd73753c2ff255566382e241918414f7
---
M tests/Makefile.am
A tests/config/defaults.cfg
A tests/config/defaults.vty
A tests/config/one_cs7.cfg
A tests/config/one_cs7.vty
A tests/config/one_cs7_with_addrs.cfg
A tests/config/one_cs7_with_addrs.vty
A tests/config/one_cs7_with_iucs_addr.cfg
A tests/config/one_cs7_with_iucs_addr.vty
A tests/config/one_cs7_with_iups_addr.cfg
A tests/config/one_cs7_with_iups_addr.vty
A tests/config/run_tests.sh
12 files changed, 266 insertions(+), 0 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 58d6592..62fb6c6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -26,6 +26,9 @@
$(TESTSUITE) \
osmo-hnbgw-vty-test.cfg \
osmo-hnbgw.vty \
+ $(srcdir)/config/*.cfg \
+ $(srcdir)/config/*.vty \
+ $(srcdir)/config/run_tests.sh \
$(NULL)

TESTSUITE = $(srcdir)/testsuite
@@ -37,6 +40,7 @@
if ENABLE_EXT_TESTS
python-tests:
$(MAKE) vty-test
+ $(MAKE) config-tests
osmotestvty.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
osmotestconfig.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
else
@@ -57,6 +61,13 @@
-c $(srcdir)/osmo-hnbgw-vty-test.cfg" \
$(U) $(srcdir)/$(VTY_TEST)

+# Test each config/*.cfg file with the corresponding config/*.vty transcript test.
+# Each config test runs an osmo-hnbgw process to talk to, so they must not run concurrently.
+# To prevent 'make -j N' from running these tests in parallel, call a script with a linear for-loop.
+.PHONY: config-tests
+config-tests:
+ $(srcdir)/config/run_tests.sh "$(top_builddir)/src/osmo-hnbgw/osmo-hnbgw" "$(srcdir)/config/" $U
+
check-local: atconfig $(TESTSUITE)
$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
$(MAKE) $(AM_MAKEFLAGS) python-tests
diff --git a/tests/config/defaults.cfg b/tests/config/defaults.cfg
new file mode 100644
index 0000000..b4e37fb
--- /dev/null
+++ b/tests/config/defaults.cfg
@@ -0,0 +1 @@
+# configure nothing, to get purely the implicit default config
diff --git a/tests/config/defaults.vty b/tests/config/defaults.vty
new file mode 100644
index 0000000..282c080
--- /dev/null
+++ b/tests/config/defaults.vty
@@ -0,0 +1,31 @@
+OsmoHNBGW> ### Config file was empty, everything we see here is the default auto configuration
+
+OsmoHNBGW> enable
+
+OsmoHNBGW# show cs7 config
+cs7 instance 0
+ point-code 0.23.5
+ asp asp-clnt-OsmoHNBGW 2905 0 m3ua
+ local-ip localhost
+ remote-ip localhost
+ sctp-role client
+ as as-clnt-OsmoHNBGW m3ua
+ asp asp-clnt-OsmoHNBGW
+ routing-key 0 0.23.5
+
+OsmoHNBGW# show cnlink
+IuCS: OsmoHNBGW:RI=SSN_PC,PC=0.23.5,SSN=RANAP <-> RI=SSN_PC,PC=0.23.1,SSN=RANAP
+ SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-OsmoHNBGW proto=m3ua ASP asp-clnt-OsmoHNBGW
+IuPS: OsmoHNBGW:RI=SSN_PC,PC=0.23.5,SSN=RANAP <-> RI=SSN_PC,PC=0.23.4,SSN=RANAP
+ SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-OsmoHNBGW proto=m3ua ASP asp-clnt-OsmoHNBGW
+
+OsmoHNBGW# show running-config
+...
+cs7 instance 0
+ point-code 0.23.5
+hnbgw
+ rnc-id 23
+ log-prefix hnb-id
+ iuh
+ mgw 0
+...
diff --git a/tests/config/one_cs7.cfg b/tests/config/one_cs7.cfg
new file mode 100644
index 0000000..83862d8
--- /dev/null
+++ b/tests/config/one_cs7.cfg
@@ -0,0 +1,3 @@
+# auto-configuration will pick up cs7 instance 0. Configure only the local point-code.
+cs7 instance 0
+ point-code 1.1.1
diff --git a/tests/config/one_cs7.vty b/tests/config/one_cs7.vty
new file mode 100644
index 0000000..7011c83
--- /dev/null
+++ b/tests/config/one_cs7.vty
@@ -0,0 +1,28 @@
+OsmoHNBGW> enable
+
+OsmoHNBGW# ### ERROR: 'one_cs7.cfg' sets 'cs7 instance 0' / 'point-code 1.1.1', but osmo-hnbgw uses 0.23.5
+OsmoHNBGW# show cs7 config
+cs7 instance 0
+ point-code 0.23.5
+ asp asp-clnt-OsmoHNBGW 2905 0 m3ua
+ local-ip localhost
+ remote-ip localhost
+ sctp-role client
+ as as-clnt-OsmoHNBGW m3ua
+ asp asp-clnt-OsmoHNBGW
+ routing-key 0 0.23.5
+
+OsmoHNBGW# ### ERROR: 'one_cs7.cfg' sets 'cs7 instance 0' / 'point-code 1.1.1', but osmo-hnbgw uses 0.23.5
+OsmoHNBGW# show cnlink
+IuCS: OsmoHNBGW:RI=SSN_PC,PC=0.23.5,SSN=RANAP <-> RI=SSN_PC,PC=0.23.1,SSN=RANAP
+ SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-OsmoHNBGW proto=m3ua ASP asp-clnt-OsmoHNBGW
+IuPS: OsmoHNBGW:RI=SSN_PC,PC=0.23.5,SSN=RANAP <-> RI=SSN_PC,PC=0.23.4,SSN=RANAP
+ SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-OsmoHNBGW proto=m3ua ASP asp-clnt-OsmoHNBGW
+
+OsmoHNBGW# ### ERROR: 'one_cs7.cfg' sets 'cs7 instance 0' / 'point-code 1.1.1', but osmo-hnbgw uses 0.23.5
+OsmoHNBGW# show running-config
+...
+cs7 instance 0
+ point-code 0.23.5
+hnbgw
+...
diff --git a/tests/config/one_cs7_with_addrs.cfg b/tests/config/one_cs7_with_addrs.cfg
new file mode 100644
index 0000000..0369bd4
--- /dev/null
+++ b/tests/config/one_cs7_with_addrs.cfg
@@ -0,0 +1,12 @@
+# explicitly point at cs7 instance 0 via two address book entries for CS and PS. Leave ASP and AS to auto-configuration.
+cs7 instance 0
+ point-code 1.1.1
+ sccp-address my-msc
+ point-code 1.2.3
+ sccp-address my-sgsn
+ point-code 1.4.2
+hnbgw
+ iucs
+ remote-addr my-msc
+ iups
+ remote-addr my-sgsn
diff --git a/tests/config/one_cs7_with_addrs.vty b/tests/config/one_cs7_with_addrs.vty
new file mode 100644
index 0000000..59b1b76
--- /dev/null
+++ b/tests/config/one_cs7_with_addrs.vty
@@ -0,0 +1,46 @@
+OsmoHNBGW> enable
+
+OsmoHNBGW# ### ASP and AS were auto-configured
+OsmoHNBGW# show cs7 config
+cs7 instance 0
+ point-code 1.1.1
+ asp asp-clnt-OsmoHNBGW 2905 0 m3ua
+ local-ip localhost
+ remote-ip localhost
+ sctp-role client
+ as as-clnt-OsmoHNBGW m3ua
+ asp asp-clnt-OsmoHNBGW
+ routing-key 0 1.1.1
+ sccp-address my-msc
+ routing-indicator PC
+ point-code 1.2.3
+ sccp-address my-sgsn
+ routing-indicator PC
+ point-code 1.4.2
+
+OsmoHNBGW# ### IuCS and IuPS were explicitly pointed to specific remote point-codes, using cs7 instance 0 addresses
+OsmoHNBGW# show cnlink
+IuCS: OsmoHNBGW:RI=SSN_PC,PC=1.1.1,SSN=RANAP <-> my-msc:RI=SSN_PC,PC=1.2.3,SSN=RANAP
+ SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-OsmoHNBGW proto=m3ua ASP asp-clnt-OsmoHNBGW
+IuPS: OsmoHNBGW:RI=SSN_PC,PC=1.1.1,SSN=RANAP <-> my-sgsn:RI=SSN_PC,PC=1.4.2,SSN=RANAP
+ SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-OsmoHNBGW proto=m3ua ASP asp-clnt-OsmoHNBGW
+
+OsmoHNBGW# show running-config
+...
+cs7 instance 0
+ point-code 1.1.1
+ sccp-address my-msc
+ routing-indicator PC
+ point-code 1.2.3
+ sccp-address my-sgsn
+ routing-indicator PC
+ point-code 1.4.2
+hnbgw
+ rnc-id 23
+ log-prefix hnb-id
+ iuh
+ iucs
+ remote-addr my-msc
+ iups
+ remote-addr my-sgsn
+...
diff --git a/tests/config/one_cs7_with_iucs_addr.cfg b/tests/config/one_cs7_with_iucs_addr.cfg
new file mode 100644
index 0000000..9e0207e
--- /dev/null
+++ b/tests/config/one_cs7_with_iucs_addr.cfg
@@ -0,0 +1,8 @@
+# only set an explicit remote address for IuCS, let IuPS be auto-configured
+cs7 instance 0
+ point-code 1.1.1
+ sccp-address my-msc
+ point-code 1.2.3
+hnbgw
+ iucs
+ remote-addr my-msc
diff --git a/tests/config/one_cs7_with_iucs_addr.vty b/tests/config/one_cs7_with_iucs_addr.vty
new file mode 100644
index 0000000..2e57ea1
--- /dev/null
+++ b/tests/config/one_cs7_with_iucs_addr.vty
@@ -0,0 +1,37 @@
+OsmoHNBGW> enable
+
+OsmoHNBGW# show cs7 config
+cs7 instance 0
+ point-code 1.1.1
+ asp asp-clnt-OsmoHNBGW 2905 0 m3ua
+ local-ip localhost
+ remote-ip localhost
+ sctp-role client
+ as as-clnt-OsmoHNBGW m3ua
+ asp asp-clnt-OsmoHNBGW
+ routing-key 0 1.1.1
+ sccp-address my-msc
+ routing-indicator PC
+ point-code 1.2.3
+
+OsmoHNBGW# ### only IuCS was configured to go to remote-PC = 1.2.3, IuPS auto-configured to remote-PC = 0.23.4
+OsmoHNBGW# show cnlink
+IuCS: OsmoHNBGW:RI=SSN_PC,PC=1.1.1,SSN=RANAP <-> my-msc:RI=SSN_PC,PC=1.2.3,SSN=RANAP
+ SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-OsmoHNBGW proto=m3ua ASP asp-clnt-OsmoHNBGW
+IuPS: OsmoHNBGW:RI=SSN_PC,PC=1.1.1,SSN=RANAP <-> RI=SSN_PC,PC=0.23.4,SSN=RANAP
+ SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-OsmoHNBGW proto=m3ua ASP asp-clnt-OsmoHNBGW
+
+OsmoHNBGW# show running-config
+...
+cs7 instance 0
+ point-code 1.1.1
+ sccp-address my-msc
+ routing-indicator PC
+ point-code 1.2.3
+hnbgw
+ rnc-id 23
+ log-prefix hnb-id
+ iuh
+ iucs
+ remote-addr my-msc
+...
diff --git a/tests/config/one_cs7_with_iups_addr.cfg b/tests/config/one_cs7_with_iups_addr.cfg
new file mode 100644
index 0000000..96e7afa
--- /dev/null
+++ b/tests/config/one_cs7_with_iups_addr.cfg
@@ -0,0 +1,8 @@
+# only set an explicit remote address for IuPS, let IuCS be auto-configured
+cs7 instance 0
+ point-code 1.1.1
+ sccp-address my-sgsn
+ point-code 1.4.2
+hnbgw
+ iups
+ remote-addr my-sgsn
diff --git a/tests/config/one_cs7_with_iups_addr.vty b/tests/config/one_cs7_with_iups_addr.vty
new file mode 100644
index 0000000..1e4346f
--- /dev/null
+++ b/tests/config/one_cs7_with_iups_addr.vty
@@ -0,0 +1,37 @@
+OsmoHNBGW> enable
+
+OsmoHNBGW# show cs7 config
+cs7 instance 0
+ point-code 1.1.1
+ asp asp-clnt-OsmoHNBGW 2905 0 m3ua
+ local-ip localhost
+ remote-ip localhost
+ sctp-role client
+ as as-clnt-OsmoHNBGW m3ua
+ asp asp-clnt-OsmoHNBGW
+ routing-key 0 1.1.1
+ sccp-address my-sgsn
+ routing-indicator PC
+ point-code 1.4.2
+
+OsmoHNBGW# ### only IuPS was configured to go to remote-PC = 1.4.2, IuCS auto-configured to remote-PC = 0.23.1
+OsmoHNBGW# show cnlink
+IuCS: OsmoHNBGW:RI=SSN_PC,PC=1.1.1,SSN=RANAP <-> RI=SSN_PC,PC=0.23.1,SSN=RANAP
+ SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-OsmoHNBGW proto=m3ua ASP asp-clnt-OsmoHNBGW
+IuPS: OsmoHNBGW:RI=SSN_PC,PC=1.1.1,SSN=RANAP <-> my-sgsn:RI=SSN_PC,PC=1.4.2,SSN=RANAP
+ SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-OsmoHNBGW proto=m3ua ASP asp-clnt-OsmoHNBGW
+
+OsmoHNBGW# show running-config
+...
+cs7 instance 0
+ point-code 1.1.1
+ sccp-address my-sgsn
+ routing-indicator PC
+ point-code 1.4.2
+hnbgw
+ rnc-id 23
+ log-prefix hnb-id
+ iuh
+ iups
+ remote-addr my-sgsn
+...
diff --git a/tests/config/run_tests.sh b/tests/config/run_tests.sh
new file mode 100755
index 0000000..3177df9
--- /dev/null
+++ b/tests/config/run_tests.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+osmo_hnbgw="$1"
+tests_src="$2"
+shift
+shift
+
+if [ ! -x "$osmo_hnbgw" ]; then
+ echo "there seems to be no osmo-hnbgw executable at '$osmo_hnbgw'"
+ exit 1
+fi
+
+if [ ! -d "$tests_src" ]; then
+ echo "there seems to be no tests source dir at '$tests_src'"
+ exit 1
+fi
+
+set -e
+for dot_vty in "$tests_src"/*.vty; do
+ dot_cfg="$(echo $dot_vty | sed 's/\.vty$/.cfg/')"
+ osmo_verify_transcript_vty.py -v -n OsmoHNBGW -p 4261 -r "$osmo_hnbgw -c $dot_cfg" "$dot_vty" $@
+done

To view, visit change 32991. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Ic8bb30e1dd73753c2ff255566382e241918414f7
Gerrit-Change-Number: 32991
Gerrit-PatchSet: 5
Gerrit-Owner: neels <nhofmeyr@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged