summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-03-03 20:01:56 +0100
committerChristian Poessinger <christian@poessinger.com>2020-03-04 21:43:59 +0100
commit665d1c5bdb24aa0aef79405dc2f2962b930fb9b3 (patch)
tree467499a4ce63308ca6d1e349b13f1e807ba4703e /python
parentdac5ad318b00853591121078bce5c849db23c810 (diff)
downloadvyos-1x-665d1c5bdb24aa0aef79405dc2f2962b930fb9b3.tar.gz
vyos-1x-665d1c5bdb24aa0aef79405dc2f2962b930fb9b3.zip
vrf: T31: initial support for a VRF backend in XML/Python
This is a work in progress to complete T31 whoever thought it was less than 1 hour of work was ..... optimistic. Only VRF vreation and show is supported right now. No interface can be bound to any one VRF.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/vrf.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/python/vyos/vrf.py b/python/vyos/vrf.py
new file mode 100644
index 000000000..99e4cb7d1
--- /dev/null
+++ b/python/vyos/vrf.py
@@ -0,0 +1,23 @@
+# Copyright 2020 VyOS maintainers and contributors <maintainers@vyos.io>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+import json
+import subprocess
+
+
+def list_vrfs():
+ command = 'ip -j -br link show type vrf'
+ answer = json.loads(subprocess.check_output(command.split()).decode())
+ return [_ for _ in answer if _]