Skip to content

Commit dd2a83b

Browse files
committed
[fix] Handle called_station_id uses "-" instead of ":"
Also made device mac address lookup case insensitive
1 parent becfa38 commit dd2a83b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

openwisp_radius/integrations/monitoring/tasks.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ def post_save_radiusaccounting(
105105
device = (
106106
Device.objects.select_related('devicelocation')
107107
.only('id', 'devicelocation__location_id')
108-
.get(mac_address=called_station_id, organization_id=organization_id)
108+
.get(
109+
mac_address__iexact=called_station_id.replace('-', ':'),
110+
organization_id=organization_id,
111+
)
109112
)
110113
except Device.DoesNotExist:
111114
logger.warning(

openwisp_radius/integrations/monitoring/tests/test_metrics.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_post_save_radiusaccounting(self, *args):
139139
{
140140
'unique_id': '117',
141141
'username': user.username,
142-
'called_station_id': device.mac_address,
142+
'called_station_id': device.mac_address.replace('-', ':').upper(),
143143
'calling_station_id': '00:00:00:00:00:00',
144144
'input_octets': '8000000000',
145145
'output_octets': '9000000000',

0 commit comments

Comments
 (0)