import eventlet
+from oslo.config import cfg as q_conf
+
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
from neutron.api.v2 import attributes
from neutron.db import dhcp_rpc_base
from neutron.db import external_net_db
from neutron.db import extraroute_db
-from neutron.db import l3_db
+from neutron.db import l3_agentschedulers_db
from neutron.db import l3_rpc_base
from neutron.db import portbindings_db
from neutron.extensions import portbindings
from neutron.extensions import providernet
+from neutron.openstack.common import importutils
from neutron.openstack.common import log as logging
from neutron.openstack.common import rpc
from neutron.openstack.common import uuidutils as uuidutils
class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
external_net_db.External_net_db_mixin,
extraroute_db.ExtraRoute_db_mixin,
- l3_db.L3_NAT_db_mixin,
portbindings_db.PortBindingMixin,
n1kv_db_v2.NetworkProfile_db_mixin,
n1kv_db_v2.PolicyProfile_db_mixin,
network_db_v2.Credential_db_mixin,
- agentschedulers_db.AgentSchedulerDbMixin):
+ l3_agentschedulers_db.L3AgentSchedulerDbMixin,
+ agentschedulers_db.DhcpAgentSchedulerDbMixin):
"""
Implement the Neutron abstractions using Cisco Nexus1000V.
supported_extension_aliases = ["provider", "agent",
"n1kv", "network_profile",
"policy_profile", "external-net", "router",
- "binding", "credential"]
+ "binding", "credential",
+ "l3_agent_scheduler",
+ "dhcp_agent_scheduler"]
def __init__(self, configfile=None):
"""
c_cred.Store.initialize()
self._setup_vsm()
self._setup_rpc()
+ self.network_scheduler = importutils.import_object(
+ q_conf.CONF.network_scheduler_driver
+ )
+ self.router_scheduler = importutils.import_object(
+ q_conf.CONF.router_scheduler_driver
+ )
def _setup_rpc(self):
# RPC support
:returns: port object
"""
if ('device_id' in port['port'] and port['port']['device_owner'] in
- [constants.DEVICE_OWNER_DHCP, constants.DEVICE_OWNER_ROUTER_INTF]):
+ [constants.DEVICE_OWNER_DHCP, constants.DEVICE_OWNER_ROUTER_INTF,
+ constants.DEVICE_OWNER_ROUTER_GW,
+ constants.DEVICE_OWNER_FLOATINGIP]):
p_profile_name = c_conf.CISCO_N1K.network_node_policy_profile
p_profile = self._get_policy_profile_by_name(p_profile_name)
if p_profile:
net_profile_id,
network_profile))
self._send_update_network_profile_request(net_p)
- return net_p
+ return net_p
+
+ def create_router(self, context, router):
+ """
+ Handle creation of router.
+
+ Schedule router to L3 agent as part of the create handling.
+ :param context: neutron api request context
+ :param router: router dictionary
+ :returns: router object
+ """
+ session = context.session
+ with session.begin(subtransactions=True):
+ rtr = (super(N1kvNeutronPluginV2, self).
+ create_router(context, router))
+ LOG.debug(_("Scheduling router %s"), rtr['id'])
+ self.schedule_router(context, rtr['id'])
+ return rtr