Load the configuration from the shared configuration JSON file.
(self)
| 1519 | self.levelnbr = self.calculate_level(total_points) |
| 1520 | self.gamification_data["level"] = self.levelnbr |
| 1521 | |
| 1522 | def normalize_mac(self, mac_address: str) -> str: |
| 1523 | """Return a normalized MAC address suitable for persistence.""" |
| 1524 | if not mac_address: |
| 1525 | return "" |
| 1526 | |
| 1527 | mac = mac_address.strip().upper() |
| 1528 | if mac in {"UNKNOWN", "N/A", "NONE"}: |
| 1529 | return "" |
| 1530 | |
| 1531 | mac = mac.replace('-', ':') |
| 1532 | if '.' in mac: |
| 1533 | mac = mac.replace('.', '') |
| 1534 | mac = mac.replace(' ', '') |
| 1535 | |
| 1536 | if ':' not in mac and len(mac) == 12: |
| 1537 | mac = ':'.join(mac[i:i + 2] for i in range(0, 12, 2)) |
| 1538 | |
| 1539 | if mac.count(':') == 5: |
| 1540 | if mac in {"00:00:00:00:00:00", "FF:FF:FF:FF:FF:FF"}: |
| 1541 | return "" |
| 1542 | return mac |
| 1543 | |
| 1544 | return "" |
| 1545 | |
| 1546 | def process_discovered_macs(self, mac_addresses): |
| 1547 | """Track newly discovered MAC addresses and award points once per device.""" |
| 1548 | normalized = {self.normalize_mac(mac) for mac in mac_addresses} |
| 1549 | normalized.discard("") |
| 1550 | |
| 1551 | if not normalized: |
| 1552 | return 0, 0 |
| 1553 |
no test coverage detected