示例#1
0
 def process_config(self, config_dict):
     for section in config_dict:
         if section == "endaga":
             self.conf.process_config_update(config_dict[section])
         # TODO cloud should use generic key names not openbts specific
         elif section == "openbts":
             bts.process_bts_settings(config_dict[section])
         elif section == "prices":
             process_prices(config_dict['prices'], self.conf)
         elif section == "autoupgrade":
             self.process_autoupgrade(config_dict['autoupgrade'])
 def setUpClass(cls):
     # Setup the config db.
     cls.config_db = config_database.ConfigDB()
     cls.config_db['bts_secret'] = 'hokay'
     cls.config_db['free_seconds'] = '5'
     cls.config_db['billable_unit'] = '1'
     # Setup some price data like what would be sent back from the cloud.
     price_data = [{
         'directionality': 'off_network_send',
         'prefix': '509',
         'country_name': 'Haiti',
         'country_code': 'HT',
         'cost_to_subscriber_per_sms': 900,
         'cost_to_subscriber_per_min': 1100,
         'billable_unit': 1,
     }, {
         'directionality': 'off_network_send',
         'prefix': '56',
         'country_name': 'Chile',
         'country_code': 'CL',
         'cost_to_subscriber_per_sms': 1000,
         'cost_to_subscriber_per_min': 800,
         'billable_unit': 1,
     }, {
         'directionality': 'off_network_send',
         'prefix': '63',
         'country_name': 'Philippines',
         'country_code': 'PH',
         'cost_to_subscriber_per_sms': 100,
         'cost_to_subscriber_per_min': 600,
         'billable_unit': 30,
     }, {
         'directionality': 'off_network_receive',
         'cost_to_subscriber_per_sms': 200,
         'cost_to_subscriber_per_min': 100,
         'billable_unit': 1,
     }, {
         'directionality': 'on_network_send',
         'cost_to_subscriber_per_sms': 400,
         'cost_to_subscriber_per_min': 300,
         'billable_unit': 1,
     }, {
         'directionality': 'on_network_receive',
         'cost_to_subscriber_per_sms': 500,
         'cost_to_subscriber_per_min': 200,
         'billable_unit': 1,
     }]
     # Populate the config db with prices
     process_prices(price_data, cls.config_db)
 def setUpClass(cls):
     # Setup the config db.
     cls.config_db = config_database.ConfigDB()
     cls.config_db['bts_secret'] = 'yup'
     # Load up some pricing data into the config db.  We use this data to
     # determine what prefixes are available.
     # 2015dec9(shasan): This is a legacy billing response, lacking billable
     # units. This also tests we can handle that case.
     price_data = [{
         'directionality': 'off_network_send',
         'prefix': '789',
         'country_name': 'Ocenaia',
         'country_code': 'OC',
         'cost_to_subscriber_per_sms': 300,
         'cost_to_subscriber_per_min': 20,
     }, {
         'directionality': 'off_network_send',
         'prefix': '78',
         'country_name': 'Eurasia',
         'country_code': 'EU',
         'cost_to_subscriber_per_sms': 400,
         'cost_to_subscriber_per_min': 10,
     }, {
         'directionality': 'off_network_send',
         'prefix': '7',
         'country_name': 'Eastasia',
         'country_code': 'EA',
         'cost_to_subscriber_per_sms': 500,
         'cost_to_subscriber_per_min': 30,
     }, {
         'directionality': 'off_network_send',
         'prefix': '3',
         'country_name': 'London',
         'country_code': 'LN',
         'cost_to_subscriber_per_sms': 5000,
         'cost_to_subscriber_per_min': 3000,
     }]
     # Populate the config db with prices
     process_prices(price_data, cls.config_db)
    def setUpClass(cls):
        # Setup the price data to be processed.  We will process the data once
        # in this setUpClass method and then make assertions on the results in
        # the tests.
        price_data = [{
            'directionality': 'off_network_send',
            'prefix': '509',
            'country_name': 'Haiti',
            'country_code': 'HT',
            'cost_to_subscriber_per_sms': 900,
            'cost_to_subscriber_per_min': 1100,
        }, {
            'directionality': 'off_network_send',
            'prefix': '56',
            'country_name': 'Chile',
            'country_code': 'CL',
            'cost_to_subscriber_per_sms': 1000,
            'cost_to_subscriber_per_min': 800,
        }, {
            'directionality': 'off_network_receive',
            'cost_to_subscriber_per_sms': 200,
            'cost_to_subscriber_per_min': 100,
        }, {
            'directionality': 'on_network_send',
            'cost_to_subscriber_per_sms': 30,
            'cost_to_subscriber_per_min': 40,
        }, {
            'directionality': 'on_network_receive',
            'cost_to_subscriber_per_sms': 10,
            'cost_to_subscriber_per_min': 20,
        }]

        # Setup a config db connection.
        cls.config_db = config_database.ConfigDB()
        # Populate the config db with prices
        process_prices(price_data, cls.config_db)