~niedbalski/ubuntu/vivid/neutron/fixes-1447803

« back to all changes in this revision

Viewing changes to neutron/plugins/cisco/db/nexus_models_v2.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-10-03 18:45:23 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20141003184523-4mt6dy1q3j8n30c9
Tags: 1:2014.2~rc1-0ubuntu1
* New upstream release candidate:
  - d/p/*: Refreshed.
  - d/control: Add python-requests-mock to BD's.
  - d/control: Align versioned requirements with upstream.
* Transition linuxbridge and openvswitch plugin users to modular
  layer 2 plugin (LP: #1323729):
  - d/control: Mark removed plugin packages as transitional, depend
    on neutron-plugin-ml2, mark oldlibs/extra.
  - d/neutron-plugin-{linuxbridge,openvswitch}.install: Drop.
  - d/control: Depend on neutron-plugin-ml2 for linuxbridge
    agent package.
  - d/neutron-plugin-linuxbridge-agent.upstart: Use ml2 plugin
    configuration files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2012, Cisco Systems, Inc.
2
 
#
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
6
 
#
7
 
#         http://www.apache.org/licenses/LICENSE-2.0
8
 
#
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
13
 
#    under the License.
14
 
# @author: Rohit Agarwalla, Cisco Systems, Inc.
15
 
 
16
 
import sqlalchemy as sa
17
 
 
18
 
from neutron.db import model_base
19
 
 
20
 
 
21
 
class NexusPortBinding(model_base.BASEV2):
22
 
    """Represents a binding of VM's to nexus ports."""
23
 
 
24
 
    __tablename__ = "cisco_nexusport_bindings"
25
 
 
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)
31
 
 
32
 
    def __repr__(self):
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))
36
 
 
37
 
    def __eq__(self, other):
38
 
        """Compare only the binding, without the id key."""
39
 
        return (
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
44
 
        )