1
# Copyright 2013 Cloudbase Solutions SRL
4
# Licensed under the Apache License, Version 2.0 (the "License"); you may
5
# not use this file except in compliance with the License. You may obtain
6
# a copy of the License at
8
# http://www.apache.org/licenses/LICENSE-2.0
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
# License for the specific language governing permissions and limitations
16
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
18
from neutron.db import model_base
21
class VlanAllocation(model_base.BASEV2):
22
"""Represents allocation state of vlan_id on physical network."""
23
__tablename__ = 'hyperv_vlan_allocations'
25
physical_network = Column(String(64), nullable=False, primary_key=True)
26
vlan_id = Column(Integer, nullable=False, primary_key=True,
28
allocated = Column(Boolean, nullable=False)
30
def __init__(self, physical_network, vlan_id):
31
self.physical_network = physical_network
32
self.vlan_id = vlan_id
33
self.allocated = False
36
class NetworkBinding(model_base.BASEV2):
37
"""Represents binding of virtual network to physical realization."""
38
__tablename__ = 'hyperv_network_bindings'
40
network_id = Column(String(36),
41
ForeignKey('networks.id', ondelete="CASCADE"),
43
network_type = Column(String(32), nullable=False)
44
physical_network = Column(String(64))
45
segmentation_id = Column(Integer)
47
def __init__(self, network_id, network_type, physical_network,
49
self.network_id = network_id
50
self.network_type = network_type
51
self.physical_network = physical_network
52
self.segmentation_id = segmentation_id