Skip to content

Commit 0d5eb26

Browse files
committed
network: discovery: zigbee: get active route table entry if exists
If the same route entry (destination - next hop) is repeated in the routing table of a node but with different status, keep the "active" one. For example: Route of 0013A2004195C88B - usb1_100B: 0000 - 0000 -> Inactive Route of 0013A2004195C88B - usb1_100B: 0000 - 0000 -> Active Route of 0013A2004195C88B - usb1_100B: E814 - 27C9 -> Active Route of 0013A2004195C88B - usb1_100B: F2E7 - 27C9 -> Active Route of 0013A2004195C88B - usb1_100B: 27C9 - 0000 -> Active Route of 0013A2004195C88B - usb1_100B: 0000 - 0000 -> Inactive Two first entries are the route to the coordinator: the first one is 'Inactive', the second one is 'Active'. In this case keep the second one. Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
1 parent 880ab5e commit 0d5eb26

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

digi/xbee/devices.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11232,6 +11232,15 @@ def __new_route_cb(xbee, route):
1123211232
# Add the new route
1123311233
if str(route.next_hop) not in routes_list:
1123411234
routes_list.update({str(route.next_hop): route})
11235+
else:
11236+
r_in_list = routes_list.get(str(route.next_hop))
11237+
self._log.debug(" - ROUTE already found %s - %s -> %s",
11238+
r_in_list.destination, r_in_list.next_hop, r_in_list.status)
11239+
from digi.xbee.models.zdo import RouteStatus
11240+
if r_in_list.status != RouteStatus.ACTIVE and route.status == RouteStatus.ACTIVE:
11241+
self._log.debug(" - Updating route %s - %s -> %s",
11242+
route.destination, route.next_hop, route.status)
11243+
routes_list.update({str(route.next_hop): route})
1123511244

1123611245
# Check for cancel
1123711246
if self._stop_event.is_set():

0 commit comments

Comments
 (0)