Hi, could you help me with this?
It may be silly but I don’t know what I’m missing…
I want to change the “interface list” of a number of interfaces that contain the word “ospf” and replace ListA with the new ListB.
[ ] > interface/list/member pr
Columns: LIST, INTERFACE
# LIST INTERFACE
0 ListA wg-ospf-to-A
1 ListA wg-ospf-to-B
2 ListA wg-ospf-to-C
3 ListA wg-ospf-to-D
{
/interface list
add name=ListB
:delay 1s
/interface
:foreach i in=[find name~"ospf"] do={
list/member set $i list=ListB
}
}
Output:
no such item (4)
In Winbox it is easy to change it, but I want to learn how to do it by CLI.
Sorry, but after several tests I have already discovered the solution.
{
/interface list
add name=ListB
:delay 1s
/interface/list/member
:foreach i in=[find where ((interface~"ospf") and (list~"ListA"))] do={
set $i list="ListB"
}
}
One tip to help spotting the inheiret command path is using spaces & curly braces after the path and put your code there. Just style, but helps keep track visually what the [find] refers.
/interface/list {
add name=ListB
:delay 1s
}
/interface/list/member {
:foreach i in=[find where ((interface~"ospf") and (list~"ListA"))] do={
set $i list="ListB"
}
}
Both work, just an idea. But you might have spotted the /interface vs /interface/list/member sooner