1 # Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
2 # and others. All rights reserved.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain 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,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
19 SNAPS domain object for Images. Should contain attributes that
20 are shared amongst cloud providers
22 def __init__(self, name, inst_id, image_id, flavor_id, ports,
23 keypair_name, sec_grp_names, volume_ids, compute_host,
27 :param name: the image's name
28 :param inst_id: the instance's id
29 :param image_id: the instance's image id
30 :param flavor_id: the ID used to spawn this instance
31 :param ports: list of SNAPS-OO Port domain objects associated with this
33 :param keypair_name: the name of the associated keypair
34 :param sec_grp_names: list of security group names
35 :param volume_ids: list of attached volume IDs
36 :param compute_host: the name of the host on which this VM is running
37 When the user requesting this query is not part of
38 the 'admin' role, this value will be None
39 :param availability_zone: the name of the availability zone to which
40 this VM has been assigned
44 self.image_id = image_id
45 self.flavor_id = flavor_id
47 self.keypair_name = keypair_name
48 self.sec_grp_names = sec_grp_names
49 self.volume_ids = volume_ids
50 self.compute_host = compute_host
51 self.availability_zone = availability_zone
53 def __eq__(self, other):
54 return (self.name == other.name and
55 self.id == other.id and
56 self.image_id == other.image_id and
57 self.flavor_id == other.flavor_id and
58 self.ports == other.ports and
59 self.keypair_name == other.keypair_name and
60 self.volume_ids == other.volume_ids)
65 SNAPS domain object for Images. Should contain attributes that
66 are shared amongst cloud providers
68 def __init__(self, **kwargs):
71 :param id: the floating ip's id
72 :param description: the description
73 :param ip|floating_ip_address: the Floating IP address mapped to the
75 :param fixed_ip_address: the IP address of the tenant network
76 :param floating_network_id: the ID of the external network
77 :param port_id: the ID of the associated port
78 :param router_id: the ID of the associated router
79 :param project_id|tenant_id: the ID of the associated project mapped to
80 the attribute 'project_id'
83 self.id = kwargs.get('id')
84 self.description = kwargs.get('description')
85 self.ip = kwargs.get('ip', kwargs.get('floating_ip_address'))
86 self.fixed_ip_address = kwargs.get('fixed_ip_address')
87 self.floating_network_id = kwargs.get('floating_network_id')
88 self.port_id = kwargs.get('port_id')
89 self.router_id = kwargs.get('router_id')
90 self.project_id = kwargs.get('project_id', kwargs.get('tenant_id'))