From d0dca903df6740e8888e8aa855d3563b6b207a60 Mon Sep 17 00:00:00 2001
From: "shuangyang.qian" <shuangyang.qian@easystack.cn>
Date: Mon, 6 Nov 2017 16:04:33 +0800
Subject: [PATCH] Modify the Ironic api-ref's parameters in parameters.yaml

Separate parameter identifiers in case when a parameter
is required in the request or response.
This patch adjusts the relevant *.nic file to fix the problem.

Change-Id: Ie2c8cae2280fc1e92a5e6f3fef4f2783a12a2c3f
Story: #1651775
Task: #10160
---
 api-ref/source/baremetal-api-v1-chassis.inc   |  10 +-
 .../baremetal-api-v1-node-management.inc      |  12 +-
 .../source/baremetal-api-v1-nodes-vifs.inc    |   4 +-
 .../source/baremetal-api-v1-portgroups.inc    |   4 +-
 api-ref/source/baremetal-api-v1-ports.inc     |  14 +--
 api-ref/source/baremetal-api-v1-volume.inc    |   8 +-
 api-ref/source/parameters.yaml                | 108 ++++++++++++++++++
 7 files changed, 134 insertions(+), 26 deletions(-)

diff --git a/api-ref/source/baremetal-api-v1-chassis.inc b/api-ref/source/baremetal-api-v1-chassis.inc
index 39563dcac0..b6a6a83f49 100644
--- a/api-ref/source/baremetal-api-v1-chassis.inc
+++ b/api-ref/source/baremetal-api-v1-chassis.inc
@@ -107,8 +107,8 @@ The BODY of the PATCH request must be a JSON PATCH document, adhering to
 .. rest_parameters:: parameters.yaml
 
    - chassis_id: chassis_ident
-   - description: description
-   - extra: extra
+   - description: req_description
+   - extra: req_extra
 
 Request Example
 ---------------
@@ -167,9 +167,9 @@ Request
 
 .. rest_parameters:: parameters.yaml
 
-   - chassis: chassis
-   - description: description
-   - extra: extra
+   - chassis: req_chassis
+   - description: req_description
+   - extra: req_extra
 
 Request Example
 ---------------
diff --git a/api-ref/source/baremetal-api-v1-node-management.inc b/api-ref/source/baremetal-api-v1-node-management.inc
index ac86a366fd..fd6f150597 100644
--- a/api-ref/source/baremetal-api-v1-node-management.inc
+++ b/api-ref/source/baremetal-api-v1-node-management.inc
@@ -153,8 +153,8 @@ Request
 .. rest_parameters:: parameters.yaml
 
     - node_ident: node_ident
-    - boot_device: boot_device
-    - persistent: persistent
+    - boot_device: req_boot_device
+    - persistent: req_persistent
 
 **Example JSON request body to set boot device:**
 
@@ -322,7 +322,7 @@ Request
 .. rest_parameters:: parameters.yaml
 
     - node_ident: node_ident
-    - target: target_power_state
+    - target: req_target_power_state
     - timeout: power_timeout
 
 **Example request to power off a Node:**
@@ -366,7 +366,7 @@ Request
 .. rest_parameters:: parameters.yaml
 
     - node_ident: node_ident
-    - target: requested_provision_state
+    - target: req_provision_state
     - configdrive: configdrive
     - clean_steps: clean_steps
     - rescue_password: rescue_password
@@ -404,7 +404,7 @@ Request
 .. rest_parameters:: parameters.yaml
 
     - node_ident: node_ident
-    - target_raid_config: target_raid_config
+    - target_raid_config: req_target_raid_config
 
 **Example requested RAID config:**
 
@@ -445,4 +445,4 @@ Request
 .. rest_parameters:: parameters.yaml
 
     - node_ident: node_ident
