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 class for Projects. Should contain attributes that
20 are shared amongst cloud providers
22 def __init__(self, name, project_id, domain_id=None):
25 :param name: the project's name
26 :param project_id: the project's id
27 :param domain_id: the project's domain id
31 self.domain_id = domain_id
33 def __eq__(self, other):
34 return self.name == other.name and self.id == other.id
39 SNAPS domain class for OpenStack Keystone v3+ domains.
41 def __init__(self, name, domain_id=None):
44 :param name: the project's name
45 :param domain_id: the project's domain id
50 def __eq__(self, other):
51 return self.name == other.name and self.id == other.id
56 SNAPS domain class for holding project quotas for compute services
58 def __init__(self, nova_quotas=None, **kwargs):
61 :param nova_quotas: the OS nova quota object
64 self.metadata_items = nova_quotas.metadata_items
65 self.cores = nova_quotas.cores # aka. VCPUs
66 self.instances = nova_quotas.instances
67 self.injected_files = nova_quotas.injected_files
68 self.injected_file_content_bytes = nova_quotas.injected_file_content_bytes
69 self.ram = nova_quotas.ram
70 self.fixed_ips = nova_quotas.fixed_ips
71 self.key_pairs = nova_quotas.key_pairs
73 self.metadata_items = kwargs.get('metadata_items')
74 self.cores = kwargs.get('cores') # aka. VCPUs
75 self.instances = kwargs.get('instances')
76 self.injected_files = kwargs.get('injected_files')
77 self.injected_file_content_bytes = kwargs.get(
78 'injected_file_content_bytes')
79 self.ram = kwargs.get('ram')
80 self.fixed_ips = kwargs.get('fixed_ips')
81 self.key_pairs = kwargs.get('key_pairs')
83 def __eq__(self, other):
84 return (self.metadata_items == other.metadata_items and
85 self.cores == other.cores and
86 self.instances == other.instances and
87 self.injected_files == other.injected_files and
88 self.injected_file_content_bytes == other.injected_file_content_bytes and
89 self.fixed_ips == other.fixed_ips and
90 self.key_pairs == other.key_pairs)
95 SNAPS domain class for holding project quotas for networking services
97 def __init__(self, **neutron_quotas):
100 :param neutron_quotas: the OS network quota object
103 # Networks settings here
104 self.security_group = neutron_quotas['security_group']
105 self.security_group_rule = neutron_quotas['security_group_rule']
106 self.floatingip = neutron_quotas['floatingip']
107 self.network = neutron_quotas['network']
108 self.port = neutron_quotas['port']
109 self.router = neutron_quotas['router']
110 self.subnet = neutron_quotas['subnet']
112 def __eq__(self, other):
113 return (self.security_group == other.security_group and
114 self.security_group_rule == other.security_group_rule and
115 self.floatingip == other.floatingip and
116 self.network == other.network and
117 self.port == other.port and
118 self.router == other.router and
119 self.subnet == other.subnet)