# Path: networking_odl/_i18n.py
# DOMAIN = "networking_odl"
# _C = _translators.contextual_form
# _P = _translators.plural_form
# def get_available_languages():
# 
# Path: networking_odl/common/client.py
# LOG = log.getLogger(__name__)
# class OpenDaylightRestClient(object):
# class OpenDaylightRestClientGlobal(object):
#     def _check_opt(url):
#     def create_client(cls, url=None):
#     def __init__(self, url, username, password, timeout):
#     def get_resource(self, resource_type, resource_id):
#     def get(self, urlpath='', data=None):
#     def request(self, method, urlpath='', data=None):
#     def sendjson(self, method, urlpath, obj):
#     def _check_response(self, response):
#     def __init__(self):
#     def get_client(self):


import re
import ssl
import threading
import time
import websocket
from oslo_config import cfg
from oslo_log import log
from oslo_serialization import jsonutils
from oslo_utils import excutils
from requests import codes
from requests import exceptions
from networking_odl._i18n import _
from networking_odl.common import client as odl_client
            # we handle them all the same way, return None.
            # As such, enough to just "except Exception."
            LOG.exception("websocket create connection failed",
                          exc_info=True)
            return None
        if ws is None or not ws.connected:
            LOG.error("websocket create connection unsuccessful")
            return None

        LOG.debug("websocket connection established")
        return ws

    def _connect_ws(self):
        self._set_websocket_status(ODL_WEBSOCKET_CONNECTING)
        stream_url = self._subscribe_websocket()
        if stream_url is None:
            return None
        if 'https:' in self.odl_rest_client.url and 'wss:' not in stream_url:
            LOG.warning('TLS ODL URL detected, but websocket URL is not.  '
                        'Forcing websocket URL to TLS')
            stream_url = stream_url.replace('ws:', 'wss:')
        # Delay here causes websocket notification lose (ODL Bug 8299)
        ws = self._socket_create_connection(stream_url)
        if ws is not None:
            self._set_websocket_status(ODL_WEBSOCKET_CONNECTED)
        return ws

    def _close_ws(self, ws):
        LOG.debug("closing websocket")
        try:

# Path: networking_odl/_i18n.py
# DOMAIN = "networking_odl"
# _C = _translators.contextual_form
# _P = _translators.plural_form
# def get_available_languages():
# 
# Path: networking_odl/common/client.py
# LOG = log.getLogger(__name__)
# class OpenDaylightRestClient(object):
# class OpenDaylightRestClientGlobal(object):
#     def _check_opt(url):
#     def create_client(cls, url=None):
#     def __init__(self, url, username, password, timeout):
#     def get_resource(self, resource_type, resource_id):
#     def get(self, urlpath='', data=None):
#     def request(self, method, urlpath='', data=None):
#     def sendjson(self, method, urlpath, obj):
#     def _check_response(self, response):
#     def __init__(self):
#     def get_client(self):


# Path: networking_odl/common/websocket_client.py
import re
import ssl
import threading
import time
import websocket
from oslo_config import cfg
from oslo_log import log
from oslo_serialization import jsonutils
from oslo_utils import excutils
from requests import codes
from requests import exceptions
from networking_odl._i18n import _
from networking_odl.common import client as odl_client

            # we handle them all the same way, return None.
            # As such, enough to just "except Exception."
            LOG.exception("websocket create connection failed",
                          exc_info=True)
            return None
        if ws is None or not ws.connected:
            LOG.error("websocket create connection unsuccessful")
            return None

        LOG.debug("websocket connection established")
        return ws

    def _connect_ws(self):
        self._set_websocket_status(ODL_WEBSOCKET_CONNECTING)
        stream_url = self._subscribe_websocket()
        if stream_url is None:
            return None
        if 'https:' in self.odl_rest_client.url and 'wss:' not in stream_url:
            LOG.warning('TLS ODL URL detected, but websocket URL is not.  '
                        'Forcing websocket URL to TLS')
            stream_url = stream_url.replace('ws:', 'wss:')
        # Delay here causes websocket notification lose (ODL Bug 8299)
        ws = self._socket_create_connection(stream_url)
        if ws is not None:
            self._set_websocket_status(ODL_WEBSOCKET_CONNECTED)
        return ws

    def _close_ws(self, ws):
        LOG.debug("closing websocket")
        try:

            if ws is not None: