diff --git a/neutron/objects/port/__init__.py b/neutron/objects/port/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/objects/port/extensions/__init__.py b/neutron/objects/port/extensions/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/objects/port/extensions/extra_dhcp_opt.py b/neutron/objects/port/extensions/extra_dhcp_opt.py new file mode 100644 index 00000000000..c94ab5754cd --- /dev/null +++ b/neutron/objects/port/extensions/extra_dhcp_opt.py @@ -0,0 +1,33 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from oslo_versionedobjects import base as obj_base +from oslo_versionedobjects import fields as obj_fields + +from neutron.db import extradhcpopt_db as models +from neutron.objects import base + + +@obj_base.VersionedObjectRegistry.register +class ExtraDhcpOpt(base.NeutronDbObject): + # Version 1.0: Initial version + VERSION = '1.0' + + db_model = models.ExtraDhcpOpt + + fields = { + 'id': obj_fields.UUIDField(), + 'port_id': obj_fields.UUIDField(), + 'opt_name': obj_fields.StringField(), + 'opt_value': obj_fields.StringField(), + 'ip_version': obj_fields.IntegerField(), + } diff --git a/neutron/tests/unit/objects/port/__init__.py b/neutron/tests/unit/objects/port/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/tests/unit/objects/port/extensions/__init__.py b/neutron/tests/unit/objects/port/extensions/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/tests/unit/objects/port/extensions/test_extra_dhcp_opt.py b/neutron/tests/unit/objects/port/extensions/test_extra_dhcp_opt.py new file mode 100644 index 00000000000..adb9f737121 --- /dev/null +++ b/neutron/tests/unit/objects/port/extensions/test_extra_dhcp_opt.py @@ -0,0 +1,35 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from neutron.objects.port.extensions import extra_dhcp_opt +from neutron.tests.unit.objects import test_base as obj_test_base +from neutron.tests.unit import testlib_api + + +class ExtraDhcpOptIfaceObjectTestCase(obj_test_base.BaseObjectIfaceTestCase): + + _test_class = extra_dhcp_opt.ExtraDhcpOpt + + +class ExtraDhcpOptDbObjectTestCase(obj_test_base.BaseDbObjectTestCase, + testlib_api.SqlTestCase): + + _test_class = extra_dhcp_opt.ExtraDhcpOpt + + def setUp(self): + super(ExtraDhcpOptDbObjectTestCase, self).setUp() + self._create_test_network() + self._create_test_port(self._network) + for obj in self.db_objs: + obj['port_id'] = self._port['id'] + for obj in self.obj_fields: + obj['port_id'] = self._port['id'] diff --git a/neutron/tests/unit/objects/test_objects.py b/neutron/tests/unit/objects/test_objects.py index 1eeea617abf..b29f9ef5f9f 100644 --- a/neutron/tests/unit/objects/test_objects.py +++ b/neutron/tests/unit/objects/test_objects.py @@ -26,6 +26,7 @@ from neutron.tests import tools # NOTE: The hashes in this list should only be changed if they come with a # corresponding version bump in the affected objects. object_data = { + 'ExtraDhcpOpt': '1.0-632f689cbeb36328995a7aed1d0a78d3', 'QosBandwidthLimitRule': '1.1-4e44a8f5c2895ab1278399f87b40a13d', 'QosDscpMarkingRule': '1.1-0313c6554b34fd10c753cb63d638256c', 'QosRuleType': '1.1-8a53fef4c6a43839d477a85b787d22ce',