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:
25
vppapi.py
25
vppapi.py
@ -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
|
||||
|
Reference in New Issue
Block a user