From f53f7d50953247e8ea015122e3c7c38cf01dac91 Mon Sep 17 00:00:00 2001
From: Pim van Pelt <pim@ipng.nl>
Date: Tue, 5 Apr 2022 11:08:58 +0000
Subject: [PATCH] Remove linux-cp / lcpng specialcase, the API exposed by lcpng
 and linux-cp is now identical

---
 vpp/vppapi.py | 24 ++++++------------------
 vppcfg        |  2 +-
 2 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/vpp/vppapi.py b/vpp/vppapi.py
index 24f85ab..c497551 100644
--- a/vpp/vppapi.py
+++ b/vpp/vppapi.py
@@ -148,24 +148,9 @@ class VPPApi():
 
         ## Workaround LCPng and linux-cp, in order.
         self.lcp_enabled = False
-        if not self.lcp_enabled:
-            try:
-                self.logger.debug("Retrieving LCPs (lcpng)")
-                r = self.vpp.api.lcpng_itf_pair_get()
-                self.lcp_enabled = True
-            except:
-                self.logger.warning("lcpng not found, trying linux-cp")
-        if not self.lcp_enabled:
-            try:
-                self.logger.debug("Retrieving LCPs (linux-cp)")
-                r = self.vpp.api.lcp_itf_pair_get()
-                self.lcp_enabled = True
-            except:
-                pass
-
-        if not self.lcp_enabled:
-            self.logger.warning("lcpng nor linux-cp found, will not reconcile Linux Control Plane")
-        else:
+        try:
+            self.logger.debug("Retrieving LCPs")
+            r = self.vpp.api.lcp_itf_pair_get()
             if isinstance(r, tuple) and r[0].retval == 0:
                 for lcp in r[1]:
                     if lcp.phy_sw_if_index > 65535 or lcp.host_sw_if_index > 65535:
@@ -176,6 +161,9 @@ class VPPApi():
                         lcp = lcp._replace(vif_index=socket.ntohl(lcp.vif_index))
                         self.logger.warning("LCP workaround for endianness issue on %s" % lcp.host_if_name)
                     self.cache['lcps'][lcp.phy_sw_if_index] = lcp
+                self.lcp_enabled = True
+        except:
+            self.logger.warning("linux-cp not found, will not reconcile Linux Control Plane")
 
         self.logger.debug("Retrieving interfaces")
         r = self.vpp.api.sw_interface_dump()
diff --git a/vppcfg b/vppcfg
index 1c45fef..6cd878c 100755
--- a/vppcfg
+++ b/vppcfg
@@ -102,7 +102,7 @@ def main():
         sys.exit(-5)
 
     if not r.lcps_exist_with_lcp_enabled():
-        logging.error("Linux Control Plane is needed, but neither lcpng nor linux-cp are available")
+        logging.error("Linux Control Plane is needed, but linux-cp API is not available")
         sys.exit(-6)
 
     failed = False