diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json index 0a88eb2483..787f5f3b7f 100644 --- a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json +++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json @@ -1,12 +1,12 @@ { "flavor": { - "OS-FLV-EXT-DATA:ephemeral": 30, - "disk": 10, - "id": "666", "name": "flavortest", "ram": 1024, + "vcpus": 2, + "disk": 10, + "id": "666", "rxtx_factor": 2.0, - "swap": 5, - "vcpus": 2 + "OS-FLV-EXT-DATA:ephemeral": 30, + "swap": 5 } -} +} \ No newline at end of file diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml index cc2d05eed5..99aec19ed8 100644 --- a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml +++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml @@ -1,11 +1,11 @@ + OS-FLV-EXT-DATA:ephemeral="30" /> \ No newline at end of file diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml index c877553a1b..7da3e23797 100644 --- a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml +++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/doc/api_samples/os-flavor-manage/flavor-create-post-req.json b/doc/api_samples/os-flavor-manage/flavor-create-post-req.json index 9c5661cdbf..8a3830f094 100644 --- a/doc/api_samples/os-flavor-manage/flavor-create-post-req.json +++ b/doc/api_samples/os-flavor-manage/flavor-create-post-req.json @@ -5,9 +5,5 @@ "vcpus": 2, "disk": 10, "id": "10", - "os-flavor-access:is_public": true, - "rxtx_factor": 1, - "OS-FLV-EXT-DATA:ephemeral": 0, - "swap": 0 } } diff --git a/doc/api_samples/os-flavor-manage/flavor-create-post-req.xml b/doc/api_samples/os-flavor-manage/flavor-create-post-req.xml index 2018acb0f3..b90c108d0c 100644 --- a/doc/api_samples/os-flavor-manage/flavor-create-post-req.xml +++ b/doc/api_samples/os-flavor-manage/flavor-create-post-req.xml @@ -5,6 +5,4 @@ 2 10 10 - 1 - 0 diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json.tpl index 3b421b4e1d..3422de9f5e 100644 --- a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json.tpl +++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json.tpl @@ -2,19 +2,19 @@ "flavor": { "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 0, - "id": "1", + "id": "%(flavor_id)s", "links": [ { - "href": "http://openstack.example.com/v2/openstack/flavors/1", + "href": "%(host)s/v2/openstack/flavors/%(flavor_id)s", "rel": "self" }, { - "href": "http://openstack.example.com/openstack/flavors/1", + "href": "%(host)s/openstack/flavors/%(flavor_id)s", "rel": "bookmark" } ], - "name": "m1.tiny", + "name": "%(flavor_name)s", "ram": 512, "vcpus": 1 } -} \ No newline at end of file +} diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml.tpl index dfecff1fc3..dc143010a8 100644 --- a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml.tpl +++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml.tpl @@ -1,5 +1,5 @@ - - - - \ No newline at end of file + + + + diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json.tpl index ee7696bed7..2c79efeaf4 100644 --- a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json.tpl +++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json.tpl @@ -6,11 +6,11 @@ "id": "1", "links": [ { - "href": "http://openstack.example.com/v2/openstack/flavors/1", + "href": "%(host)s/v2/openstack/flavors/1", "rel": "self" }, { - "href": "http://openstack.example.com/openstack/flavors/1", + "href": "%(host)s/openstack/flavors/1", "rel": "bookmark" } ], @@ -24,11 +24,11 @@ "id": "2", "links": [ { - "href": "http://openstack.example.com/v2/openstack/flavors/2", + "href": "%(host)s/v2/openstack/flavors/2", "rel": "self" }, { - "href": "http://openstack.example.com/openstack/flavors/2", + "href": "%(host)s/openstack/flavors/2", "rel": "bookmark" } ], @@ -42,11 +42,11 @@ "id": "3", "links": [ { - "href": "http://openstack.example.com/v2/openstack/flavors/3", + "href": "%(host)s/v2/openstack/flavors/3", "rel": "self" }, { - "href": "http://openstack.example.com/openstack/flavors/3", + "href": "%(host)s/openstack/flavors/3", "rel": "bookmark" } ], @@ -60,11 +60,11 @@ "id": "4", "links": [ { - "href": "http://openstack.example.com/v2/openstack/flavors/4", + "href": "%(host)s/v2/openstack/flavors/4", "rel": "self" }, { - "href": "http://openstack.example.com/openstack/flavors/4", + "href": "%(host)s/openstack/flavors/4", "rel": "bookmark" } ], @@ -78,11 +78,11 @@ "id": "5", "links": [ { - "href": "http://openstack.example.com/v2/openstack/flavors/5", + "href": "%(host)s/v2/openstack/flavors/5", "rel": "self" }, { - "href": "http://openstack.example.com/openstack/flavors/5", + "href": "%(host)s/openstack/flavors/5", "rel": "bookmark" } ], @@ -91,4 +91,4 @@ "vcpus": 8 } ] -} \ No newline at end of file +} diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml.tpl index 7b53621b7a..7108ebd79b 100644 --- a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml.tpl +++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml.tpl @@ -1,23 +1,23 @@ - - + + - - + + - - + + - - + + - - + + - \ No newline at end of file + diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json.tpl index 0a88eb2483..64385ad682 100644 --- a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json.tpl +++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json.tpl @@ -1,12 +1,12 @@ { "flavor": { - "OS-FLV-EXT-DATA:ephemeral": 30, - "disk": 10, - "id": "666", - "name": "flavortest", + "name": "%(flavor_name)s", "ram": 1024, + "vcpus": 2, + "disk": 10, + "id": "%(flavor_id)s", "rxtx_factor": 2.0, - "swap": 5, - "vcpus": 2 + "OS-FLV-EXT-DATA:ephemeral": 30, + "swap": 5 } } diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml.tpl index cc2d05eed5..df74ab383f 100644 --- a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml.tpl +++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml.tpl @@ -1,11 +1,11 @@ diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.json.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.json.tpl index 9eb2c77ff5..3a92dabca8 100644 --- a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.json.tpl +++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.json.tpl @@ -2,19 +2,19 @@ "flavor": { "OS-FLV-EXT-DATA:ephemeral": 30, "disk": 10, - "id": "666", + "id": "%(flavor_id)s", "links": [ { - "href": "http://openstack.example.com/v2/openstack/flavors/666", + "href": "%(host)s/v2/openstack/flavors/%(flavor_id)s", "rel": "self" }, { - "href": "http://openstack.example.com/openstack/flavors/666", + "href": "%(host)s/openstack/flavors/%(flavor_id)s", "rel": "bookmark" } ], - "name": "flavortest", + "name": "%(flavor_name)s", "ram": 1024, "vcpus": 2 } -} \ No newline at end of file +} diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml.tpl index c877553a1b..df7fc07a32 100644 --- a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml.tpl +++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml.tpl @@ -1,5 +1,5 @@ - - - - \ No newline at end of file + + + + diff --git a/nova/tests/integrated/api_samples/os-flavor-manage/flavor-create-post-req.json.tpl b/nova/tests/integrated/api_samples/os-flavor-manage/flavor-create-post-req.json.tpl index 9ff3957b9c..5383e5d15e 100644 --- a/nova/tests/integrated/api_samples/os-flavor-manage/flavor-create-post-req.json.tpl +++ b/nova/tests/integrated/api_samples/os-flavor-manage/flavor-create-post-req.json.tpl @@ -4,10 +4,6 @@ "ram": 1024, "vcpus": 2, "disk": 10, - "id": "%(flavor_id)s", - "os-flavor-access:is_public": true, - "rxtx_factor": 1, - "OS-FLV-EXT-DATA:ephemeral": 0, - "swap": 0 + "id": "%(flavor_id)s" } } diff --git a/nova/tests/integrated/api_samples/os-flavor-manage/flavor-create-post-req.xml.tpl b/nova/tests/integrated/api_samples/os-flavor-manage/flavor-create-post-req.xml.tpl index 6b03dc2f91..764cebe8e4 100644 --- a/nova/tests/integrated/api_samples/os-flavor-manage/flavor-create-post-req.xml.tpl +++ b/nova/tests/integrated/api_samples/os-flavor-manage/flavor-create-post-req.xml.tpl @@ -5,6 +5,4 @@ 2 10 %(flavor_id)s - 1 - 0 diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index b864b84fad..6648fa896f 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -774,23 +774,34 @@ class FlavorsExtraDataJsonTest(ApiSampleTestBase): return f def test_flavors_extra_data_get(self): - response = self._do_get('flavors/1') - subs = self._get_regexes() + flavor_id = 1 + response = self._do_get('flavors/%s' % flavor_id) + self.assertEqual(response.status, 200) + subs = { + 'flavor_id': flavor_id, + 'flavor_name': 'm1.tiny' + } + subs.update(self._get_regexes()) return self._verify_response('flavors-extra-data-get-resp', subs, response) def test_flavors_extra_data_list(self): response = self._do_get('flavors/detail') + self.assertEqual(response.status, 200) subs = self._get_regexes() return self._verify_response('flavors-extra-data-list-resp', subs, response) - def test_flavors_extra_data_post(self): + def test_flavors_extra_data_create(self): + subs = { + 'flavor_id': 666, + 'flavor_name': 'flavortest' + } response = self._do_post('flavors', 'flavors-extra-data-post-req', - {}) + subs) self.assertEqual(response.status, 200) - subs = self._get_regexes() + subs.update(self._get_regexes()) return self._verify_response('flavors-extra-data-post-resp', subs, response)