def __init__(self, configuration, measure_model, time_to_shutdown_event):
        self.measure_model = measure_model
        self.time_to_shutdown_event = time_to_shutdown_event

        self.logger = logging_utils.get_logger("CommsInterfaceServer")

        try:
            self.vty_host = configuration.get('osmo_nitb_vty', 'host')
            self.vty_port = configuration.getint('osmo_nitb_vty', 'port')
            self.vty_readtimeout_secs = configuration.getint('osmo_nitb_vty', 'timeout')

            self.xmlrpc_server_host = configuration.get('app:main', 'xmlrpc.host')
            self.xmlrpc_server_port = configuration.getint('app:main', 'xmlrpc.port')

            self.pf_db_conn_str = configuration.get('app:main', 'sqlalchemy.pf.url')
            self.hlr_db_conn_str = configuration.get('app:main', 'sqlalchemy.hlr.url')

        except ConfigParser.Error as err:
            raise ValueError('Configuration error: {0}'.format(err.message))

        self.vty_client_connection = None
        self.xmlrpc_thread = None
        self.proc_measure_thread = None
        self.proc_unknow_adress_sms_thread = None

        self.pf_phone_number = pf_subscriber_extension
        self.pf_subscriber_imsi = pf_subscriber_imsi
        self.measure_update_period = 3

        bind_session(self.pf_db_conn_str)
        bind_hlr_session(self.hlr_db_conn_str)

        self.vty_use_send_sms_rlock = threading.RLock()
    def __init__(self, configuration, measure_model, time_to_shutdown_event):
        self.measure_model = measure_model
        self.time_to_shutdown_event = time_to_shutdown_event

        self.logger = logging_utils.get_logger("CommsInterfaceServer")

        try:
            self.vty_host = configuration.get('osmo_nitb_vty', 'host')
            self.vty_port = configuration.getint('osmo_nitb_vty', 'port')
            self.vty_readtimeout_secs = configuration.getint(
                'osmo_nitb_vty', 'timeout')

            self.xmlrpc_server_host = configuration.get(
                'app:main', 'xmlrpc.host')
            self.xmlrpc_server_port = configuration.getint(
                'app:main', 'xmlrpc.port')

            self.pf_db_conn_str = configuration.get('app:main',
                                                    'sqlalchemy.pf.url')
            self.hlr_db_conn_str = configuration.get('app:main',
                                                     'sqlalchemy.hlr.url')

            self.kannel_url = configuration.get('app:main', 'kannel.url')
            self.kannel_smssend_port = configuration.get(
                'app:main', 'kannel.smssend.port')

        except ConfigParser.Error as err:
            raise ValueError('Configuration error: {0}'.format(err.message))

        self.vty_client_connection = None
        self.xmlrpc_thread = None
        self.proc_measure_thread = None
        self.proc_unknow_adress_sms_thread = None

        self.pf_phone_number = pf_subscriber_extension
        self.pf_subscriber_imsi = pf_subscriber_imsi
        self.measure_update_period = 3

        bind_session(self.pf_db_conn_str)
        bind_hlr_session(self.hlr_db_conn_str)

        self.vty_use_send_sms_rlock = threading.RLock()
Пример #3
0
    configuration.readfp(args.configuration)

    logger = logging_utils.get_logger("main")
    logger.info("Comm interface started! pid: {0}".format(os.getpid()))

    # Init DB ================================================================
    pf_db_conn_str = None
    try:
        pf_db_conn_str = configuration.get('app:main', 'sqlalchemy.pf.url')
    except ConfigParser.Error as err:
        logger.error("Identification People Finder DB fail: {0}".format(err.message))
        sys.exit(1)

    logger.info("PF db sqlite path: {0}".format(pf_db_conn_str))
    try:
        bind_session(pf_db_conn_str)
        DBSession.query(Measure).count()
        DBSession.query(Settings).count()
    except:
        logger.error("People finder DB connection err")
        raise

    hlr_db_conn_str = None
    try:
        hlr_db_conn_str = configuration.get('app:main', 'sqlalchemy.hlr.url')
    except ConfigParser.Error as err:
        logger.error("Identification HLR fail: {0}".format(err.message))
        sys.exit(1)

    logger.info("HLR db sqlite path: {0}".format(hlr_db_conn_str))
    try: