Other Parts Discussed in Thread: Z-STACK
I couldn' tremove all devices in a single "Gateway session". I generally can remove 2 or 3 devices, but then the gateway must be restarted.
I had to restart the gateway in order to complete the deletion before doing a hard reset.
**** For information, the grep command that provide the log extract (that I then reduced further manually): egrep '(NWK_REMOVE_DEVICE_REQ|_APS|NWK_MGR/LSTN.*ieeeAddr =|RESET|missing|parentAddr =|nwkAddr)' RestartRequiredToRemoveDevice.log **** Some of the TC Device Indications with network addresses: [2020-11-21 03:44:53.157959] [Z_STACK/HNDL] INFO : zstackpb Sending TC Device Ind: nwkAddr:0xE1B7, extAddr:0xCCCCCCFFFE3A2F33, parentAddr:0x0000 [2020-11-21 03:44:56.456502] [Z_STACK/HNDL] INFO : zstackpb Sending TC Device Ind: nwkAddr:0xBAC8, extAddr:0x000D6F0012199E48, parentAddr:0x0000 [2020-11-21 03:45:54.978735] [Z_STACK/HNDL] INFO : zstackpb Sending TC Device Ind: nwkAddr:0xD34C, extAddr:0x00124B000760BB0A, parentAddr:0x0000 [2020-11-21 04:17:31.523794] [Z_STACK/HNDL] INFO : zstackpb Sending TC Device Ind: nwkAddr:0x1017, extAddr:0x00158D00047B8369, parentAddr:0x0000 **** some information about the remove request recieved by the NWK_MGR and the request sent to the ZNP [2020-11-21 15:47:35.418681] [NWK_MGR/LSTN] PKTBODY: cmdId = NWK_REMOVE_DEVICE_REQ [2020-11-21 15:47:35.419072] [NWK_MGR/LSTN] PKTBODY: ieeeAddr = 00:12:4B:00:07:60:BB:0A [2020-11-21 15:47:35.420954] [NWK_MGR/LSTN] PKTBODY: parentAddr = 0x0000D34C (54092) [2020-11-21 15:47:35.421074] [NWK_MGR/LSTN] PKTBODY: nwkAddr = 0x0000D34C (54092) [2020-11-21 15:47:35.427088] < [ZDO/SREQ] **EXT_SEC_APS_REMOVE_REQ** <D34C-00124b000760bb0a> Parent:D34C (SYS:5/TYPE:20/CMD:51) ( 17)::fe 0c 25 51 4c d3 4c d3 0a bb 60 07 00 4b 12 00 f7 [2020-11-21 15:47:35.698590] > [ZDO/SRSP] **EXT_SEC_APS_REMOVE_REQ** ZSuccess (SYS:5/TYPE:60/CMD:51) ( 6)::fe 01 65 51 00 35 **** Other device [2020-11-21 15:47:37.363760] [NWK_MGR/LSTN] PKTBODY: cmdId = NWK_REMOVE_DEVICE_REQ [2020-11-21 15:47:37.364139] [NWK_MGR/LSTN] PKTBODY: ieeeAddr = CC:CC:CC:FF:FE:3A:2F:33 [2020-11-21 15:47:37.366035] [NWK_MGR/LSTN] PKTBODY: parentAddr = 0x0000E1B7 (57783) [2020-11-21 15:47:37.366150] [NWK_MGR/LSTN] PKTBODY: nwkAddr = 0x0000E1B7 (57783) [2020-11-21 15:47:37.370148] < [ZDO/SREQ] **EXT_SEC_APS_REMOVE_REQ** <E1B7-ccccccfffe3a2f33> Parent:E1B7 (SYS:5/TYPE:20/CMD:51) ( 17)::fe 0c 25 51 b7 e1 b7 e1 33 2f 3a fe ff cc cc cc 93 [2020-11-21 15:47:37.641244] > [ZDO/SRSP] **EXT_SEC_APS_REMOVE_REQ** ZSuccess (SYS:5/TYPE:60/CMD:51) ( 6)::fe 01 65 51 00 35 **** This device removal request did not succeed - the device still appeared in the Device List in the application: [2020-11-21 15:47:40.412069] [NWK_MGR/LSTN] PKTBODY: cmdId = NWK_REMOVE_DEVICE_REQ [2020-11-21 15:47:40.412365] [NWK_MGR/LSTN] PKTBODY: ieeeAddr = 70:B3:D5:B1:30:01:01:1E [2020-11-21 15:47:40.413838] [NWK_MGR/LSTN] PKTBODY: parentAddr = 0x00009424 (37924) [2020-11-21 15:47:40.413926] [NWK_MGR/LSTN] PKTBODY: nwkAddr = 0x00009424 (37924) [2020-11-21 15:47:40.421569] < [ZDO/SREQ] **EXT_SEC_APS_REMOVE_REQ** <9424-70b3d5b13001011e> Parent:9424 (SYS:5/TYPE:20/CMD:51) ( 17)::fe 0c 25 51 24 94 24 94 1e 01 01 30 b1 d5 b3 70 f1 [2020-11-21 15:47:40.691802] > [ZDO/SRSP] **EXT_SEC_APS_REMOVE_REQ** ZSuccess (SYS:5/TYPE:60/CMD:51) ( 6)::fe 01 65 51 00 35 [2020-11-21 15:50:09.766092] [NWK_MGR/MAIN] PKTBODY: nwkAddrRsp = 1 [2020-11-21 15:50:12.935236] [NWK_MGR/LSTN] PKTBODY: ieeeAddr = 70:B3:D5:B1:30:01:01:1E **** At this point the gatway restarted: [2020-11-21 15:50:13] when we see something missing we will send a SIGUSR2 to pid 551 **** And removing the device "succeeded". [2020-11-21 15:50:21.401887] [NWK_MGR/LSTN] PKTBODY: cmdId = NWK_REMOVE_DEVICE_REQ [2020-11-21 15:50:21.402259] [NWK_MGR/LSTN] PKTBODY: ieeeAddr = 70:B3:D5:B1:30:01:01:1E [2020-11-21 15:50:21.403681] [NWK_MGR/LSTN] PKTBODY: parentAddr = 0x00009424 (37924) [2020-11-21 15:50:21.403769] [NWK_MGR/LSTN] PKTBODY: nwkAddr = 0x00009424 (37924) [2020-11-21 15:50:21.411374] < [ZDO/SREQ] **EXT_SEC_APS_REMOVE_REQ** <9424-70b3d5b13001011e> Parent:9424 (SYS:5/TYPE:20/CMD:51) ( 17)::fe 0c 25 51 24 94 24 94 1e 01 01 30 b1 d5 b3 70 f1 [2020-11-21 15:50:21.681819] > [ZDO/SRSP] **EXT_SEC_APS_REMOVE_REQ** ZSuccess (SYS:5/TYPE:60/CMD:51) ( 6)::fe 01 65 51 00 35 [2020-11-21 15:51:52.778861] [NWK_MGR/LSTN] PKTBODY: cmdId = NWK_ZIGBEE_SYSTEM_RESET_REQ [2020-11-21 15:51:52.778990] [NWK_MGR/LSTN] PKTBODY: mode = HARD_RESET [2020-11-21 15:51:52.779117] [NWK_MGR/LSTN] MISC1 : NWK_ZIGBEE_SYSTEM_RESET: ResetMode 1 [2020-11-21 15:51:52.780307] [NWK_MGR/LSTN] INFO : preparing to send 6 bytes, subSys 0x11, cmdId 0x00 (SYS_RESET_REQ), pData: [2020-11-21 15:51:52.780945] [NWK_MGR/LSTN] PKTBODY: cmdID = SYS_RESET_REQ [2020-11-21 15:51:52.842210] < [SYS/AREQ] **RESET_REQ** (SYS:1/TYPE:40/CMD:00) ( 6)::fe 01 41 00 01 41 [2020-11-21 15:51:54.667997] > [SYS/AREQ] **RESET_IND** EXTRST(1) Protocol 2 ProductID 2 SWVer 2.7.2 (SYS:1/TYPE:40/CMD:80) ( 11)::fe 06 41 80 01 02 02 02 07 02 c1 [2020-11-21 15:52:14] when we see something missing we will send a SIGUSR2 to pid 551
One can see tha the remove request for ZED 70:B3:D5:B1:30:01:01:1E was repeated in the second session, where it disappeared from the Device List.
The sniffer did not capture much during this period, after its reset line had been hit:
[2020-11-21 15:47:08.363092] 32377 â<86><92> Broadcast IEEE 802.15.4 10 Beacon Request^M [2020-11-21 15:47:08.364902] 32378 â<86><92> IEEE 802.15.4 28 Ack^M [2020-11-21 15:47:11.538880] < ( 2)::ef 0a [2020-11-21 15:47:11] done [2020-11-21 15:47:11] hitting led_reset line, LED dir is /sys/class/leds/evmsk:zigbeeReset:usr2 sleeping 5 seconds after reset... done
That is in itself annoying since from the application's point of view it is difficult to know that the ZNP is not actually functionnal. Any idea to improve on that is welcome.
Also, I think that the INCOMING_MSG's during this period are internal replies of the Coordinator - example:
[2020-11-21 15:47:48.171483] < [AF/SREQ] **DATA_REQUEST_EXT** <0000 EP:01 PAN:BEBE> {SRC EP:0E CLSTR:000A} #0 TXOPT:00() RADIUS:30 (SYS:4/TYPE:20/CMD:02) ( 31)::fe 1a 24 02 02 00 00 be be be be be be 01 be be 0e 0a 00 00 00 1e 06 00 18 09 01 00 00 86 b5
[2020-11-21 15:47:48.192640] > [AF/AREQ] **INCOMING_MSG** <0000/GRP:0000/CLSTR:000A/EP:0E> Seq:0 DstEP:01 SrcMAC:0918 LQI:255 SECURE:0 TIMSTMP:0 DATALEN:6 RADIUS:24 (SYS:4/TYPE:40/CMD:81) ( 31)::fe 1a 44 81 00 00 0a 00 00 00 0e 01 00 ff 00 00 00 00 00 00 06 18 09 01 00 00 86 00 00 00 b5
The examination of the logs also shows that the parentAddr and then nwkAddr in the secApsRemoveReqare are reported as the same. So they are the same as well for EXT_SEC_APS_REMOVE_REQ as well. So it would be logical tha the removal request fail, but they actually return success.
The "Z-Stack Monitor and Test API" documents also says that the status in the EXT_SEC_APS_REMOVE_REQ responses is "Status of removing device from the network" . I think that I have to read that as the status of the removal request, and not the status of the device.
I think there is more to this problem than just fixing the parent in the removal request. I also think that the ZNP code should be improved - using the IEEE Address to remove a device is more precise than the Parent/NWK address.
It appears to me that non of the removal requests succeeded as no Leave requests were issued according to the sniffer.