Commit Graph

15 Commits (c1a8606095d4021c0f484d2bfa86fc15602503eb)

Author SHA1 Message Date
Zhenguo Niu c1a8606095 Add db api layer for CRUD operations on node tags
- set/unset node tags
- get node tags
- add/delete single tag
- check whether node tag exists
- Delete all tags attached to the node when it's destroyed

This will not support creating node with tags, just ignore
the specified tags.

Change-Id: Ibe83a726d904fd33b8550c8bec134cf05644560e
Partial-bug: #1526266
7 years ago
Ruby Loo edc37cbe1d API to manually clean nodes
This adds an API to allow manual cleaning of nodes, via
PUT /v1/nodes/<node_ident>/states/provision. The argument
'target' is 'clean', and the argument 'clean_steps' (the
list of clean steps to be performed on the node) must be

The API version is bumped to 1.15.

Change-Id: I0e34407133684e34c4ab9446b3521a24f3038f92
Partial-Bug: #1526290
7 years ago
Om Kumar 1740ab7970 Add portgroups to support LAG interfaces - DB
Ironic should be able to provide the requisite connectivity
information to the Neutron ML2 plugin to allow drivers to
provision the top-of-rack switch for the bare metal server.
The addition of portgroups in Ironic allows the concept of
link aggregation to be handled in Ironic in order to provide
support for cases where multiple interfaces on the bare metal
server connect to switch ports of a single LAG.

This commit includes changes to:
- the DB models (extension of port model and addition of portgroup
- the DB tests

Partial-bug: #1526403
Co-Authored-By: Laura Moore (
Co-Authored-By: Jenny Moorehead (
Co-Authored-By: Will Stevenson (

Change-Id: Ic028c316b0670c2d18de89111e83069f3441f476
7 years ago
Yatin Kumbhare a23b9b7fbd Use assertTrue/False instead of assertEqual(T/F)
The usage of assertEqual(True/False, ***) should be changed
to a meaningful format of assertTrue/False(***).

Change-Id: I7ec7fdb53d9141c25a16b78a5149dc0d2909c366
Closes-Bug: #1512207
8 years ago
Jim Rollenhagen bd60603e44 Don't return tracebacks in API response in debug mode
The API should not return tracebacks in a production environment. As
deployers often run services in debug mode, because OpenStack is hard to
debug, we should not return tracebacks in debug mode. To allow
developers etc to continue to use this feature, add a new config option
'debug_tracebacks_in_api' that maintains this behavior.

Also add to troubleshooting docs.

Change-Id: Idbbf7efc45140e9e3d8b9491edd58905cbba0363
Closes-Bug: #1525002
8 years ago
John L. Villalovos ec2a3285d8 Replace HTTP 'magic numbers' with constants
Replace HTTP 'magic numbers' (also known as unnamed numerical constants)
with constants provided by the http_client/httplib library.

For example, use 'http_client.OK' instead of '200'

This was done before in commit 107e064ca1c981480f12fad03fdd02d1f4847422
but a few more HTTP numbers have slipped in since that commit.

Change-Id: Ia3db6b0c8ef832290ffde8510a7ebe33adf356c4
8 years ago
Miles Gould 34b3589ea3 Get mandatory patch attrs from WSME properties
Attributes which are mandatory (ie, required for object creation) should
not be removable. However, some attributes (such as Node.chassis_uuid)
are not required for object creation, but should not be removable if
they are set. This commit does the following:

 - rename JsonPatchType.mandatory_attrs to non_removable_attrs to better
   describe its meaning,
 - change its return type to set-of-strings for faster lookup
 - ensure all mandatory attributes on the type being patched are
   included in the set of non-removable attributes,
 - add a new field, JsonPatchType._extra_non_removable_attrs, which
   should be a set of attributes that are not required for creation but
   should not be removed if set.

Since the object to be patched does not exist at patch-validation time,
we leave the validation logic in methods of JsonPatchType and
subclasses. This means introspecting the types to be patched.

Closes-Bug: #1284781

Change-Id: I2bb7fed2c776c8d63535c5ee19cdc218e57806e3
8 years ago
Jenkins c99eef2456 Merge "Added unit tests for CORS middleware" 8 years ago
Jenkins 3e51391e35 Merge "Expose versioning information on GET / endpoint" 8 years ago
Michael Krotscheck 9a2f7c3112 Added unit tests for CORS middleware
A simple set of sanity tests that assert that the CORS middleware
is correctly triggered.

Change-Id: I4c40d748caf404a152bcd2b60a6b9a4dbe2cff9b
8 years ago
John L. Villalovos d1cb7180d5 Move ironic.tests.unit.base to ironic.tests.base
We will use the file for both unit and functional testing, so
move it under ironic/tests/

Change-Id: Ifc36d61be60c820dd8e5ee0f9b9dadb52d8b480a
Partial-Bug: #1491670
8 years ago
Zhenguo Niu cd687bc503 Convert set() to list in ListType
ListType should return a list instead of set, As set is not json

Change-Id: I06011929022c124883a00cdf5784ed63f79f48a5
8 years ago
Dmitry Tantsur 91467d3135 Expose versioning information on GET / endpoint
This returns 'min_version' (minimum supported version), 'version'
(current/maximum supported version), and 'status' (of the version,
is 'CURRENT' for v1) in the response to a GET / request.
It makes our response to / very close to Nova's one[0], and will allow
us to implement a `ironic version-list` command similar to Nova's.

As this change is needed for proper versioning support on client
side, it's not versioned itself. Otherwise we'll have a
chicken-and-egg problem.


Closes-Bug: #1489172
Co-Authored-By: Ruby Loo <>
Change-Id: I6dd1ea20e23137d9a9566355adc0784067d2cb5b
8 years ago
John L. Villalovos 93ff6cb519 Follow up for: Prepare for functional testing patch
Follow up patch to fix the issues from the patch:
    Prepare for functional testing
    commit f350d87af8

Fix comment in tests/unit/

Changed name of base test class from 'FunctionalTest' to 'BaseApiTest'

Change-Id: I26c093826047ac604c613fd975c6d512d2c156af
8 years ago
John L. Villalovos f350d87af8 Prepare for functional testing
Prepare for functional testing by creating two new directories:
  * ironic/tests/unit
  * ironic/tests/functional

Move all files currently in ironic/tests/* to ironic/tests/unit/

Update imports from 'ironic.tests.YYY' to 'ironic.tests.unit.YYY'

Fix any PEP8 issues due to longer lines

Partial-Bug: #1491670
Change-Id: I1166f20adf8c84b2042b62e348926502a4851e08
8 years ago