Remove linux-cp / lcpng specialcase, the API exposed by lcpng and linux-cp is now identical

This commit is contained in:
Pim van Pelt
2022-04-05 11:08:58 +00:00
parent b461ef49bb
commit f53f7d5095
2 changed files with 7 additions and 19 deletions

View File

@ -148,24 +148,9 @@ class VPPApi():
## Workaround LCPng and linux-cp, in order. ## Workaround LCPng and linux-cp, in order.
self.lcp_enabled = False self.lcp_enabled = False
if not self.lcp_enabled: try:
try: self.logger.debug("Retrieving LCPs")
self.logger.debug("Retrieving LCPs (lcpng)") r = self.vpp.api.lcp_itf_pair_get()
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:
if isinstance(r, tuple) and r[0].retval == 0: if isinstance(r, tuple) and r[0].retval == 0:
for lcp in r[1]: for lcp in r[1]:
if lcp.phy_sw_if_index > 65535 or lcp.host_sw_if_index > 65535: 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)) 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.logger.warning("LCP workaround for endianness issue on %s" % lcp.host_if_name)
self.cache['lcps'][lcp.phy_sw_if_index] = lcp 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") self.logger.debug("Retrieving interfaces")
r = self.vpp.api.sw_interface_dump() r = self.vpp.api.sw_interface_dump()

2
vppcfg
View File

@ -102,7 +102,7 @@ def main():
sys.exit(-5) sys.exit(-5)
if not r.lcps_exist_with_lcp_enabled(): 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) sys.exit(-6)
failed = False failed = False