Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 1 | /* Osmocom VTY interface functions in TTCN-3 |
| 2 | * (C) 2017-2018 Harald Welte <laforge@gnumonks.org> |
| 3 | * contributions by sysmocom - s.f.m.c. GmbH |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Released under the terms of GNU General Public License, Version 2 or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 10 | */ |
| 11 | |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 12 | module Osmocom_VTY_Functions { |
Pau Espin Pedrol | 3bc82b4 | 2021-02-05 16:01:36 +0100 | [diff] [blame] | 13 | |
| 14 | import from Misc_Helpers all; |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 15 | import from TELNETasp_PortType all; |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 16 | import from Osmocom_Types all; |
Neels Hofmeyr | e23496a | 2021-12-13 17:07:40 +0100 | [diff] [blame] | 17 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 11ac91c | 2023-06-10 01:09:04 +0200 | [diff] [blame] | 18 | import from Socket_API_Definitions all; |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 19 | |
Harald Welte | 553f655 | 2018-01-24 18:50:53 +0100 | [diff] [blame] | 20 | modulepar { |
| 21 | charstring mp_prompt_prefix := "OpenBSC"; |
Vadim Yanitskiy | bc1e66a | 2021-01-30 14:14:15 +0100 | [diff] [blame] | 22 | float mp_prompt_timeout := 2.0; |
Harald Welte | 553f655 | 2018-01-24 18:50:53 +0100 | [diff] [blame] | 23 | } |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 24 | |
Harald Welte | 553f655 | 2018-01-24 18:50:53 +0100 | [diff] [blame] | 25 | const charstring VTY_VIEW_SUFFIX := "> "; |
| 26 | const charstring VTY_ENABLE_SUFFIX := "# "; |
| 27 | const charstring VTY_CFG_SUFFIX := "(*)"; |
| 28 | |
| 29 | template charstring t_vty_unknown := pattern "*% Unknown command."; |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 30 | |
| 31 | /* configure prompts in TELNETasp module */ |
Harald Welte | a266325 | 2018-09-10 10:21:44 +0200 | [diff] [blame] | 32 | function f_vty_set_prompts(TELNETasp_PT pt, charstring prompt_prefix := mp_prompt_prefix) { |
Harald Welte | 553f655 | 2018-01-24 18:50:53 +0100 | [diff] [blame] | 33 | var ASP_TelnetDynamicConfig vty_prompt[3] := { |
| 34 | { |
| 35 | prompt := { |
| 36 | id := 1, |
Harald Welte | a266325 | 2018-09-10 10:21:44 +0200 | [diff] [blame] | 37 | prompt := prompt_prefix & VTY_VIEW_SUFFIX, |
Harald Welte | 553f655 | 2018-01-24 18:50:53 +0100 | [diff] [blame] | 38 | has_wildcards := false |
| 39 | } |
| 40 | }, { |
| 41 | prompt := { |
| 42 | id := 2, |
Harald Welte | a266325 | 2018-09-10 10:21:44 +0200 | [diff] [blame] | 43 | prompt := prompt_prefix & VTY_ENABLE_SUFFIX, |
Harald Welte | 553f655 | 2018-01-24 18:50:53 +0100 | [diff] [blame] | 44 | has_wildcards := false |
| 45 | } |
| 46 | }, { |
| 47 | prompt := { |
| 48 | id := 3, |
Harald Welte | a266325 | 2018-09-10 10:21:44 +0200 | [diff] [blame] | 49 | prompt := prompt_prefix & VTY_CFG_SUFFIX, |
Harald Welte | 553f655 | 2018-01-24 18:50:53 +0100 | [diff] [blame] | 50 | has_wildcards := true |
| 51 | } |
| 52 | } |
| 53 | }; |
| 54 | |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 55 | /* set some configuration that isn't possible to express |
| 56 | * in the config file due to syntactic restrictions (Who invents config |
| 57 | * files that don't permit regular expressions? */ |
| 58 | for (var integer i := 0; i < sizeof(vty_prompt); i:= i + 1) { |
Harald Welte | 553f655 | 2018-01-24 18:50:53 +0100 | [diff] [blame] | 59 | pt.send(vty_prompt[i]); |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 60 | } |
| 61 | } |
| 62 | |
| 63 | /* wait for any of the permitted prompts; buffer + return all intermediate output */ |
Vadim Yanitskiy | 26e30aa | 2021-01-30 14:06:37 +0100 | [diff] [blame] | 64 | function f_vty_wait_for_prompt(TELNETasp_PT pt, boolean strict := true, charstring log_label := "(?)") |
| 65 | return charstring { |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 66 | var charstring rx, buf := ""; |
Stefan Sperling | 23b4597 | 2018-07-27 17:20:38 +0200 | [diff] [blame] | 67 | var integer fd; |
Vadim Yanitskiy | bc1e66a | 2021-01-30 14:14:15 +0100 | [diff] [blame] | 68 | timer T; |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 69 | |
Vadim Yanitskiy | bc1e66a | 2021-01-30 14:14:15 +0100 | [diff] [blame] | 70 | T.start(mp_prompt_timeout); |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 71 | alt { |
Vadim Yanitskiy | 26e30aa | 2021-01-30 14:06:37 +0100 | [diff] [blame] | 72 | [] pt.receive(pattern "[\w-]+" & VTY_VIEW_SUFFIX) { }; |
| 73 | [] pt.receive(pattern "[\w-]+\# ") { }; |
| 74 | [] pt.receive(pattern "[\w-]+\(*\)\# ") { }; |
| 75 | [] pt.receive(t_vty_unknown) -> value rx { |
| 76 | if (strict) { |
| 77 | setverdict(fail, "VTY: Unknown Command: " & log_label); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 78 | mtc.stop; |
Vadim Yanitskiy | 26e30aa | 2021-01-30 14:06:37 +0100 | [diff] [blame] | 79 | } else { |
| 80 | log("VTY: Unknown Command (ignored): " & log_label); |
| 81 | buf := buf & rx; |
| 82 | repeat; |
| 83 | } |
| 84 | }; |
| 85 | [] pt.receive(charstring:?) -> value rx { buf := buf & rx; repeat }; |
| 86 | [] pt.receive(integer:?) -> value fd { |
| 87 | if (fd == -1) { |
| 88 | setverdict(fail, "VTY Telnet Connection Failure: " & log_label); |
| 89 | mtc.stop; |
| 90 | } else { |
| 91 | repeat; /* telnet connection succeeded */ |
| 92 | } |
| 93 | } |
| 94 | [] T.timeout { |
| 95 | setverdict(fail, "VTY Timeout for prompt: " & log_label); |
| 96 | mtc.stop; |
| 97 | }; |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 98 | } |
| 99 | T.stop; |
| 100 | return buf; |
| 101 | } |
| 102 | |
| 103 | /* send a VTY command and obtain response until prompt is received */ |
Neels Hofmeyr | 2fe5ad1 | 2020-08-09 21:50:25 +0000 | [diff] [blame] | 104 | function f_vty_transceive_ret(TELNETasp_PT pt, charstring tx, boolean strict := true) return charstring { |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 105 | pt.send(tx); |
Neels Hofmeyr | 9ebabc8 | 2020-11-25 22:56:13 +0000 | [diff] [blame] | 106 | return f_vty_wait_for_prompt(pt, strict, tx); |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | /* send a VTY command and obtain response until prompt is received */ |
Neels Hofmeyr | 2fe5ad1 | 2020-08-09 21:50:25 +0000 | [diff] [blame] | 110 | function f_vty_transceive(TELNETasp_PT pt, charstring tx, boolean strict := true) { |
| 111 | var charstring unused := f_vty_transceive_ret(pt, tx, strict); |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | type integer BtsNr (0..255); |
| 115 | type integer BtsTrxNr (0..255); |
| 116 | type integer BtsTimeslotNr (0..7); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 117 | type integer MscNr (0..255); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 118 | type integer Cs7Nr (0..255); |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 119 | |
| 120 | type charstring BtsGprsMode ("none", "gprs", "egrps"); |
| 121 | |
| 122 | /* enter the'confiugration' mode of the VTY */ |
| 123 | function f_vty_enter_config(TELNETasp_PT pt) { |
| 124 | f_vty_transceive(pt, "configure terminal") |
| 125 | } |
| 126 | |
| 127 | function f_vty_enter_cfg_network(TELNETasp_PT pt) { |
| 128 | f_vty_enter_config(pt); |
| 129 | f_vty_transceive(pt, "network") |
| 130 | } |
| 131 | |
| 132 | function f_vty_enter_cfg_bts(TELNETasp_PT pt, BtsNr bts := 0) { |
| 133 | f_vty_enter_cfg_network(pt); |
| 134 | f_vty_transceive(pt, "bts " & int2str(bts)); |
| 135 | } |
| 136 | |
| 137 | function f_vty_enter_cfg_trx(TELNETasp_PT pt, BtsNr bts := 0, BtsTrxNr trx := 0) { |
| 138 | f_vty_enter_cfg_bts(pt, bts); |
| 139 | f_vty_transceive(pt, "trx " & int2str(trx)); |
| 140 | } |
| 141 | |
| 142 | function f_vty_enter_cfg_ts(TELNETasp_PT pt, BtsNr bts := 0, BtsTrxNr trx := 0, BtsTimeslotNr ts) { |
| 143 | f_vty_enter_cfg_trx(pt, bts, trx); |
| 144 | f_vty_transceive(pt, "timeslot " & int2str(ts)); |
| 145 | } |
| 146 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 147 | function f_vty_enter_cfg_msc(TELNETasp_PT pt, MscNr msc := 0) { |
| 148 | f_vty_enter_config(pt); |
| 149 | f_vty_transceive(pt, "msc " & int2str(msc)); |
| 150 | } |
| 151 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 152 | function f_vty_enter_cfg_cs7_inst(TELNETasp_PT pt, Cs7Nr cs7_inst := 0) { |
| 153 | f_vty_enter_config(pt); |
| 154 | f_vty_transceive(pt, "cs7 instance " & int2str(cs7_inst)); |
| 155 | } |
| 156 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 157 | type record of charstring rof_charstring; |
Neels Hofmeyr | 1a1f854 | 2020-11-25 23:39:46 +0000 | [diff] [blame] | 158 | function f_vty_config3(TELNETasp_PT pt, rof_charstring config_nodes, rof_charstring cmds) |
Harald Welte | 872ce17 | 2018-02-16 22:10:33 +0100 | [diff] [blame] | 159 | { |
| 160 | /* enter config mode; enter node */ |
| 161 | f_vty_enter_config(pt); |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 162 | for (var integer i := 0; i < sizeof(config_nodes); i := i+1) { |
| 163 | f_vty_transceive(pt, config_nodes[i]); |
| 164 | } |
Neels Hofmeyr | 1a1f854 | 2020-11-25 23:39:46 +0000 | [diff] [blame] | 165 | /* execute commands */ |
| 166 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 167 | f_vty_transceive(pt, cmds[i]); |
| 168 | } |
Harald Welte | 872ce17 | 2018-02-16 22:10:33 +0100 | [diff] [blame] | 169 | /* leave config mode */ |
| 170 | f_vty_transceive(pt, "end"); |
| 171 | } |
| 172 | |
Neels Hofmeyr | 1a1f854 | 2020-11-25 23:39:46 +0000 | [diff] [blame] | 173 | function f_vty_config2(TELNETasp_PT pt, rof_charstring config_nodes, charstring cmd) |
| 174 | { |
| 175 | f_vty_config3(pt, config_nodes, { cmd }); |
| 176 | } |
Harald Welte | 872ce17 | 2018-02-16 22:10:33 +0100 | [diff] [blame] | 177 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 178 | function f_vty_config(TELNETasp_PT pt, charstring config_node, charstring cmd) |
| 179 | { |
| 180 | f_vty_config2(pt, {config_node}, cmd); |
| 181 | } |
| 182 | |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 183 | function f_vty_cfg_bts(TELNETasp_PT pt, BtsNr bts := 0, rof_charstring cmds) { |
| 184 | f_vty_config3(pt, {"network", "bts " & int2str(bts)}, cmds); |
| 185 | } |
| 186 | |
| 187 | function f_vty_cfg_msc(TELNETasp_PT pt, MscNr msc := 0, rof_charstring cmds) { |
| 188 | f_vty_config3(pt, {"msc " & int2str(msc)}, cmds); |
| 189 | } |
| 190 | |
Alexander Couzens | 98aa59e | 2018-06-12 13:45:59 +0200 | [diff] [blame] | 191 | function f_vty_transceive_match(TELNETasp_PT pt, charstring cmd, template charstring exp_ret) { |
| 192 | var charstring ret := f_vty_transceive_ret(pt, cmd); |
| 193 | if (not match(ret, exp_ret)) { |
| 194 | setverdict(fail, "Non-matching VTY response: ", ret); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 195 | mtc.stop; |
Alexander Couzens | 98aa59e | 2018-06-12 13:45:59 +0200 | [diff] [blame] | 196 | } |
| 197 | } |
| 198 | |
Alexander Couzens | 1e6d990 | 2018-06-12 13:48:26 +0200 | [diff] [blame] | 199 | function f_vty_transceive_not_match(TELNETasp_PT pt, charstring cmd, template charstring exp_ret) { |
| 200 | var charstring ret := f_vty_transceive_ret(pt, cmd); |
| 201 | if (match(ret, exp_ret)) { |
| 202 | setverdict(fail, "Unexpected matching VTY response: ", ret); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 203 | mtc.stop; |
Alexander Couzens | 1e6d990 | 2018-06-12 13:48:26 +0200 | [diff] [blame] | 204 | } |
| 205 | } |
| 206 | |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 207 | function f_vty_transceive_match_regex(TELNETasp_PT pt, charstring cmd, charstring regex, integer groupno) return charstring |
| 208 | { |
| 209 | var charstring resp := f_vty_transceive_ret(pt, cmd); |
| 210 | return regexp(resp, regex, groupno); |
| 211 | } |
| 212 | |
| 213 | function f_vty_transceive_match_regexp_retry(TELNETasp_PT pt, charstring cmd, charstring regex, |
| 214 | integer groupno, integer num_attempts, float retry_delay) return charstring |
| 215 | { |
| 216 | while (num_attempts > 0) { |
| 217 | var charstring ret := f_vty_transceive_match_regex(pt, cmd, regex, groupno); |
| 218 | if (ret != "") { |
| 219 | return ret; |
| 220 | } |
| 221 | f_sleep(retry_delay); |
| 222 | num_attempts := num_attempts - 1; |
| 223 | } |
| 224 | |
Pau Espin Pedrol | 3bc82b4 | 2021-02-05 16:01:36 +0100 | [diff] [blame] | 225 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 226 | log2str("No matching VTY response for regular expression '", |
| 227 | regex, "' after ", num_attempts, " attempts." )); |
| 228 | return ""; |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 229 | } |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 230 | |
Neels Hofmeyr | e23496a | 2021-12-13 17:07:40 +0100 | [diff] [blame] | 231 | /* Return a count of how many times sub_str occurs in str. */ |
| 232 | function f_strstr_count(in charstring str, in charstring sub_str) return integer |
| 233 | { |
| 234 | var integer count := 0; |
| 235 | var integer pos := 0; |
| 236 | |
| 237 | while (true) { |
| 238 | var integer at := f_strstr(str, sub_str, pos); |
| 239 | if (at < 0) { |
| 240 | break; |
| 241 | } |
| 242 | count := count + 1; |
| 243 | pos := at + 1; |
| 244 | } |
| 245 | return count; |
| 246 | } |
| 247 | |
| 248 | private type record of charstring StrList; |
| 249 | |
| 250 | /* Perform a 'show talloc-context' to get a count of the given object_strs that are still allocated. |
| 251 | * Retry 'attempts' times until the actual talloc object count matches 'expect_count'. |
| 252 | * Useful to ensure that no mem leaks remain after running a test. */ |
| 253 | function f_verify_talloc_count(TELNETasp_PT pt, StrList object_strs, integer expect_count := 0, |
| 254 | integer attempts := 5, float wait_time := 3.0) |
| 255 | { |
| 256 | var charstring show_cmd := "show talloc-context application full filter "; |
| 257 | for (var integer i := 0; i < lengthof(object_strs); i := i + 1) { |
| 258 | var charstring obj_str := object_strs[i]; |
| 259 | /* spaces confuse the VTY command */ |
| 260 | obj_str := f_replaceEveryOccurenceOfSubstring(obj_str, " ", "."); |
| 261 | /* In the regexp, expect word start and word end to bound the obj name */ |
| 262 | obj_str := "\\<" & obj_str & "\\>"; |
| 263 | if (i > 0) { |
| 264 | show_cmd := show_cmd & "\\|"; |
| 265 | } |
| 266 | show_cmd := show_cmd & obj_str; |
| 267 | } |
| 268 | |
| 269 | while (attempts > 0) { |
| 270 | attempts := attempts - 1; |
| 271 | var charstring ret := f_vty_transceive_ret(pt, show_cmd); |
| 272 | |
| 273 | var boolean ok := true; |
| 274 | for (var integer i := 0; i < lengthof(object_strs); i := i + 1) { |
| 275 | var charstring object_str := object_strs[i]; |
| 276 | var integer count := f_strstr_count(ret, object_str); |
| 277 | log("talloc reports ", object_str, " x ", count, ", expecting ", expect_count); |
| 278 | if (count != expect_count) { |
| 279 | ok := false; |
| 280 | } |
| 281 | } |
| 282 | if (ok) { |
| 283 | return; |
| 284 | } |
| 285 | if (attempts == 0) { |
| 286 | break; |
| 287 | } |
| 288 | log("count mismatch, retrying in ", wait_time); |
| 289 | f_sleep(wait_time); |
| 290 | } |
Neels Hofmeyr | c0633b7 | 2023-04-15 17:58:07 +0200 | [diff] [blame] | 291 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "talloc count mismatch"); |
Neels Hofmeyr | e23496a | 2021-12-13 17:07:40 +0100 | [diff] [blame] | 292 | } |
| 293 | |
Neels Hofmeyr | 11ac91c | 2023-06-10 01:09:04 +0200 | [diff] [blame] | 294 | public function f_str_split(charstring str, charstring delim := "\n") return ro_charstring |
| 295 | { |
| 296 | var integer pos := 0; |
| 297 | var ro_charstring parts := {}; |
| 298 | var integer delim_pos; |
| 299 | var integer end := lengthof(str); |
| 300 | while (pos < end) { |
| 301 | delim_pos := f_strstr(str, delim, pos); |
| 302 | if (delim_pos < 0) { |
| 303 | delim_pos := end; |
| 304 | } |
| 305 | if (delim_pos > pos) { |
| 306 | parts := parts & { substr(str, pos, delim_pos - pos) }; |
| 307 | } |
| 308 | pos := delim_pos + 1; |
| 309 | } |
| 310 | return parts; |
| 311 | } |
| 312 | |
Neels Hofmeyr | 75d905b | 2023-04-27 00:30:25 +0200 | [diff] [blame] | 313 | public function f_verify_talloc_bytes(TELNETasp_PT pt, ro_charstring object_strs, integer expect_bytes := 0, |
| 314 | integer attempts := 5, float wait_time := 3.0) |
| 315 | { |
| 316 | var charstring show_cmd := "show talloc-context application brief"; |
| 317 | |
| 318 | while (attempts > 0) { |
| 319 | attempts := attempts - 1; |
| 320 | var charstring ret := f_vty_transceive_ret(pt, show_cmd); |
| 321 | |
| 322 | var ro_charstring lines := f_str_split(ret); |
| 323 | |
| 324 | var boolean ok := true; |
| 325 | for (var integer i := 0; i < lengthof(object_strs); i := i + 1) { |
| 326 | var charstring object_str := object_strs[i]; |
| 327 | |
| 328 | var integer bytes := 0; |
| 329 | |
| 330 | for (var integer j := 0; j < lengthof(lines); j := j + 1) { |
| 331 | var charstring line := lines[j]; |
| 332 | if (f_strstr(line, object_str) < 0) { |
| 333 | continue; |
| 334 | } |
| 335 | var ro_charstring tokens := f_str_split(line, " "); |
| 336 | if (lengthof(tokens) < 4) { |
| 337 | continue; |
| 338 | } |
| 339 | if (tokens[3] != "bytes") { |
| 340 | continue; |
| 341 | } |
| 342 | bytes := f_str2int(tokens[2]); |
| 343 | } |
| 344 | |
| 345 | if (bytes != expect_bytes) { |
| 346 | ok := false; |
| 347 | log("ERROR: talloc reports ", object_str, " = ", bytes, " bytes, expecting ", expect_bytes, |
| 348 | " from VTY response ", lines); |
| 349 | } else { |
| 350 | log("ok: talloc reports ", object_str, " = ", bytes, " bytes"); |
| 351 | } |
| 352 | } |
| 353 | if (ok) { |
| 354 | return; |
| 355 | } |
| 356 | if (attempts == 0) { |
| 357 | break; |
| 358 | } |
| 359 | log("bytes count mismatch, retrying in ", wait_time); |
| 360 | f_sleep(wait_time); |
| 361 | } |
| 362 | setverdict(fail, "talloc bytes count mismatch"); |
| 363 | mtc.stop; |
| 364 | } |
| 365 | |
Oliver Smith | 7bb63cf | 2023-10-20 13:54:28 +0200 | [diff] [blame] | 366 | public function f_logp(TELNETasp_PT pt, charstring log_msg) |
| 367 | { |
| 368 | // log on TTCN3 log output |
| 369 | log(log_msg); |
| 370 | // log in stderr log |
| 371 | if (pt.checkstate("Mapped")) { |
| 372 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
| 373 | } |
| 374 | } |
| 375 | |
Harald Welte | 8542cef | 2017-07-19 20:06:26 +0200 | [diff] [blame] | 376 | } |