summaryrefslogtreecommitdiffstats
path: root/test/vpp_ip_route.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-11-08 12:42:31 +0000
committerOle Trøan <otroan@employees.org>2019-11-26 09:15:11 +0000
commit9db6ada779794779158163f6293b479ae7f6ad5e (patch)
tree53dd65975958b2d87b1cd312e612b45d7225e531 /test/vpp_ip_route.py
parent0d3d4824a46205e776ff32c82be4cb514f459a5f (diff)
fib: Table Replace
Type: feature from the API doc, a table replace is: " The use-case is that, for some unspecified reason, the control plane has a very different set of entries it wants in the table than VPP currently has. The CP would thus like to 'replace' VPP's current table only by specifying what the new set of entries shall be, i.e. it is not going to delete anything that already eixts. the CP delcartes the start of this procedure with this begin_replace API Call, and when it has populated all the entries it wants, it calls the below end_replace API. From this point on it is of coursce free to add and delete entries as usual. The underlying mechanism by which VPP implements this replace is purposefully left unspecified. " In the FIB, the algorithm is implemented using mark and sweep. Algorithm goes: 1) replace_begin: this marks all the entries in that table as 'stale' 2) download all the entries that should be in this table - this clears the stale flag on those entries 3) signal the table converged: ip_table_replace_end - this removes all entries that are still stale this procedure can be used when an agent first connects to VPP, as an alternative to dump and diff state reconciliation. Change-Id: I168edec10cf7670866076b129ebfe6149ea8222e Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test/vpp_ip_route.py')
-rw-r--r--test/vpp_ip_route.py50
1 files changed, 46 insertions, 4 deletions
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py
index d6004756d34..031412cc2fa 100644
--- a/test/vpp_ip_route.py
+++ b/test/vpp_ip_route.py
@@ -108,6 +108,23 @@ def find_route(test, addr, len, table_id=0):
return False
+def find_route_in_dump(dump, route, table):
+ for r in dump:
+ if table.table_id == r.route.table_id \
+ and route.prefix == r.route.prefix:
+ if len(route.paths) == r.route.n_paths:
+ return True
+ return False
+
+
+def find_mroute_in_dump(dump, route, table):
+ for r in dump:
+ if table.table_id == r.route.table_id \
+ and route.prefix == r.route.prefix:
+ return True
+ return False
+
+
def find_mroute(test, grp_addr, src_addr, grp_addr_len,
table_id=0):
ip_mprefix = VppIpMPrefix(text_type(src_addr),
@@ -168,13 +185,36 @@ class VppIpTable(VppObject):
self.is_ip6 = is_ip6
def add_vpp_config(self):
- self._test.vapi.ip_table_add_del(is_ipv6=self.is_ip6, is_add=1,
- table_id=self.table_id)
+ self._test.vapi.ip_table_add_del(is_add=1,
+ table={'is_ip6': self.is_ip6,
+ 'table_id': self.table_id})
self._test.registry.register(self, self._test.logger)
+ return self
def remove_vpp_config(self):
- self._test.vapi.ip_table_add_del(is_ipv6=self.is_ip6, is_add=0,
- table_id=self.table_id)
+ self._test.vapi.ip_table_add_del(is_add=0,
+ table={'is_ip6': self.is_ip6,
+ 'table_id': self.table_id})
+
+ def replace_begin(self):
+ self._test.vapi.ip_table_replace_begin(
+ table={'is_ip6': self.is_ip6,
+ 'table_id': self.table_id})
+
+ def replace_end(self):
+ self._test.vapi.ip_table_replace_end(
+ table={'is_ip6': self.is_ip6,
+ 'table_id': self.table_id})
+
+ def flush(self):
+ self._test.vapi.ip_table_flush(table={'is_ip6': self.is_ip6,
+ 'table_id': self.table_id})
+
+ def dump(self):
+ return self._test.vapi.ip_route_dump(self.table_id, self.is_ip6)
+
+ def mdump(self):
+ return self._test.vapi.ip_mroute_dump(self.table_id, self.is_ip6)
def query_vpp_config(self):
if self.table_id == 0:
@@ -468,6 +508,7 @@ class VppIpRoute(VppObject):
self.stats_index = r.stats_index
if self.register:
self._test.registry.register(self, self._test.logger)
+ return self
def remove_vpp_config(self):
# there's no need to issue different deletes for modified routes
@@ -540,6 +581,7 @@ class VppIpMRoute(VppObject):
is_add=1)
self.stats_index = r.stats_index
self._test.registry.register(self, self._test.logger)
+ return self
def remove_vpp_config(self):
self._test.vapi.ip_mroute_add_del(self.table_id,