Test: vpp_papi_provider. __getattr__
[vpp.git] / test / vpp_papi_provider.py
index 9635aa5..2188ed3 100644 (file)
@@ -174,11 +174,15 @@ class VppPapiProvider(object):
             return self.api(apifn, d)
         return f
 
-    def __getattr__(self, name):
+    def __getattribute__(self, name):
         try:
-            return getattr(self, name)
-        except:
-            return self.factory(name, getattr(self.papi, name))
+            method = super(VppPapiProvider, self).__getattribute__(name)
+        except AttributeError:
+            method = self.factory(name, getattr(self.papi, name))
+            # lazily load the method so we don't need to call factory
+            # again for this name.
+            setattr(self, name, method)
+        return method
 
     def connect(self):
         """Connect the API to VPP"""
@@ -3576,7 +3580,8 @@ class VppPapiProvider(object):
                         {'_no_type_conversion': True})
 
     def gbp_endpoint_group_add(self, epg, sclass, bd,
-                               rd, uplink_sw_if_index):
+                               rd, uplink_sw_if_index,
+                               retention):
         """ GBP endpoint group Add """
         return self.api(self.papi.gbp_endpoint_group_add,
                         {'epg':
@@ -3585,7 +3590,8 @@ class VppPapiProvider(object):
                              'bd_id': bd,
                              'rd_id': rd,
                              'epg_id': epg,
-                             'sclass': sclass
+                             'sclass': sclass,
+                             'retention': retention
                          }})
 
     def gbp_endpoint_group_del(self, epg):
@@ -3709,11 +3715,6 @@ class VppPapiProvider(object):
         """ GBP contract Dump """
         return self.api(self.papi.gbp_contract_dump, {})
 
-    def gbp_endpoint_learn_set_inactive_threshold(self, threshold):
-        """ GBP set inactive threshold """
-        return self.api(self.papi.gbp_endpoint_learn_set_inactive_threshold,
-                        {'threshold': threshold})
-
     def gbp_vxlan_tunnel_add(self, vni, bd_rd_id, mode):
         """ GBP VXLAN tunnel add """
         return self.api(self.papi.gbp_vxlan_tunnel_add,