~ubuntu-branches/ubuntu/vivid/neutron/vivid-proposed

« back to all changes in this revision

Viewing changes to neutron/tests/unit/plugins/ml2/drivers/opendaylight/test_driver.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2015-04-15 13:59:07 UTC
  • mfrom: (1.1.22)
  • Revision ID: package-import@ubuntu.com-20150415135907-z10fr18evag1ozq3
Tags: 1:2015.1~rc1-0ubuntu1
* New upstream milestone release:
  - debian/control: Update dependencies. 
  - debian/patches/disable-udev-tests.patch: Dropped no longer needed.
  - debian/patches/fixup-driver-test-execution.patch: Dropped no longer needed.
  - debian/patches/skip-iptest.patch: Skip failing test
  - debian/neutron-plugin-openvswitch-agent.install: Added neutron-ovsvapp-agent binary.
  - debian/neutron-plugin-cisco.install: Added neutron-cisco-apic-service-agent and 
    neutron-cisco-apic-host-agent

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (c) 2013-2015 OpenStack Foundation
 
2
# All Rights Reserved.
 
3
#
 
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
 
7
#
 
8
#         http://www.apache.org/licenses/LICENSE-2.0
 
9
#
 
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
 
14
#    under the License.
 
15
 
 
16
import sys
 
17
 
 
18
import mock
 
19
from neutron import context
 
20
from neutron.tests.unit.plugins.ml2 import test_plugin
 
21
 
 
22
 
 
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
 
29
 
 
30
 
 
31
class TestODLShim(test_plugin.Ml2PluginV2TestCase):
 
32
 
 
33
    def setUp(self):
 
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()
 
39
 
 
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',
 
43
                                                           const.ODL_NETWORKS,
 
44
                                                           self.context)
 
45
 
 
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',
 
49
                                                           const.ODL_NETWORKS,
 
50
                                                           self.context)
 
51
 
 
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',
 
55
                                                           const.ODL_NETWORKS,
 
56
                                                           self.context)
 
57
 
 
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',
 
61
                                                           const.ODL_SUBNETS,
 
62
                                                           self.context)
 
63
 
 
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',
 
67
                                                           const.ODL_SUBNETS,
 
68
                                                           self.context)
 
69
 
 
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',
 
73
                                                           const.ODL_SUBNETS,
 
74
                                                           self.context)
 
75
 
 
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',
 
79
                                                           const.ODL_PORTS,
 
80
                                                           self.context)
 
81
 
 
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',
 
85
                                                           const.ODL_PORTS,
 
86
                                                           self.context)
 
87
 
 
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',
 
91
                                                           const.ODL_PORTS,
 
92
                                                           self.context)