1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
# Copyright 2012 Nicira, Inc.
5
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6
# not use this file except in compliance with the License. You may obtain
7
# a copy of the License at
9
# http://www.apache.org/licenses/LICENSE-2.0
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
# License for the specific language governing permissions and limitations
18
from sqlalchemy import Column, Enum, ForeignKey, Integer, String
20
from quantum.db.models_v2 import model_base
23
class NvpNetworkBinding(model_base.BASEV2):
24
"""Represents a binding of a virtual network with a transport zone.
26
This model class associates a Quantum network with a transport zone;
27
optionally a vlan ID might be used if the binding type is 'bridge'
29
__tablename__ = 'nvp_network_bindings'
31
network_id = Column(String(36),
32
ForeignKey('networks.id', ondelete="CASCADE"),
34
# 'flat', 'vlan', stt' or 'gre'
35
binding_type = Column(Enum('flat', 'vlan', 'stt', 'gre'), nullable=False)
36
tz_uuid = Column(String(36))
37
vlan_id = Column(Integer)
39
def __init__(self, network_id, binding_type, tz_uuid, vlan_id):
40
self.network_id = network_id
41
self.binding_type = binding_type
42
self.tz_uuid = tz_uuid
43
self.vlan_id = vlan_id
46
return "<NetworkBinding(%s,%s,%s,%s)>" % (self.network_id,