Skip to content

Commit 9eab810

Browse files
l0crian1mergify[bot]
authored andcommitted
T6335: Add/Update EVPN op commands
Converted completion helpers from python to bash for performance Previous commit: Added the following commands: show evpn show evpn es show evpn es <es-id> show evpn es detail show evpn es-evi show evpn es-evi detail show evpn es-evi vni <num> show evpn vni show evpn vni detail show evpn vni <num> Updated the following commands: show evpn access-vlan show evpn arp-cache show evpn mac show evpn next-hops show evpn rmac (cherry picked from commit 3917e3e)
1 parent 53d6eb1 commit 9eab810

File tree

5 files changed

+14
-32
lines changed

5 files changed

+14
-32
lines changed

op-mode-definitions/include/vni-tagnode-all.xml.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<help>VXLAN network identifier (VNI) number</help>
55
<completionHelp>
66
<list>&lt;1-16777215&gt; all</list>
7-
<script>${vyos_completion_dir}/list_vni.py</script>
7+
<script>${vyos_completion_dir}/list_vni.sh</script>
88
</completionHelp>
99
</properties>
1010
<command>${vyos_op_scripts_dir}/evpn.py show_evpn --command "$*"</command>

op-mode-definitions/include/vni-tagnode.xml.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<help>VXLAN network identifier (VNI) number</help>
55
<completionHelp>
66
<list>&lt;1-16777215&gt;</list>
7-
<script>${vyos_completion_dir}/list_vni.py</script>
7+
<script>${vyos_completion_dir}/list_vni.sh</script>
88
</completionHelp>
99
</properties>
1010
<command>${vyos_op_scripts_dir}/evpn.py show_evpn --command "$*"</command>

op-mode-definitions/show-evpn.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<help>Show ESI information for specified ESI</help>
4949
<completionHelp>
5050
<list>&lt;esi&gt;</list>
51-
<script>${vyos_completion_dir}/list_esi.py</script>
51+
<script>${vyos_completion_dir}/list_esi.sh</script>
5252
</completionHelp>
5353
</properties>
5454
<command>${vyos_op_scripts_dir}/evpn.py show_evpn --command "$*"</command>
Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,20 @@
1-
#!/usr/bin/env python3
1+
#!/bin/bash
22
#
3-
# Copyright (C) 2016-2024 VyOS maintainers and contributors
3+
# Copyright (C) 2024 VyOS maintainers and contributors
44
#
55
# This program is free software; you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License version 2 or later as
77
# published by the Free Software Foundation.
88
#
99
# This program is distributed in the hope that it will be useful,
1010
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1212
# GNU General Public License for more details.
1313
#
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
#
17-
# This script is completion helper to list all configured VNIs that are visible to FRR
17+
# This script is completion helper to list all valid ESEs that are visible to FRR
1818

19-
import json
20-
from vyos.utils.process import cmd
21-
22-
def get_esi():
23-
esiDict = json.loads(cmd(f"vtysh -c 'show evpn es json'"))
24-
esiList = []
25-
for i in esiDict:
26-
esiList.append(i['esi'])
27-
28-
print(' '.join(esiList))
29-
30-
if __name__ == '__main__':
31-
get_esi()
19+
esiJson=$(vtysh -c 'show evpn es json')
20+
echo "$(echo "$esiJson" | jq -r '.[] | .esi')"
Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
1-
#!/usr/bin/env python3
1+
#!/bin/bash
22
#
3-
# Copyright (C) 2016-2024 VyOS maintainers and contributors
3+
# Copyright (C) 2024 VyOS maintainers and contributors
44
#
55
# This program is free software; you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License version 2 or later as
77
# published by the Free Software Foundation.
88
#
99
# This program is distributed in the hope that it will be useful,
1010
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1212
# GNU General Public License for more details.
1313
#
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
#
1717
# This script is completion helper to list all configured VNIs that are visible to FRR
1818

19-
import json
20-
from vyos.utils.process import cmd
21-
22-
def get_vni():
23-
vniDict = json.loads(cmd(f"vtysh -c 'show evpn vni json'"))
24-
print(' '.join(vniDict.keys()))
25-
26-
if __name__ == '__main__':
27-
get_vni()
19+
vniJson=$(vtysh -c 'show evpn vni json')
20+
echo "$(echo "$vniJson" | jq -r 'keys | .[]')"

0 commit comments

Comments
 (0)