[M] Change in libosmo-abis[master]: e1line_dump_vty(): dump keepalive state and params

2024-03-19 Thread fixeria
fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email )

Change subject: e1line_dump_vty(): dump keepalive state and params
..

e1line_dump_vty(): dump keepalive state and params

There is currently no obvious way to know if the keepalive is enabled
and which parameters are in use.  Executing 'show running-config'
command in the VTY would not always reveal the current configuration,
because it tends to omit parameters with default values.

Let's print the keepalive state and params in the output of the
'show e1_line' command.  Below is a few examples:

! keepalive is disabled
OsmoBSC# show e1_line
E1 Line Number 0, Name , Driver ipa
Keepalive: disabled
IPA Keepalive: disabled

! TCP Keepalive is enabled (default)
OsmoBSC# show e1_line
E1 Line Number 0, Name , Driver ipa
Keepalive: enabled
  Number of probes: (driver's default)
  Idle timeout: (driver's default)
  Probe interval: (driver's default)
IPA Keepalive: disabled

! TCP and IPA keepalive enabled (custom params)
OsmoBSC# show e1_line
E1 Line Number 0, Name , Driver ipa
Keepalive: enabled
  Number of probes: 2
  Idle timeout: 1s
  Probe interval: 3s
IPA Keepalive: enabled
  Interval: 2s
  Timeout: 10s

Note that in the case of TCP keepalive with default parameters
we cannot retrieve the actual defaults because that would be a
layering violation.  Thus we say "(driver's default)".

Change-Id: I17bd991850333ee794ab216f474b5e045fb01fa3
Related: OS#6375, SYS#6801
---
M src/e1_input_vty.c
1 file changed, 95 insertions(+), 0 deletions(-)

Approvals:
  osmith: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified




diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c
index ca45f93..b1898dd 100644
--- a/src/e1_input_vty.c
+++ b/src/e1_input_vty.c
@@ -457,12 +457,59 @@
return CMD_SUCCESS;
 }

+static void e1line_ka_dump_vty(struct vty *vty, const struct e1inp_line *line)
+{
+   if (line->keepalive_num_probes == 0) {
+   vty_out(vty, "Keepalive: disabled%s", VTY_NEWLINE);
+   return;
+   }
+
+   vty_out(vty, "Keepalive: enabled%s", VTY_NEWLINE);
+
+   vty_out(vty, "  Number of probes: ");
+   if (line->keepalive_num_probes != E1INP_USE_DEFAULT)
+   vty_out(vty, "%d", line->keepalive_num_probes);
+   else
+   vty_out(vty, "(driver's default)");
+   vty_out(vty, "%s", VTY_NEWLINE);
+
+   vty_out(vty, "  Idle timeout: ");
+   if (line->keepalive_idle_timeout != E1INP_USE_DEFAULT)
+   vty_out(vty, "%ds", line->keepalive_idle_timeout);
+   else
+   vty_out(vty, "(driver's default)");
+   vty_out(vty, "%s", VTY_NEWLINE);
+
+   vty_out(vty, "  Probe interval: ");
+   if (line->keepalive_probe_interval != E1INP_USE_DEFAULT)
+   vty_out(vty, "%ds", line->keepalive_probe_interval);
+   else
+   vty_out(vty, "(driver's default)");
+   vty_out(vty, "%s", VTY_NEWLINE);
+}
+
+static void e1line_ipa_ka_dump_vty(struct vty *vty, const struct e1inp_line 
*line)
+{
+   if (line->ipa_kap == NULL) {
+   vty_out(vty, "IPA Keepalive: disabled%s", VTY_NEWLINE);
+   return;
+   }
+
+   vty_out(vty, "IPA Keepalive: enabled%s", VTY_NEWLINE);
+   vty_out(vty, "  Interval: %us%s", line->ipa_kap->interval, VTY_NEWLINE);
+   vty_out(vty, "  Timeout: %us%s", line->ipa_kap->wait_for_resp, 
VTY_NEWLINE);
+}
+
 static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line,
int stats)
 {
vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
line->num, line->name ? line->name : "",
line->driver->name, VTY_NEWLINE);
+   if (line->driver->has_keepalive)
+   e1line_ka_dump_vty(vty, line);
+   if (!strcmp(line->driver->name, "ipa"))
+   e1line_ipa_ka_dump_vty(vty, line);
if (line->pcap_file)
vty_out(vty, "PCAP %s%s", line->pcap_file, VTY_NEWLINE);
if (line->driver->vty_show)

--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I17bd991850333ee794ab216f474b5e045fb01fa3
Gerrit-Change-Number: 36342
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


[M] Change in libosmo-abis[master]: e1line_dump_vty(): dump keepalive state and params

2024-03-19 Thread osmith
Attention is currently required from: fixeria.

osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email )

Change subject: e1line_dump_vty(): dump keepalive state and params
..


Patch Set 1: Code-Review+2

(2 comments)

File src/e1_input_vty.c:

