from neutron.db import api as db
from neutron.db import db_base_plugin_v2
from neutron.db import dhcp_rpc_base
+from neutron.db import extradhcpopt_db
from neutron.db import l3_db
+from neutron.extensions import extra_dhcp_opt as edo_ext
from neutron.extensions import l3
from neutron.extensions import portbindings
from neutron.openstack.common import log as logging
class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2,
- routerrule_db.RouterRule_db_mixin):
+ routerrule_db.RouterRule_db_mixin,
+ extradhcpopt_db.ExtraDhcpOptMixin):
- supported_extension_aliases = ["router", "binding", "router_rules"]
+ supported_extension_aliases = ["router", "binding", "router_rules",
+ "extra_dhcp_opt"]
def __init__(self, server_timeout=None):
LOG.info(_('NeutronRestProxy: Starting plugin. Version=%s'),
# Update DB
port["port"]["admin_state_up"] = False
+ dhcp_opts = port['port'].get(edo_ext.EXTRADHCPOPTS, [])
new_port = super(NeutronRestProxyV2, self).create_port(context, port)
if (portbindings.HOST_ID in port['port']
and 'id' in new_port):
porttracker_db.put_port_hostid(context, new_port['id'],
port['port'][portbindings.HOST_ID])
+ self._process_port_create_extra_dhcp_opts(context, new_port, dhcp_opts)
new_port = self._extend_port_dict_binding(context, new_port)
net = super(NeutronRestProxyV2,
self).get_network(context, new_port["network_id"])
# Update DB
new_port = super(NeutronRestProxyV2, self).update_port(context,
port_id, port)
+ self._update_extra_dhcp_opts_on_port(context, port_id, port, new_port)
if (portbindings.HOST_ID in port['port']
and 'id' in new_port):
porttracker_db.put_port_hostid(context, new_port['id'],
from neutron.openstack.common.notifier import api as notifier_api
from neutron.openstack.common.notifier import test_notifier
from neutron.plugins.bigswitch.extensions import routerrule
+from neutron.tests.unit import test_extension_extradhcpopts as test_extradhcp
from neutron.tests.unit import test_l3_plugin
return []
+class DHCPOptsTestCase(test_extradhcp.TestExtraDhcpOpt):
+
+ def setUp(self, plugin=None):
+ self.httpPatch = patch('httplib.HTTPConnection', create=True,
+ new=HTTPConnectionMock)
+ self.httpPatch.start()
+ self.addCleanup(self.httpPatch.stop)
+ p_path = 'neutron.plugins.bigswitch.plugin.NeutronRestProxyV2'
+ super(test_extradhcp.ExtraDhcpOptDBTestCase, self).setUp(plugin=p_path)
+
+
class RouterDBTestCase(test_l3_plugin.L3NatDBTestCase):
def setUp(self):