(self, info)
Configure the S400
Configure the S400
Configure the S400
def configure(self, info):
        """Configure the S400"""
        logger.info("Configuring the S400 receiver at {} via SNMP".format(
            self.address))

        # Local parameters
        l_band_freq = int(info['freqs']['l_band'] * 1e6)
        lo_freq = int(info['freqs']['lo'] * 1e6)
        sym_rate = defs.sym_rate[info['sat']['alias']]
        if (info['lnb']['pol'].lower() == "dual"
                and 'v1_pointed' in info['lnb'] and info['lnb']['v1_pointed']):
            pol = "horizontal" if (info['lnb']["v1_psu_voltage"] >= 16) else \
                "vertical"
        else:
            pol = "horizontal" if (info['sat']['pol'] == "H") else "vertical"
        if (info['lnb']['universal']
                and info['freqs']['dl'] > defs.ku_band_thresh):
            tone = 'enable'
        else:
            tone = 'disable'

        # Fetch and delete the current MPE PIDs
        current_cfg = self._walk()
        mpe_prefix = 's400MpePid' + self.demod
        has_mpe_table = any(
            [mpe_prefix + "RowStatus" in key for key in current_cfg])
        if (has_mpe_table):
            logger.info("Resetting MPE PIDs")
        for key in current_cfg:
            mpe_row_status = mpe_prefix + "RowStatus"
            if mpe_row_status in key:
                self._set((tuple(key.split(".")), 'destroy'))

        # Configure via SNMP
        logger.info("Configuring interface RF{}".format(self.demod))
        self._set(('s400ModulationStandard' + self.demod, 'dvbs2'))
        self._set(('s400LBandFrequency' + self.demod, l_band_freq))
        self._set(('s400SymbolRate' + self.demod, sym_rate))
        self._set(('s400SymbolRateAuto' + self.demod, 'disable'))

        logger.info("Setting LNB parameters")
        self._set(('s400LOFrequency', lo_freq))
        self._set(('s400Polarization', pol))
        self._set(('s400LongLineCompensation', 'disable'))

        logger.info("Configuring the RF{} service".format(self.demod))
        self._set(('s400Modcod' + self.demod, 'auto'))
        self._set(('s400ForwardEntireStream' + self.demod, 'disable'))

        # Set the target PIDs
        for i_pid, pid in enumerate(defs.pids):
            logger.info("Adding MPE PID {}".format(pid))
            self._set((('s400MpePid' + self.demod + 'RowStatus', i_pid),
                       'createAndWait'))
            self._set((('s400MpePid' + self.demod + 'Pid', i_pid), pid))
            self._set(
                (('s400MpePid' + self.demod + 'RowStatus', i_pid), 'active'))

        logger.info("Turning on the LNB power")
        self._set(('s400LNBSupply', 'enabled'))
        if (tone == 'enable'):
            logger.info("Enabling the LNB 22kHz tone")
        self._set(('s400Enable22KHzTone', tone))

        if (not self.dry):
            logger.info("Receiver configured successfully")
def configure ( self , info ) : logger . info ( "Configuring the S400 receiver at {} via SNMP" . format ( self . address ) ) # Local parameters l_band_freq = int ( info [ 'freqs' ] [ 'l_band' ] * 1e6 ) lo_freq = int ( info [ 'freqs' ] [ 'lo' ] * 1e6 ) sym_rate = defs . sym_rate [ info [ 'sat' ] [ 'alias' ] ] if ( info [ 'lnb' ] [ 'pol' ] . lower ( ) == "dual" and 'v1_pointed' in info [ 'lnb' ] and info [ 'lnb' ] [ 'v1_pointed' ] ) : pol = "horizontal" if ( info [ 'lnb' ] [ "v1_psu_voltage" ] >= 16 ) else "vertical" else : pol = "horizontal" if ( info [ 'sat' ] [ 'pol' ] == "H" ) else "vertical" if ( info [ 'lnb' ] [ 'universal' ] and info [ 'freqs' ] [ 'dl' ] > defs . ku_band_thresh ) : tone = 'enable' else : tone = 'disable' # Fetch and delete the current MPE PIDs current_cfg = self . _walk ( ) mpe_prefix = 's400MpePid' + self . demod has_mpe_table = any ( [ mpe_prefix + "RowStatus" in key for key in current_cfg ] ) if ( has_mpe_table ) : logger . info ( "Resetting MPE PIDs" ) for key in current_cfg : mpe_row_status = mpe_prefix + "RowStatus" if mpe_row_status in key : self . _set ( ( tuple ( key . split ( "." ) ) , 'destroy' ) ) # Configure via SNMP logger . info ( "Configuring interface RF{}" . format ( self . demod ) ) self . _set ( ( 's400ModulationStandard' + self . demod , 'dvbs2' ) ) self . _set ( ( 's400LBandFrequency' + self . demod , l_band_freq ) ) self . _set ( ( 's400SymbolRate' + self . demod , sym_rate ) ) self . _set ( ( 's400SymbolRateAuto' + self . demod , 'disable' ) ) logger . info ( "Setting LNB parameters" ) self . _set ( ( 's400LOFrequency' , lo_freq ) ) self . _set ( ( 's400Polarization' , pol ) ) self . _set ( ( 's400LongLineCompensation' , 'disable' ) ) logger . info ( "Configuring the RF{} service" . format ( self . demod ) ) self . _set ( ( 's400Modcod' + self . demod , 'auto' ) ) self . _set ( ( 's400ForwardEntireStream' + self . demod , 'disable' ) ) # Set the target PIDs for i_pid , pid in enumerate ( defs . pids ) : logger . info ( "Adding MPE PID {}" . format ( pid ) ) self . _set ( ( ( 's400MpePid' + self . demod + 'RowStatus' , i_pid ) , 'createAndWait' ) ) self . _set ( ( ( 's400MpePid' + self . demod + 'Pid' , i_pid ) , pid ) ) self . _set ( ( ( 's400MpePid' + self . demod + 'RowStatus' , i_pid ) , 'active' ) ) logger . info ( "Turning on the LNB power" ) self . _set ( ( 's400LNBSupply' , 'enabled' ) ) if ( tone == 'enable' ) : logger . info ( "Enabling the LNB 22kHz tone" ) self . _set ( ( 's400Enable22KHzTone' , tone ) ) if ( not self . dry ) : logger . info ( "Receiver configured successfully" )