Remove the workaround for endianness in VPP; Remove the --disable-lcp flag. Catch connect exceptions for VPPStats and VPP API

This commit is contained in:
Pim van Pelt
2022-07-09 10:14:15 +00:00
parent c9233749bc
commit 3be732e6ab
3 changed files with 38 additions and 39 deletions

View File

@ -88,7 +88,6 @@ class VPPApi():
if not self.connected:
return ret
try:
lcp_list = self.vpp.api.lcp_itf_pair_get()
except Exception as e:
@ -97,30 +96,10 @@ class VPPApi():
self.connected = False
return ret
if not lcp_list or not lcp_list[1]:
if not lcp_list:
logger.error("Can't get LCP list")
return ret
## TODO(pim) - fix upstream, the indexes are in network byte order and
## the message is messed up. This hack allows for both little endian and
## big endian responses, and will be removed once VPP's LinuxCP is updated
## and rolled out to AS8298
for lcp in lcp_list[1]:
if lcp.phy_sw_if_index > 65535 or lcp.host_sw_if_index > 65535 or lcp.vif_index > 65535:
i = {
'phy_sw_if_index': socket.ntohl(lcp.phy_sw_if_index),
'host_sw_if_index': socket.ntohl(lcp.host_sw_if_index),
'vif_index': socket.ntohl(lcp.vif_index),
'host_if_name': lcp.host_if_name,
'namespace': lcp.namespace
}
else:
i = {
'phy_sw_if_index': lcp.phy_sw_if_index,
'host_sw_if_index': lcp.host_sw_if_index,
'vif_index': lcp.vif_index,
'host_if_name': lcp.host_if_name,
'namespace': lcp.namespace
}
ret[lcp.host_if_name] = i
ret[lcp.host_if_name] = lcp
return ret