Skip to main content

PUT /switches/{uuid}

Use this method to modify properties, refresh inventory, or perform a power operation on a specific Flex and RackSwitch switch, such as restart, power on, or power off. This REST API is available only for Lenovo XClarity Administrator v1.0.1 and later.

The request body differs depending on the action that you want to perform. You can use this PUT method to perform the following management actions.

This method starts a job that runs in the background to perform the operation. The response header includes a URI in the form /tasks/{task_id} (for example, /tasks/12) that represents the job that is created to perform this request. You can use GET /tasks/{job_list} to monitor the status and progress of the job. If a job was not successfully started, refer to the response code and response body for details.

Authentication

Authentication with username and password is required.

Request URL

PUT https://{management_server_IP}/switches/{uuid}

where {uuid} is the UUID of the switch to be retrieved. To obtain the switch UUID, use the GET /switches method.

Query parameters

AttributesRequired / OptionalDescription
synchronous={value}OptionalWhen modifying attributes, indicates when the job ID is returned
  • true. (default) Returns the job ID and job status after the job is complete.
  • false. Returns the job ID immediately. You can use GET /tasks/{job_list} to monitor the status and progress of the job.
Note
This query parameter applies only when one or more property parameters are specified in the request body.

Request body

You can specify attributes from one of the following tables in each request.

Note
If you specify one or more attributes in Table 1 (to modify properties), Table 3 (to modify the power state), or Table 5 (to refresh the inventory), this method starts a job that runs in the background to perform the operation. The response header includes a URI in the form /tasks/{task_id} (for example, /tasks/12) that represents the job that is created to perform this request. You can use GET /tasks/{job_list} to monitor the status and progress of the job. If a job was not successfully started, refer to the response code and response body for details.
Attention
A successful response indicates that the request was successfully created and accepted by the management server. It does not indicate that the operation that is associated with the job was successful.
Table 1. Modify switch properties.
AttributesRequired / OptionalTypeDescription
contactOptionalStringOwner of the switch
hostnameOptionalStringHostnam
ipv4AddressOptionalArray of stringsPairs of IPv4 addresses including the old and the new IP address
ipv6AddressOptionalArray of stringsPairs of IPv6 addresses including the old and the new IP address
ipInterfacesOptionalArrayInformation about the switch IP addresses
 IPv4assignmentsOptionalArrayInformation about IPv4 assignments
  addressOptionalStringIPv4 address
  gatewayOptionalStringIPv4 gateway
  idRequiredIntegerIPv4 assignment ID
  subnetOptionalStringIPv4 subnet mask
 IPv4DHCPmodeOptionalStringIPv4 address assignment method. This can be one of the following values.
  • STATIC_ONLY
  • DHCP_ONLY
  • DHCP_THEN_STATIC
  • UNKNOWN
 IPv4enabledOptionalBooleanIdentifies whether IPv4 is enabled. This can be one of the following values.
  • true. IPv4 is enabled
  • false. IPv4 is disabled
 IPv6assignmentsOptionalArrayInformation about IPv6 assignments
  addressOptionalStringIPv6 address
  idRequiredIntegerIPv6 assignment ID
  gatewayOptionalStringIPv6 gateway
  prefixOptionalIntegerIPv6 prefix
 IPv6DHCPenabledOptionalBooleanIdentifies whether IPv6 DHCP is enabled. This can be one of the following values.
  • true. IPv6 DHCP is enabled
  • false. IPv6 DHCP is disabled
 IPv6enabledOptionalBooleanIdentifies whether IPv6 is enabled. This can be one of the following values.
  • true. IPv6 is enabled
  • false. IPv6 is disabled
 IPv6statelessEnabledOptionalBooleanIdentifies whether IPv6 stateless is enabled. This can be one of the following values.
  • true. IPv6 stateless is enabled
  • false. IPv6 stateless is disabled
 IPv6staticEnabledOptionalBooleanIdentifies whether IPv6 static is enabled. This can be one of the following values.
  • true. IPv6 static is enabled
  • false. IPv6 static is disabled
 nameRequiredStringIP interface name
