From 6492541b2ee3f7f246682d27974670bd6fbdacbe Mon Sep 17 00:00:00 2001 From: zsdc Date: Wed, 14 Aug 2019 22:03:42 +0300 Subject: [bfd] T1183: Added validations and fixing bugs in BFD: * added validations for "source address IP" and "bfd peer IP" * added check for configuring multihop together with an interface name * fixed "show protocols bfd peer X" for peers with custom options --- interface-definitions/protocols-bfd.xml | 8 ++++++++ op-mode-definitions/show-protocols-bfd.xml | 6 +++--- src/conf_mode/protocols_bfd.py | 4 ++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/interface-definitions/protocols-bfd.xml b/interface-definitions/protocols-bfd.xml index f2d7d7d2f..62e2c87b9 100644 --- a/interface-definitions/protocols-bfd.xml +++ b/interface-definitions/protocols-bfd.xml @@ -20,6 +20,10 @@ ipv6 BFD peer IPv6 address + + + + @@ -46,6 +50,10 @@ ipv6 Local IPv6 address used to connect to the peer + + + + diff --git a/op-mode-definitions/show-protocols-bfd.xml b/op-mode-definitions/show-protocols-bfd.xml index 2a94d0497..398a81d1b 100644 --- a/op-mode-definitions/show-protocols-bfd.xml +++ b/op-mode-definitions/show-protocols-bfd.xml @@ -24,16 +24,16 @@ Show Bidirectional Forwarding Detection (BFD) peer status - + - /usr/bin/vtysh -c "show bfd peer $5" + /usr/bin/vtysh -c "show bfd peers" | awk -v BFD_PEER=$5 '($0 ~ peer BFD_PEER) { system("/usr/bin/vtysh -c \"show bfd " $0 "\"") }' Show Bidirectional Forwarding Detection (BFD) peer counters - /usr/bin/vtysh -c "show bfd peer $5 counters" + /usr/bin/vtysh -c "show bfd peers" | awk -v BFD_PEER=$5 '($0 ~ peer BFD_PEER) { system("/usr/bin/vtysh -c \"show bfd " $0 " counters\"") }' diff --git a/src/conf_mode/protocols_bfd.py b/src/conf_mode/protocols_bfd.py index 98f38035a..9ca194edd 100755 --- a/src/conf_mode/protocols_bfd.py +++ b/src/conf_mode/protocols_bfd.py @@ -176,6 +176,10 @@ def verify(bfd): if peer['multihop'] and peer['echo_mode']: raise ConfigError('Multihop and echo-mode cannot be used together') + # multihop doesn't accept interface names + if peer['multihop'] and peer['src_if']: + raise ConfigError('Multihop and source interface cannot be used together') + # echo interval can be configured only with enabled echo-mode if peer['echo_interval'] != '' and not peer['echo_mode']: raise ConfigError('echo-interval can be configured only with enabled echo-mode') -- cgit v1.2.3