summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Leroy <maxime.leroy@6wind.com>2015-05-06 20:26:53 +0200
committerMaxime Leroy <maxime.leroy@6wind.com>2015-05-13 17:12:08 +0200
commitc77d53f049948759825e76f216a495e1184b0194 (patch)
tree7ad985e65d406c5536e20a85b308389b066eead4
parentacbe6a00bb824e4b1a2449ce39176944b3b582b7 (diff)
tests: add unit tests for ovs-fp ml2 mech
Units tests based on the official mech_openvswitch tests. "tox -e py27" should return the following output: OVSFPMechanismVlanTestCase.test_type_vlan_bad [0.077848s] ... ok OVSFPMechanismSGDisabledLocalTestCase.test_type_local [0.074092s] ... ok OVSFPMechanismGreTestCase.test_type_gre [0.077582s] ... ok OVSFPMechanismGenericTestCase.test_unknown_type [0.074716s] ... ok OVSFPMechanismGreTestCase.test_type_gre_bad [0.076943s] ... ok OVSFPMechanismVlanTestCase.test_type_vlan [0.077639s] ... ok OVSFPMechanismSGDisabledLocalTestCase.test_type_local_dead [0.075834s] ... ok OVSFPMechanismLocalTestCase.test_type_local [0.116571s] ... ok OVSFPMechanismFlatTestCase.test_type_flat_bad [0.116716s] ... ok OVSFPMechanismFlatTestCase.test_type_flat [0.120457s] ... ok OVSFPMechanismLocalTestCase.test_type_local_dead [0.120383s] ... ok Change-Id: Iea598e1417ded9a84281816ce55c7924bf290544
Notes
Notes (review): Verified+2: Jenkins Code-Review+2: Samuel Gauthier <samuel.gauthier@6wind.com> Workflow+1: Samuel Gauthier <samuel.gauthier@6wind.com> Submitted-by: Jenkins Submitted-at: Wed, 13 May 2015 15:40:58 +0000 Reviewed-on: https://review.openstack.org/182712 Project: stackforge/networking-6wind Branch: refs/heads/master
-rw-r--r--networking_6wind/tests/base.py23
-rw-r--r--networking_6wind/tests/test_networking_6wind.py28
-rw-r--r--networking_6wind/tests/unit/__init__.py0
-rw-r--r--networking_6wind/tests/unit/ml2_drivers/__init__.py0
-rw-r--r--networking_6wind/tests/unit/ml2_drivers/test_mech_ovs_fp.py85
5 files changed, 85 insertions, 51 deletions
diff --git a/networking_6wind/tests/base.py b/networking_6wind/tests/base.py
deleted file mode 100644
index 1c30cdb..0000000
--- a/networking_6wind/tests/base.py
+++ /dev/null
@@ -1,23 +0,0 @@
1# -*- coding: utf-8 -*-
2
3# Copyright 2010-2011 OpenStack Foundation
4# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18from oslotest import base
19
20
21class TestCase(base.BaseTestCase):
22
23 """Test case base class for all unit tests."""
diff --git a/networking_6wind/tests/test_networking_6wind.py b/networking_6wind/tests/test_networking_6wind.py
deleted file mode 100644
index 2e9c742..0000000
--- a/networking_6wind/tests/test_networking_6wind.py
+++ /dev/null
@@ -1,28 +0,0 @@
1# -*- coding: utf-8 -*-
2
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15"""
16test_networking_6wind
17----------------------------------
18
19Tests for `networking_6wind` module.
20"""
21
22from networking_6wind.tests import base
23
24
25class TestNetworking_6wind(base.TestCase):
26
27 def test_something(self):
28 pass
diff --git a/networking_6wind/tests/unit/__init__.py b/networking_6wind/tests/unit/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/networking_6wind/tests/unit/__init__.py
diff --git a/networking_6wind/tests/unit/ml2_drivers/__init__.py b/networking_6wind/tests/unit/ml2_drivers/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/networking_6wind/tests/unit/ml2_drivers/__init__.py
diff --git a/networking_6wind/tests/unit/ml2_drivers/test_mech_ovs_fp.py b/networking_6wind/tests/unit/ml2_drivers/test_mech_ovs_fp.py
new file mode 100644
index 0000000..3e02334
--- /dev/null
+++ b/networking_6wind/tests/unit/ml2_drivers/test_mech_ovs_fp.py
@@ -0,0 +1,85 @@
1# Copyright 2015 6WIND S.A.
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
16from oslo.config import cfg
17
18from networking_6wind.common import constants
19from networking_6wind.common.utils import get_vif_vhostuser_socket
20from networking_6wind.ml2_drivers import mech_ovs_fp
21
22from neutron.extensions import portbindings
23from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base
24from neutron.tests.unit.plugins.ml2.drivers import (
25 test_mech_openvswitch as test_ovs)
26
27
28class OVSFPMechanismBaseTestCase(test_ovs.OpenvswitchMechanismBaseTestCase):
29 VIF_TYPE = constants.VIF_TYPE_VHOSTUSER
30 VIF_DETAILS = {portbindings.CAP_PORT_FILTER: True,
31 portbindings.OVS_HYBRID_PLUG: True,
32 constants.VIF_PLUGIN_SCRIPT: "vif-ovs-fp-plug",
33 constants.VIF_VHOSTUSER_SOCKET: get_vif_vhostuser_socket(
34 base.PORT_ID)}
35
36 def setUp(self):
37 super(OVSFPMechanismBaseTestCase, self).setUp()
38 self.driver = mech_ovs_fp.OVSFPMechanismDriver()
39 self.driver.initialize()
40
41
42class OVSFPMechanismSGDisabledBaseTestCase(
43 OVSFPMechanismBaseTestCase):
44 VIF_DETAILS = {portbindings.CAP_PORT_FILTER: False,
45 portbindings.OVS_HYBRID_PLUG: False,
46 constants.VIF_PLUGIN_SCRIPT: "vif-ovs-fp-plug",
47 constants.VIF_VHOSTUSER_SOCKET: get_vif_vhostuser_socket(
48 base.PORT_ID)}
49
50 def setUp(self):
51 cfg.CONF.set_override('enable_security_group',
52 False,
53 group='SECURITYGROUP')
54 super(OVSFPMechanismSGDisabledBaseTestCase, self).setUp()
55
56
57class OVSFPMechanismGenericTestCase(OVSFPMechanismBaseTestCase,
58 base.AgentMechanismGenericTestCase):
59 pass
60
61
62class OVSFPMechanismLocalTestCase(OVSFPMechanismBaseTestCase,
63 base.AgentMechanismLocalTestCase):
64 pass
65
66
67class OVSFPMechanismFlatTestCase(OVSFPMechanismBaseTestCase,
68 base.AgentMechanismFlatTestCase):
69 pass
70
71
72class OVSFPMechanismVlanTestCase(OVSFPMechanismBaseTestCase,
73 base.AgentMechanismVlanTestCase):
74 pass
75
76
77class OVSFPMechanismGreTestCase(OVSFPMechanismBaseTestCase,
78 base.AgentMechanismGreTestCase):
79 pass
80
81
82class OVSFPMechanismSGDisabledLocalTestCase(
83 OVSFPMechanismSGDisabledBaseTestCase,
84 base.AgentMechanismLocalTestCase):
85 pass