laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27719 )
Change subject: vty: Print only applicable information during 'show line' ......................................................................
vty: Print only applicable information during 'show line'
If the line is in channelized mode, only print per-TS information. If the line is in superchannel mode, only print SC information.
This avoids printing information that is not applicable to the line mode.
Change-Id: I7b55ae8a5e1d352f90e14342d7f7e82e4848118a --- M src/vty.c 1 file changed, 17 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/19/27719/1
diff --git a/src/vty.c b/src/vty.c index ba6b1ac..65eb334 100644 --- a/src/vty.c +++ b/src/vty.c @@ -170,15 +170,24 @@ line->ts0.cur_errmask & E1L_TS0_RX_CRC4_ERR ? " [REMOTE-CRC-ERROR]" : "", VTY_NEWLINE);
- for (tn = 0; tn < ARRAY_SIZE(line->ts); tn++) { - const struct e1_ts *ts = &line->ts[tn]; - vty_out(vty, " TS%02u: Mode %s, FD %d, Peer PID %d%s", - ts->id, get_value_string(e1_ts_mode_names, ts->mode), - ts->fd, get_remote_pid(ts->fd), VTY_NEWLINE); + switch (line->mode) { + case E1_LINE_MODE_CHANNELIZED: + for (tn = 0; tn < ARRAY_SIZE(line->ts); tn++) { + const struct e1_ts *ts = &line->ts[tn]; + vty_out(vty, " TS%02u: Mode %s, FD %d, Peer PID %d%s", + ts->id, get_value_string(e1_ts_mode_names, ts->mode), + ts->fd, get_remote_pid(ts->fd), VTY_NEWLINE); + } + break; + case E1_LINE_MODE_SUPERCHANNEL: + vty_out(vty, " SC: Mode %s, FD %d, Peer PID %d%s", + get_value_string(e1_ts_mode_names, line->superchan.mode), + line->superchan.fd, get_remote_pid(line->superchan.fd), VTY_NEWLINE); + break; + case E1_LINE_MODE_E1OIP: + /* TODO: dump some information about E1oIP */ + break; } - vty_out(vty, " SC: Mode %s, FD %d, Peer PID %d%s", - get_value_string(e1_ts_mode_names, line->superchan.mode), - line->superchan.fd, get_remote_pid(line->superchan.fd), VTY_NEWLINE);
vty_out_rate_ctr_group(vty, " ", line->ctrs); }