tests: set object_id for routes.

Object id's are used as keys in the object repository.
They need to be unique.

Also useful for debugging in log.txt.

Type: test

Change-Id: I69b5f3a7508918a5780ff8f20d27d4a3c34a5699
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
This commit is contained in:
Paul Vinciguerra
2019-06-18 07:57:53 -04:00
committed by Neale Ranns
parent a608afeec3
commit 941da4a224

View File

@ -149,6 +149,7 @@ def fib_interface_ip_prefix(test, address, length, sw_if_index):
prefix = IPv6Network("%s/%d" % (text_type(address), length),
strict=False)
# TODO: refactor this to VppIpPrefix.__eq__
for a in addrs:
if a.sw_if_index == sw_if_index and \
a.prefix == prefix:
@ -426,6 +427,7 @@ class VppIpRoute(VppObject):
self.table_id = table_id
self.prefix = VppIpPrefix(dest_addr, dest_addr_len)
self.register = register
self.stats_index = None
self.encoded_paths = []
for path in self.paths:
@ -482,10 +484,11 @@ class VppIpRoute(VppObject):
self.table_id)
def object_id(self):
return ("%d:%s/%d"
% (self.table_id,
self.prefix.address,
self.prefix.len))
return ("%s:table-%d-%s/%d" % (
'ip6-route' if self.prefix.addr.version == 6 else 'ip-route',
self.table_id,
self.prefix.address,
self.prefix.len))
def get_stats_to(self):
c = self._test.statistics.get_counter("/net/route/to")
@ -721,7 +724,7 @@ class VppMplsRoute(VppObject):
self.local_label, self.eos_bit)
def object_id(self):
return ("%d:%s/%d"
return ("mpls-route-%d:%s/%d"
% (self.table_id,
self.local_label,
20 + self.eos_bit))