# License for the specific language governing permissions and limitations
# under the License.
+from networking_odl.common import constants as odl_const
from networking_odl.ml2 import mech_driver
from oslo.config import cfg
LOG = log.getLogger(__name__)
-ODL_NETWORKS = 'networks'
-ODL_SUBNETS = 'subnets'
-ODL_PORTS = 'ports'
-
odl_opts = [
cfg.StrOpt('url',
help=_("HTTP URL of OpenDaylight REST interface.")),
# Postcommit hooks are used to trigger synchronization.
def create_network_postcommit(self, context):
- self.odl_drv.synchronize('create', ODL_NETWORKS, context)
+ self.odl_drv.synchronize('create', odl_const.ODL_NETWORKS, context)
def update_network_postcommit(self, context):
- self.odl_drv.synchronize('update', ODL_NETWORKS, context)
+ self.odl_drv.synchronize('update', odl_const.ODL_NETWORKS, context)
def delete_network_postcommit(self, context):
- self.odl_drv.synchronize('delete', ODL_NETWORKS, context)
+ self.odl_drv.synchronize('delete', odl_const.ODL_NETWORKS, context)
def create_subnet_postcommit(self, context):
- self.odl_drv.synchronize('create', ODL_SUBNETS, context)
+ self.odl_drv.synchronize('create', odl_const.ODL_SUBNETS, context)
def update_subnet_postcommit(self, context):
- self.odl_drv.synchronize('update', ODL_SUBNETS, context)
+ self.odl_drv.synchronize('update', odl_const.ODL_SUBNETS, context)
def delete_subnet_postcommit(self, context):
- self.odl_drv.synchronize('delete', ODL_SUBNETS, context)
+ self.odl_drv.synchronize('delete', odl_const.ODL_SUBNETS, context)
def create_port_postcommit(self, context):
- self.odl_drv.synchronize('create', ODL_PORTS, context)
+ self.odl_drv.synchronize('create', odl_const.ODL_PORTS, context)
def update_port_postcommit(self, context):
- self.odl_drv.synchronize('update', ODL_PORTS, context)
+ self.odl_drv.synchronize('update', odl_const.ODL_PORTS, context)
def delete_port_postcommit(self, context):
- self.odl_drv.synchronize('delete', ODL_PORTS, context)
+ self.odl_drv.synchronize('delete', odl_const.ODL_PORTS, context)
def bind_port(self, context):
LOG.debug("Attempting to bind port %(port)s on "
from neutron.tests.unit.ml2 import test_ml2_plugin as test_plugin
-ODL_NETWORKS = 'networks'
-ODL_SUBNETS = 'subnets'
-ODL_PORTS = 'ports'
-
-
with mock.patch.dict(sys.modules,
{'networking_odl': mock.Mock(),
+ 'networking_odl.common': mock.Mock(),
'networking_odl.ml2': mock.Mock()}):
+ from networking_odl.common import constants as const
from neutron.plugins.ml2.drivers import mechanism_odl
def test_create_network_postcommit(self):
self.driver.create_network_postcommit(self.context)
self.driver.odl_drv.synchronize.assert_called_with('create',
- ODL_NETWORKS,
+ const.ODL_NETWORKS,
self.context)
def test_update_network_postcommit(self):
self.driver.update_network_postcommit(self.context)
self.driver.odl_drv.synchronize.assert_called_with('update',
- ODL_NETWORKS,
+ const.ODL_NETWORKS,
self.context)
def test_delete_network_postcommit(self):
self.driver.delete_network_postcommit(self.context)
self.driver.odl_drv.synchronize.assert_called_with('delete',
- ODL_NETWORKS,
+ const.ODL_NETWORKS,
self.context)
def test_create_subnet_postcommit(self):
self.driver.create_subnet_postcommit(self.context)
self.driver.odl_drv.synchronize.assert_called_with('create',
- ODL_SUBNETS,
+ const.ODL_SUBNETS,
self.context)
def test_update_subnet_postcommit(self):
self.driver.update_subnet_postcommit(self.context)
self.driver.odl_drv.synchronize.assert_called_with('update',
- ODL_SUBNETS,
+ const.ODL_SUBNETS,
self.context)
def test_delete_subnet_postcommit(self):
self.driver.delete_subnet_postcommit(self.context)
self.driver.odl_drv.synchronize.assert_called_with('delete',
- ODL_SUBNETS,
+ const.ODL_SUBNETS,
self.context)
def test_create_port_postcommit(self):
self.driver.create_port_postcommit(self.context)
self.driver.odl_drv.synchronize.assert_called_with('create',
- ODL_PORTS,
+ const.ODL_PORTS,
self.context)
def test_update_port_postcommit(self):
self.driver.update_port_postcommit(self.context)
self.driver.odl_drv.synchronize.assert_called_with('update',
- ODL_PORTS,
+ const.ODL_PORTS,
self.context)
def test_delete_port_postcommit(self):
self.driver.delete_port_postcommit(self.context)
self.driver.odl_drv.synchronize.assert_called_with('delete',
- ODL_PORTS,
+ const.ODL_PORTS,
self.context)