[netdata] new API to get lowpan context IDs (#8870)

This commit adds `otNetDataGetNextLowpanContextInfo()` to iterate
through the list of LoWPAN Context entries in Thread Network Data
providing info about the prefix, its LoWPAN Context ID and Compress
flag (relating to `ContextTlv` sub-TLVs of `PrefixTlv`s in Network
Data).

This commit also updates CLI command `netdata show` to list the
context IDs in addition to prefixes, routes, and services.
This commit is contained in:
Abtin Keshavarzian
2023-03-17 21:39:59 -07:00
committed by GitHub
parent 89d5799d76
commit af031f3b50
14 changed files with 263 additions and 11 deletions
+4 -1
View File
@@ -1694,7 +1694,7 @@ class OpenThreadTHCI(object):
@watched
def getNetworkData(self):
lines = self.__executeCommand('netdata show')
prefixes, routes, services = [], [], []
prefixes, routes, services, contexts = [], [], [], []
classify = None
for line in lines:
@@ -1704,6 +1704,8 @@ class OpenThreadTHCI(object):
classify = routes
elif line == 'Services:':
classify = services
elif line == 'Contexts:':
classify = contexts
elif line == 'Done':
classify = None
else:
@@ -1713,6 +1715,7 @@ class OpenThreadTHCI(object):
'Prefixes': prefixes,
'Routes': routes,
'Services': services,
'Contexts': contexts,
}
@API
+10 -1
View File
@@ -1570,7 +1570,16 @@ class OTCI(object):
routes_output.append(line)
netdata['routes'] = self.__parse_routes(routes_output)
netdata['services'] = self.__parse_services(output)
services_output = []
while True:
line = output.pop(0)
if line == 'Contexts:':
break
else:
services_output.append(line)
netdata['services'] = self.__parse_services(services_output)
return netdata