Commit Graph

252 Commits

Author SHA1 Message Date
Jerome Pansanel db1a78a9c8 Set correctly request parameters for the list_resources request
The Neutron API requires that the content_type and accept headers
are correcty set in the request. This commit permit to fix this
issue.

It has been successfully tested with Tox.

Closes-Bug: 1754096

Change-Id: I977f97cd0692a86bac1d817fa1c4de27889f2675
2018-03-08 09:09:48 +01:00
Jenkins 9ab7f8299b Merge "Removes listing of inaccessible subnets" 2017-08-24 08:24:52 +00:00
Enol Fernandez f29d0803a9 Add a new base mixin for Floating IP
Change-Id: I1c0f61db4e549bca6233231230c24a5c453d1a00
Closes-Bug: 1687935
2017-08-23 10:23:05 +01:00
Enol Fernandez 3647b2bbf0 Add missing location to mixins
Change-Id: I25d3a2ae81c42f24d98ed2536e3dd0acb06b96e3
Closes-Bug: 1687933
2017-08-23 07:49:09 +01:00
Luís Alves 73e744d6b1 Removes listing of inaccessible subnets
- Related-Bug: 1709249
 - WARN when subnet is inaccessible

Change-Id: I22fd07025300127d411803d4ea0351eb09c1ce64
2017-08-11 09:55:25 +01:00
Jenkins 8f3a0de485 Merge "Add occi.compute.ephemeral_storage.size attribute" 2017-08-03 11:45:09 +00:00
Enol Fernandez f936ed3c78 Render default values that are not None
Allow rendering 0, False and other default values that would be
considered as false by python.

Change-Id: I0108b4430e831a7aa14bfd8d6deb4accb759d578
2017-08-03 11:33:50 +00:00
Enol Fernandez 54d97ffcda Add occi.compute.ephemeral_storage.size attribute
Implemented as an alias of org.openstack.flavor.ephemeral so both can be
used.

Change-Id: I8764af5778d73b3a9e112cfff97be7efdda6af33
Related-Bug: 1687943
2017-08-03 11:33:47 +00:00
Enol Fernandez 8500d14450 Add default values to resource templates
Change-Id: I55e5b66cdc1d861651658d8e3bad204618ad2e35
Closes-Bug: 1687943
2017-08-03 11:33:21 +00:00
Enol Fernandez 9a98331c7f Add applies to compute mixins
Change-Id: I2a7b9403063fa42806751a37fb9e8ec8a082a7cd
Closes-Bug: 1687938
2017-08-03 10:42:47 +00:00
Enol Fernandez 8f669d9225 Add VM resize support
Updates in compute with correct mixin will produce a VM resize. The
resize will not be confirmed automatically unless the
resize_confirm_window is configured in nova.

Change-Id: I8b868a8a4fb403e337d3fe6c08b7d3f65736e545
2017-08-01 07:18:13 +00:00
Jenkins 65bd940498 Merge "Remove unused logging import" 2017-07-11 08:34:32 +00:00
Kiran_totad 51a1d47ec4 Remove unused logging import
Change-Id: I897c47758f38c935572d19440eb7f54840a13f81
2017-07-11 06:04:25 +00:00
Jenkins aea176223f Merge "Fixed order of arguments in assertEqual" 2017-07-10 08:41:17 +00:00
sudhir_agarwal 70942f44ea Fixed order of arguments in assertEqual
Some tests used incorrect order of arguments in
assertEqual(observed, expected). The correct order expected
by testtool is assertEqual(expected, observed).

Change-Id: I9ef01d5aef1610830a4d89ecea3c5b128c9fa6ed
2017-07-06 18:20:39 +05:30
kavithahr 4c72f8233c Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid using six.iteritems to
achieve iterators. We can use dict.items instead, as it will
return iterators in PY3 as well. And dict.items/keys will more
readable.
2.In py2, the performance about list should be negligible, see
the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June
/066391.html

Change-Id: Icfc0998c77b4d9c2112af331d21ec5b41fd7de50
2017-07-06 11:41:20 +05:30
Alvaro Lopez Garcia 4923182db3 Use same environment for Neutron calls
We need to use the same environment (with the token, etc.) for making
the neutron calls, instead of just trying to obtain the token from the
headers (whose key lookup in the dictionary, by the way, was wrong). We
need to remove some keys from the environ, so that the new request is
created properly.

Change-Id: I86bedab940449a07780e288c03d4de789b8e695a
2017-06-27 11:18:23 +02:00
Alvaro Lopez Garcia b3d479729a Publish and accept OCCI/1.1 as a valid version
Change d5ad90a fixed the publication of OCCI/1.1 as the supported OCCI
version, but it introduced a new bug that prevented users from passing
OCCI/1.1 in the user agent, forcing them to be OCCI/1.2. Even if the
OCCI spec says that: "The 'User-Agent' header MUST include the same
value (OCCI/X.Y) as advertised by the server" we should continue
accepting OCCI/1.1 as a valid version.

