# Path: networking_odl/common/utils.py
# def try_del(d, keys):
# def make_url_object(object_type):
# def neutronify(name):
# def get_odl_url(path=''):


import threading
import requests
from oslo_config import cfg
from oslo_log import log
from oslo_serialization import jsonutils
from oslo_utils import excutils
from requests import sessions
from networking_odl.common import utils
            from networking_odl.common import lightweight_testing as lwt
    def create_client(cls, url=None):
        if cfg.CONF.ml2_odl.enable_lightweight_testing:
            LOG.debug("ODL lightweight testing is enabled, "
                      "returning a OpenDaylightLwtClient instance")

            # Have to import at here, otherwise we create a dependency loop
            # pylint: disable=import-outside-toplevel
            cls = lwt.OpenDaylightLwtClient

        url = url or cfg.CONF.ml2_odl.url
        cls._check_opt(url)
        return cls(
            url,
            cfg.CONF.ml2_odl.username,
            cfg.CONF.ml2_odl.password,
            cfg.CONF.ml2_odl.timeout)

    def __init__(self, url, username, password, timeout):
        super(OpenDaylightRestClient, self).__init__()
        self.url = url
        self.timeout = timeout
        self.session = sessions.Session()
        self.session.auth = (username, password)

    def get_resource(self, resource_type, resource_id):
        response = self.get(utils.make_url_object(resource_type) + '/' +
                            resource_id)
        if response.status_code == requests.codes.not_found:
            return None


# Path: networking_odl/common/utils.py
# def try_del(d, keys):
# def make_url_object(object_type):
# def neutronify(name):
# def get_odl_url(path=''):


# Path: networking_odl/common/client.py
import threading
import requests
from oslo_config import cfg
from oslo_log import log
from oslo_serialization import jsonutils
from oslo_utils import excutils
from requests import sessions
from networking_odl.common import utils
            from networking_odl.common import lightweight_testing as lwt

    def create_client(cls, url=None):
        if cfg.CONF.ml2_odl.enable_lightweight_testing:
            LOG.debug("ODL lightweight testing is enabled, "
                      "returning a OpenDaylightLwtClient instance")

            # Have to import at here, otherwise we create a dependency loop
            # pylint: disable=import-outside-toplevel
            cls = lwt.OpenDaylightLwtClient

        url = url or cfg.CONF.ml2_odl.url
        cls._check_opt(url)
        return cls(
            url,
            cfg.CONF.ml2_odl.username,
            cfg.CONF.ml2_odl.password,
            cfg.CONF.ml2_odl.timeout)

    def __init__(self, url, username, password, timeout):
        super(OpenDaylightRestClient, self).__init__()
        self.url = url
        self.timeout = timeout
        self.session = sessions.Session()
        self.session.auth = (username, password)

    def get_resource(self, resource_type, resource_id):
        response = self.get(utils.make_url_object(resource_type) + '/' +
                            resource_id)
        if response.status_code == requests.codes.not_found:
            return None


        return self._check_response(response).json()