1
# Copyright (c) 2012 OpenStack, LLC.
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
7
# http://www.apache.org/licenses/LICENSE-2.0
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright (c) 2012 OpenStack LLC.
6
# Licensed under the Apache License, Version 2.0 (the "License"); you may
7
# not use this file except in compliance with the License. You may obtain
8
# a copy of the License at
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
# License for the specific language governing permissions and limitations
16
18
import sqlalchemy as sa
17
19
from sqlalchemy import orm
19
from quantum.common import utils
20
21
from quantum.db import model_base
22
from quantum.openstack.common import uuidutils
23
25
class HasTenant(object):
29
31
class HasId(object):
30
32
"""id mixin, add to subclasses that have an id."""
31
id = sa.Column(sa.String(36), primary_key=True, default=utils.str_uuid)
33
id = sa.Column(sa.String(36),
35
default=uuidutils.generate_uuid)
34
38
class IPAvailabilityRange(model_base.BASEV2):
65
69
last_ip = sa.Column(sa.String(64), nullable=False)
66
70
available_ranges = orm.relationship(IPAvailabilityRange,
67
71
backref='ipallocationpool',
70
75
def __repr__(self):
71
76
return "%s - %s" % (self.first_ip, self.last_ip)
132
137
gateway_ip = sa.Column(sa.String(64))
133
138
allocation_pools = orm.relationship(IPAllocationPool,
134
139
backref='subnet',
136
142
enable_dhcp = sa.Column(sa.Boolean())
137
143
dns_nameservers = orm.relationship(DNSNameServer,
138
144
backref='subnet',