Skip to content

Commit

Permalink
[fix] Handle called_station_id uses "-" instead of ":"
Browse files Browse the repository at this point in the history
Also made device mac address lookup case insensitive
  • Loading branch information
pandafy committed Feb 16, 2024
1 parent becfa38 commit dd2a83b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion openwisp_radius/integrations/monitoring/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ def post_save_radiusaccounting(
device = (
Device.objects.select_related('devicelocation')
.only('id', 'devicelocation__location_id')
.get(mac_address=called_station_id, organization_id=organization_id)
.get(
mac_address__iexact=called_station_id.replace('-', ':'),
organization_id=organization_id,
)
)
except Device.DoesNotExist:
logger.warning(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def test_post_save_radiusaccounting(self, *args):
{
'unique_id': '117',
'username': user.username,
'called_station_id': device.mac_address,
'called_station_id': device.mac_address.replace('-', ':').upper(),
'calling_station_id': '00:00:00:00:00:00',
'input_octets': '8000000000',
'output_octets': '9000000000',
Expand Down

0 comments on commit dd2a83b

Please sign in to comment.