def post_zones(self, body, **kw): assert body.keys() == ["zone"] fakes.assert_has_keys( body["zone"], required=["api_url", "username", "password"], optional=["weight_offset", "weight_scale"] ) return (202, self.get_zones_1()[1])
def post_os_volumes_boot(self, body, **kw): assert set(body.keys()) <= set(['server', 'os:scheduler_hints']) fakes.assert_has_keys( body['server'], required=['name', 'block_device_mapping', 'flavorRef'], optional=['imageRef']) return (202, self.get_servers_9012()[1])
def post_zones(self, body, **kw): assert body.keys() == ['zone'] fakes.assert_has_keys(body['zone'], required=['api_url', 'username', 'password'], optional=['weight_offset', 'weight_scale']) return (202, self.get_zones_1()[1])
def post_os_security_groups(self, body, **kw): assert body.keys() == ['security_group'] fakes.assert_has_keys(body['security_group'], required=['name', 'description']) r = {'security_group': self.get_os_security_groups()[1]['security_groups'][0]} return (202, r)
def post_flavors_1_os_extra_specs(self, body, **kw): assert body.keys() == ['extra_specs'] fakes.assert_has_keys(body['extra_specs'], required=['k1']) return (200, {}, {'extra_specs': {"k1": "v1"}})
def put_zones_1(self, body, **kw): assert body.keys() == ['zone'] fakes.assert_has_keys(body['zone'], optional=['api_url', 'username', 'password', 'weight_offset', 'weight_scale']) return (204, None)
def post_images_1_metadata(self, body, **kw): assert body.keys() == ['metadata'] fakes.assert_has_keys(body['metadata'], required=['test_key']) return (200, {}, {'metadata': self.get_images_1()[2]['image']['metadata']})
def post_os_security_groups(self, body, **kw): assert body.keys() == ['security_group'] fakes.assert_has_keys(body['security_group'], required=['name', 'description']) r = {'security_group': self.get_os_security_groups()[2]['security_groups'][0]} return (202, {}, r)
def put_os_quota_sets_test(self, body, **kw): assert body.keys() == ["quota_set"] fakes.assert_has_keys(body["quota_set"], required=["tenant_id"]) return ( 200, {}, {"quota_set": {"tenant_id": "test", "metadata_items": [], "shares": 2, "snapshots": 2, "gigabytes": 1}}, )
def post_os_floating_ip_dns(self, body, **kw): fakes.assert_has_keys(body['dns_entry'], required=['name', 'ip', 'dns_type', 'zone']) return (205, {'dns_entry': {'ip': body['dns_entry'].get('ip'), 'name': body['dns_entry'].get('name'), 'type': body['dns_entry'].get('dns_type'), 'zone': body['dns_entry'].get('zone')}})
def post_os_security_group_rules(self, body, **kw): assert body.keys() == ['security_group_rule'] fakes.assert_has_keys(body['security_group_rule'], required=['parent_group_id'], optional=['group_id', 'ip_protocol', 'from_port', 'to_port', 'cidr']) r = {'security_group_rule': self.get_os_security_group_rules()[1]['security_group_rules'][0]} return (202, r)
def put_os_quota_class_sets_test(self, body, **kw): assert body.keys() == ['quota_class_set'] fakes.assert_has_keys(body['quota_class_set'], required=['class_name']) return (200, {'quota_class_set': { 'class_name': 'test', 'metadata_items': [], 'volumes': 2, 'gigabytes': 1}})
def post_servers(self, body, **kw): assert body.keys() == ["server"] fakes.assert_has_keys( body["server"], required=["name", "imageRef", "flavorRef"], optional=["metadata", "personality"] ) if "personality" in body["server"]: for pfile in body["server"]["personality"]: fakes.assert_has_keys(pfile, required=["path", "contents"]) return (202, self.get_servers_1234()[1])
def post_os_security_group_rules(self, body, **kw): assert body.keys() == ['security_group_rule'] fakes.assert_has_keys(body['security_group_rule'], required=['parent_group_id'], optional=['group_id', 'ip_protocol', 'from_port', 'to_port', 'cidr']) r = {'security_group_rule': self.get_os_security_group_rules()[2]['security_group_rules'][0]} return (202, {}, r)
def post_os_security_group_rules(self, body, **kw): assert body.keys() == ["security_group_rule"] fakes.assert_has_keys( body["security_group_rule"], required=["parent_group_id"], optional=["group_id", "ip_protocol", "from_port", "to_port", "cidr"], ) r = {"security_group_rule": self.get_os_security_group_rules()[1]["security_group_rules"][0]} return (202, r)
def post_servers(self, body, **kw): assert body.keys() == ['server'] fakes.assert_has_keys(body['server'], required=['name', 'imageRef', 'flavorRef'], optional=['metadata', 'personality']) if 'personality' in body['server']: for pfile in body['server']['personality']: fakes.assert_has_keys(pfile, required=['path', 'contents']) return (202, self.get_servers_1234()[1])
def post_servers(self, body, **kw): assert set(body.keys()) <= set(['server', 'os:scheduler_hints']) fakes.assert_has_keys(body['server'], required=['name', 'imageRef', 'flavorRef'], optional=['metadata', 'personality']) if 'personality' in body['server']: for pfile in body['server']['personality']: fakes.assert_has_keys(pfile, required=['path', 'contents']) return (202, {}, self.get_servers_1234()[2])
def post_servers(self, body, **kw): assert set(body.keys()) <= set(['server', 'os:scheduler_hints']) fakes.assert_has_keys(body['server'], required=['name', 'imageRef', 'flavorRef'], optional=['metadata', 'personality']) if 'personality' in body['server']: for pfile in body['server']['personality']: fakes.assert_has_keys(pfile, required=['path', 'contents']) return (202, self.get_servers_1234()[1])
def put_os_quota_sets_test(self, body, **kw): assert body.keys() == ['quota_set'] fakes.assert_has_keys(body['quota_set'], required=['tenant_id']) return (200, {}, {'quota_set': { 'tenant_id': 'test', 'metadata_items': [], 'monitors': 2, 'snapshots': 2, 'gigabytes': 1}})
def post_shared_ip_groups(self, body, **kw): assert body.keys() == ['sharedIpGroup'] fakes.assert_has_keys(body['sharedIpGroup'], required=['name'], optional=['server']) return (201, {'sharedIpGroup': { 'id': 10101, 'name': body['sharedIpGroup']['name'], 'servers': 'server' in body['sharedIpGroup'] and \ [body['sharedIpGroup']['server']] or None }})
def post_accounts_test_account_create_instance(self, body, **kw): assert body.keys() == ['server'] fakes.assert_has_keys(body['server'], required=['name', 'imageId', 'flavorId'], optional=['sharedIpGroupId', 'metadata', 'personality', 'min_count', 'max_count']) if 'personality' in body['server']: for pfile in body['server']['personality']: fakes.assert_has_keys(pfile, required=['path', 'contents']) return (202, self.get_servers_1234()[1])
def put_os_quota_sets_test(self, body, **kw): assert body.keys() == ['quota_set'] fakes.assert_has_keys(body['quota_set'], required=['tenant_id']) return (200, {}, {'quota_set': { 'tenant_id': 'test', 'metadata_items': [], 'vsms': 2, 'snapshots': 2, 'gigabytes': 1}})
def post_os_floating_ip_dns(self, body, **kw): fakes.assert_has_keys(body['dns_entry'], required=['name', 'ip', 'dns_type', 'zone']) return (205, { 'dns_entry': { 'ip': body['dns_entry'].get('ip'), 'name': body['dns_entry'].get('name'), 'type': body['dns_entry'].get('dns_type'), 'zone': body['dns_entry'].get('zone') } })
def post_accounts_test_account_create_instance(self, body, **kw): assert body.keys() == ["server"] fakes.assert_has_keys( body["server"], required=["name", "imageId", "flavorId"], optional=["sharedIpGroupId", "metadata", "personality", "min_count", "max_count"], ) if "personality" in body["server"]: for pfile in body["server"]["personality"]: fakes.assert_has_keys(pfile, required=["path", "contents"]) return (202, self.get_servers_1234()[1])
def post_os_floating_ip_dns(self, body, **kw): fakes.assert_has_keys(body["dns_entry"], required=["name", "ip", "dns_type", "zone"]) return ( 205, { "dns_entry": { "ip": body["dns_entry"].get("ip"), "name": body["dns_entry"].get("name"), "type": body["dns_entry"].get("dns_type"), "zone": body["dns_entry"].get("zone"), } }, )
def post_shared_ip_groups(self, body, **kw): assert body.keys() == ["sharedIpGroup"] fakes.assert_has_keys(body["sharedIpGroup"], required=["name"], optional=["server"]) return ( 201, { "sharedIpGroup": { "id": 10101, "name": body["sharedIpGroup"]["name"], "servers": "server" in body["sharedIpGroup"] and [body["sharedIpGroup"]["server"]] or None, } }, )
def put_os_quota_sets_test(self, body, **kw): assert body.keys() == ['quota_set'] fakes.assert_has_keys(body['quota_set'], required=['tenant_id']) return (200, {'quota_set': { 'tenant_id': 'test', 'metadata_items': [], 'injected_file_content_bytes': 1, 'volumes': 2, 'gigabytes': 1, 'ram': 1, 'floating_ips': 1, 'instances': 1, 'injected_files': 1, 'cores': 1}})
def put_os_quota_class_sets_test(self, body, **kw): assert list(body) == ['quota_class_set'] fakes.assert_has_keys(body['quota_class_set'], required=['class_name']) quota_class_set = { 'quota_class_set': { 'class_name': 'test', 'metadata_items': [], 'shares': 2, 'snapshots': 2, 'gigabytes': 1, 'share_networks': 1, } } return (200, {}, quota_class_set)
def put_os_quota_class_sets_test(self, body, **kw): assert body.keys() == ['quota_class_set'] fakes.assert_has_keys(body['quota_class_set'], required=['class_name']) return (200, {}, {'quota_class_set': { 'class_name': 'test', 'metadata_items': [], 'injected_file_content_bytes': 1, 'injected_file_path_bytes': 1, 'volumes': 2, 'gigabytes': 1, 'ram': 1, 'floating_ips': 1, 'instances': 1, 'injected_files': 1, 'cores': 1, 'keypairs': 1, 'security_groups': 1, 'security_group_rules': 1}})
def put_os_quota_sets_test(self, body, **kw): assert body.keys() == ["quota_set"] fakes.assert_has_keys(body["quota_set"], required=["tenant_id"]) return ( 200, { "quota_set": { "tenant_id": "test", "metadata_items": [], "injected_file_content_bytes": 1, "volumes": 2, "gigabytes": 1, "ram": 1, "floating_ips": 1, "instances": 1, "injected_files": 1, "cores": 1, } }, )
def put_os_floating_ip_dns_testdomain(self, body, **kw): if body["domain_entry"]["scope"] == "private": fakes.assert_has_keys(body["domain_entry"], required=["availability_zone", "scope"]) elif body["domain_entry"]["scope"] == "public": fakes.assert_has_keys(body["domain_entry"], required=["project", "scope"]) else: fakes.assert_has_keys(body["domain_entry"], required=["project", "scope"]) return (205, None)
def put_os_floating_ip_dns_testdomain(self, body, **kw): if body['domain_entry']['scope'] == 'private': fakes.assert_has_keys(body['domain_entry'], required=['availability_zone', 'scope']) elif body['domain_entry']['scope'] == 'public': fakes.assert_has_keys(body['domain_entry'], required=['project', 'scope']) else: fakes.assert_has_keys(body['domain_entry'], required=['project', 'scope']) return (205, None)
def put_os_floating_ip_dns_testdomain(self, body, **kw): if body['domain_entry']['scope'] == 'private': fakes.assert_has_keys(body['domain_entry'], required=['availability_zone', 'scope']) elif body['domain_entry']['scope'] == 'public': fakes.assert_has_keys(body['domain_entry'], required=['project', 'scope']) else: fakes.assert_has_keys(body['domain_entry'], required=['project', 'scope']) return (205, {}, None)
def post_images_1_metadata(self, body, **kw): assert body.keys() == ['metadata'] fakes.assert_has_keys(body['metadata'], required=['test_key']) return (200, {'metadata': self.get_images_1()[1]['image']['metadata']})
def post_os_keypairs(self, body, **kw): assert body.keys() == ['keypair'] fakes.assert_has_keys(body['keypair'], required=['name']) r = {'keypair': self.get_os_keypairs()[2]['keypairs'][0]} return (202, {}, r)
def post_servers_1234_backup_schedule(self, body, **kw): assert body.keys() == ['backupSchedule'] fakes.assert_has_keys(body['backupSchedule'], required=['enabled'], optional=['weekly', 'daily']) return (204, None)
def post_images(self, body, **kw): assert body.keys() == ['image'] fakes.assert_has_keys(body['image'], required=['serverId', 'name']) return (202, {}, self.get_images_1()[2])
def put_os_floating_ip_dns_testdomain_entries_testname(self, body, **kw): fakes.assert_has_keys(body['dns_entry'], required=['ip', 'dns_type']) return (205, {}, None)
def put_servers_1234(self, body, **kw): assert body.keys() == ['server'] fakes.assert_has_keys(body['server'], optional=['name', 'adminPass']) return (204, None)
def put_servers_1234(self, body, **kw): assert body.keys() == ['server'] fakes.assert_has_keys(body['server'], optional=['name', 'adminPass']) return (204, {}, None)
def post_flavors_1_os_extra_specs(self, body, **kw): assert body.keys() == ['extra_specs'] fakes.assert_has_keys(body['extra_specs'], required=['k1']) return (200, {'extra_specs': {"k1": "v1"}})
def put_os_floating_ip_dns_testdomain_entries_testname(self, body, **kw): fakes.assert_has_keys(body['dns_entry'], required=['ip', 'dns_type']) return (205, None)
def post_images(self, body, **kw): assert body.keys() == ['image'] fakes.assert_has_keys(body['image'], required=['serverId', 'name']) return (202, self.get_images_1()[1])
def put_servers_1234_ips_public_1_2_3_4(self, body, **kw): assert body.keys() == ['shareIp'] fakes.assert_has_keys(body['shareIp'], required=['sharedIpGroupId', 'configureServer']) return (202, None)
def post_os_keypairs(self, body, **kw): assert body.keys() == ['keypair'] fakes.assert_has_keys(body['keypair'], required=['name']) r = {'keypair': self.get_os_keypairs()[1]['keypairs'][0]} return (202, r)