Add support for router scheduling in Cisco N1kv Plugin
Added functionality for router and network scheduling in Cisco N1kv Plugin. Change-Id: I1a8d27670d10ca26fb62a8d02230a1aaf3e7bbca Closes-Bug: #1286412
This commit is contained in:
parent
025d7c3413
commit
8afbe03190
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
import eventlet
|
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 dhcp_rpc_agent_api
|
||||||
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
|
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
|
||||||
from neutron.api.v2 import attributes
|
from neutron.api.v2 import attributes
|
||||||
@ -35,11 +37,12 @@ from neutron.db import db_base_plugin_v2
|
|||||||
from neutron.db import dhcp_rpc_base
|
from neutron.db import dhcp_rpc_base
|
||||||
from neutron.db import external_net_db
|
from neutron.db import external_net_db
|
||||||
from neutron.db import extraroute_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 l3_rpc_base
|
||||||
from neutron.db import portbindings_db
|
from neutron.db import portbindings_db
|
||||||
from neutron.extensions import portbindings
|
from neutron.extensions import portbindings
|
||||||
from neutron.extensions import providernet
|
from neutron.extensions import providernet
|
||||||
|
from neutron.openstack.common import importutils
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.openstack.common import rpc
|
from neutron.openstack.common import rpc
|
||||||
from neutron.openstack.common import uuidutils as uuidutils
|
from neutron.openstack.common import uuidutils as uuidutils
|
||||||
@ -78,12 +81,12 @@ class N1kvRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
|
|||||||
class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
external_net_db.External_net_db_mixin,
|
external_net_db.External_net_db_mixin,
|
||||||
extraroute_db.ExtraRoute_db_mixin,
|
extraroute_db.ExtraRoute_db_mixin,
|
||||||
l3_db.L3_NAT_db_mixin,
|
|
||||||
portbindings_db.PortBindingMixin,
|
portbindings_db.PortBindingMixin,
|
||||||
n1kv_db_v2.NetworkProfile_db_mixin,
|
n1kv_db_v2.NetworkProfile_db_mixin,
|
||||||
n1kv_db_v2.PolicyProfile_db_mixin,
|
n1kv_db_v2.PolicyProfile_db_mixin,
|
||||||
network_db_v2.Credential_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.
|
Implement the Neutron abstractions using Cisco Nexus1000V.
|
||||||
@ -99,7 +102,9 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
|||||||
supported_extension_aliases = ["provider", "agent",
|
supported_extension_aliases = ["provider", "agent",
|
||||||
"n1kv", "network_profile",
|
"n1kv", "network_profile",
|
||||||
"policy_profile", "external-net", "router",
|
"policy_profile", "external-net", "router",
|
||||||
"binding", "credential"]
|
"binding", "credential",
|
||||||
|
"l3_agent_scheduler",
|
||||||
|
"dhcp_agent_scheduler"]
|
||||||
|
|
||||||
def __init__(self, configfile=None):
|
def __init__(self, configfile=None):
|
||||||
"""
|
"""
|
||||||
@ -119,6 +124,12 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
|||||||
c_cred.Store.initialize()
|
c_cred.Store.initialize()
|
||||||
self._setup_vsm()
|
self._setup_vsm()
|
||||||
self._setup_rpc()
|
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):
|
def _setup_rpc(self):
|
||||||
# RPC support
|
# RPC support
|
||||||
@ -1155,7 +1166,9 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
|||||||
:returns: port object
|
:returns: port object
|
||||||
"""
|
"""
|
||||||
if ('device_id' in port['port'] and port['port']['device_owner'] in
|
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_name = c_conf.CISCO_N1K.network_node_policy_profile
|
||||||
p_profile = self._get_policy_profile_by_name(p_profile_name)
|
p_profile = self._get_policy_profile_by_name(p_profile_name)
|
||||||
if p_profile:
|
if p_profile:
|
||||||
@ -1413,4 +1426,21 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
|||||||
net_profile_id,
|
net_profile_id,
|
||||||
network_profile))
|
network_profile))
|
||||||
self._send_update_network_profile_request(net_p)
|
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
|
||||||
|
@ -37,6 +37,8 @@ from neutron.tests.unit import _test_extension_portbindings as test_bindings
|
|||||||
from neutron.tests.unit.cisco.n1kv import fake_client
|
from neutron.tests.unit.cisco.n1kv import fake_client
|
||||||
from neutron.tests.unit import test_api_v2
|
from neutron.tests.unit import test_api_v2
|
||||||
from neutron.tests.unit import test_db_plugin as test_plugin
|
from neutron.tests.unit import test_db_plugin as test_plugin
|
||||||
|
from neutron.tests.unit import test_l3_plugin
|
||||||
|
from neutron.tests.unit import test_l3_schedulers
|
||||||
|
|
||||||
|
|
||||||
PHYS_NET = 'some-phys-net'
|
PHYS_NET = 'some-phys-net'
|
||||||
@ -546,3 +548,13 @@ class TestN1kvSubnets(test_plugin.TestSubnetsV2,
|
|||||||
N1kvPluginTestCase):
|
N1kvPluginTestCase):
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class TestN1kvL3Test(test_l3_plugin.L3NatExtensionTestCase):
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class TestN1kvL3SchedulersTest(test_l3_schedulers.L3SchedulerTestCase):
|
||||||
|
|
||||||
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user