From 8f576719609df13f3f547cff90c696dd3453cd30 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 12 Aug 2020 22:49:53 +0000 Subject: [PATCH] bsc: fix f_vty_msc_allow_attach(): do not create new empty mscs (fix latest) In the ttcn3-bsc-latest tests, there are no 'msc 1' and 'msc 2' configured, so stepping into 'msc 1' and '2' creates two new, empty MSC configurations. osmo-bsc latest actually still tries to use them and fails 2/3 Compl L3. So do not step into 'msc' config scopes if no such MSC is mentioned in the running config yet. This should finally fix the bsc latest tests after I broke them in I02ad58ed7d0d0aac61e393b415e09c6c5c8a70ca and Ibd5adb359b3fb302e2c70700d911878aef605ff3 and I75295d638072df9f5213a7e74e4a960c009c2865. Yes, I know :/ Change-Id: Ibfeeea98c2a962dec58ad03beb35bb7f83cad228 --- bsc/BSC_Tests.ttcn | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn index 15d83da81..1c02cb642 100644 --- a/bsc/BSC_Tests.ttcn +++ b/bsc/BSC_Tests.ttcn @@ -837,7 +837,15 @@ private type record of boolean my_BooleanList; private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) { + var charstring config := f_vty_transceive_ret(pt, "show running-config"); + for (var integer msc_nr := 0; msc_nr < sizeof(allow_attach_list); msc_nr := msc_nr+1) { + if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { + /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by + * stepping into that config node. */ + log("msc ", msc_nr, " is not configured, skipping"); + continue; + } f_vty_enter_cfg_msc(pt, msc_nr); if (allow_attach_list[msc_nr]) { /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */