mirror of
https://github.com/espressif/openthread.git
synced 2026-10-26 17:24:00 +00:00
[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:
@@ -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
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user