summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2022-08-01 08:40:47 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2022-08-01 08:40:47 +0000
commitab84f1f3757bb82c3ddf95143c014cdb3d997977 (patch)
tree52ee3d4dbb80563aae85f1450a76bf0fc94eb2ee /src
parent225b1d3ef2e211c03814cb823b857c66084f7978 (diff)
downloadvyos-1x-ab84f1f3757bb82c3ddf95143c014cdb3d997977.tar.gz
vyos-1x-ab84f1f3757bb82c3ddf95143c014cdb3d997977.zip
vrf: T4562: Check VRF if it has not been configured
Check list of VRF's, check key 'ifname' is configured If not configured, return message "VRF is not configured"
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/vrf.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/op_mode/vrf.py b/src/op_mode/vrf.py
index f86516786..e3d944d90 100755
--- a/src/op_mode/vrf.py
+++ b/src/op_mode/vrf.py
@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import json
+import jmespath
import sys
import typing
@@ -76,6 +77,8 @@ def _get_formatted_output(raw_data):
def show(raw: bool, name: typing.Optional[str]):
vrf_data = _get_raw_data(name=name)
+ if not jmespath.search('[*].ifname', vrf_data):
+ return "VRF is not configured"
if raw:
return vrf_data
else: