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, networks,
23 keypair_name, sec_grp_names, volume_ids):
26 :param name: the image's name
27 :param inst_id: the instance's id
28 :param image_id: the instance's image id
29 :param flavor_id: the ID used to spawn this instance
30 :param networks: dict of networks where the key is the network name and
31 value is a list of associated IPs
32 :param keypair_name: the name of the associated keypair
33 :param sec_grp_names: list of security group names
34 :param volume_ids: list of attached volume IDs
38 self.image_id = image_id
39 self.flavor_id = flavor_id
40 self.networks = networks
41 self.keypair_name = keypair_name
42 self.sec_grp_names = sec_grp_names
43 self.volume_ids = volume_ids
45 def __eq__(self, other):
46 return (self.name == other.name and
47 self.id == other.id and
48 self.image_id == other.image_id and
49 self.flavor_id == other.flavor_id and
50 self.networks == other.networks and
51 self.keypair_name == other.keypair_name and
52 self.sec_grp_names == other.sec_grp_names and
53 self.volume_ids == other.volume_ids)
58 SNAPS domain object for Images. Should contain attributes that
59 are shared amongst cloud providers
61 def __init__(self, **kwargs):
64 :param id: the floating ip's id
65 :param description: the description
66 :param ip|floating_ip_address: the Floating IP address mapped to the
68 :param fixed_ip_address: the IP address of the tenant network
69 :param floating_network_id: the ID of the external network
70 :param port_id: the ID of the associated port
71 :param router_id: the ID of the associated router
72 :param project_id|tenant_id: the ID of the associated project mapped to
73 the attribute 'project_id'
76 self.id = kwargs.get('id')
77 self.description = kwargs.get('description')
78 self.ip = kwargs.get('ip', kwargs.get('floating_ip_address'))
79 self.fixed_ip_address = kwargs.get('fixed_ip_address')
80 self.floating_network_id = kwargs.get('floating_network_id')
81 self.port_id = kwargs.get('port_id')
82 self.router_id = kwargs.get('router_id')
83 self.project_id = kwargs.get('project_id', kwargs.get('tenant_id'))