def initialize(self): self.resource_groups = nwa_com_utils.load_json_from_file( 'resource_group', cfg.CONF.NWA.resource_group_file, cfg.CONF.NWA.resource_group, default_value=[]) self.necnwa_router = cfg.CONF.NWA.use_necnwa_router self.multi_dc = cfg.CONF.NWA.use_neutron_vlan_id
def __init__(self): super(NECNWAL3Plugin, self).__init__() l3_db.subscribe() self.start_rpc_listeners() self.nwa_proxies = {} self.resource_groups = nwa_com_utils.load_json_from_file( 'resource_group', cfg.CONF.NWA.resource_group_file, cfg.CONF.NWA.resource_group, default_value=[])
def _test_load_json_from_file_from_file(self, json_str=None): json_data = {'foo': 'bar'} json_file = self.get_temp_file_path('test.json') with open(json_file, 'w') as f: f.write(jsonutils.dumps(json_data)) ret = nwa_com_utils.load_json_from_file('test', json_file, json_str, []) self.assertEqual(json_data, ret)
def initialize(self): self.resource_groups = nwa_com_utils.load_json_from_file( 'resource_group', cfg.CONF.NWA.resource_group_file, cfg.CONF.NWA.resource_group, default_value=[])
def test_load_json_from_file_default_value(self): self.assertEqual( 'test_data', nwa_com_utils.load_json_from_file('test', None, None, 'test_data'))
def test_load_json_from_file_from_str(self): json_data = {'foo': 'bar'} json_str = jsonutils.dumps(json_data) ret = nwa_com_utils.load_json_from_file('test', None, json_str, []) self.assertEqual(json_data, ret)