Commit 07f7a8dd authored by David Johnson's avatar David Johnson

Forgot the Nova Neutron API wrapper in initial commit.

No wonder I couldn't figure out (again) how the Nova vif driver was
figuring out which physical OVS bridge to plug a Capnet VM NIC into...
I had forgotten about this little guy.  This is a simple wrapper for
the Nova network API Neutron driver that adds a couple of
Capnet-specific fields into the VIF info.  This seemed to be the way
to do it at the time... maybe there's a way to not have to do it
parent bfd788c9
Pipeline #1122 skipped
from oslo_config import cfg
from oslo_log import log as logging
from import API as NeutronAPI
from networking_capnet.common import config as cn_config
LOG = logging.getLogger(__name__)
class API(NeutronAPI):
def __init__(self, skip_policy_check=False):
super(API, self).__init__(skip_policy_check=skip_policy_check)
self.bridge_mappings = {}
for mapping in cfg.CONF.CAPNET.bridge_mappings:
sma = mapping.split(':')
self.bridge_mappings[sma[0]] = sma[1]
pass"Initialized Capnet bridge_mappings: %s"
% (str(self.bridge_mappings)))
LOG.exception("Failed to initialize Capnet Neutron Interface Driver;"
" will effectively revert to openvswitch driver")
def _nw_info_build_network(self, port, networks, subnets):
(network, ovs_interfaceid) = \
super(API,self)._nw_info_build_network(port,networks,subnets)"port = %s, networks = %s, subnets = %s"
% (str(port),str(networks),str(subnets)))
for net in networks:
if net['id'] == port['network_id'] \
and 'provider:physical_network' in net \
and net['provider:physical_network'] in self.bridge_mappings:
network['physical_network'] = net['provider:physical_network']
network['bridge'] = \
ovs_interfaceid = port['id']"updated bridge for port %s network %s %s to %s/%s"
% (port['id'],net['name'],net['id'],
return (network, ovs_interfaceid)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment