@startuml

:ZB_ZDO_SIGNAL_LEAVE;

    if (status == RET_OK) then (no)
    else (yes)
    if (role == coordinator) then (no)
        :start_network_rejoin();
    else (yes)
        :bdb_start_top_level_commissioning(ZB_BDB_NETWORK_FORMATION);
    endif
    endif
stop

@enduml