Revision 44a90141

b/astakosclient/astakosclient/services.py
39 39
        'prefix': 'account',
40 40
        'public': True,
41 41
        'endpoints': [
42
            {'versionId': 'v1.0',
42
            {'versionId': '1.0',
43 43
             'publicURL': None},
44 44
        ],
45 45
        'resources': {
......
58 58
        'prefix': 'identity',
59 59
        'public': True,
60 60
        'endpoints': [
61
            {'versionId': 'v2.0',
61
            {'versionId': '2.0',
62 62
             'publicURL': None},
63 63
        ],
64 64
        'resources': {},
b/docs/astakos-api-guide.rst
376 376
            {"endpoints_links": [],
377 377
             "endpoints": [{
378 378
                "SNF:uiURL": "https://accounts.example.synnefo.org/ui",
379
                "versionId": "v1.0",
379
                "versionId": "1.0",
380 380
                "publicURL": "https://accounts.example.synnefo.org/account/v1.0"}],
381 381
             "type": "account",
382 382
             "name": "astakos_account"},
383 383
            {"endpoints_links": [],
384 384
             "endpoints": [{
385 385
                 "SNF:uiURL": "https://accounts.example.synnefo.org/ui",
386
                 "versionId": "v2.0",
386
                 "versionId": "2.0",
387 387
                 "publicURL": "https://accounts.example.synnefo.org/account/v2.0"}],
388 388
             "type": "identity",
389 389
             "name": "astakos_identity"},
390 390
            {"endpoints_links": [],
391 391
             "endpoints": [{
392 392
                 "SNF:uiURL": "https://cyclades.example.synnefo.org/ui",
393
                 "versionId": "v2.0",
394
                 "publicURL": "https://cyclades.example.synnefo.org/cyclades/compute/v2.0"}],
393
                 "versionId": "2",
394
                 "publicURL": "https://cyclades.example.synnefo.org/cyclades/compute/v2"}],
395 395
             "type": "compute",
396 396
             "name": "cyclades_compute"},
397 397
            {"endpoints_links": [],
398 398
             "endpoints": [{
399 399
                 "SNF:uiURL": "https://cyclades.example.synnefo.org/ui",
400
                 "versionId": "v1.0",
400
                 "versionId": "1.0",
401 401
                 "publicURL": "https://cyclades.example.synnefo.org/cyclades/vmapi/v1.0"}],
402 402
             "type": "cyclades_vmapi",
403 403
             "name": "cyclades_vmapi"},
404 404
            {"endpoints_links": [],
405 405
             "endpoints": [{
406 406
                 "SNF:uiURL": "https://cyclades.example.synnefo.org/ui",
407
                 "versionId": "v1.0",
407
                 "versionId": "1.0",
408 408
                 "publicURL": "https://cyclades.example.synnefo.org/cyclades/image/v1.0"}],
409 409
             "type": "image",
410 410
             "name": "cyclades_plankton"},
411 411
            {"endpoints_links": [],
412 412
             "endpoints": [{
413 413
                 "SNF:uiURL": "https://object-store.example.synnefo.org/ui",
414
                 "versionId": "v2.0",
414
                 "versionId": "2.0",
415 415
                 "publicURL": "https://object-store.example.synnefo.org/pithos/public/v2.0"}],
416 416
             "type": "public",
417 417
             "name": "pithos_public"},
418 418
            {"endpoints_links": [],
419 419
             "endpoints": [{
420 420
                 "SNF:uiURL": "https://object-store.example.synnefo.org/ui",
421
                 "versionId": "v1",
421
                 "versionId": "1",
422 422
                 "publicURL": "https://object-store.example.synnefo.org/pithos/object-store/v1"}],
423 423
             "type": "object-store",
424 424
             "name": "pithos_object-store"},
......
454 454
        </user>
455 455
        <serviceCatalog>
456 456
            <service type="account" name="astakos_account">
457
                <endpoint  SNF:uiURL="https://accounts.example.synnefo.org/ui"  versionId="v1.0"  publicURL="https://accounts.example.synnefo.org/account/v1.0"  />
457
                <endpoint  SNF:uiURL="https://accounts.example.synnefo.org/ui"  versionId="1.0"  publicURL="https://accounts.example.synnefo.org/account/v1.0"  />
458 458
            </service>
459 459
            <service type="identity" name="astakos_identity">
460
                <endpoint  SNF:uiURL="https://accounts.example.synnefo.org/ui"  versionId="v2.0"  publicURL="https://accounts.example.synnefo.org/account/v2.0"  />
460
                <endpoint  SNF:uiURL="https://accounts.example.synnefo.org/ui"  versionId="2.0"  publicURL="https://accounts.example.synnefo.org/account/v2.0"  />
461 461
            </service>
462 462
            <service type="compute" name="cyclades_compute">
463
                <endpoint  SNF:uiURL="https://cyclades.example.synnefo.org/ui"  versionId="v2.0"  publicURL="https://cyclades.example.synnefo.org/cyclades/compute/v2.0"  />
463
                <endpoint  SNF:uiURL="https://cyclades.example.synnefo.org/ui"  versionId="2"  publicURL="https://cyclades.example.synnefo.org/cyclades/compute/v2"  />
464 464
            </service>
465 465
            <service type="cyclades_vmapi" name="cyclades_vmapi">
466
                <endpoint  SNF:uiURL="https://cyclades.example.synnefo.org/ui"  versionId="v1.0"  publicURL="https://cyclades.example.synnefo.org/cyclades/vmapi/v1.0"  />
466
                <endpoint  SNF:uiURL="https://cyclades.example.synnefo.org/ui"  versionId="1.0"  publicURL="https://cyclades.example.synnefo.org/cyclades/vmapi/v1.0"  />
467 467
            </service>
468 468
            <service type="image" name="cyclades_plankton">
469
                <endpoint  SNF:uiURL="https://cyclades.example.synnefo.org/ui"  versionId="v1.0"  publicURL="https://cyclades.example.synnefo.org/cyclades/image/v1.0"  />
469
                <endpoint  SNF:uiURL="https://cyclades.example.synnefo.org/ui"  versionId="1.0"  publicURL="https://cyclades.example.synnefo.org/cyclades/image/v1.0"  />
470 470
            </service>
471 471
            <service type="public" name="pithos_public">
472
                <endpoint  SNF:uiURL="https://object-store.example.synnefo.org/ui"  versionId="v2.0"  publicURL="https://object-store.example.synnefo.org/pithos/public/v2.0"  />
472
                <endpoint  SNF:uiURL="https://object-store.example.synnefo.org/ui"  versionId="2.0"  publicURL="https://object-store.example.synnefo.org/pithos/public/v2.0"  />
473 473
            </service>
474 474
            <service type="object-store" name="pithos_object-store">
475
                <endpoint  SNF:uiURL="https://object-store.example.synnefo.org/ui"  versionId="v1"  publicURL="https://object-store.example.synnefo.org/pithos/object-store/v1"  /> </service>
475
                <endpoint  SNF:uiURL="https://object-store.example.synnefo.org/ui"  versionId="1"  publicURL="https://object-store.example.synnefo.org/pithos/object-store/v1"  /> </service>
476 476
            <service type="astakos_weblogin" name="astakos_weblogin">
477 477
                <endpoint  SNF:uiURL="htftps://accounts.example.synnefo.org/ui"  versionId=""  "SNF:webloginURL": "http://localhost:8080/astakos/weblogin"  publicURL="https://accounts.example.synnefo.org/astakos/weblogin"  />
478 478
        </serviceCatalog>
b/snf-astakos-app/astakos/im/tests/api.py
31 31
# interpreted as representing official policies, either expressed
32 32
# or implied, of GRNET S.A.
33 33

  
34
from astakos.im.tests.common import *
34
from astakos.im.tests.common import (
35
    astakos_settings, Client, Component, register, get_local_user, quotas,
36
    AstakosUser, Service, Endpoint, assertIn, activation_backends)
37

  
35 38
from astakos.im.settings import astakos_services, BASE_HOST
36 39
from synnefo.lib.services import get_service_path
37 40
from synnefo.lib import join_urls
......
335 338
        self.assertEqual(r.status_code, 200)
336 339

  
337 340
        reject_data = {'reject': ""}
338
        post_data = json.dumps(accept_data)
341
        post_data = json.dumps(reject_data)
339 342
        r = client.post(u('commissions/' + str(serial) + '/action'), post_data,
340 343
                        content_type='application/json', **s1_headers)
341 344
        self.assertEqual(r.status_code, 404)
......
402 405
        s1.save()
403 406
        e1 = Endpoint(service=s1)
404 407
        e1.save()
405
        e1.data.create(key='versionId', value='v1.0')
408
        e1.data.create(key='versionId', value='1.0')
406 409
        e1.data.create(key='publicURL', value='http://localhost:8000/s1/v1.0')
407 410

  
408 411
        s2 = Service(component=c1, type='type2', name='service2')
409 412
        s2.save()
410 413
        e2 = Endpoint(service=s2)
411 414
        e2.save()
412
        e2.data.create(key='versionId', value='v1.0')
415
        e2.data.create(key='versionId', value='1.0')
413 416
        e2.data.create(key='publicURL', value='http://localhost:8000/s2/v1.0')
414 417

  
415 418
        c2 = Component(name='component2', url='http://localhost/component2')
......
418 421
        s3.save()
419 422
        e3 = Endpoint(service=s3)
420 423
        e3.save()
421
        e3.data.create(key='versionId', value='v2.0')
424
        e3.data.create(key='versionId', value='2.0')
422 425
        e3.data.create(key='publicURL', value='http://localhost:8000/s3/v2.0')
423 426

  
424 427
    def test_authenticate(self):
......
585 588

  
586 589
class WrongPathAPITest(TestCase):
587 590
    def test_catch_wrong_account_paths(self, *args):
588
        path = get_service_path(astakos_services, 'account', 'v1.0')
591
        path = get_service_path(astakos_services, 'account', '1.0')
589 592
        path = join_urls(BASE_HOST, path, 'nonexistent')
590 593
        response = self.client.get(path)
591 594
        self.assertEqual(response.status_code, 400)
592 595
        try:
593
            error = json.loads(response.content)
596
            json.loads(response.content)
594 597
        except ValueError:
595 598
            self.assertTrue(False)
596 599

  
597 600
    def test_catch_wrong_identity_paths(self, *args):
598
        path = get_service_path(astakos_services, 'identity', 'v2.0')
601
        path = get_service_path(astakos_services, 'identity', '2.0')
599 602
        path = join_urls(BASE_HOST, path, 'nonexistent')
600 603
        response = self.client.get(path)
601 604
        self.assertEqual(response.status_code, 400)
b/snf-astakos-app/astakos/scripts/snf_service_export.py
12 12
        'prefix': 'account',
13 13
        'public': True,
14 14
        'endpoints': [
15
            {'versionId': 'v1.0',
15
            {'versionId': '1.0',
16 16
             'publicURL': None},
17 17
        ],
18 18
        'resources': {
......
31 31
        'prefix': 'identity',
32 32
        'public': True,
33 33
        'endpoints': [
34
            {'versionId': 'v2.0',
34
            {'versionId': '2.0',
35 35
             'publicURL': None},
36 36
        ],
37 37
        'resources': {},
......
67 67
        'prefix': 'compute',
68 68
        'public': True,
69 69
        'endpoints': [
70
            {'versionId': 'v2.0',
70
            {'versionId': '2.0',
71 71
             'publicURL': None},
72 72
        ],
73 73
        'resources': {
......
112 112
        'prefix': 'image',
113 113
        'public': True,
114 114
        'endpoints': [
115
            {'versionId': 'v1.0',
115
            {'versionId': '1.0',
116 116
             'publicURL': None},
117 117
        ],
118 118
        'resources': {},
......
124 124
        'prefix': 'vmapi',
125 125
        'public': True,
126 126
        'endpoints': [
127
            {'versionId': 'v1.0',
127
            {'versionId': '1.0',
128 128
             'publicURL': None},
129 129
        ],
130 130
        'resources': {},
......
173 173
        'prefix': 'object-store',
174 174
        'public': True,
175 175
        'endpoints': [
176
            {'versionId': 'v1',
176
            {'versionId': '1',
177 177
             'publicURL': None},
178 178
        ],
179 179
        'resources': {
......
193 193
        'prefix': 'public',
194 194
        'public': False,
195 195
        'endpoints': [
196
            {'versionId': 'v1.0',
196
            {'versionId': '1.0',
197 197
             'publicURL': None},
198 198
        ],
199 199
        'resources': {},
b/snf-common/synnefo/lib/services.py
43 43
        endpoints = get_path(service, 'endpoints')
44 44
        for endpoint in endpoints:
45 45
            version = get_path(endpoint, 'versionId')
46
            if version and version[0].isdigit():
47
                version = 'v' + version
48

  
46 49
            publicURL = get_path(endpoint, 'publicURL')
47 50
            if publicURL is not None:
48 51
                continue
b/snf-cyclades-app/synnefo/api/services.py
41 41
        'prefix': 'compute',
42 42
        'public': True,
43 43
        'endpoints': [
44
            {'versionId': 'v2.0',
44
            {'versionId': '2',
45 45
             'publicURL': None},
46 46
        ],
47 47
        'resources': {
......
106 106
        'prefix': 'image',
107 107
        'public': True,
108 108
        'endpoints': [
109
            {'versionId': 'v1.0',
109
            {'versionId': '1.0',
110 110
             'publicURL': None},
111 111
        ],
112 112
        'resources': {},
......
118 118
        'prefix': 'vmapi',
119 119
        'public': True,
120 120
        'endpoints': [
121
            {'versionId': 'v1.0',
121
            {'versionId': '1.0',
122 122
             'publicURL': None},
123 123
        ],
124 124
        'resources': {},
b/snf-cyclades-app/synnefo/api/test/extensions.py
38 38
from synnefo.cyclades_settings import cyclades_services
39 39
from synnefo.lib import join_urls
40 40

  
41
COMPUTE_URL = get_service_path(cyclades_services, 'compute',
42
                               version='v2.0')
41
COMPUTE_URL = get_service_path(cyclades_services, 'compute', version='2')
43 42
EXTENSIONS_URL = join_urls(COMPUTE_URL, "extensions/")
44 43

  
45 44

  
b/snf-cyclades-app/synnefo/api/test/flavors.py
48 48
        self.flavor2 = FlavorFactory(deleted=True)
49 49
        self.flavor3 = FlavorFactory()
50 50
        self.compute_path = get_service_path(cyclades_services, 'compute',
51
                                             version='v2.0')
51
                                             version='2')
52 52

  
53 53

  
54 54
    def myget(self, path):
b/snf-cyclades-app/synnefo/api/test/floating_ips.py
47 47
from synnefo.lib import join_urls
48 48

  
49 49

  
50
compute_path = get_service_path(cyclades_services, "compute", version="v2.0")
50
compute_path = get_service_path(cyclades_services, "compute", version="2")
51 51
URL = join_urls(compute_path, "os-floating-ips")
52 52
NETWORKS_URL = join_urls(compute_path, "networks")
53 53
SERVERS_URL = join_urls(compute_path, "servers")
b/snf-cyclades-app/synnefo/api/test/images.py
58 58
    def setUp(self, *args, **kwargs):
59 59
        super(ComputeAPITest, self).setUp(*args, **kwargs)
60 60
        self.compute_path = get_service_path(cyclades_services, 'compute',
61
                                             version='v2.0')
61
                                             version='2')
62 62
    def myget(self, path, *args, **kwargs):
63 63
        path = join_urls(self.compute_path, path)
64 64
        return self.get(path, *args, **kwargs)
b/snf-cyclades-app/synnefo/api/test/networks.py
46 46
    def __init__(self, *args, **kwargs):
47 47
        super(ComputeAPITest, self).__init__(*args, **kwargs)
48 48
        self.compute_path = get_service_path(cyclades_services, 'compute',
49
                                             version='v2.0')
49
                                             version='2')
50 50

  
51 51
    def myget(self, path, *args, **kwargs):
52 52
        path = join_urls(self.compute_path, path)
b/snf-cyclades-app/synnefo/api/test/servers.py
52 52
    def __init__(self, *args, **kwargs):
53 53
        super(ComputeAPITest, self).__init__(*args, **kwargs)
54 54
        self.compute_path = get_service_path(cyclades_services, 'compute',
55
                                             version='v2.0')
55
                                             version='2')
56 56

  
57 57
    def myget(self, path, *args, **kwargs):
58 58
        path = join_urls(self.compute_path, path)
b/snf-cyclades-app/synnefo/api/test/versions.py
42 42
class APITest(TestCase):
43 43
    def test_api_version(self):
44 44
        """Check API version."""
45
        path = get_service_path(cyclades_services,
46
                                'compute', version='v2.0')
45
        path = get_service_path(cyclades_services, 'compute', version='2')
47 46
        with astakos_user('user'):
48 47
            response = self.client.get(path)
49 48
        self.assertEqual(response.status_code, 200)
50 49
        api_version = json.loads(response.content)['version']
51
        self.assertEqual(api_version['id'], 'v2.0')
50
        self.assertEqual(api_version['id'], 'v2')
52 51
        self.assertEqual(api_version['status'], 'CURRENT')
53 52

  
54 53
    def test_catch_wrong_api_paths(self, *args):
55
        path = get_service_path(cyclades_services,
56
                                'compute', version='v2.0')
54
        path = get_service_path(cyclades_services, 'compute', version='2')
57 55
        response = self.client.get(join_urls(path, 'nonexistent'))
58 56
        self.assertEqual(response.status_code, 400)
59 57
        try:
b/snf-cyclades-app/synnefo/api/urls.py
57 57
urlpatterns = patterns(
58 58
    '',
59 59
    (r'^(?:.json|.xml|.atom)?$', versions_list),
60
    (r'^v2.0/(?:.json|.xml|.atom)?$', version_details,
60
    (r'^v2/(?:.json|.xml|.atom)?$', version_details,
61 61
        {'api_version': 'v1.1'}),
62
    (r'^v2.0/', include(api20_patterns)),
62
    (r'^v2/', include(api20_patterns)),
63 63
    (r'^.*', api_endpoint_not_found),
64 64
)
b/snf-cyclades-app/synnefo/api/util.py
63 63

  
64 64
COMPUTE_URL = \
65 65
    join_urls(BASE_HOST,
66
              get_service_path(cyclades_services, "compute", version="v2.0"))
66
              get_service_path(cyclades_services, "compute", version="2"))
67 67
SERVERS_URL = join_urls(COMPUTE_URL, "servers/")
68 68
NETWORKS_URL = join_urls(COMPUTE_URL, "networks/")
69 69
FLAVORS_URL = join_urls(COMPUTE_URL, "flavors/")
70 70
IMAGES_URL = join_urls(COMPUTE_URL, "images/")
71 71
PLANKTON_URL = \
72 72
    join_urls(BASE_HOST,
73
              get_service_path(cyclades_services, "image", version="v1.0"))
73
              get_service_path(cyclades_services, "image", version="1.0"))
74 74
IMAGES_PLANKTON_URL = join_urls(PLANKTON_URL, "images/")
75 75

  
76 76

  
b/snf-cyclades-app/synnefo/api/versions.py
45 45

  
46 46

  
47 47
VERSION_2_0 = {
48
    "id": "v2.0",
48
    "id": "v2",
49 49
    "status": "CURRENT",
50 50
    "updated": "2011-01-21T11:33:21-06:00",
51 51
    "links": [
b/snf-cyclades-app/synnefo/plankton/tests.py
46 46
    def setUp(self, *args, **kwargs):
47 47
        super(PlanktonAPITest, self).setUp(*args, **kwargs)
48 48
        self.api_path = get_service_path(cyclades_services, 'image',
49
                                             version='v1.0')
49
                                             version='1.0')
50 50
    def myget(self, path, *args, **kwargs):
51 51
        path = join_urls(self.api_path, path)
52 52
        return self.get(path, *args, **kwargs)
b/snf-cyclades-app/synnefo/ui/settings.py
44 44
if not BASE_PATH.startswith("/"):
45 45
    BASE_PATH = "/" + BASE_PATH
46 46

  
47
GLANCE_URL = endpoint(cyclades_services, 'image', 'v1.0').rstrip('/')
48
COMPUTE_URL = endpoint(cyclades_services, 'compute', 'v2.0').rstrip('/')
47
GLANCE_URL = endpoint(cyclades_services, 'image', '1.0').rstrip('/')
48
COMPUTE_URL = endpoint(cyclades_services, 'compute', '2').rstrip('/')
49 49
USERDATA_URL = endpoint(cyclades_services, 'cyclades_userdata', '').rstrip('/')
50 50
ASTAKOS_UI_URL = endpoint(astakos_services, 'astakos_ui', '').rstrip('/')
51 51

  
......
54 54
    ACCOUNT_URL = join_urls('/', cyclades.BASE_ASTAKOS_PROXY_PATH,
55 55
                            cyclades.ASTAKOS_ACCOUNTS_PREFIX, 'v1.0')
56 56
else:
57
    ACCOUNT_URL = endpoint(astakos_services, 'account', 'v1.0')
57
    ACCOUNT_URL = endpoint(astakos_services, 'account', '1.0')
58 58

  
59 59

  
60 60
USER_CATALOG_URL = join_urls(ACCOUNT_URL, 'user_catalogs')
b/snf-cyclades-app/synnefo/vmapi/tests.py
47 47
    def setUp(self, *args, **kwargs):
48 48
        super(VMAPITest, self).setUp(*args, **kwargs)
49 49
        self.api_path = get_service_path(cyclades_services, 'vmapi',
50
                                         version='v1.0')
50
                                         version='1.0')
51 51
    def myget(self, path, *args, **kwargs):
52 52
        path = join_urls(self.api_path, path)
53 53
        return self.client.get(path, *args, **kwargs)
b/snf-pithos-app/pithos/api/services.py
39 39
        'prefix': 'object-store',
40 40
        'public': True,
41 41
        'endpoints': [
42
            {'versionId': 'v1',
42
            {'versionId': '1',
43 43
             'publicURL': None},
44 44
        ],
45 45
        'resources': {
......
59 59
        'prefix': 'public',
60 60
        'public': False,
61 61
        'endpoints': [
62
            {'versionId': 'v1.0',
62
            {'versionId': '1.0',
63 63
             'publicURL': None},
64 64
        ],
65 65
        'resources': {},

Also available in: Unified diff