Modify add_bridge_ports(...) to include port up and permisc code

This fixes bug#1570411 where the add_bridge_port(...) function was
modified to include a port type but missed off port up and promisc
features.

Change-Id: I2a304270be97ed1eae5a7ceeb5777514460d8b4f
Closes-Bug: #1570411
This commit is contained in:
Alex Kavanagh 2016-04-14 19:45:38 +00:00
parent cdb6f31f02
commit 1dfe139242
2 changed files with 6 additions and 5 deletions

View File

@ -24,7 +24,7 @@ from charmhelpers.contrib.openstack.utils import (
import neutron_ovs_context
from charmhelpers.contrib.network.ovs import (
add_bridge,
# add_bridge_port,
add_bridge_port,
full_restart,
)
from charmhelpers.core.hookenv import (
@ -364,8 +364,8 @@ def configure_ovs():
device_index = 0
for br in dpdk_bridgemaps.itervalues():
add_bridge(br, datapath_type)
add_bridge_port(br, 'dpdk{}'.format(device_index),
port_type='dpdk')
dpdk_add_bridge_port(br, 'dpdk{}'.format(device_index),
port_type='dpdk')
device_index += 1
# Ensure this runs so that mtu is applied to data-port interfaces if
@ -405,7 +405,7 @@ def use_dpdk():
# TODO: update into charm-helpers to add port_type parameter
def add_bridge_port(name, port, promisc=False, port_type=None):
def dpdk_add_bridge_port(name, port, promisc=False, port_type=None):
''' Add a port to the named openvswitch bridge '''
# log('Adding port {} to bridge {}'.format(port, name))
cmd = ["ovs-vsctl", "--", "--may-exist", "add-port", name, port]

View File

@ -17,6 +17,7 @@ import charmhelpers.core.hookenv as hookenv
TO_PATCH = [
'add_bridge',
'add_bridge_port',
'dpdk_add_bridge_port',
'apt_install',
'apt_update',
'config',
@ -360,7 +361,7 @@ class TestNeutronOVSUtils(CharmTestCase):
call('br-phynet2', 'netdev'),
call('br-phynet3', 'netdev'),
])
self.add_bridge_port.assert_has_calls([
self.dpdk_add_bridge_port.assert_has_calls([
call('br-phynet1', 'dpdk0', port_type='dpdk'),
call('br-phynet2', 'dpdk1', port_type='dpdk'),
call('br-phynet3', 'dpdk2', port_type='dpdk'),