1 # Copyright (C) 2015 VA Linux Systems Japan K.K.
2 # Copyright (C) 2015 YAMAMOTO Takashi <yamamoto at valinux co jp>
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License. You may obtain
7 # a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 # License for the specific language governing permissions and limitations
19 import ryu.app.ofctl.api # noqa
20 from ryu.base import app_manager
21 from ryu.lib import hub
22 from ryu.ofproto import ofproto_v1_3
24 from neutron.plugins.ml2.drivers.openvswitch.agent.openflow.native \
26 from neutron.plugins.ml2.drivers.openvswitch.agent.openflow.native \
28 from neutron.plugins.ml2.drivers.openvswitch.agent.openflow.native \
30 from neutron.plugins.ml2.drivers.openvswitch.agent \
31 import ovs_neutron_agent as ovs_agent
34 class OVSNeutronAgentRyuApp(app_manager.RyuApp):
35 OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
38 # Start Ryu event loop thread
39 super(OVSNeutronAgentRyuApp, self).start()
41 def _make_br_cls(br_cls):
42 return functools.partial(br_cls, ryu_app=self)
44 # Start agent main loop thread
46 'br_int': _make_br_cls(br_int.OVSIntegrationBridge),
47 'br_phys': _make_br_cls(br_phys.OVSPhysicalBridge),
48 'br_tun': _make_br_cls(br_tun.OVSTunnelBridge),
50 return hub.spawn(ovs_agent.main, bridge_classes)