From 77d1537d406b089296dcf2960de10bde6f9c4b14 Mon Sep 17 00:00:00 2001 From: Vasyl Saienko Date: Fri, 23 Dec 2016 12:34:58 +0000 Subject: [PATCH] Add VIFs attach/detach to api-ref This patch updates api-ref documentation with VIF attach/detach changes that were added in API microversion 1.28. Closes-Bug: #1582188 Change-Id: I2950a1a356ccb3feb7a4c6335eb95a7a52b3266a --- api-ref/regenerate-samples.sh | 8 ++- .../source/baremetal-api-v1-nodes-vifs.inc | 69 +++++++++++++++++++ api-ref/source/index.rst | 1 + api-ref/source/parameters.yaml | 12 ++++ api-ref/source/samples/api-root-response.json | 4 +- .../samples/node-vif-attach-request.json | 3 + .../samples/node-vif-list-response.json | 7 ++ 7 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 api-ref/source/baremetal-api-v1-nodes-vifs.inc create mode 100644 api-ref/source/samples/node-vif-attach-request.json create mode 100644 api-ref/source/samples/node-vif-list-response.json diff --git a/api-ref/regenerate-samples.sh b/api-ref/regenerate-samples.sh index 6196886aaf..d35113cf97 100755 --- a/api-ref/regenerate-samples.sh +++ b/api-ref/regenerate-samples.sh @@ -11,7 +11,7 @@ fi OS_AUTH_TOKEN=$(openstack token issue | grep ' id ' | awk '{print $4}') IRONIC_URL="http://127.0.0.1:6385" -IRONIC_API_VERSION="1.24" +IRONIC_API_VERSION="1.28" export OS_AUTH_TOKEN IRONIC_URL @@ -238,6 +238,12 @@ GET v1/nodes/$NID/management/boot_device/supported > node-get-supported-boot-dev PUT v1/nodes/$NID/management/boot_device node-set-boot-device.json GET v1/nodes/$NID/management/boot_device > node-get-boot-device-response.json +############################# +# NODES VIF ATTACH/DETACH API + +POST v1/nodes/$NID/vifs node-vif-attach-request.json +GET v1/nodes/$NID/vifs > node-vif-list-response.json + ##################### # Replace automatically generated UUIDs by already used in documentation diff --git a/api-ref/source/baremetal-api-v1-nodes-vifs.inc b/api-ref/source/baremetal-api-v1-nodes-vifs.inc new file mode 100644 index 0000000000..34834ab55c --- /dev/null +++ b/api-ref/source/baremetal-api-v1-nodes-vifs.inc @@ -0,0 +1,69 @@ +.. -*- rst -*- + +================================== +VIFs (Virtual Interfaces) of nodes +================================== + +Starting with API version 1.28 attaching and detaching VIFs (Virtual Interfaces) +to or from a node are done via the ``v1/nodes/{node_ident}/vifs`` endpoint. Attaching +a VIF to a node means that a VIF will be mapped to a free port or port group of +the specified node. + +List attached VIFs of a Node +============================ + +.. rest_method:: GET /v1/nodes/{node_ident}/vifs + +Return a list of VIFs that are attached to the node. + +Normal response code: 200 + +Error codes: 400,401,403,404 + +Response +-------- + +.. rest_parameters:: parameters.yaml + + - id: node_vif_ident + - vifs: n_vifs + +**Example list of VIFs that are attached to the node:** + +.. literalinclude:: samples/node-vif-list-response.json + :language: javascript + + +Attach a VIF to a node +====================== + +.. rest_method:: POST /v1/nodes/{node_ident}/vifs + +Attach a VIF to a node. + +Normal response code: 204 + +Error codes: 400,401,403,404,409 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - id: node_vif_ident + +**Example request to attach a VIF to a Node:** + +.. literalinclude:: samples/node-vif-attach-request.json + + +Detach VIF from a node +====================== + +.. rest_method:: DELETE /v1/nodes/{node_ident}/vifs/{node_vif_ident} + +Detach VIF from a Node. + +Normal response code: 204 + +Error codes: 400,401,403,404 diff --git a/api-ref/source/index.rst b/api-ref/source/index.rst index 1a5fa0ee53..f6fed5e339 100644 --- a/api-ref/source/index.rst +++ b/api-ref/source/index.rst @@ -10,6 +10,7 @@ .. include:: baremetal-api-v1-nodes.inc .. include:: baremetal-api-v1-node-management.inc .. include:: baremetal-api-v1-node-passthru.inc +.. include:: baremetal-api-v1-nodes-vifs.inc .. include:: baremetal-api-v1-portgroups.inc .. include:: baremetal-api-v1-nodes-portgroups.inc .. include:: baremetal-api-v1-ports.inc diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml index 28cb8105dd..2cb1de4b56 100644 --- a/api-ref/source/parameters.yaml +++ b/api-ref/source/parameters.yaml @@ -489,6 +489,12 @@ n_states: in: body required: true type: array +n_vifs: + description: | + VIFs attached to this node. Added in API microversion 1.28. + in: body + required: true + type: array name: description: | The name of the driver. @@ -515,6 +521,12 @@ node_uuid: in: body required: true type: string +node_vif_ident: + description: | + The UUID or name of the VIF. Added in API microversion 1.28. + in: body + required: true + type: string nodes: description: | Links to the collection of nodes contained in diff --git a/api-ref/source/samples/api-root-response.json b/api-ref/source/samples/api-root-response.json index 294230dcf2..16f548a611 100644 --- a/api-ref/source/samples/api-root-response.json +++ b/api-ref/source/samples/api-root-response.json @@ -9,7 +9,7 @@ ], "min_version": "1.1", "status": "CURRENT", - "version": "1.24" + "version": "1.28" }, "description": "Ironic is an OpenStack project which aims to provision baremetal machines.", "name": "OpenStack Ironic API", @@ -24,7 +24,7 @@ ], "min_version": "1.1", "status": "CURRENT", - "version": "1.24" + "version": "1.28" } ] } diff --git a/api-ref/source/samples/node-vif-attach-request.json b/api-ref/source/samples/node-vif-attach-request.json new file mode 100644 index 0000000000..9d6dd0a9bc --- /dev/null +++ b/api-ref/source/samples/node-vif-attach-request.json @@ -0,0 +1,3 @@ +{ + "id": "1974dcfa-836f-41b2-b541-686c100900e5" +} diff --git a/api-ref/source/samples/node-vif-list-response.json b/api-ref/source/samples/node-vif-list-response.json new file mode 100644 index 0000000000..b90c21d381 --- /dev/null +++ b/api-ref/source/samples/node-vif-list-response.json @@ -0,0 +1,7 @@ +{ + "vifs": [ + { + "id": "1974dcfa-836f-41b2-b541-686c100900e5" + } + ] +}