bfd: Add an update API that has create new or modify existing semantics
Type: improvement
helps keep the agents stateless
Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: I3588f13c081e24f5a8083b490eb02856361e4ccb
diff --git a/test/bfd.py b/test/bfd.py
index 9d44425..bbfa594 100644
--- a/test/bfd.py
+++ b/test/bfd.py
@@ -392,6 +392,30 @@
is_authenticated=is_authenticated)
self._test.registry.register(self, self.test.logger)
+ def upd_vpp_config(self,
+ detect_mult=None,
+ desired_min_tx=None,
+ required_min_rx=None):
+ if desired_min_tx:
+ self._desired_min_tx = desired_min_tx
+ if required_min_rx:
+ self._required_min_rx = required_min_rx
+ if detect_mult:
+ self._detect_mult = detect_mult
+ bfd_key_id = self._bfd_key_id if self._sha1_key else None
+ conf_key_id = self._sha1_key.conf_key_id if self._sha1_key else None
+ is_authenticated = True if self._sha1_key else False
+ self.test.vapi.bfd_udp_upd(sw_if_index=self._interface.sw_if_index,
+ desired_min_tx=self.desired_min_tx,
+ required_min_rx=self.required_min_rx,
+ detect_mult=self.detect_mult,
+ local_addr=self.local_addr,
+ peer_addr=self.peer_addr,
+ bfd_key_id=bfd_key_id,
+ conf_key_id=conf_key_id,
+ is_authenticated=is_authenticated)
+ self._test.registry.register(self, self.test.logger)
+
def query_vpp_config(self):
session = self.get_bfd_udp_session_dump_entry()
return session is not None
diff --git a/test/test_bfd.py b/test/test_bfd.py
index e6a710d..7a444cb 100644
--- a/test/test_bfd.py
+++ b/test/test_bfd.py
@@ -142,6 +142,34 @@
"required min receive interval")
self.assert_equal(session.detect_mult, s.detect_mult, "detect mult")
+ def test_upd_bfd(self):
+ """ Create/Modify w/ Update BFD session parameters """
+ session = VppBFDUDPSession(self, self.pg0, self.pg0.remote_ip4,
+ desired_min_tx=50000,
+ required_min_rx=10000,
+ detect_mult=1)
+ session.upd_vpp_config()
+ s = session.get_bfd_udp_session_dump_entry()
+ self.assert_equal(session.desired_min_tx,
+ s.desired_min_tx,
+ "desired min transmit interval")
+ self.assert_equal(session.required_min_rx,
+ s.required_min_rx,
+ "required min receive interval")
+
+ self.assert_equal(session.detect_mult, s.detect_mult, "detect mult")
+ session.upd_vpp_config(desired_min_tx=session.desired_min_tx * 2,
+ required_min_rx=session.required_min_rx * 2,
+ detect_mult=session.detect_mult * 2)
+ s = session.get_bfd_udp_session_dump_entry()
+ self.assert_equal(session.desired_min_tx,
+ s.desired_min_tx,
+ "desired min transmit interval")
+ self.assert_equal(session.required_min_rx,
+ s.required_min_rx,
+ "required min receive interval")
+ self.assert_equal(session.detect_mult, s.detect_mult, "detect mult")
+
def test_add_sha1_keys(self):
""" add SHA1 keys """
key_count = 10