summaryrefslogtreecommitdiffstats
path: root/test/vpp_udp_encap.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-09-07 08:57:41 -0700
committerDamjan Marion <dmarion@me.com>2018-09-20 10:57:25 +0000
commit9c0a3c423ee0b9326f600a00c1bd46fef45d4975 (patch)
tree6415119b2e341cd340f2b2cbbb44e8ce0c689451 /test/vpp_udp_encap.py
parentda8e1802625bd5d6e9901d5a96106e6de4f3d71f (diff)
UDP-Encap: name counters for the stats segment
change the ADD api so that is returns the 'ID' that can be used by the client to read the stats from the stats segment and to delete the object. Previously a similar value used required to be chosen by the client, now VPP allocates one (like it does e.g. for interfaces) Change-Id: I563cf6092276eb990c52d5457c86e72546bcf69e Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test/vpp_udp_encap.py')
-rw-r--r--test/vpp_udp_encap.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/vpp_udp_encap.py b/test/vpp_udp_encap.py
index 826378b4de8..209115f2c3f 100644
--- a/test/vpp_udp_encap.py
+++ b/test/vpp_udp_encap.py
@@ -25,14 +25,12 @@ class VppUdpEncap(VppObject):
def __init__(self,
test,
- id,
src_ip,
dst_ip,
src_port,
dst_port,
table_id=0):
self._test = test
- self.id = id
self.table_id = table_id
self.src_ip_s = src_ip
self.dst_ip_s = dst_ip
@@ -42,13 +40,13 @@ class VppUdpEncap(VppObject):
self.dst_port = dst_port
def add_vpp_config(self):
- self._test.vapi.udp_encap_add(
- self.id,
+ r = self._test.vapi.udp_encap_add(
self.src_ip.encode(),
self.dst_ip.encode(),
self.src_port,
self.dst_port,
self.table_id)
+ self.id = r.id
self._test.registry.register(self, self._test.logger)
def remove_vpp_config(self):
@@ -62,3 +60,7 @@ class VppUdpEncap(VppObject):
def object_id(self):
return ("udp-encap-%d" % self.id)
+
+ def get_stats(self):
+ c = self._test.statistics.get_counter("/net/udp-encap")
+ return c[0][self.id]