Check double use of E1 interface and notify, if not defined
E1 interface may be used by one V5 link only. Also notify user, if not created and application must be restarted when created.
This commit is contained in:
parent
d1c0b37bce
commit
d8a9f29153
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include <osmocom/vty/command.h>
|
||||
#include <osmocom/abis/e1_input.h>
|
||||
|
||||
#include "v5x_internal.h"
|
||||
#include "v5x_protocol.h"
|
||||
|
@ -473,9 +474,25 @@ DEFUN(cfg_e1_line, cfg_e1_line_cmd,
|
|||
"e1 line <0-255>",
|
||||
"E1 configuration\n" "E1 line configuration\n" "E1 line number to use for link")
|
||||
{
|
||||
struct v5x_link *v5l = vty->index;
|
||||
struct v5x_link *v5l = vty->index, *search_v5l;
|
||||
struct e1inp_line *e1l;
|
||||
int e1_line = atoi(argv[0]);
|
||||
|
||||
v5l->e1_line = atoi(argv[0]);
|
||||
llist_for_each_entry(search_v5l, &v5l->interface->links, list) {
|
||||
if (search_v5l->e1_line < 0)
|
||||
continue;
|
||||
if (search_v5l->e1_line == e1_line) {
|
||||
vty_out(vty, "%%E1 line %d already used by another link ID %d.%s", e1_line, search_v5l->id,
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
}
|
||||
|
||||
v5l->e1_line = e1_line;
|
||||
e1l = e1inp_line_find(e1_line);
|
||||
if (!e1l)
|
||||
vty_out(vty, "%%E1 line %d is not created. Create it and restart application.%s", e1_line,
|
||||
VTY_NEWLINE);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue