# Path: networking_odl/ceilometer/network/statistics/opendaylight_v2/client.py
# LOG = log.getLogger(__name__)
# class _Base(object, metaclass=abc.ABCMeta):
# class OpenDaylightRESTAPIFailed(Exception):
# class SwitchStatisticsAPIClient(_Base):
# class Client(object):
#     def base_url(self):
#     def __init__(self, client):
#     def get_statistics(self):
#     def __init__(self, conf, endpoint, params):
#     def _get_req_params(self, params):
#     def _log_req(self, url):
#     def _log_res(resp):
#     def _http_request(self, url):
#     def request(self, path):


import urllib
from debtcollector import removals
from oslo_log import log
from ceilometer import keystone_client
from ceilometer.network.statistics import driver
from networking_odl.ceilometer.network.statistics.opendaylight_v2 import client

        if 'network.statistics.opendaylight_v2' in cache:
            return cache['network.statistics.opendaylight_v2']

        data = {}

        odl_params = {}
        if 'auth' in params:
            odl_params['auth'] = params['auth'][0]
        if 'user' in params:
            odl_params['user'] = params['user'][0]
        if 'password' in params:
            odl_params['password'] = params['password'][0]
        cs = client.Client(self.conf, endpoint, odl_params)

        if not self.admin_project_id:
            try:
                ks_client = keystone_client.get_client(self.conf)
                project = ks_client.projects.find(name='admin')
                if project:
                    self.admin_project_id = project.id
            except Exception:
                LOG.exception('Unable to fetch admin tenant id')
                cache['network.statistics.opendaylight_v2'] = data
                return data

        try:
            # get switch statistics
            data['switch'] = cs.switch_statistics.get_statistics()
            data['admin_tenant_id'] = self.admin_project_id

# Path: networking_odl/ceilometer/network/statistics/opendaylight_v2/client.py
# LOG = log.getLogger(__name__)
# class _Base(object, metaclass=abc.ABCMeta):
# class OpenDaylightRESTAPIFailed(Exception):
# class SwitchStatisticsAPIClient(_Base):
# class Client(object):
#     def base_url(self):
#     def __init__(self, client):
#     def get_statistics(self):
#     def __init__(self, conf, endpoint, params):
#     def _get_req_params(self, params):
#     def _log_req(self, url):
#     def _log_res(resp):
#     def _http_request(self, url):
#     def request(self, path):


# Path: networking_odl/ceilometer/network/statistics/opendaylight_v2/driver.py
import urllib
from debtcollector import removals
from oslo_log import log
from ceilometer import keystone_client
from ceilometer.network.statistics import driver
from networking_odl.ceilometer.network.statistics.opendaylight_v2 import client


        if 'network.statistics.opendaylight_v2' in cache:
            return cache['network.statistics.opendaylight_v2']

        data = {}

        odl_params = {}
        if 'auth' in params:
            odl_params['auth'] = params['auth'][0]
        if 'user' in params:
            odl_params['user'] = params['user'][0]
        if 'password' in params:
            odl_params['password'] = params['password'][0]
        cs = client.Client(self.conf, endpoint, odl_params)

        if not self.admin_project_id:
            try:
                ks_client = keystone_client.get_client(self.conf)
                project = ks_client.projects.find(name='admin')
                if project:
                    self.admin_project_id = project.id
            except Exception:
                LOG.exception('Unable to fetch admin tenant id')
                cache['network.statistics.opendaylight_v2'] = data
                return data

        try:
            # get switch statistics
            data['switch'] = cs.switch_statistics.get_statistics()
            data['admin_tenant_id'] = self.admin_project_id

        except client.OpenDaylightRESTAPIFailed: