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>
diff --git a/test/vpp_udp_encap.py b/test/vpp_udp_encap.py
index 826378b..209115f 100644
--- a/test/vpp_udp_encap.py
+++ b/test/vpp_udp_encap.py
@@ -25,14 +25,12 @@
 
     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 @@
         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 @@
 
     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]