1
# Copyright (c) 2013-2015 OpenStack Foundation
4
# Licensed under the Apache License, Version 2.0 (the "License"); you may
5
# not use this file except in compliance with the License. You may obtain
6
# a copy of the License at
8
# http://www.apache.org/licenses/LICENSE-2.0
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
# License for the specific language governing permissions and limitations
19
from neutron import context
20
from neutron.tests.unit.plugins.ml2 import test_plugin
23
with mock.patch.dict(sys.modules,
24
{'networking_odl': mock.Mock(),
25
'networking_odl.common': mock.Mock(),
26
'networking_odl.ml2': mock.Mock()}):
27
from networking_odl.common import constants as const
28
from neutron.plugins.ml2.drivers.opendaylight import driver
31
class TestODLShim(test_plugin.Ml2PluginV2TestCase):
34
super(TestODLShim, self).setUp()
35
self.context = context.get_admin_context()
36
self.plugin = mock.Mock()
37
self.driver = driver.OpenDaylightMechanismDriver()
38
self.driver.odl_drv = mock.Mock()
40
def test_create_network_postcommit(self):
41
self.driver.create_network_postcommit(self.context)
42
self.driver.odl_drv.synchronize.assert_called_with('create',
46
def test_update_network_postcommit(self):
47
self.driver.update_network_postcommit(self.context)
48
self.driver.odl_drv.synchronize.assert_called_with('update',
52
def test_delete_network_postcommit(self):
53
self.driver.delete_network_postcommit(self.context)
54
self.driver.odl_drv.synchronize.assert_called_with('delete',
58
def test_create_subnet_postcommit(self):
59
self.driver.create_subnet_postcommit(self.context)
60
self.driver.odl_drv.synchronize.assert_called_with('create',
64
def test_update_subnet_postcommit(self):
65
self.driver.update_subnet_postcommit(self.context)
66
self.driver.odl_drv.synchronize.assert_called_with('update',
70
def test_delete_subnet_postcommit(self):
71
self.driver.delete_subnet_postcommit(self.context)
72
self.driver.odl_drv.synchronize.assert_called_with('delete',
76
def test_create_port_postcommit(self):
77
self.driver.create_port_postcommit(self.context)
78
self.driver.odl_drv.synchronize.assert_called_with('create',
82
def test_update_port_postcommit(self):
83
self.driver.update_port_postcommit(self.context)
84
self.driver.odl_drv.synchronize.assert_called_with('update',
88
def test_delete_port_postcommit(self):
89
self.driver.delete_port_postcommit(self.context)
90
self.driver.odl_drv.synchronize.assert_called_with('delete',