This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/21781 ) Change subject: vpair: fix writing config file with vpairs configured ...................................................................... vpair: fix writing config file with vpairs configured prior to this patch, the configured vpair interfaces would not be saved to the config file on 'write file'. Change-Id: Iff6551318534a3717c374060082147f17b925a21 --- M doc/examples/osmo-e1d-vpair.cfg M src/e1d.h M src/vpair.c M src/vty.c 4 files changed, 61 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified tnt: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/doc/examples/osmo-e1d-vpair.cfg b/doc/examples/osmo-e1d-vpair.cfg index 32742de..04bdb72 100644 --- a/doc/examples/osmo-e1d-vpair.cfg +++ b/doc/examples/osmo-e1d-vpair.cfg @@ -1,2 +1,2 @@ - -virtual-e1-pair 1 +e1d + virtual-e1-pair 1 diff --git a/src/e1d.h b/src/e1d.h index c35f4a8..a7ba005 100644 --- a/src/e1d.h +++ b/src/e1d.h @@ -146,3 +146,6 @@ int e1d_vpair_create(struct e1_daemon *e1d, unsigned int num_lines); + +struct e1_intf * +e1d_vpair_intf_peer(struct e1_intf *intf); diff --git a/src/vpair.c b/src/vpair.c index 12452fe..df14026 100644 --- a/src/vpair.c +++ b/src/vpair.c @@ -88,6 +88,15 @@ talloc_free(intf->drv_data); } +/* resolve the peer of a given interface */ +struct e1_intf * +e1d_vpair_intf_peer(struct e1_intf *intf) +{ + struct ve1_intf_data *intf_data = intf->drv_data; + OSMO_ASSERT(intf->drv == E1_DRIVER_VPAIR); + return intf_data->peer; +} + static int ve1_timerfd_cb(struct osmo_fd *ofd, unsigned int what) { diff --git a/src/vty.c b/src/vty.c index 0690177..d4d26ef 100644 --- a/src/vty.c +++ b/src/vty.c @@ -41,6 +41,16 @@ static struct e1_daemon *vty_e1d; +enum e1d_vty_node { + E1D_NODE = _LAST_OSMOVTY_NODE + 1, +}; + +static struct cmd_node e1d_node = { + (enum node_type) E1D_NODE, + "%s(config-e1d)# ", + 1, +}; + #if 0 static void vty_dump_ts(struct vty *vty, const struct e1_ts *ts) { @@ -142,6 +152,14 @@ return CMD_SUCCESS; } +DEFUN(cfg_e1d, cfg_e1d_cmd, "e1d", + "E1 Daemon specific configuration\n") +{ + vty->node = E1D_NODE; + + return CMD_SUCCESS; +} + DEFUN(cfg_vpair, cfg_vpair_cmd, "virtual-e1-pair <1-255>", "Create a virtual E1 interface pair\n" "Number of E1 lines in virtual E1 interface pair\n") @@ -158,11 +176,39 @@ return CMD_SUCCESS; } +static int config_write_e1d(struct vty *vty) +{ + struct e1_intf *intf; + + vty_out(vty, "e1d%s", VTY_NEWLINE); + + /* find all vpair interfaces */ + llist_for_each_entry(intf, &vty_e1d->interfaces, list) { + struct e1_intf *peer = e1d_vpair_intf_peer(intf); + unsigned int line_count = 0; + struct e1_line *line; + + if (intf->drv != E1_DRIVER_VPAIR) + continue; + /* skip the 'mirror' interfaces */ + if (intf->id > peer->id) + continue; + + llist_for_each_entry(line, &intf->lines, list) + line_count++; + + vty_out(vty, " virtual-e1-pair %u%s", line_count, VTY_NEWLINE); + } + return 0; +} + void e1d_vty_init(struct e1_daemon *e1d) { vty_e1d = e1d; install_element_ve(&show_intf_cmd); install_element_ve(&show_line_cmd); - install_element(CONFIG_NODE, &cfg_vpair_cmd); + install_node(&e1d_node, config_write_e1d); + install_element(CONFIG_NODE, &cfg_e1d_cmd); + install_element(E1D_NODE, &cfg_vpair_cmd); } -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/21781 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Iff6551318534a3717c374060082147f17b925a21 Gerrit-Change-Number: 21781 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: tnt <tnt at 246tNt.com> Gerrit-CC: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201220/770ed447/attachment.htm>