# Path: networking_odl/ml2/legacy_port_binding.py
# LOG = log.getLogger(__name__)
# class LegacyPortBindingManager(port_binding.PortBindingController):
#     def __init__(self):
#     def bind_port(self, port_context):
#     def _check_segment(self, segment):
#     def _get_vif_type(self, port_context):
# 
# Path: networking_odl/ml2/port_binding.py
# LOG = log.getLogger(__name__)
# class PortBindingController(object, metaclass=abc.ABCMeta):
# class PortBindingManager(PortBindingController):
#     def get_workers(self):
#     def bind_port(self, port_context):
#     def __init__(self, name, controller):
#     def create(
#             cls, namespace='networking_odl.ml2.port_binding_controllers',
#             name=None):
#     def get_workers(self):
#     def bind_port(self, port_context):
# 
# Path: networking_odl/tests/base.py
# class DietTestCase(base.DietTestCase):
# class OpenDaylightRestClientFixture(fixtures.Fixture):
# class OpenDaylightRestClientGlobalFixture(fixtures.Fixture):
# class OpenDaylightFeaturesFixture(fixtures.Fixture):
# class OpenDaylightJournalThreadFixture(fixtures.Fixture):
# class JournalWorkerPidFileFixture(fixtures.Fixture):
# class OpenDaylightPeriodicTaskFixture(fixtures.Fixture):
# class OpenDaylightPseudoAgentPrePopulateFixture(
#         nl_fixture.CallbackRegistryFixture):
# class OpenDaylightFullSyncFixture(fixtures.Fixture):
#     def patch(self, target, name, *args, **kwargs):
#     def _setUp(self):
#     def __init__(self, global_client):
#     def _setUp(self):
#     def _setUp(self):
#     def _setUp(self):
#     def remock_atexit(self):
#     def _setUp(self):
#     def _setUp(self):
#     def _setUp(self):
#     def _restore(self):
#     def _setUp(self):


from unittest import mock
from networking_odl.ml2 import legacy_port_binding
from networking_odl.ml2 import port_binding
from networking_odl.tests import base
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.




class TestPortBindingManager(base.DietTestCase):

    def test_create(self):
        mgr = port_binding.PortBindingManager.create(
            name="legacy-port-binding")
        self.assertEqual("legacy-port-binding", mgr.name)
        self.assertIsInstance(mgr.controller,
                              legacy_port_binding.LegacyPortBindingManager)

    def test_create_with_nonexist_name(self):
        self.assertRaises(AssertionError,
                          port_binding.PortBindingManager.create,
                          name="nonexist-port-binding")


# Path: networking_odl/ml2/legacy_port_binding.py
# LOG = log.getLogger(__name__)
# class LegacyPortBindingManager(port_binding.PortBindingController):
#     def __init__(self):
#     def bind_port(self, port_context):
#     def _check_segment(self, segment):
#     def _get_vif_type(self, port_context):
# 
# Path: networking_odl/ml2/port_binding.py
# LOG = log.getLogger(__name__)
# class PortBindingController(object, metaclass=abc.ABCMeta):
# class PortBindingManager(PortBindingController):
#     def get_workers(self):
#     def bind_port(self, port_context):
#     def __init__(self, name, controller):
#     def create(
#             cls, namespace='networking_odl.ml2.port_binding_controllers',
#             name=None):
#     def get_workers(self):
#     def bind_port(self, port_context):
# 
# Path: networking_odl/tests/base.py
# class DietTestCase(base.DietTestCase):
# class OpenDaylightRestClientFixture(fixtures.Fixture):
# class OpenDaylightRestClientGlobalFixture(fixtures.Fixture):
# class OpenDaylightFeaturesFixture(fixtures.Fixture):
# class OpenDaylightJournalThreadFixture(fixtures.Fixture):
# class JournalWorkerPidFileFixture(fixtures.Fixture):
# class OpenDaylightPeriodicTaskFixture(fixtures.Fixture):
# class OpenDaylightPseudoAgentPrePopulateFixture(
#         nl_fixture.CallbackRegistryFixture):
# class OpenDaylightFullSyncFixture(fixtures.Fixture):
#     def patch(self, target, name, *args, **kwargs):
#     def _setUp(self):
#     def __init__(self, global_client):
#     def _setUp(self):
#     def _setUp(self):
#     def _setUp(self):
#     def remock_atexit(self):
#     def _setUp(self):
#     def _setUp(self):
#     def _setUp(self):
#     def _restore(self):
#     def _setUp(self):


# Path: networking_odl/tests/unit/ml2/test_port_binding.py
from unittest import mock
from networking_odl.ml2 import legacy_port_binding
from networking_odl.ml2 import port_binding
from networking_odl.tests import base

#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.




class TestPortBindingManager(base.DietTestCase):

    def test_create(self):
        mgr = port_binding.PortBindingManager.create(
            name="legacy-port-binding")
        self.assertEqual("legacy-port-binding", mgr.name)
        self.assertIsInstance(mgr.controller,
                              legacy_port_binding.LegacyPortBindingManager)

    def test_create_with_nonexist_name(self):
        self.assertRaises(AssertionError,
                          port_binding.PortBindingManager.create,
                          name="nonexist-port-binding")


    @mock.patch.object(legacy_port_binding.LegacyPortBindingManager,