Change-Id: Iabcd8fda367876568b6f221d0ecc5ab2ffa06c90
Closes-Bug: #1683317
2017-04-17 13:34:53 +02:00
Jenkins 5032dbdf08 Merge "Fix block_device_mapping on compute creation" 2017-04-12 10:30:12 +00:00
Jenkins f6b3c5a5a6 Merge "Use the correct OCCI version" 2017-04-12 10:29:37 +00:00
Alvaro Lopez Garcia d5ad90a7c6 Use the correct OCCI version
We were still publishing OCCI 1.1 as the version, instead of OCCI 1.2

Closes-bug: #1679049
Change-Id: I7b76ef24b7a296f19980a63c6472b47ded96b4eb
2017-04-12 12:07:31 +02:00
Jenkins 03ca1e68f1 Merge "Include OCCI1.2 save action" 2017-04-12 09:32:49 +00:00
Enol Fernandez 571cca3752 Fix block_device_mapping on compute creation
Use block_device_mapping instead of block_device_mapping_v2 that seems
to not attach properly volumes on creation. This legacy option is enough
to support the requested use case (attaching volumes on boot).

Change-Id: I39f17faec6a48e90740e5e4757c1278df0b9830c
Closes-bug: #1679498
2017-04-05 11:50:04 +01:00
Jenkins 2e6c6b22c0 Merge "Included OCCI IPReservation support" 2017-04-03 07:07:34 +00:00
Jorge Sevilla 7566dce6af Included OCCI IPReservation support
This is a complete change in which we have add the OCCI IPRESERVATION
class with the features provided by CESNET. We include: the controller,
the occi class, middleware changes, and tests to control it.
In addition, we have modified networklink to support this feature,
now networklink is identified by using only compute id and ipreservation
ip. Last, we add the documentation relate to its usage.

Change-Id: I52f80a9a7a39e00d1d7487001863586a551edf5f
2017-04-03 08:59:52 +02:00
Alvaro Lopez Garcia 0549ee16cb Check if project id is None from headers
To check if the user was providing a scoped token we were relying on the
"HTTP_X_PROJECT_ID" environment variable, relying on a KeyError
exception when accessing the dictionary. However, the variable can be
empty, resulting in a dictionary key "HTTP_X_PROJECT_ID":None. As a
consequence, we were using None as the project ID, resulting in
misleading errors.

Closes-bug: #1678060
Change-Id: I1956fd99be5771371b1d3401e335528c5cc6455e
2017-04-03 08:38:50 +02:00
Enol Fernandez f6fdeaf0b7 Include OCCI1.2 save action
OCCI1.2 creates new actions on compute resources, "save" creates
an snapshot of an existing image and includes that snapshot as
a valid OS Template.

Implements: blueprint snapshot-support
Change-Id: Ic416d3c5fd9757af4f949158a0a15c83775ea801
2017-03-31 14:13:14 +02:00
Jenkins 98af646b0c Merge "Security Group support for Nova and Neutron" 2017-03-31 12:06:23 +00:00
Jenkins d01e7b04fb Merge "Include OCCI Security Group infrastructure" 2017-03-31 11:52:57 +00:00
Alvaro Lopez Garcia 59e75c3f5d docs: fix network.py docstring
Change-Id: If527afa733f4ad8ac54f695330a4a08aa0ae2b7e
2017-03-29 10:29:40 +00:00
Enol Fernandez d1da7a1dfe Add option to handle SSL termination proxies
ooi needs to return URLs of objects matching the URL scheme used
for serving the application even if ooi is behind a SSL termination
proxy.

A new configuration variable "ooi_secure_proxy_ssl_header" that
defines the HTTP header that can be used to update the wsgi.url_scheme
environment variable. Typical value for this variable is
'HTTP_X_FORWARDED_PROTO'.

Change-Id: I7ce7583f64778f667a7ea310d493390d9e19f1e2
Closes-Bug: #1676844
2017-03-28 13:16:25 +01:00
Jorge Sevilla ecf29929d7 Security Group support for Nova and Neutron
We have implemented the API and helpers for Nova and Neutron for
the Security Group Resource and Link. Security Group is working
just by using json requests.

Change-Id: I15ce76a42caa75f158ac1a792aa44d2da8c7e404
2017-02-24 17:59:57 +01:00
Jorge Sevilla 647740eb9c Include OCCI Security Group infrastructure
This change add the OCCI Security Group infrastructure following
the features provided by CESNET.

Change-Id: Ic573210399bbcd30e699d0d4f6446b932230d4ae
2017-02-24 16:49:21 +01:00
Enol Fernandez a8cfcb58e8 Do not crash on volume attachments without device
Sometimes OpenStack does not return any device in the attached volumes, this
change avoids a KeyError when not defined.

Change-Id: If96fa02a7d6fd93e31667b2481943c6294173f72
Closes-Bug: #1663491
2017-02-13 07:09:55 +00:00
Enol Fernandez bb194c3e8e Add categories to resource links
Text rendering of OCCI includes the category of the link associated to a
resource. This helps clients to select the links based on their kinds.

