OW2 Consortium contrail

Rev

Rev 2691 | Rev 2792 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2691 aaasz 1
'''
2
Copyright (c) 2010-2012, Contrail consortium.
3
All rights reserved.
4
 
5
Redistribution and use in source and binary forms,
6
with or without modification, are permitted provided
7
that the following conditions are met:
8
 
9
 1. Redistributions of source code must retain the
10
    above copyright notice, this list of conditions
11
    and the following disclaimer.
12
 2. Redistributions in binary form must reproduce
13
    the above copyright notice, this list of
14
    conditions and the following disclaimer in the
15
    documentation and/or other materials provided
16
    with the distribution.
2693 aaasz 17
 3. Neither the name of the Contrail consortium nor the
2691 aaasz 18
    names of its contributors may be used to endorse
19
    or promote products derived from this software
20
    without specific prior written permission.
21
 
22
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
27
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
34
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
POSSIBILITY OF SUCH DAMAGE.
36
 
37
 
38
Created on Mar 9, 2011
39
 
40
@package conpaas.core
41
@author: ielhelw
42
@file
43
'''
44
 
45
'''
46
 
47
    This class represents the abstraction of a node.
48
    A basic node is represented by a vmid and an ip
49
    address. This class can be extented with more
50
    information about the node, specific to each
51
    service.
52
 
53
'''
54
class ServiceNode(object):
55
 
56
  def __init__(self, vmid, ip, cloud_name):
57
      self.vmid = vmid
58
      self.ip = ip
59
      self.cloud_name = cloud_name
60
 
61
  def __repr__(self):
62
      return 'ServiceNode(vmid=%s, ip=%s)' % (str(self.vmid), self.ip)
63
 
64
  def __cmp__(self, other):
65
      if self.vmid == other.vmid and \
66
      self.cloud_name == other.cloud_name:
67
          return 0
68
      elif self.vmid < other.vmid: return -1
69
      else: return 1