Implement workaround for endianness issue in linux-cp
This commit is contained in:
@ -152,9 +152,6 @@ class VPPApi():
|
|||||||
try:
|
try:
|
||||||
self.logger.debug("Retrieving LCPs (lcpng)")
|
self.logger.debug("Retrieving LCPs (lcpng)")
|
||||||
r = self.vpp.api.lcpng_itf_pair_get()
|
r = self.vpp.api.lcpng_itf_pair_get()
|
||||||
if isinstance(r, tuple) and r[0].retval == 0:
|
|
||||||
for lcp in r[1]:
|
|
||||||
self.cache['lcps'][lcp.phy_sw_if_index] = lcp
|
|
||||||
self.lcp_enabled = True
|
self.lcp_enabled = True
|
||||||
except:
|
except:
|
||||||
self.logger.warning("lcpng not found, trying linux-cp")
|
self.logger.warning("lcpng not found, trying linux-cp")
|
||||||
@ -162,15 +159,23 @@ class VPPApi():
|
|||||||
try:
|
try:
|
||||||
self.logger.debug("Retrieving LCPs (linux-cp)")
|
self.logger.debug("Retrieving LCPs (linux-cp)")
|
||||||
r = self.vpp.api.lcp_itf_pair_get()
|
r = self.vpp.api.lcp_itf_pair_get()
|
||||||
if isinstance(r, tuple) and r[0].retval == 0:
|
|
||||||
for lcp in r[1]:
|
|
||||||
self.cache['lcps'][lcp.phy_sw_if_index] = lcp
|
|
||||||
self.lcp_enabled = True
|
self.lcp_enabled = True
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not self.lcp_enabled:
|
if not self.lcp_enabled:
|
||||||
self.logger.warning("lcpng nor linux-cp found, will not reconcile Linux Control Plane")
|
self.logger.warning("lcpng nor linux-cp found, will not reconcile Linux Control Plane")
|
||||||
|
else:
|
||||||
|
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:
|
||||||
|
## Work around endianness bug: https://gerrit.fd.io/r/c/vpp/+/35479
|
||||||
|
## TODO(pim) - remove this when 22.06 ships
|
||||||
|
lcp = lcp._replace(phy_sw_if_index=socket.ntohl(lcp.phy_sw_if_index))
|
||||||
|
lcp = lcp._replace(host_sw_if_index=socket.ntohl(lcp.host_sw_if_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.cache['lcps'][lcp.phy_sw_if_index] = lcp
|
||||||
|
|
||||||
self.logger.debug("Retrieving interfaces")
|
self.logger.debug("Retrieving interfaces")
|
||||||
r = self.vpp.api.sw_interface_dump()
|
r = self.vpp.api.sw_interface_dump()
|
||||||
|
Reference in New Issue
Block a user