https://gerrit.osmocom.org/c/libosmo-abis/+/36342/comment/99e4898b_b5ff17d7
PS1, Line 460: static void e1line_ka_dump_vty(struct vty *vty, const struct 
e1inp_line *line)
> The problem here (in generic code path) is that you cannot make assumptions 
> on what kind of transpor […]
Ack


https://gerrit.osmocom.org/c/libosmo-abis/+/36342/comment/dc7f7e7f_ed9edc62
PS1, Line 473:  vty_out(vty, "(driver's default)");
> See the comment above.
Ack



--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I17bd991850333ee794ab216f474b5e045fb01fa3
Gerrit-Change-Number: 36342
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Tue, 19 Mar 2024 11:36:16 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: osmith 
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


[M] Change in libosmo-abis[master]: e1line_dump_vty(): dump keepalive state and params

2024-03-19 Thread fixeria
Attention is currently required from: osmith.

fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email )

Change subject: e1line_dump_vty(): dump keepalive state and params
..


Patch Set 1:

(2 comments)

File src/e1_input_vty.c:

https://gerrit.osmocom.org/c/libosmo-abis/+/36342/comment/32ca57ac_06e68e2b
PS1, Line 460: static void e1line_ka_dump_vty(struct vty *vty, const struct 
e1inp_line *line)
> I would suggest making clear that this is TCP keepalive: […]
The problem here (in generic code path) is that you cannot make assumptions on 
what kind of transport is used by particular driver implementation. The 
Abis-over-IP is just one of the existing drivers. For instance, you don't have 
TCP on the E1 line.

As far as I understand the abstraction layers, we just provide the driver with 
generic keepalive parameters. And `E1INP_USE_DEFAULT` means driver's default 
value.


https://gerrit.osmocom.org/c/libosmo-abis/+/36342/comment/ac001228_2b74f123
PS1, Line 473:  vty_out(vty, "(driver's default)");
> (I see that it is in a different c file, still I think it would be useful to 
> have the information th […]
See the comment above.



--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I17bd991850333ee794ab216f474b5e045fb01fa3
Gerrit-Change-Number: 36342
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Attention: osmith 
Gerrit-Comment-Date: Tue, 19 Mar 2024 11:17:41 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith 
Gerrit-MessageType: comment


[M] Change in libosmo-abis[master]: e1line_dump_vty(): dump keepalive state and params

2024-03-19 Thread osmith
Attention is currently required from: fixeria.

osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email )

Change subject: e1line_dump_vty(): dump keepalive state and params
..


Patch Set 1:

(1 comment)

File src/e1_input_vty.c:

https://gerrit.osmocom.org/c/libosmo-abis/+/36342/comment/bf488a56_5f21b8fc
PS1, Line 473:  vty_out(vty, "(driver's default)");
> how about: […]
(I see that it is in a different c file, still I think it would be useful to 
have the information there... I guess code could be refactored / maybe a getter 
function could be added etc.)



--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I17bd991850333ee794ab216f474b5e045fb01fa3
Gerrit-Change-Number: 36342
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Tue, 19 Mar 2024 08:26:42 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith 
Gerrit-MessageType: comment


[M] Change in libosmo-abis[master]: e1line_dump_vty(): dump keepalive state and params

2024-03-19 Thread osmith
Attention is currently required from: fixeria.

osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email )

Change subject: e1line_dump_vty(): dump keepalive state and params
..


Patch Set 1:

(1 comment)

File src/e1_input_vty.c:

https://gerrit.osmocom.org/c/libosmo-abis/+/36342/comment/466730ce_b71f55a1
PS1, Line 473:  vty_out(vty, "(driver's default)");
how about:

```
vty_out(vty, "%ds (driver's default)", DEFAULT_TCP_KEEPALIVE_RETRY_COUNT);
```

same with DEFAULT_TCP_KEEPALIVE_INTERVAL, DEFAULT_TCP_KEEPALIVE_RETRY_COUNT



--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I17bd991850333ee794ab216f474b5e045fb01fa3
Gerrit-Change-Number: 36342
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Tue, 19 Mar 2024 08:24:31 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


[M] Change in libosmo-abis[master]: e1line_dump_vty(): dump keepalive state and params

2024-03-19 Thread osmith
Attention is currently required from: fixeria.

osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email )

Change subject: e1line_dump_vty(): dump keepalive state and params
..


Patch Set 1:

(2 comments)

Patchset:

PS1:
very nice!


File src/e1_input_vty.c:

https://gerrit.osmocom.org/c/libosmo-abis/+/36342/comment/4f307a3b_57c0460a
PS1, Line 460: static void e1line_ka_dump_vty(struct vty *vty, const struct 
e1inp_line *line)
I would suggest making clear that this is TCP keepalive:
* name the function e1line_tcp_ka_dump_vty
* Print "TCP Keepalive" instead of "Keepalive"



--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I17bd991850333ee794ab216f474b5e045fb01fa3
Gerrit-Change-Number: 36342
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Tue, 19 Mar 2024 08:19:17 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