Change-Id: Ibd803cb26566e40b5fc589cdea6d111eaec36e03
Closes-Bug: #1656844
2017-01-16 18:03:54 +00:00
jorgesece e2207d7c12 Check if router exists on network creation
List the routers of the tenant and use the first router with external
gateway, thus It is linked to the public network.
In case no router with those features is found, a new one is created.

Change-Id: I696ebe04426fab7e210d86f30084c4fee64cbce8
Closes-bug: #1637497
2017-01-16 08:22:31 +00:00
Enol Fernandez e30fdd75f4 OCCI 1.2 Contextualization
Introduces two new mixins defined in the OCCI 1.2 spec for handling
contextualization: user_data and ssh_key. Functionality is similar to
the already existing OpenStack mixins, which may be deprecated in the
future.

Partially-Implements: blueprint occi-1-2-core
Change-Id: Ibb6624e3e15bf7b9f3ad39786dcefb36b1a9a797
2017-01-13 12:32:36 +00:00
Enol Fernandez db9dae4a26 Update link handling in parser
Change the link structure returned by the parser to better follow the
OCCI 1.2 standard. The parser returns a dictionary where keys are the
link target kind type and values are lists with dictionaries for each
of the links of the links defined for that kind type. Those dictionaries
contain the target location (occi.core.target), the link id if defined,
and a dictionary with any extra attributes defined.

Change-Id: I24205044a6e2b670ceb98f3a0e9224637bf9fcf4
2017-01-13 12:32:03 +00:00
Enol Fernandez a74fdd5dd5 OCCI 1.2 JSON parser
Parses JSON OCCI structures as defined in the current OCCI 1.2 draft and
populates the internal structure used in ooi for managing input from
users.

Change-Id: I687f38420a0f4290f1ee0cffdae22c9b5fade43d
2017-01-13 12:31:47 +00:00
Enol Fernandez f6061d46d5 JSON serializer
Add a new serializer for application/occi+json content type.

Change-Id: I1c055efae29b6a9a6645f02744d8c0e5c65ff335
2017-01-13 12:31:35 +00:00
Enol Fernandez 38cccfe3c5 Return collections instead of object lists
Every time we need to return more than one object a collection should
be used instead of a list of those objects. This allows to render the
objects taking into account their context. If returning a single
object controllers must return the object instead of a list.

Change-Id: I0caa3334dbd14374f39bf41acf45528fc7befa45
2017-01-13 12:31:05 +00:00
Enol Fernandez 43995a96dc Improve Collection rendering
Collection with only one type of objects are rendered as X-OCCI-Location,
as when returned when performing a GET to a resource location.
For collections with more than one type, render each of the individual
objects.

Change-Id: I4978e5f8eacbb3db0e6f0bc2ddf02ac3c6d9ac54
2017-01-13 12:28:19 +00:00
Enol Fernandez 3ee034c683 OCCI 1.2 json rendering
Render OCCI objects as json as defined in the current draft of
the OCCI 1.2 standard.

Partially-Implements: blueprint json-rendering
Change-Id: I472e452a7cb1fda70ebd991df6cf64e2e1d5cc7b
2017-01-13 09:50:46 +00:00
Enol Fernandez 967f1a2cab Increase attribute types
In order to do proper JSON rendering, ooi needs to to further refine
the Object attribute type into numbers, bools and strings. All
attributes are updated to include the type. Object attribute type is
only used now for source and targets in links. Handling of attributes
in network is simplified thanks to this change.

Change-Id: If1c0e6b1e08139b369b3c68c4a12ff7244c3445f
2017-01-13 09:46:11 +00:00
Enol Fernandez 1df2897254 Parse attributes according to their types
Follow OCCI 1.2 text rendering to parse attributes as string, number,
boolean or enum.

Change-Id: I7b78509a276abc6d77e72598f5da234be2e72a00
2017-01-13 09:44:58 +00:00
shashi.kant 32ef451892 Removes unnecessary utf-8 encoding
Change-Id: I41eef96cd4740e085a900b53429144c5ba3dfbc2
2017-01-12 15:21:57 +05:30
Jenkins bd63013ce9 Merge "add bandit security linter" 2016-11-29 22:14:31 +00:00
Jenkins f1389f3179 Merge "utils: remove use of assert" 2016-11-29 22:14:22 +00:00
Alvaro Lopez Garcia 9f5a7ad26b add bandit security linter
skip B104:hardcoded_bind_all_interfaces since we are an API, so we need
to bind to all interfaces, skip this test for now.

Change-Id: I2ce3eccb28872b81c04f79e2434833f8c038af3f
2016-11-21 15:03:52 +01:00
Alvaro Lopez Garcia 6ff6a3147a utils: remove use of assert
When code is optimized, the assertion will be removed.

Change-Id: I3d313ef637646ca10b721acd3bf91795ed2a3293
2016-11-21 14:54:16 +01:00