def _update_device_mapping( self, client_ip: str, inform: models.Inform, ) -> None: """ When receiving an Inform message, we can figure out what device we are talking to. We can also see if the IP has changed, and the StateMachineManager must track this so that subsequent tr069 messages can be handled correctly. """ enb_serial = self._parse_msg_for_serial(inform) if enb_serial is None: raise UnrecognizedEnodebError( 'eNB does not have serial number ' 'under expected param path', ) if not is_enb_registered(self._service.mconfig, enb_serial): raise UnrecognizedEnodebError( 'eNB not registered to this Access ' 'Gateway (serial #%s)' % enb_serial, ) self._associate_serial_to_ip(client_ip, enb_serial) handler = self._get_handler(client_ip) if handler is None: device_name = get_device_name_from_inform(inform) handler = self._build_handler(device_name) self._state_machine_by_ip[client_ip] = handler
def get_device_name( device_oui: str, sw_version: str, hw_version: str, product_class: str, ) -> str: """ Use the manufacturer organization unique identifier read during INFORM to select the TR data model used for configuration and status reports Qualcomm-based Baicells eNodeBs use a TR098-based model different from the Intel units. The software version on the Qualcomm models also further limits the model usable by that device. Args: device_oui: string, OUI representing device vendor sw_version: string, firmware version of eNodeB device hw_version: string, hardware version of eNodeB device product_class: string, product descriptor of eNodeB device Raises: UnrecognizedEnodebError: when device is not recognized Returns: DataModel """ if device_oui in {'34ED0B', '48BF74'}: if sw_version.startswith('BaiBS_QAFB'): return EnodebDeviceName.BAICELLS_QAFB elif sw_version.startswith('BaiBS_QAFA'): return EnodebDeviceName.BAICELLS_QAFA elif sw_version.startswith('BaiStation_'): # Note: to disable flag inversion completely (for all builds), # set to BaiStation_V000R000C00B000SPC000 # Note: to force flag inversion always (for all builds), # set to BaiStation_V999R999C99B999SPC999 invert_before_version = \ _parse_sw_version('BaiStation_V100R001C00B110SPC003') if _parse_sw_version(sw_version) < invert_before_version: return EnodebDeviceName.BAICELLS_OLD return EnodebDeviceName.BAICELLS elif sw_version.startswith('BaiBS_RTS_'): return EnodebDeviceName.BAICELLS_RTS elif sw_version.startswith('BaiBS_RTSH_'): return EnodebDeviceName.BAICELLS_RTS elif sw_version.startswith('BaiBS_QRTB_') and ( # noqa: WPS222 hw_version == 'E01' and 'mBS31001' in product_class or hw_version == 'A01' and 'pBS3101S' in product_class): return EnodebDeviceName.BAICELLS_QRTB raise UnrecognizedEnodebError( "Device %s unsupported: Software (%s), Hardware (%s), Product Class (%s)" % (device_oui, sw_version, hw_version, product_class), ) elif device_oui in {'000FB7', '744D28'}: return EnodebDeviceName.CAVIUM elif device_oui == '000E8F': return EnodebDeviceName.FREEDOMFI_ONE raise UnrecognizedEnodebError( "Device %s unsupported: Software (%s), Hardware (%s), Product Class (%s)" % (device_oui, sw_version, hw_version, product_class), )
def get_device_name( device_oui: str, sw_version: str, ) -> str: """ Use the manufacturer organization unique identifier read during INFORM to select the TR data model used for configuration and status reports Qualcomm-based Baicells eNodeBs use a TR098-based model different from the Intel units. The software version on the Qualcomm models also further limits the model usable by that device. Args: device_oui: string, OUI representing device vendor sw_version: string, firmware version of eNodeB device Returns: DataModel """ if device_oui in {'34ED0B', '48BF74'}: if sw_version.startswith('BaiBS_QAFB'): return EnodebDeviceName.BAICELLS_QAFB elif sw_version.startswith('BaiBS_QAFA'): return EnodebDeviceName.BAICELLS_QAFA elif sw_version.startswith('BaiStation_'): # Note: to disable flag inversion completely (for all builds), # set to BaiStation_V000R000C00B000SPC000 # Note: to force flag inversion always (for all builds), # set to BaiStation_V999R999C99B999SPC999 invert_before_version = \ _parse_sw_version('BaiStation_V100R001C00B110SPC003') if _parse_sw_version(sw_version) < invert_before_version: return EnodebDeviceName.BAICELLS_OLD return EnodebDeviceName.BAICELLS elif sw_version.startswith('BaiBS_RTS_'): return EnodebDeviceName.BAICELLS_RTS elif sw_version.startswith('BaiBS_RTSH_'): return EnodebDeviceName.BAICELLS_RTS else: raise UnrecognizedEnodebError( "Device %s unsupported: Software (%s)" % (device_oui, sw_version)) elif device_oui in { '000FB7', '744D28', }: return EnodebDeviceName.CAVIUM else: raise UnrecognizedEnodebError("Device %s unsupported" % device_oui)