[M] Change in libosmo-abis[master]: e1line_dump_vty(): dump keepalive state and params

2024-03-18 Thread pespin
Attention is currently required from: fixeria, osmith.

pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email )

Change subject: e1line_dump_vty(): dump keepalive state and params
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I17bd991850333ee794ab216f474b5e045fb01fa3
Gerrit-Change-Number: 36342
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Attention: osmith 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Mon, 18 Mar 2024 17:24:58 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in libosmo-abis[master]: e1line_dump_vty(): dump keepalive state and params

2024-03-18 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email )


Change subject: e1line_dump_vty(): dump keepalive state and params
..

e1line_dump_vty(): dump keepalive state and params

There is currently no obvious way to know if the keepalive is enabled
and which parameters are in use.  Executing 'show running-config'
command in the VTY would not always reveal the current configuration,
because it tends to omit parameters with default values.

Let's print the keepalive state and params in the output of the
'show e1_line' command.  Below is a few examples:

! keepalive is disabled
OsmoBSC# show e1_line
E1 Line Number 0, Name , Driver ipa
Keepalive: disabled
IPA Keepalive: disabled

! TCP Keepalive is enabled (default)
OsmoBSC# show e1_line
E1 Line Number 0, Name , Driver ipa
Keepalive: enabled
  Number of probes: (driver's default)
  Idle timeout: (driver's default)
  Probe interval: (driver's default)
IPA Keepalive: disabled

! TCP and IPA keepalive enabled (custom params)
OsmoBSC# show e1_line
E1 Line Number 0, Name , Driver ipa
Keepalive: enabled
  Number of probes: 2
  Idle timeout: 1s
  Probe interval: 3s
IPA Keepalive: enabled
  Interval: 2s
  Timeout: 10s

Note that in the case of TCP keepalive with default parameters
we cannot retrieve the actual defaults because that would be a
layering violation.  Thus we say "(driver's default)".

Change-Id: I17bd991850333ee794ab216f474b5e045fb01fa3
Related: OS#6375, SYS#6801
---
M src/e1_input_vty.c
1 file changed, 95 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/42/36342/1

diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c
index ca45f93..b1898dd 100644
--- a/src/e1_input_vty.c
+++ b/src/e1_input_vty.c
@@ -457,12 +457,59 @@
return CMD_SUCCESS;
 }

+static void e1line_ka_dump_vty(struct vty *vty, const struct e1inp_line *line)
+{
+   if (line->keepalive_num_probes == 0) {
+   vty_out(vty, "Keepalive: disabled%s", VTY_NEWLINE);
+   return;
+   }
+
+   vty_out(vty, "Keepalive: enabled%s", VTY_NEWLINE);
+
+   vty_out(vty, "  Number of probes: ");
+   if (line->keepalive_num_probes != E1INP_USE_DEFAULT)
+   vty_out(vty, "%d", line->keepalive_num_probes);
+   else
+   vty_out(vty, "(driver's default)");
+   vty_out(vty, "%s", VTY_NEWLINE);
+
+   vty_out(vty, "  Idle timeout: ");
+   if (line->keepalive_idle_timeout != E1INP_USE_DEFAULT)
+   vty_out(vty, "%ds", line->keepalive_idle_timeout);
+   else
+   vty_out(vty, "(driver's default)");
+   vty_out(vty, "%s", VTY_NEWLINE);
+
+   vty_out(vty, "  Probe interval: ");
+   if (line->keepalive_probe_interval != E1INP_USE_DEFAULT)
+   vty_out(vty, "%ds", line->keepalive_probe_interval);
+   else
+   vty_out(vty, "(driver's default)");
+   vty_out(vty, "%s", VTY_NEWLINE);
+}
+
+static void e1line_ipa_ka_dump_vty(struct vty *vty, const struct e1inp_line 
*line)
+{
+   if (line->ipa_kap == NULL) {
+   vty_out(vty, "IPA Keepalive: disabled%s", VTY_NEWLINE);
+   return;
+   }
+
+   vty_out(vty, "IPA Keepalive: enabled%s", VTY_NEWLINE);
+   vty_out(vty, "  Interval: %us%s", line->ipa_kap->interval, VTY_NEWLINE);
+   vty_out(vty, "  Timeout: %us%s", line->ipa_kap->wait_for_resp, 
VTY_NEWLINE);
+}
+
 static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line,
int stats)
 {
vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
line->num, line->name ? line->name : "",
line->driver->name, VTY_NEWLINE);
+   if (line->driver->has_keepalive)
+   e1line_ka_dump_vty(vty, line);
+   if (!strcmp(line->driver->name, "ipa"))
+   e1line_ipa_ka_dump_vty(vty, line);
if (line->pcap_file)
vty_out(vty, "PCAP %s%s", line->pcap_file, VTY_NEWLINE);
if (line->driver->vty_show)

--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/36342?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I17bd991850333ee794ab216f474b5e045fb01fa3
Gerrit-Change-Number: 36342
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange