From 8f43c26bb9b093a741b900250c29bc82933200ba Mon Sep 17 00:00:00 2001 From: Michael Jeffrey Date: Thu, 27 Jul 2023 15:39:32 -0700 Subject: [PATCH] check active during reconcile (#984) * check active during reconcile active was only being checked during device updates * explicitly mark devices as active in reconcile tests --- src/grpc/router_ics_eui_worker.erl | 7 ++++--- test/router_ics_eui_worker_SUITE.erl | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/grpc/router_ics_eui_worker.erl b/src/grpc/router_ics_eui_worker.erl index 08f7a5775..47229afd2 100644 --- a/src/grpc/router_ics_eui_worker.erl +++ b/src/grpc/router_ics_eui_worker.erl @@ -424,11 +424,12 @@ get_local_eui_pairs(RouteID) -> lists:filtermap( fun(APIDevice) -> OrgId = kvc:path([<<"organization_id">>], APIDevice), + Active = kvc:path([<<"active">>], APIDevice, false), - case lists:member(OrgId, UnfundedOrgs) of - true -> - false; + case Active andalso not lists:member(OrgId, UnfundedOrgs) of false -> + false; + true -> <> = lorawan_utils:hex_to_binary( kvc:path([<<"app_eui">>], APIDevice) ), diff --git a/test/router_ics_eui_worker_SUITE.erl b/test/router_ics_eui_worker_SUITE.erl index 58bbd1565..beda26957 100644 --- a/test/router_ics_eui_worker_SUITE.erl +++ b/test/router_ics_eui_worker_SUITE.erl @@ -357,6 +357,7 @@ reconcile_ignore_unfunded_orgs_test(_Config) -> }, JsonDevices = [ #{ + <<"active">> => true, <<"app_eui">> => lorawan_utils:binary_to_hex(router_device:app_eui(D)), <<"dev_eui">> => lorawan_utils:binary_to_hex(router_device:dev_eui(D)), <<"organization_id">> => maps:get(organization_id, router_device:metadata(D)) @@ -493,6 +494,7 @@ reconcile_test(_Config) -> JSONDevices = lists:map( fun(X) -> #{ + <<"active">> => true, <<"app_eui">> => lorawan_utils:binary_to_hex(<>), <<"dev_eui">> => lorawan_utils:binary_to_hex(<>) }