-    - enabled: console_enabled
+    - enabled: req_console_enabled
diff --git a/api-ref/source/baremetal-api-v1-nodes-vifs.inc b/api-ref/source/baremetal-api-v1-nodes-vifs.inc
index 298bd1e245..6a42b42d84 100644
--- a/api-ref/source/baremetal-api-v1-nodes-vifs.inc
+++ b/api-ref/source/baremetal-api-v1-nodes-vifs.inc
@@ -53,7 +53,7 @@ Request
 
 .. rest_parameters:: parameters.yaml
 
-    - id: node_vif_ident
+    - id: req_node_vif_ident
     - node_ident: node_ident
 
 **Example request to attach a VIF to a Node:**
@@ -78,4 +78,4 @@ Request
 .. rest_parameters:: parameters.yaml
 
     - node_ident: node_ident
-    - node_vif_ident: node_vif_ident
+    - node_vif_ident: req_node_vif_ident
diff --git a/api-ref/source/baremetal-api-v1-portgroups.inc b/api-ref/source/baremetal-api-v1-portgroups.inc
index 6149ff054f..ed2f440ae0 100644
--- a/api-ref/source/baremetal-api-v1-portgroups.inc
+++ b/api-ref/source/baremetal-api-v1-portgroups.inc
@@ -81,8 +81,8 @@ Request
 
 .. rest_parameters:: parameters.yaml
 
-    - node_uuid: node_uuid
-    - address: portgroup_address
+    - node_uuid: req_node_uuid
+    - address: req_portgroup_address
     - name: portgroup_name
 
 **Example Portgroup creation request:**
diff --git a/api-ref/source/baremetal-api-v1-ports.inc b/api-ref/source/baremetal-api-v1-ports.inc
index 88e08a53a4..813208a429 100644
--- a/api-ref/source/baremetal-api-v1-ports.inc
+++ b/api-ref/source/baremetal-api-v1-ports.inc
@@ -102,13 +102,13 @@ Request
 
 .. rest_parameters:: parameters.yaml
 
-    - node_uuid: node_uuid
-    - address: port_address
-    - portgroup_uuid: portgroup_uuid
-    - local_link_connection: local_link_connection
-    - pxe_enabled: pxe_enabled
-    - physical_network: physical_network
-    - extra: extra
+    - node_uuid: req_node_uuid
+    - address: req_port_address
+    - portgroup_uuid: req_portgroup_uuid
+    - local_link_connection: req_local_link_connection
+    - pxe_enabled: req_pxe_enabled
+    - physical_network: req_physical_network
+    - extra: req_extra
 
 **Example Port creation request:**
 
diff --git a/api-ref/source/baremetal-api-v1-volume.inc b/api-ref/source/baremetal-api-v1-volume.inc
index 721b39a87a..203af581be 100644
--- a/api-ref/source/baremetal-api-v1-volume.inc
+++ b/api-ref/source/baremetal-api-v1-volume.inc
@@ -114,10 +114,10 @@ Request
 
 .. rest_parameters:: parameters.yaml
 
-    - node_uuid: node_uuid
+    - node_uuid: req_node_uuid
     - type: volume_connector_type
     - connector_id: volume_connector_connector_id
-    - extra: extra
+    - extra: req_extra
 
 **Example Volume connector creation request:**
 
@@ -320,12 +320,12 @@ Request
 
 .. rest_parameters:: parameters.yaml
 
-    - node_uuid: node_uuid
+    - node_uuid: req_node_uuid
     - volume_type: volume_target_volume_type
     - properties: volume_target_properties
     - boot_index: volume_target_boot_index
     - volume_id: volume_target_volume_id
-    - extra: extra
+    - extra: req_extra
 
 **Example Volume target creation request:**
 
diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml
index 3c81dc5062..240ce9ab3e 100644
--- a/api-ref/source/parameters.yaml
+++ b/api-ref/source/parameters.yaml
@@ -973,12 +973,30 @@ reason:
   in: body
   required: false
   type: string
