1
# Copyright 2012, Cisco Systems, Inc.
3
# Licensed under the Apache License, Version 2.0 (the "License"); you may
4
# not use this file except in compliance with the License. You may obtain
5
# 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, WITHOUT
11
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
# License for the specific language governing permissions and limitations
14
# @author: Rohit Agarwalla, Cisco Systems, Inc.
16
import sqlalchemy as sa
18
from neutron.db import model_base
21
class NexusPortBinding(model_base.BASEV2):
22
"""Represents a binding of VM's to nexus ports."""
24
__tablename__ = "cisco_nexusport_bindings"
26
id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
27
port_id = sa.Column(sa.String(255))
28
vlan_id = sa.Column(sa.Integer, nullable=False)
29
switch_ip = sa.Column(sa.String(255), nullable=False)
30
instance_id = sa.Column(sa.String(255), nullable=False)
33
"""Just the binding, without the id key."""
34
return ("<NexusPortBinding(%s,%s,%s,%s)>" %
35
(self.port_id, self.vlan_id, self.switch_ip, self.instance_id))
37
def __eq__(self, other):
38
"""Compare only the binding, without the id key."""
40
self.port_id == other.port_id and
41
self.vlan_id == other.vlan_id and
42
self.switch_ip == other.switch_ip and
43
self.instance_id == other.instance_id