Exemple #1
0
    def _handle_tr069_message(
        cls,
        ctx: WsgiMethodContext,
        message: ComplexModelBase,
    ) -> ComplexModelBase:
        # Log incoming msg
        logger.debug('Handling TR069 message: %s %s',
                     message.__class__.__name__, str(as_dict(message)))

        req = cls._get_tr069_response_from_sm(ctx, message)

        # Log outgoing msg
        logger.debug('Sending TR069 message: %s %s', req.__class__.__name__,
                     str(as_dict(req)))

        # Set header
        ctx.out_header = models.ID(mustUnderstand='1')
        ctx.out_header.Data = 'null'

        # Set return message name
        if isinstance(req, models.DummyInput):
            # Generate 'empty' request to CPE using empty message name
            ctx.descriptor.out_message.Attributes.sub_name = 'EmptyHttp'
            return models.AcsToCpeRequests()
        ctx.descriptor.out_message.Attributes.sub_name = req.__class__.__name__
        return cls._generate_acs_to_cpe_request_copy(req)
Exemple #2
0
    def _handle_tr069_message(
        cls,
        ctx: WsgiMethodContext,
        message: ComplexModelBase,
    ) -> ComplexModelBase:
        # Log incoming msg
        if hasattr(message, 'as_dict'):
            logging.debug('Handling TR069 message: %s', str(type(message)))
        else:
            logging.debug('Handling TR069 message.')

        # The manager will route the request to the state machine handling
        # the specific eNodeB.
        req = cls.state_machine_manager.handle_tr069_message(ctx, message)

        # Log outgoing msg
        if hasattr(req, 'as_dict'):
            logging.debug('Sending TR069 message: %s', str(req.as_dict()))
        else:
            logging.debug('Sending TR069 message.')

        # Set header
        ctx.out_header = models.ID(mustUnderstand='1')
        ctx.out_header.Data = 'null'

        # Set return message name
        if isinstance(req, models.DummyInput):
            # Generate 'empty' request to CPE using empty message name
            ctx.descriptor.out_message.Attributes.sub_name = 'EmptyHttp'
            return models.AcsToCpeRequests()
        ctx.descriptor.out_message.Attributes.sub_name = req.__class__.__name__
        return cls._generate_acs_to_cpe_request_copy(req)