Revision cdd6fc06
b/snf-cyclades-app/synnefo/api/compute_urls.py | ||
---|---|---|
1 |
# Copyright 2011, 2012, 2013 GRNET S.A. All rights reserved. |
|
2 |
# |
|
3 |
# Redistribution and use in source and binary forms, with or |
|
4 |
# without modification, are permitted provided that the following |
|
5 |
# conditions are met: |
|
6 |
# |
|
7 |
# 1. Redistributions of source code must retain the above |
|
8 |
# copyright notice, this list of conditions and the following |
|
9 |
# disclaimer. |
|
10 |
# |
|
11 |
# 2. Redistributions in binary form must reproduce the above |
|
12 |
# copyright notice, this list of conditions and the following |
|
13 |
# disclaimer in the documentation and/or other materials |
|
14 |
# provided with the distribution. |
|
15 |
# |
|
16 |
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
17 |
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
18 |
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
19 |
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
20 |
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
21 |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
22 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
23 |
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
24 |
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
25 |
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
26 |
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
27 |
# POSSIBILITY OF SUCH DAMAGE. |
|
28 |
# |
|
29 |
# The views and conclusions contained in the software and |
|
30 |
# documentation are those of the authors and should not be |
|
31 |
# interpreted as representing official policies, either expressed |
|
32 |
# or implied, of GRNET S.A. |
|
33 |
|
|
34 |
from django.conf.urls import include, patterns |
|
35 |
|
|
36 |
from snf_django.lib.api import api_endpoint_not_found |
|
37 |
from synnefo.api import (servers, flavors, images, extensions) |
|
38 |
from synnefo.api.versions import versions_list, version_details |
|
39 |
|
|
40 |
|
|
41 |
# |
|
42 |
# The OpenStack Compute API v2.0 |
|
43 |
# |
|
44 |
compute_api20_patterns = patterns( |
|
45 |
'', |
|
46 |
(r'^servers', include(servers)), |
|
47 |
(r'^flavors', include(flavors)), |
|
48 |
(r'^images', include(images)), |
|
49 |
(r'^extensions', include(extensions)), |
|
50 |
) |
|
51 |
|
|
52 |
|
|
53 |
urlpatterns = patterns( |
|
54 |
'', |
|
55 |
(r'^(?:.json|.xml|.atom)?$', versions_list), |
|
56 |
(r'^v2.0/(?:.json|.xml|.atom)?$', version_details, |
|
57 |
{'api_version': 'v1.1'}), |
|
58 |
(r'^v2.0/', include(compute_api20_patterns)), |
|
59 |
(r'^.*', api_endpoint_not_found), |
|
60 |
) |
b/snf-cyclades-app/synnefo/api/network_urls.py | ||
---|---|---|
1 |
# Copyright 2011, 2012, 2013 GRNET S.A. All rights reserved. |
|
2 |
# |
|
3 |
# Redistribution and use in source and binary forms, with or |
|
4 |
# without modification, are permitted provided that the following |
|
5 |
# conditions are met: |
|
6 |
# |
|
7 |
# 1. Redistributions of source code must retain the above |
|
8 |
# copyright notice, this list of conditions and the following |
|
9 |
# disclaimer. |
|
10 |
# |
|
11 |
# 2. Redistributions in binary form must reproduce the above |
|
12 |
# copyright notice, this list of conditions and the following |
|
13 |
# disclaimer in the documentation and/or other materials |
|
14 |
# provided with the distribution. |
|
15 |
# |
|
16 |
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
17 |
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
18 |
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
19 |
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
20 |
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
21 |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
22 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
23 |
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
24 |
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
25 |
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
26 |
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
27 |
# POSSIBILITY OF SUCH DAMAGE. |
|
28 |
# |
|
29 |
# The views and conclusions contained in the software and |
|
30 |
# documentation are those of the authors and should not be |
|
31 |
# interpreted as representing official policies, either expressed |
|
32 |
# or implied, of GRNET S.A. |
|
33 |
|
|
34 |
from django.conf.urls import include, patterns |
|
35 |
|
|
36 |
from snf_django.lib.api import api_endpoint_not_found |
|
37 |
from synnefo.api import (networks, ports, floating_ips, subnets) |
|
38 |
|
|
39 |
|
|
40 |
network_api20_patterns = patterns( |
|
41 |
'', |
|
42 |
(r'^networks', include(networks)), |
|
43 |
(r'^ports', include(ports)), |
|
44 |
(r'^subnets', include(subnets)), |
|
45 |
(r'^floatingips', include(floating_ips.ips_urlpatterns)), |
|
46 |
) |
|
47 |
|
|
48 |
urlpatterns = patterns( |
|
49 |
'', |
|
50 |
(r'^v2.0/', include(network_api20_patterns)), |
|
51 |
(r'^.*', api_endpoint_not_found), |
|
52 |
) |
b/snf-cyclades-app/synnefo/api/services.py | ||
---|---|---|
85 | 85 |
"service_type": "compute", |
86 | 86 |
"service_origin": "cyclades_compute", |
87 | 87 |
}, |
88 |
'network-private': { |
|
89 |
"name": "cyclades.network.private", |
|
90 |
"desc": "Number of private networks", |
|
91 |
"service_type": "compute", |
|
92 |
"service_origin": "cyclades_compute", |
|
93 |
}, |
|
94 |
'floating_ip': { |
|
95 |
"name": "cyclades.floating_ip", |
|
96 |
"desc": "Number of Floating IP addresses", |
|
97 |
"service_type": "compute", |
|
98 |
"service_origin": "cyclades_compute", |
|
99 |
}, |
|
100 | 88 |
}, |
101 | 89 |
}, |
102 | 90 |
|
... | ... | |
112 | 100 |
'resources': {}, |
113 | 101 |
}, |
114 | 102 |
|
103 |
'cyclades_network': { |
|
104 |
'type': 'network', |
|
105 |
'component': 'cyclades', |
|
106 |
'prefix': 'network', |
|
107 |
'public': True, |
|
108 |
'endpoints': [ |
|
109 |
{'versionId': 'v2.0', |
|
110 |
'publicURL': None}, |
|
111 |
], |
|
112 |
'resources': { |
|
113 |
'network-private': { |
|
114 |
"name": "cyclades.network.private", |
|
115 |
"desc": "Number of private networks", |
|
116 |
"service_type": "compute", |
|
117 |
"service_origin": "cyclades_network", |
|
118 |
}, |
|
119 |
'floating_ip': { |
|
120 |
"name": "cyclades.floating_ip", |
|
121 |
"desc": "Number of Floating IP addresses", |
|
122 |
"service_type": "compute", |
|
123 |
"service_origin": "cyclades_network", |
|
124 |
}, |
|
125 |
}, |
|
126 |
}, |
|
127 |
|
|
115 | 128 |
'cyclades_vmapi': { |
116 | 129 |
'type': 'vmapi', |
117 | 130 |
'component': 'cyclades', |
b/snf-cyclades-app/synnefo/api/tests/floating_ips.py | ||
---|---|---|
43 | 43 |
from synnefo.lib import join_urls |
44 | 44 |
|
45 | 45 |
|
46 |
compute_path = get_service_path(cyclades_services, "compute", version="v2.0")
|
|
47 |
URL = join_urls(compute_path, "floatingips")
|
|
48 |
NETWORKS_URL = join_urls(compute_path, "networks")
|
|
49 |
SERVERS_URL = join_urls(compute_path, "servers")
|
|
46 |
network_path = get_service_path(cyclades_services, "network", version="v2.0")
|
|
47 |
URL = join_urls(network_path, "floatingips")
|
|
48 |
NETWORKS_URL = join_urls(network_path, "networks")
|
|
49 |
SERVERS_URL = join_urls(network_path, "servers")
|
|
50 | 50 |
|
51 | 51 |
|
52 | 52 |
floating_ips = IPAddress.objects.filter(floating_ip=True) |
b/snf-cyclades-app/synnefo/api/tests/networks.py | ||
---|---|---|
40 | 40 |
from synnefo.db.models import Network |
41 | 41 |
from django.conf import settings |
42 | 42 |
|
43 |
COMPUTE_URL = get_service_path(cyclades_services, 'compute',
|
|
43 |
NETWORK_URL = get_service_path(cyclades_services, 'network',
|
|
44 | 44 |
version='v2.0') |
45 |
NETWORKS_URL = join_urls(COMPUTE_URL, "networks/")
|
|
45 |
NETWORKS_URL = join_urls(NETWORK_URL, "networks/")
|
|
46 | 46 |
|
47 | 47 |
|
48 | 48 |
class NetworkTest(BaseAPITest): |
b/snf-cyclades-app/synnefo/api/tests/ports.py | ||
---|---|---|
40 | 40 |
from mock import patch |
41 | 41 |
import synnefo.db.models_factory as dbmf |
42 | 42 |
|
43 |
COMPUTE_URL = get_service_path(cyclades_services, 'compute',
|
|
43 |
NETWORK_URL = get_service_path(cyclades_services, 'network',
|
|
44 | 44 |
version='v2.0') |
45 |
PORTS_URL = join_urls(COMPUTE_URL, "ports/")
|
|
45 |
PORTS_URL = join_urls(NETWORK_URL, "ports/")
|
|
46 | 46 |
|
47 | 47 |
|
48 | 48 |
class PortTest(BaseAPITest): |
b/snf-cyclades-app/synnefo/api/tests/subnets.py | ||
---|---|---|
37 | 37 |
import synnefo.db.models_factory as mf |
38 | 38 |
|
39 | 39 |
|
40 |
COMPUTE_URL = get_service_path(cyclades_services, 'compute', version='v2.0')
|
|
41 |
SUBNETS_URL = join_urls(COMPUTE_URL, "subnets/")
|
|
40 |
NETWORK_URL = get_service_path(cyclades_services, 'network', version='v2.0')
|
|
41 |
SUBNETS_URL = join_urls(NETWORK_URL, "subnets/")
|
|
42 | 42 |
|
43 | 43 |
|
44 | 44 |
class SubnetTest(BaseAPITest): |
/dev/null | ||
---|---|---|
1 |
# Copyright 2011, 2012, 2013 GRNET S.A. All rights reserved. |
|
2 |
# |
|
3 |
# Redistribution and use in source and binary forms, with or |
|
4 |
# without modification, are permitted provided that the following |
|
5 |
# conditions are met: |
|
6 |
# |
|
7 |
# 1. Redistributions of source code must retain the above |
|
8 |
# copyright notice, this list of conditions and the following |
|
9 |
# disclaimer. |
|
10 |
# |
|
11 |
# 2. Redistributions in binary form must reproduce the above |
|
12 |
# copyright notice, this list of conditions and the following |
|
13 |
# disclaimer in the documentation and/or other materials |
|
14 |
# provided with the distribution. |
|
15 |
# |
|
16 |
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
17 |
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
18 |
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
19 |
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
20 |
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
21 |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
22 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
23 |
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
24 |
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
25 |
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
26 |
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
27 |
# POSSIBILITY OF SUCH DAMAGE. |
|
28 |
# |
|
29 |
# The views and conclusions contained in the software and |
|
30 |
# documentation are those of the authors and should not be |
|
31 |
# interpreted as representing official policies, either expressed |
|
32 |
# or implied, of GRNET S.A. |
|
33 |
|
|
34 |
from django.conf.urls import include, patterns |
|
35 |
|
|
36 |
from snf_django.lib.api import api_endpoint_not_found |
|
37 |
from synnefo.api import (servers, flavors, images, networks, extensions, |
|
38 |
ports, floating_ips, subnets) |
|
39 |
from synnefo.api.versions import versions_list, version_details |
|
40 |
|
|
41 |
|
|
42 |
# |
|
43 |
# The OpenStack Compute API v2.0 |
|
44 |
# |
|
45 |
api20_patterns = patterns( |
|
46 |
'', |
|
47 |
(r'^servers', include(servers)), |
|
48 |
(r'^flavors', include(flavors)), |
|
49 |
(r'^images', include(images)), |
|
50 |
(r'^networks', include(networks)), |
|
51 |
(r'^ports', include(ports)), |
|
52 |
(r'^subnets', include(subnets)), |
|
53 |
(r'^extensions', include(extensions)), |
|
54 |
(r'^floatingips', include(floating_ips.ips_urlpatterns)), |
|
55 |
# (r'^os-floating-ip-pools', include(floating_ips.pools_urlpatterns)), |
|
56 |
) |
|
57 |
|
|
58 |
|
|
59 |
urlpatterns = patterns( |
|
60 |
'', |
|
61 |
(r'^(?:.json|.xml|.atom)?$', versions_list), |
|
62 |
(r'^v2.0/(?:.json|.xml|.atom)?$', version_details, |
|
63 |
{'api_version': 'v1.1'}), |
|
64 |
(r'^v2.0/', include(api20_patterns)), |
|
65 |
(r'^.*', api_endpoint_not_found), |
|
66 |
) |
b/snf-cyclades-app/synnefo/api/util.py | ||
---|---|---|
60 | 60 |
join_urls(BASE_HOST, |
61 | 61 |
get_service_path(cyclades_services, "compute", version="v2.0")) |
62 | 62 |
SERVERS_URL = join_urls(COMPUTE_URL, "servers/") |
63 |
NETWORKS_URL = join_urls(COMPUTE_URL, "networks/") |
|
64 | 63 |
FLAVORS_URL = join_urls(COMPUTE_URL, "flavors/") |
65 | 64 |
IMAGES_URL = join_urls(COMPUTE_URL, "images/") |
66 | 65 |
PLANKTON_URL = \ |
... | ... | |
68 | 67 |
get_service_path(cyclades_services, "image", version="v1.0")) |
69 | 68 |
IMAGES_PLANKTON_URL = join_urls(PLANKTON_URL, "images/") |
70 | 69 |
|
70 |
NETWORK_URL = \ |
|
71 |
join_urls(BASE_HOST, |
|
72 |
get_service_path(cyclades_services, "network", version="v2.0")) |
|
73 |
NETWORKS_URL = join_urls(NETWORK_URL, "networks/") |
|
74 |
PORTS_URL = join_urls(NETWORK_URL, "ports/") |
|
75 |
SUBNETS_URL = join_urls(NETWORK_URL, "subnets/") |
|
76 |
FLOATING_IPS_URL = join_urls(NETWORK_URL, "floatingips/") |
|
77 |
|
|
71 | 78 |
PITHOSMAP_PREFIX = "pithosmap://" |
72 | 79 |
|
73 | 80 |
log = getLogger('synnefo.api') |
b/snf-cyclades-app/synnefo/app_settings/urls.py | ||
---|---|---|
39 | 39 |
extend_with_root_redirects, extend_endpoint_with_slash |
40 | 40 |
from snf_django.lib.api.urls import api_patterns |
41 | 41 |
from synnefo.cyclades_settings import ( |
42 |
BASE_PATH, COMPUTE_PREFIX, VMAPI_PREFIX, |
|
42 |
BASE_PATH, COMPUTE_PREFIX, NETWORK_PREFIX, VMAPI_PREFIX,
|
|
43 | 43 |
PLANKTON_PREFIX, HELPDESK_PREFIX, UI_PREFIX, ASTAKOS_BASE_URL, |
44 | 44 |
USERDATA_PREFIX, ADMIN_PREFIX, BASE_ASTAKOS_PROXY_PATH, |
45 | 45 |
ASTAKOS_ACCOUNTS_PREFIX, ASTAKOS_VIEWS_PREFIX, PROXY_USER_SERVICES, |
... | ... | |
63 | 63 |
'', |
64 | 64 |
(prefix_pattern(VMAPI_PREFIX), include('synnefo.vmapi.urls')), |
65 | 65 |
(prefix_pattern(PLANKTON_PREFIX), include('synnefo.plankton.urls')), |
66 |
(prefix_pattern(COMPUTE_PREFIX), include('synnefo.api.urls')), |
|
66 |
(prefix_pattern(COMPUTE_PREFIX), include('synnefo.api.compute_urls')), |
|
67 |
(prefix_pattern(NETWORK_PREFIX), include('synnefo.api.network_urls')), |
|
67 | 68 |
(prefix_pattern(USERDATA_PREFIX), include('synnefo.userdata.urls')), |
68 | 69 |
(prefix_pattern(ADMIN_PREFIX), include('synnefo.admin.urls')), |
69 | 70 |
) |
b/snf-cyclades-app/synnefo/cyclades_settings.py | ||
---|---|---|
54 | 54 |
set_path(cyclades_services, path, value, createpath=True) |
55 | 55 |
|
56 | 56 |
COMPUTE_PREFIX = get_path(cyclades_services, 'cyclades_compute.prefix') |
57 |
NETWORK_PREFIX = get_path(cyclades_services, 'cyclades_network.prefix') |
|
57 | 58 |
VMAPI_PREFIX = get_path(cyclades_services, 'cyclades_vmapi.prefix') |
58 | 59 |
PLANKTON_PREFIX = get_path(cyclades_services, 'cyclades_plankton.prefix') |
59 | 60 |
HELPDESK_PREFIX = get_path(cyclades_services, 'cyclades_helpdesk.prefix') |
b/snf-cyclades-app/synnefo/quotas/resources.py | ||
---|---|---|
34 | 34 |
from synnefo.util.keypath import get_path |
35 | 35 |
from synnefo.api.services import cyclades_services |
36 | 36 |
|
37 |
resources = get_path(cyclades_services, 'cyclades_compute.resources').values() |
|
37 |
resources = \ |
|
38 |
get_path(cyclades_services, 'cyclades_compute.resources').values() +\ |
|
39 |
get_path(cyclades_services, 'cyclades_network.resources').values() |
Also available in: Unified diff