Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of the patch set that enables VM's to use libvirts bridge type.
Fixes bug 1078210 The patch set enables the following: 1. Bridges to be created by Nova 2. Bridges to be created by the agent The code is backward compatible, that is, if Nova does not create the brdige then the agent will create the bridge. In addition to this it cleans gateway code no longer used. The patch enables the following Nova code to be backported: https://review.openstack.org/#/c/14830/ Change-Id: Ia621ba5edd12d8eb7ea412a2993fea43189bd511
- Loading branch information
Gary Kotton
committed
Nov 17, 2012
1 parent
aeef038
commit 04aab72
Showing
2 changed files
with
100 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||
|
||
# Copyright (c) 2012 OpenStack, LLC. | ||
# | ||
# 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. | ||
|
||
import mock | ||
import unittest2 as unittest | ||
|
||
from quantum.openstack.common import cfg | ||
from quantum.plugins.linuxbridge.agent import linuxbridge_quantum_agent | ||
from quantum.plugins.linuxbridge.common import config | ||
from quantum.plugins.linuxbridge.common import constants as lconst | ||
|
||
|
||
class TestLinuxBridge(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.addCleanup(cfg.CONF.reset) | ||
interface_mappings = {'physnet1': 'eth1'} | ||
root_helper = cfg.CONF.AGENT.root_helper | ||
|
||
self.linux_bridge = linuxbridge_quantum_agent.LinuxBridge( | ||
interface_mappings, root_helper) | ||
|
||
def test_ensure_physical_in_bridge_invalid(self): | ||
result = self.linux_bridge.ensure_physical_in_bridge('network_id', | ||
'physnetx', | ||
7) | ||
self.assertFalse(result) | ||
|
||
def test_ensure_physical_in_bridge_flat(self): | ||
with mock.patch.object(self.linux_bridge, | ||
'ensure_flat_bridge') as flat_bridge_func: | ||
result = self.linux_bridge.ensure_physical_in_bridge( | ||
'network_id', 'physnet1', lconst.FLAT_VLAN_ID) | ||
self.assertTrue(flat_bridge_func.called) | ||
|
||
def test_ensure_physical_in_bridge_vlan(self): | ||
with mock.patch.object(self.linux_bridge, | ||
'ensure_vlan_bridge') as vlan_bridge_func: | ||
result = self.linux_bridge.ensure_physical_in_bridge( | ||
'network_id', 'physnet1', 7) | ||
self.assertTrue(vlan_bridge_func.called) |