+req_boot_device:
+  description: |
+    The boot device for a Node, eg. "pxe" or "disk".
+  in: body
+  required: true
+  type: string
 req_boot_interface:
   description: |
     The boot interface for a Node, e.g. "pxe".
   in: body
   required: false
   type: string
+req_chassis:
+  description: |
+    A ``chassis`` object.
+  in: body
+  required: true
+  type: array
+req_console_enabled:
+  description: |
+    Indicates whether console access is enabled or disabled on this node.
+  in: body
+  required: true
+  type: boolean
 req_console_interface:
   description: |
     The console interface for a node, e.g. "no-console".
@@ -991,6 +1009,12 @@ req_deploy_interface:
   in: body
   required: false
   type: string
+req_description:
+  description: |
+    Descriptive text about the Ironic service.
+  in: body
+  required: false
+  type: string
 req_driver_info:
   description: |
     All the metadata required by the driver to manage this Node. List of fields
@@ -1018,6 +1042,16 @@ req_inspect_interface:
   in: body
   required: false
   type: string
+req_local_link_connection:
+  description: |
+    The Port binding profile. If specified, must contain ``switch_id`` (only
+    a MAC address or an OpenFlow based datapath_id of the switch are accepted
+    in this field) and ``port_id`` (identifier of the physical port on the
+    switch to which node's port is connected to) fields. ``switch_info`` is an
+    optional string field to be used to store any vendor-specific information.
+  in: body
+  required: false
+  type: JSON
 req_management_interface:
   description: |
     Interface for out-of-band node management, e.g. "ipmitool".
@@ -1031,6 +1065,52 @@ req_network_interface:
   in: body
   required: false
   type: string
+req_node_uuid:
+  description: |
+    UUID of the Node this resource belongs to.
+  in: body
+  required: true
+  type: string
+req_node_vif_ident:
+  description: |
+    The UUID or name of the VIF.
+  in: body
+  required: true
+  type: string
+req_persistent:
+  description: |
+    Whether the boot device should be set only for the next reboot, or
+    persistently.
+  in: body
+  required: false
+  type: boolean
+req_physical_network:
+  description: |
+    The name of the physical network to which a port is connected. May be
+    empty.
+  in: body
+  required: false
+  type: string
+req_port_address:
+  description: |
+    Physical hardware address of this network Port, typically the hardware
+    MAC address.
+  in: body
+  required: true
+  type: string
+req_portgroup_address:
+  description: |
+    Physical hardware address of this Portgroup, typically the hardware
+    MAC address.
+  in: body
+  required: false
+  type: string
+req_portgroup_uuid:
+  description: |
+    UUID of the Portgroup this resource belongs to.
+  in: body
+  required: false
+  type: string
 req_power_interface:
   description: |
     Interface used for performing power actions on the node, e.g. "ipmitool".
@@ -1044,6 +1124,18 @@ req_properties:
   in: body
   required: false
   type: JSON
+req_provision_state:
+  description: |
+    The requested provisioning state of this Node.
+  in: body
+  required: true
+  type: string
+req_pxe_enabled:
+  description: |
+    Indicates whether PXE is enabled or disabled on the Port.
+  in: body
+  required: false
+  type: boolean
 req_raid_interface:
   description: |
     Interface used for configuring RAID on this node, e.g. "no-raid".
@@ -1070,6 +1162,22 @@ req_storage_interface:
   in: body
   required: false
   type: string
+req_target_power_state:
+  description: |
+    If a power state transition has been requested, this field represents the
+    requested (ie, "target") state either "power on", "power off", "rebooting",
+    "soft power off" or "soft rebooting".
+  in: body
+  required: true
+  type: string
+req_target_raid_config:
+  description: |
+    Represents the requested RAID configuration of the node, which will be
+    applied when the Node next transitions through the CLEANING state. Introduced
+    with the cleaning feature.
+  in: body
+  required: true
+  type: JSON
 req_uuid:
   description: |
     The UUID for the resource.