typeOptionalStringRype. This value is always Switch.
userDescriptionOptionalStringFree-form description of the switch
The following example modifies configuration settings for the target switch.
{
"hostname":"",
"ipv4Addresses":["1.2.3.4", "5.6.7.8"],
"ipv6Addresses":["fe80::00::45", new IP],
"location":{
"location":"new location",
"contact": "new contact"
}
}
Table 2. Configure device authentication and access control.
Note
Only users with lxc-supervisor or lxc-security-admin authority can modify the access-control settings.
AttributesRequired / OptionalTypeDescription
securityDescriptorRequiredObjectInformation about the authentication enablement and support the associated stored credentials for a managed device
 managedAuthEnabledOptionalBooleanIndicates whether the device uses managed authentication. This can be one of the following values.
  • true. The device uses managed authentication.

  • false. The device uses local authentication

 publicAccessOptionalBooleanIndicates whether the resource can be accessed by all role groups. This can be one of the following values.
  • true. The resource is can be access by all role group.

  • false. The resource is restricted to specific role groups.

 roleGroupsOptionalArray of stringsList of role groups that are permitted to view and manage this device
 storedCredentialsRequired if managedAuthEnabled is set to trueObjectInformation about the stored credential that is associated with this device, if applicable
  idRequired if managedAuthEnabled is set to trueStringID of the stored credential to associated with the device
The following example restricts access to the managed device to members of the specified role groups:
{
"securityDescriptor": {
"publicAccess": false,
"roleGroups": ["sales-os-admin","corp_fw_admin"]
}
}
Table 3. Modify the power state
AttributesRequired / OptionalTypeDescription
powerStateOptionalStringPerforms a power operation on the switch. This can be one of the following values.
  • Flex switches

    • powerOn. Powers on the switch.
    • powerOff. Powers off the switch immediately.
    • powerCycleSoftGrace. Restarts the switch immediately.
    • reset. Restarts the switch immediately.
    • virtualReseat. Simulates removing power from the bay.
  • RackSwitch switches

    • powerOn. Powers on the switch.
    • powerOff. Powers off the switch device immediately.
    • powerCycleSoft. Restarts the switch immediately.
Note
RackSwitch switches can only be restarted (powerCycleSoft). Other power actions are not supported.
If you specify this attribute, this method starts a job that runs in the background to perform the operation. The response header includes a URI in the form /tasks/{task_id} (for example, /tasks/12) that represents the job that is created to perform this request. You can use GET /tasks/{job_list} to monitor the status and progress of the job. If a job was not successfully started, refer to the response code and response body for details.
Attention
A successful response indicates that the request was successfully created and accepted by the management server. It does not indicate that the operation that is associated with the job was successful.
The following example restarts the target switch.
{
"powerState": "powerCycleSoft"
}
Table 4. Configure LED states.
AttributesRequired / OptionalTypeDescription
ledsOptionalObjectChanges the state of the location LED.
 nameRequiredStringDescription of the LED (for example, Fault or Power. To obtain the names of LEDs for a specific switch, use the GET /switches/{uuid_list} method.
 stateRequiredStringState of LED. This can be one of the following values.
  • off
  • on
  • blinking

To obtain the current state of the LED, use the GET /switches/{uuid_list} method.

The following example turns off the Enclosure Identify LED.
{
"leds":[{
"name":"Enclosure Identify",
"state":"off"
}]
}
Table 5. Refresh the inventory
AttributesRequired / OptionalTypeDescription
refreshInventoryOptionalStringRefreshes inventory for the switch
If you specify this attribute, this method starts a job that runs in the background to perform the operation. The response header includes a URI in the form /tasks/{task_id} (for example, /tasks/12) that represents the job that is created to perform this request. You can use GET /tasks/{job_list} to monitor the status and progress of the job. If a job was not successfully started, refer to the response code and response body for details.
Attention
A successful response indicates that the request was successfully created and accepted by the management server. It does not indicate that the operation that is associated with the job was successful.
The following example refreshes inventory for the target switch.
{
"refreshInventory": "true"
}

Response codes

CodeDescriptionComments
200OKThe request completed successfully.
400Bad RequestA query parameter or request attribute is missing or not valid, or the operation is not supported. A descriptive error message is returned in the response body.
401UnauthorizedThe user cannot be authenticated. Authentication has not been provided or has failed. A descriptive error message is returned in the response body.
403ForbiddenThe orchestrator server was prevented from fulfilling the request. A descriptive error message is returned in the response body. Ensure that you have privileges to perform the request.
409ConflictThere is a conflict with the current state of the resource. A descriptive error message is returned in the response body.
500Internal Server ErrorAn internal error occurred. A descriptive error message is returned in the response body.

Response body

The response body provides information about the success or failure of the request. The attributes in the response body differ depending on the specified request attributes.

Note
A response body is not returned for some requests.

The following example is returned when the "refreshInventory": "true" is specified in the request body to refresh the device inventory.

{
"statusCode": 200,
"statusDescription": "The request completed successfully.",
"messages": [{
"explanation": "refreshInventory request for target 6ED2CB368C594C66C2BB066D5A306138 has
completed successfully.",
"id": "FQXDM0200",
"recovery": "",
"recoveryUrl": "",
"text": "The request completed successfully."
}]
}