This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to get the unicast address of all nodes on the provisioner's side (one device acts as the provisioner, not APP)

Hi Experts,

Recently, I am developing the mesh project based on the latest nRF mesh SDK, everything is running well. But I encountered one issue, that is how can provisioner (one device acts as provisioner) obtain the unicast address of all nodes. I found the dsm_address_get_all function can implement this. However, the address still exists even if one of the nodes has removed from mesh via the node reset command. so my question is as below:

  1. Is it possible to know the node has removed from the mesh network on provisioner's side when calling node_reset t command? node reset status message can be used for this purpose?
  2. can the provisioner remove the unicast address of node after this node removed from the mesh network? also, I tried to use the dsm_devkey_delete function, but I still can get the unicast address information from dsm_address_get_all  function

anyway, my purpose is very simple, the provisioner can get the unicast address of all nodes, and the address list should be updated when some of the nodes removed from the mesh network.

could you give me a hand? thanks, in advance.

Parents
  • Hi,

    1. In our examples there is no implementation that let a provisioner know when a node has been removed from the network. Like you said it possible to send a message to the provisioner before doing a node reset. Also, this should be implemented as an ACK message, so you get an ACK from the provisioner before the node resets.

    Another option is to for example ping each node in the database and after a certain time if th node don't respond, you can consider the node removed from the network.

    2. There is no removal procedure implemented in our provisioner example that let you remove the address of a node. It is something you have to implement yourself unfortunately. There is a Node Removal procedure defined in the mesh specification under section 3.10.7.

    The function dsm_devkey_delete is for removing an existing device key not an address.

Reply
  • Hi,

    1. In our examples there is no implementation that let a provisioner know when a node has been removed from the network. Like you said it possible to send a message to the provisioner before doing a node reset. Also, this should be implemented as an ACK message, so you get an ACK from the provisioner before the node resets.

    Another option is to for example ping each node in the database and after a certain time if th node don't respond, you can consider the node removed from the network.

    2. There is no removal procedure implemented in our provisioner example that let you remove the address of a node. It is something you have to implement yourself unfortunately. There is a Node Removal procedure defined in the mesh specification under section 3.10.7.

    The function dsm_devkey_delete is for removing an existing device key not an address.

Children
  • It is something you have to implement yourself unfortunately.

    Hi, Mttrinh

    Ok, that is no problem. But I don't know how to remove the unicast address from the database. Could you give me tips about it?

    There is a Node Removal procedure defined in the mesh specification under section 3.10.7

    Ok, removing the node is very easy, but the problem is that how to utilize the unicast address of them after removing from the network and how does the provisioner deletes these unicast addresses from DSM one by one. Could you give me more information about it?

    Thanks in advance.

  • Hi, 

    Here is suggestions/tips from our developer for you to get started:

    To remove the address and the device key of a node from DSM, you can to do the following:
    nrf_mesh_address_t address_to_remove = { NRF_MESH_ADDRESS_TYPE_UNICAST, unicast_address, NULL };
    dsm_handle_t address_handle = DSM_HANDLE_INVALID;
    dsm_handle_t devkey_handle = DSM_HANDLE_INVALID;

    NRF_MESH_ASSERT(dsm_address_handle_get(&address_to_remove, &address_handle) == NRF_SUCCESS);
    NRF_MESH_ASSERT(dsm_devkey_handle_get(unicast_address, &devkey_handle) = NRF_SUCCESS);
    NRF_MESH_ASSERT(dsm_address_publish_remove(address_handle) == NRF_SUCCESS);
    NRF_MESH_ASSERT(dsm_devkey_delete(dev_handle) == NRF_SUCCESS);

    Please note, before doing that, you MUST to perform the node removal procedure defined in the mesh profile specification v1.0.1, section 3.10.7. Node reset is not the correct way of doing that.
    You can use the following Configuration Client API to do that:

    0. If the node you need to remove is not part of the primary subnet, you can obtain the netkey index using dsm_subnet_handle_to_netkey_index().
    For the primary subnet, the netkey index is 0.
    1. To Update NetKey:
    uint8_t new_netkey[NRF_MESH_KEY_SIZE] = { ... }; // New NetKey
    config_client_netkey_update(NETKEY_INDEX, new_netkey); // Where NETKEY_INDEX is 0 for the primary subnet
    2. To change Key Refresh phase to 2
    config_client_key_refresh_phase_set(NETKEY_INDEX, NRF_MESH_KEY_REFRESH_PHASE_2);
    3. To change Key Refresh phase to 3
    config_client_key_refresh_phase_set(NETKEY_INDEX, NRF_MESH_KEY_REFRESH_PHASE_3);

    Each operation must be performed sequentially for each device (including provisioner), but excluding the device you want to remove from the network.

    Remember to configure Configuration Client publication for each operation:
    nrf_mesh_address_t address_to_update = { NRF_MESH_ADDRESS_TYPE_UNICAST, unicast_address, NULL };
    dsm_handle_t address_handle = DSM_HANDLE_INVALID;
    dsm_handle_t devkey_handle = DSM_HANDLE_INVALID;

    NRF_MESH_ASSERT(dsm_address_handle_get(&address_to_update, &address_handle) == NRF_SUCCESS);
    NRF_MESH_ASSERT(dsm_devkey_handle_get(unicast_address, &devkey_handle) = NRF_SUCCESS);
    config_client_server_set(devkey_handle, address_handle);
    config_client_server_bind(devkey_handle);

    Please also note that the provisioner can reuse the remove address ONLY after IV index is updated so that the new node can reuse the SEQ numbers.

    Hope this helps.

  • Hi

    Many thanks for your detailed replies. unfortunately,  the answer you mentioned cannot meet my requirements. the way you mentioned above is to update the NetKey of the mesh network. of course, it can remove the unwanted node indirectly. However, that is not a good solution if there are 100 or 200 nodes as you need to transmit the update net key request to all the nodes one by one, excluding the unwanted node. But what I wanted as below:

    1. provisioner can know the unicast address of all nodes in the mesh network via the dsm_address_get_all() function or other functions

    2. provisioner can update the unicast address list when adding or removing the nodes

    regarding point1, I can get the unicast address of all nodes, However, as I said above, this unicast address list cannot be updated after removing the node from the mesh network. so to implement this, I tried to check if there is one API or way to delete the unicast address from DSM directly. and then the unicast address will be updated when calling the dsm_address_get_all() function next time.

    so is it possible to implement this purpose?

    thanks in advance.

  • Hi

    sorry for the late response many thanks for your replies. I will have a try and then feedback to you soon. pls close this ticket first, I will reopen it if the issue is still present.

Related