No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

eSight V300R010C00SPC200, 300, and 500 Self-Service Integration Guide 10

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Server Deployment Management Interfaces

Server Deployment Management Interfaces

Create Configuration Templates

Create a Network Configuration Template

Function

This interface is used to create a network configuration template.

URI

/rest/openapi/server/deploy/template

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

templateName

Mandatory

Parameter list

String

Indicates a template name. The value is a string of 6 to 32 characters, consisting of uppercase or lowercase letters, digits, hyphens (-), and underscores (_).

templateType

Mandatory

Parameter list

String

Indicates a template type. Enter NETWORK when creating a network configuration template.

templateDesc

Optional

Parameter list

String

Indicates the template description. The value can contain a maximum of 127 characters.

templateProp

Mandatory

Parameter list

JSON<template>

Indicates template attributes. For details of NETWORK configuration attributes, see the following table and example.

template configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

manageIpType

Mandatory

Parameter list (templateProp)

String

Indicates the network template configuration mode. The options are as follows:

  • 0: DHCP (Device IP addresses are obtained dynamically.)
  • 1: Static IP addresses in templates are used to configure devices. For batch configuration, IP addresses of specified devices are selected from the IP address segment. For parameter details, see the static IP address configuration table below.
  • 2: The template specifies device SNs, IP addresses, subnet masks, and gateways. These configurations are applied to corresponding devices. For parameter details, see the batch BMC IP address configuration table below.

manageStartIP

Optional

Parameter list (templateProp)

String

Indicates the start IP address of the IP address segment. This parameter is mandatory when ManageIPType is 1.

manageEndIP

Optional

Parameter list (templateProp)

String

Indicates the end IP address of the IP address segment. This parameter is mandatory when ManageIPType is 1.

manageMask

Optional

Parameter list (templateProp)

String

Indicates the subnet mask. This parameter is mandatory when ManageIPType is 1.

manageGateway

Optional

Parameter list (templateProp)

String

Indicates the default gateway. This parameter is mandatory when ManageIPType is 1.

deviceInfoArray

Optional

Parameter list (templateProp)

JSON<deviceInfoArray>

Indicates the information about devices whose IP addresses are to be configured. The information includes device SNs, IP addresses, subnet masks, and default gateways. This parameter is mandatory when ManageIPType is 2.

deviceInfoArray configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

sn

Mandatory

Parameter list (DeviceInfoArray)

String

Indicates the device SN. This parameter is mandatory when ManageIPType is set to 2.

iPAddress

Mandatory

Parameter list (DeviceInfoArray)

String

Indicates the IPv4 address configured for a device. This parameter is mandatory when ManageIPType is set to 2.

subnetMask

Mandatory

Parameter list (DeviceInfoArray)

String

Indicates the subnet mask configured for a device. This parameter is mandatory when ManageIPType is set to 2.

defaultGateway

Mandatory

Parameter list (DeviceInfoArray)

String

Indicates the default gateway configured for a device. This parameter is mandatory when ManageIPType is set to 2.

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

String

Indicates returned data. The value is null.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

Precautions

None

Example

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class CreateNetWorkTemplate
{
    private static final String CREATE_TEMPLATE_URL = "/rest/openapi/server/deploy/template";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        CreateNetworkTemplateTest();
    }
    
    public static void CreateNetworkTemplateTest() throws Exception
    {
        String openidURL = CREATE_TEMPLATE_URL;
        String method = "POST";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        
        //example 1: Create a template for dynamically obtaining BMC IP addresses.
        BasicNameValuePair[] parameters = 
            {
                new BasicNameValuePair("templateName", "NETWORK_Template01"),
                new BasicNameValuePair("templateType", "NETWORK"),
                new BasicNameValuePair("templateDesc", "This is a NETWORK template."),
                new BasicNameValuePair("templateProp", "{\"manageIpType\":\"0\"}")
            };
        //example 2: Create a template for static IP address configuration.
        BasicNameValuePair[] parameters2 = 
            {
                new BasicNameValuePair("templateName", "NETWORK_Template02"),
                new BasicNameValuePair("templateType", "NETWORK"),
                new BasicNameValuePair("templateDesc", "This is a NETWORK template."),
                new BasicNameValuePair("templateProp", "{     \r\n" + 
                        "    \"manageIpType\":\"1\",     \r\n" + 
                        "    \"mangeStartIp\":\"192.168.1.10\",\r\n" + 
                        "    \"mangeEndIp\":\"192.168.1.100\",\r\n" + 
                        "    \"mangeMask\":\"255.255.0.0\",\r\n" + 
                        "    \"mangeGateway\":\"192.168.1.1\"  \r\n" + 
                        "}\r\n" + 
                        "")
            };
        //example 3: Create a template for BMC IP address batch configuration where SNs are used as unique IDs of devices.
        BasicNameValuePair[] parameters3 = 
            {
                new BasicNameValuePair("templateName", "NETWORK_Template03"),
                new BasicNameValuePair("templateType", "NETWORK"),
                new BasicNameValuePair("templateDesc", "This is a NETWORK template."),
                new BasicNameValuePair("templateProp", "{\r\n" + 
                        "    \"manageIpType\": \"2\",\r\n" + 
                        "    \"deviceInfoArray\": [\r\n" + 
                        "        {\r\n" + 
                        "            \"sn\": \"210235227810AA000002-1\",\r\n" + 
                        "            \"ipAddress\": \"192.168.9.81\",\r\n" + 
                        "            \"subnetMask\": \"255.255.255.0\",\r\n" + 
                        "            \"defaultGateway\": \"192.168.9.1\"\r\n" + 
                        "        },\r\n" + 
                        "        {\r\n" + 
                        "            \"sn\": \"210235227810AA000002-2\",\r\n" + 
                        "            \"ipAddress\": \"192.168.9.82\",\r\n" + 
                        "            \"subnetMask\": \"255.255.255.0\",\r\n" + 
                        "            \"defaultGateway\": \"192.168.9.1\"\r\n" + 
                        "        }\r\n" + 
                        "    ]\r\n" + 
                        "}")
            };
        
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters3);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    
    }
}

Response example:

REST_SUCCESS   
{
    "code": 0,
    "data": null,
    "resverd": null,
    "description": "create template success."
}

Create a BIOS Configuration Template

Function

This interface is used to create a BIOS configuration template.

URI

/rest/openapi/server/deploy/template

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

templateName

Mandatory

Parameter list

String

Indicates a template name. The value is a string of 6 to 32 characters, consisting of uppercase or lowercase letters, digits, hyphens (-), and underscores (_).

templateType

Mandatory

Parameter list

String

Indicates a template type. Enter BIOS when creating a BIOS template.

templateDesc

Optional

Parameter list

String

Indicates the template description. The value can contain a maximum of 127 characters.

templateProp

Mandatory

Parameter list

JSON<template>

Indicates template attributes. For details of BIOS configuration attributes, see the following table and example.

template configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

BootOrder

Mandatory

Parameter list (templateProp)

String

Indicates the system boot sequence, for example, 0123. The value is a 4-digit string consisting of four types of code. The options are as follows:

  • 0: BEV
  • 1: Hard Disk Driver
  • 2: CD/DVD-ROM Driver
  • 3: Others

VTSupport

Optional

Parameter list (templateProp)

String

Indicates whether to enable the hardware-assisted virtualization technology. The default value is default. The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

PCIeSRIOVSupport

Optional

Parameter list (templateProp)

String

Indicates whether to enable the single-root I/O virtualization (SR-IOV) technology. By using SR-IOV, a PCIe device can export multiple PCI physical functions, or export a group of virtual functions that share resources on the I/O device, providing independent memory space, interrupts, and Direct Memory Access (DMA) streams for each VM. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

CustomPowerPolicy

Optional

Parameter list (templateProp)

String

Indicates the system energy efficiency policy. The default value is default.

The options are as follows:

  • Efficient: Prioritizes power saving.
  • Performance: Prioritizes performance.
  • Custom: Customizes a policy based on an Efficient or Performance policy.
  • default: Retain the original value.

ProcessorEistEnable

Optional

Parameter list (templateProp)

String

Specifies whether to enable the Enhanced Intel SpeedStep Technology (EIST). When the CPU usage is low, the CPU operating frequency is dynamically reduced to reduce the system power consumption and heat. When it is detected that the CPU usage is high, the original operating frequency is restored. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

PowerSaving

Optional

Parameter list (templateProp)

String

Indicates whether to enable the CPU P-state adjustment function. This function reduces power consumption by changing the CPU P-states. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

HTSupport

Optional

Parameter list (templateProp)

String

Indicates whether to enable the Intel Hyper Threading (HT) technology. This technology enhances the CPU performance by increasing the number of threads of the CPU cores. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

PowerStateRestoreOnACLoss

Optional

Parameter list (templateProp)

String

Indicates the restoration mode used by the BMC after AC power-off. The default value is default. The options are as follows:

  • Power On
  • Power Off
  • Last State: last status of the device
  • default: Retain the original value.

QuickBoot

Optional

Parameter list (templateProp)

String

Indicates whether to enable the function that enables a quick operating system startup by skipping some startup check items. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

QuietBoot

Optional

Parameter list (templateProp)

String

This feature enables the operating system to start in text mode. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

BootType

Optional

Parameter list (templateProp)

String

Indicates the BIOS boot mode. The UEFI and legacy modes are supported. The default value is default.

The options are as follows:

  • Dual Boot Type: Supports two boot modes, namely, UEFI and legacy.
  • Legacy Boot Type: Supports only the legacy mode.
  • UEFI Boot Type: Supports only the UEFI mode.
  • default: Retain the original value.

WakeOnPME

Optional

Parameter list (templateProp)

String

Indicates whether to support WOL, which wakes up the server using a magic packet. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

VTdSupport

Optional

Parameter list (templateProp)

String

Indicates whether to enable the Intel Virtualization Technology for Directed I/O (VT-D). The technology is used for internal conversion between virtual addresses and real physical addresses in virtualization scenarios to implement DMA remapping. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

InterruptRemap

Optional

Parameter list (templateProp)

String

Indicates whether to enable the function for virtual devices to generate different interrupts so that a CPU can process various interrupt signals. This parameter is effective only when VTdSupport is set to Enabled. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

ATS

Optional

Parameter list (templateProp)

String

Indicates whether to enable the ATS mechanism, which is provided by the PCIe bus. It is implemented by the PCIe device. When a PCIe device sends transaction layer packets (TLPs) through address routing, the address is converted into a host physical address (HPA), thereby relieving VT-d workload. Additionally, ATS prevents devices in different domains from affecting each other. This parameter is effective only when VTdSupport is set to Enabled. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

CoherencySupport

Optional

Parameter list (templateProp)

String

Indicates whether to enable the coherency support function. This parameter is effective only when VTdSupport is set to Enabled. The default value is default. The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

PassThroughDma

Optional

Parameter list (templateProp)

String

Indicates whether to enable the passthrough DMA technology. This parameter is effective only when VTdSupport is set to Enabled. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

EnableTurboMode

Optional

Parameter list (templateProp)

String

Indicates whether to enable the CPU acceleration mode, so that the CPU running frequency can be higher than the nominal frequency. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

AcpiVer

Optional

Parameter list (templateProp)

String

Indicates the ACPI version. The Advanced Configuration and Power Interface (ACPI) function provides power management for components such as processors, batteries, and embedded controllers through the operating system. This enables the server to meet certain performance requirements and reduce power consumption. The default value is default.

The options are as follows:

  • ACPI1.0B: 1.0B version
  • ACPI3.0: 3.0 version
  • ACPI4.0: 4.0 version
  • default: Retain the original value.

NumaEn

Optional

Parameter list (templateProp)

String

Indicates whether to enable the MONITOR/MWAIT instruction. After MONITOR/MWAIT is enabled, the CPU status can be monitored to optimize CPU instruction execution. If MONITOR/MWAIT is enabled, some operating systems can automatically enable or disable the energy saving mode. Therefore, set this parameter to Disabled if you want to disable the energy saving mode. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

MonitorMwaitEnable

Optional

Parameter list (templateProp)

String

Indicates whether to enable the PCIe 64-bit decoding function. After this function is enabled, the address space allocated to an external device can be greater than 4 GB. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

PciMem64DecodeSupport

Optional

Parameter list (templateProp)

String

Indicates whether to enable the Non-Uniform Memory Access Architecture (NUMA) technology. This technology can effectively expand the system scale, enable multiple servers to run as a single system, and retain the advantages of the small system featuring easy programming and management. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

ProcessorCcxEnable

Optional

Parameter list (templateProp)

String

Indicates whether to enable the CPU C-state function, which is a deep power-saving technology. C-states such as C3, C6, and C7 indicate power-saving effect in ascending order and processor recovery time in descending order. After the C-state function is enabled, the options are as follows:

  • OS ACPI Cx: The operating system refers to certain advanced configuration and power interface (ACPI) Cx state and instructs the CPU to enter the C-state.
  • Enhanced C-State: Enable the P-state to change with the C-state. Enable C3: Close all internal CPU clocks, including the bus interface and APIC.
  • Enable C6: Reduce the processor voltage to 0.
  • Enable C7: Retain only the last thread and refresh the remaining last level cache (LLC).

The default value is default. The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

RasMode

Optional

Parameter list (templateProp)

String

The memory reliability, availability, and serviceability (RAS) function enhances the error correction capability of the memory to improve memory reliability and data accuracy. RAS has three channel modes.

Independent: Each channel works independently. Data of each cache line comes from the same channel.

Mirror: Generate mirrors for memory.

LockStep: Two memory channels work in a synchronous manner. They comprise a logical channel.

RankSpare: Back up memory in the unit of rank.

Lock Step And Rank Spare: Both Lock Step and Rank Spare are supported. The default value is default. The options are as follows:

  • Independent
  • Mirror
  • LockStep
  • RankSpare
  • LockStep And RankSpare
  • default: Retain the original value.

OsAcpiCx

Optional

Parameter list (templateProp)

String

The operating system refers to certain advanced configuration and power interface (ACPI) Cx state and instructs the CPU to enter the C-state. This parameter is effective only when ProcessorCcxEnable is set to Enabled. The default value is default. The options are as follows:

  • ACPI C3
  • ACPI C2
  • default: Retain the original value.

MLCSpatialPrefetcherEnable

Optional

Parameter list (templateProp)

String

Indicates whether to enable the Mid Level Cache (MLC) spatial prefetcher function. This function prefetches two high-speed cache storage devices (128 bytes). As a result, the prefetched data amount is twice as much as the usual data amount. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

EnCStates

Optional

Parameter list (templateProp)

String

Indicates whether to enable the P-states to change with the C-states. This parameter is effective only when ProcessorCcxEnable is set to Enabled. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

MLCStreamerPrefetcherEnable

Optional

Parameter list (templateProp)

String

Indicates whether to enable the MLC streamer prefetcher function. This function prefetches CPU instructions to reduce the instruction reading time. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

EnableC3

Optional

Parameter list (templateProp)

String

Indicates whether to enable the function to close all internal CPU clocks, including the bus interface and APIC. This parameter is effective only when ProcessorCcxEnable is set to Enabled. The default value is default. The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

DCUIPPrefetcherEnable

Optional

Parameter list (templateProp)

String

Indicates whether to enable the Data Cache Unit (DCU) IP prefetcher function. This function determines whether to prefetch data based on historical records to shorten the data reading time. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

EnableC6

Optional

Parameter list (templateProp)

String

Indicates whether to enable the function to reduce the processor voltage to 0. This parameter is effective only when ProcessorCcxEnable is set to Enabled.

The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

DCUStreamerPrefetcherEnable

Optional

Parameter list (templateProp)

String

Indicates whether to enable the DCU streamer prefetcher function. This function prefetches CPU data to shorten the data reading time. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

EnableC7

Optional

Parameter list (templateProp)

String

Indicates whether to enable the function to retain only the last thread and refresh the remaining LLC. This parameter is effective only when ProcessorCcxEnable is set to Enabled. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

CREnable

Optional

Parameter list (templateProp)

String

Indicates whether to map data of a specified physical or virtual serial port to the system serial port. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

CRTerminalType

Optional

Parameter list (templateProp)

String

Indicates the protocol used by a terminal with serial ports. This parameter is effective only when CREnable is set to Enabled. The default value is default.

The options are as follows:

  • VT_100
  • Vt_100+
  • VT_UTF8
  • PC_ANSI
  • default: Retain the original value.

CRParity

Optional

Parameter list (templateProp)

String

Indicates whether to enable the parity check function. This function verifies code transmission accuracy. This parameter is effective only when CREnable is set to Enabled. The default value is default.

The options are as follows:

  • None
  • Even
  • Odd
  • default: Retain the original value.

CRBaudRate

Optional

Parameter list (templateProp)

String

Indicates the baud rate of a serial port, that is, the number of bits transmitted per second. This parameter is effective only when CREnable is set to Enabled. The default value is default.

The options are as follows:

  • 115200
  • 57600
  • 19200
  • 9600
  • default: Retain the original value.

CRStopBits

Optional

Parameter list (templateProp)

String

Indicates the number of stop bits in a single data packet. If the number of stop bits is larger, the system is more tolerant to different clock synchronization but the data transmission rate is lower. This parameter is effective only when CREnable is set to Enabled. The default value is default.

The options are as follows:

  • 1
  • 2
  • default: Retain the original value.

CRDataBits

Optional

Parameter list (templateProp)

String

Indicates the data bit width of a serial port. This parameter is effective only when CREnable is set to Enabled.

  • The default value is default.
  • The options are as follows:
  • 7
  • 8
  • default: Retain the original value.

OSWdtEnable

Optional

Parameter list (templateProp)

String

Indicates whether to enable the watchdog timer (WDT) to perform the specified action if the operating system startup times out. The operating system watchdog driver is required for the watchdog. Otherwise, the operating system may fail to be started. The default value is default.

The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

OSWdtTimeout

Optional

Parameter list (templateProp)

String

Indicates the maximum wait time of the WDT during an operating system startup. Unit: minute This parameter is effective only when OSWdtEnable is set to Enabled. The default value is default.

The options are as follows:

  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • default: Retain the original value.

OSWdtAction

Optional

Parameter list (templateProp)

String

Indicates how the WDT responds to an operating system startup timeout. The options are as follows:

  • No Action: The WDT does not perform any operation.
  • Hard Reset: Forcibly reset the system.
  • Power Down: Power off the system.
  • Power Cycle: Continuously attempt to start the operating system until the system works properly. (This mode is effective only when OSWdtEnable is set to Enabled.)
  • default: default value, indicating to remain the original value.

PxeOpRom

Optional

Parameter list (templateProp)

String

Indicates the network boot option. The default value is default. The options are as follows:

  • Disabled
  • UEFI Only: This option loads only the NIC UEFI driver. Check whether the NIC provides a built-in UEFI driver in advance.
  • Legacy Only: This option loads only the NIC Legacy OptionRom.
  • Legacy First: This option loads the NIC Legacy OptionRom with priority.
  • UEFI First: This option loads the NIC UEFI driver with priority.
  • default: Retain the original value.

NetworkProtocol

Optional

Parameter list (templateProp)

String

Indicates the network protocol. This parameter must be set if BootType is set to UEFI Boot Type. The default value is default. The options are as follows:

  • Disabled
  • UEFI IPV4
  • UEFI IPV6
  • UEFI IPV4_IPV6
  • default: Retain the original value.

PXE1setting

Optional

Parameter list (templateProp)

String

Indicates whether to enable PXE1. The default value is default. The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

PXE2setting

Optional

Parameter list (templateProp)

String

Indicates whether to enable PXE2. The default value is default. The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

PXE3setting

Optional

Parameter list (templateProp)

String

Indicates whether to enable PXE3. The default value is default. The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

PXE4setting

Optional

Parameter list (templateProp)

String

Indicates whether to enable PXE4. The default value is default. The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

PxeOpRom_82599

Optional

Parameter list (templateProp)

String

Indicates whether to enable the external 82599 NIC. The default value is default. The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

PxeOpRom_I350

Optional

Parameter list (templateProp)

String

Indicates whether to enable the external I350 NIC. The default value is default. The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

PxeOpRom_X540

Optional

Parameter list (templateProp)

String

Indicates whether to enable the external X540 NIC. The default value is default. The options are as follows:

  • Enabled
  • Disabled
  • default: Retain the original value.

SpecialBoot

Optional

Parameter list (templateProp)

String

Indicates whether to enable the special system boot sequence. The options are as follows:

  • Disabled
  • SanBoot First: Boot SanBoot first.
  • M.2 Hard Disk First: Boot M.2 hard disks first.
  • default: Retain the original value.

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

String

Indicates returned data. The value is null.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

Precautions

None

Example

Request example:

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class CreateBiosTemplate
{
    private static final String CREATE_TEMPLATE_URL = "/rest/openapi/server/deploy/template";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        CreateBiosTemplateTest();
    }
    
    public static void CreateBiosTemplateTest() throws Exception
    {
        String openidURL = CREATE_TEMPLATE_URL;
        String method = "POST";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        

            {
                new BasicNameValuePair("templateName", "BIOS_Template1"),
                new BasicNameValuePair("templateType", "BIOS"),
                new BasicNameValuePair("templateDesc", "This is a BIOS template."),
                new BasicNameValuePair("templateProp", "{   \r\n" + 
                        "  \"BootOrder\":\"0123\",   \r\n" + 
                        "  \"VTSupport\":\"Enabled\",   \r\n" + 
                        "  \"PCIeSRIOVSupport\":\"Enabled\",   \r\n" + 
                        "  \"CustomPowerPolicy\":\"Custom\",   \r\n" + 
                        "  \"ProcessorEistEnable\":\"Enabled\",   \r\n" + 
                        "  \"PowerSaving\":\"Disabled\",   \r\n" + 
                        "  \"HTSupport\":\"Enabled\",   \r\n" + 
                        "  \"PowerStateRestoreOnACLoss\":\"Power On\",   \r\n" + 
                        "  \"QuickBoot\":\"Enabled\",   \r\n" + 
                        "  \"QuietBoot\":\"Disabled\",   \r\n" + 
                        "  \"BootType\":\"Legacy Boot Type\",   \r\n" + 
                        "  \"WakeOnPME\":\"Disabled\",   \r\n" + 
                        "  \"VTdSupport\":\"Enabled\",   \r\n" + 
                        "  \"InterruptRemap\":\"Disabled\",   \r\n" + 
                        "  \"ATS\":\"Enabled\",   \r\n" + 
                        "  \"CoherencySupport\":\"Disabled\",   \r\n" + 
                        "  \"PassThroughDma\":\"Enabled\",   \r\n" + 
                        "  \"EnableTurboMode\":\"Enabled\",   \r\n" + 
                        "  \"AcpiVer\":\"ACPI4.0\",   \r\n" + 
                        "  \"NumaEn\":\"Enabled\",   \r\n" + 
                        "  \"MonitorMwaitEnable\":\"Disabled\",   \r\n" + 
                        "  \"PciMem64DecodeSupport\":\"Enabled\",   \r\n" + 
                        "  \"ProcessorCcxEnable\":\"Enabled\",   \r\n" + 
                        "  \"RasMode\":\"Independent\",   \r\n" + 
                        "  \"OsAcpiCx\":\"ACPI C3\",   \r\n" + 
                        "  \"MLCSpatialPrefetcherEnable\":\"Enabled\",   \r\n" + 
                        "  \"EnCStates\":\"Enabled\",   \r\n" + 
                        "  \"MLCStreamerPrefetcherEnable\":\"Enabled\",   \r\n" + 
                        "  \"EnableC3\":\"Disabled\",   \r\n" + 
                        "  \"DCUIPPrefetcherEnable\":\"Enabled\",   \r\n" + 
                        "  \"EnableC6\":\"Disabled\",   \r\n" + 
                        "  \"DCUStreamerPrefetcherEnable\":\"Enabled\",   \r\n" + 
                        "  \"EnableC7\":\"Disabled\",   \r\n" + 
                        "  \"CREnable\":\"Enabled\",   \r\n" + 
                        "  \"CRTerminalType\":\"PC_ANSI\",   \r\n" + 
                        "  \"CRParity\":\"None\",   \r\n" + 
                        "  \"CRBaudRate\":\"115200\",   \r\n" + 
                        "  \"CRStopBits\":\"1\",   \r\n" + 
                        "  \"CRDataBits\":\"8\",   \r\n" + 
                        "  \"OSWdtEnable\":\"Disabled\",   \r\n" + 
                        "  \"OSWdtTimeout\":\"5\",   \r\n" + 
                        "  \"OSWdtAction\":\"Hard Reset\",\r\n" + 
                        "  \"PxeOpRom_I350\": \"default\",\r\n" + 
                        "  \"PXE2setting\": \"default\",\r\n" + 
                        "  \"PXE3setting\": \"default\",\r\n" + 
                        "  \"PXE1setting\": \"default\",\r\n" + 
                        "  \"PXE4setting\": \"default\",\r\n" + 
                        "  \"PxeOpRom_X540\": \"default\",\r\n" + 
                        "  \"PxeOpRom\": \"default\",\r\n" + 
                        "  \"PxeOpRom_82599\": \"default\",\r\n" + 
                        "  \"NetworkProtocol\": \"default\",\r\n" + 
                        "  \"SpecialBoot\": \"default\"\r\n" + 
                        "}")
            };
        
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    
    }
    
}

Response example:

REST_SUCCESS   
{
    "code": 0,
    "data": null,
    "resverd": null,
    "description": "create template success."
}

Create a RAID Configuration Template

Function

This interface is used to create a RAID configuration template.

URI

/rest/openapi/server/deploy/template

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

templateName

Mandatory

Parameter list

String

Indicates a template name. The value is a string of 6 to 32 characters, consisting of uppercase or lowercase letters, digits, hyphens (-), and underscores (_).

templateType

Mandatory

Parameter list

String

Indicates the template type. Enter RAID when creating a RAID template.

templateDesc

Optional

Parameter list

String

Indicates the template description. The value can contain a maximum of 127 characters.

templateProp

Mandatory

Parameter list

JSON<template>

Indicates template attributes. For details about how to set RAID, see the setting description and examples of RAID.

template configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

AdapterType

Mandatory

Parameter list (templateProp)

String

Indicates the RAID adapter model. The options are as follows:

  • LSI2308: when the chip type is LSI SAS2308
  • LSI2208: when the chip type is LSI SAS2208
  • LSI3008: when the chip type is LSI SAS3008
  • LSI3108: when the chip type is LSI SAS3108
  • LSI3408: when the chip type is Avago SAS3408iMR
  • LSI3508: when the chip type is Avago SAS3508
  • LSI3004: when the chip type is Avago SAS3004
  • LSI3416: when the chip type is Avago SAS3416iMR
  • LSI3516: when the chip type is Avago SAS3516

DeleteOriginRAID

Mandatory

Parameter list (templateProp)

boolean

Indicates whether to delete the existing RAID configuration. The options are as follows:

  • true
  • false

BootDrive

Optional

Parameter list (templateProp)

String

Indicates the boot LUN ID. Default value: 0

NOTE:

The system automatically numbers LUNs created in RAID arrays or customized LUNs. The number starts from 0. The boot LUN ID cannot be larger than the maximum number.

GlobalHSP

Optional

Parameter list (templateProp)

String

Indicates the global hot spare disk. This parameter is left empty by default. For example, the value 0;1 indicates slots 0 and 1.

NOTE:
  • Hard disk slot numbers range from 0 to 43. The slots selected for GlobalHSP, DedicateHSP, and DiskArray must be different.
  • The RAID array cannot contain only RAID 0.
  • LSI3004 does not support global hot spare disks.

RebuildRate

Optional

Parameter list (templateProp)

String

Indicates the percentage of I/O resources occupied during RAID reconstruction. This parameter is left empty by default. The value ranges from 0 to 100.

NOTE:

LSI3004, LSI3416, and LSI3516 support this attribute.

MigrateRate

Optional

Parameter list (templateProp)

String

Indicates the percentage of I/O resources occupied during capacity expansion and RAID level migration. This parameter is left empty by default. The value ranges from 0 to 100.

NOTE:

LSI3004, LSI3416, and LSI3516 support this attribute.

JBOD

Mandatory under conditions

Parameter list (templateProp)

String

Indicates whether to enable the hard disk pass-through function. The options are as follows:

  • On: Enable the function.
  • Off (default value): Disable the function.
NOTE:

LSI3004, LSI3416, and LSI3516 support this attribute.

Patrol

Mandatory under conditions

Parameter list (templateProp)

String

Indicates whether to enable the hard disk inspection function. The options are as follows:

  • On: Enable the function.
  • Off (default value): Disable the function.
NOTE:

LSI3004, LSI3416, and LSI3516 support this attribute.

PatrolDelay

Mandatory under conditions

Parameter list (templateProp)

String

Indicates the disk inspection delay. The options are as follows:

  • If Patrol is set to On, the PatrolDelay parameter is mandatory, and the value ranges from 0 to 65535.
  • If Patrol is set to Off, the PatrolDelay parameter should be left empty.
NOTE:

LSI3004, LSI3416, and LSI3516 support this attribute.

SlotID

Mandatory

Parameter list (templateProp)

String

Indicates the slot number of a RAID template.

Value range:

0-10

NOTE:

The value 0 indicates the slot number of the mainboard, and the value from 1 to 10 indicates the PCIe slot.

Compatibility with northbound interfaces: If SlotID is not specified, the default value is 0.

RAIDArray

Mandatory

Parameter list (templateProp)

JSON<RAIDArray>

Indicates the configuration of a RAID array, including the following attributes: RAIDType, DedicateHSP, VDName, DiskArray, WritePolicy, ReadPolicy, CachePolicy, StripSize, PDCache, isCustom, and LUNSize. For details about the attributes, see the following table.

NOTE:
  • At least one RAID array must be created. You can create multiple RAID arrays. A maximum of two RAID arrays can be created for LSI2308 or LSI3008, and a maximum of 14 hard disks can be selected.
  • A maximum of 64 RAID arrays can be created for LSI2208, LSI3108, LSI3508, or LSI3516.
  • A maximum of 32 RAID arrays can be created for LSI3408 or LSI3416.
  • A maximum of two RAID arrays can be created for LSI3004.

RAIDArray configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

RAIDType

Mandatory

Parameter list (RAIDArray)

String

Indicates the RAID type. The options are as follows:

  • 0: RAID 0
  • 1: RAID 1
  • 5: RAID 5
  • 6: RAID 6
  • 1E: RAID 1E
  • 10: RAID 10
  • 50: RAID 50
  • 60: RAID 60
NOTE:
  • RAID 0, RAID 1, RAID 10, and RAID 1E can be configured for LSI2308 and LSI3008.
  • RAID 0, RAID 1, RAID 5, RAID 6, RAID 10, RAID 50, and RAID 60 can be configured for LSI2208, LSI3108, LSI3508, and LSI3516.
  • RAID 0, RAID 1, and RAID 10 can be configured for LSI3408 and LSI3416.
  • RAID 0 and RAID 1 can be configured for LSI3004.

DedicateHSP

Optional

Parameter list (RAIDArray)

String

Indicates the private hot spare disk. For example, the value 0;1 indicates slots 0 and 1. This parameter is left empty by default.

NOTE:
  • Private hot spare disks cannot be configured for LSI2308, LSI3008, and LSI3004.
  • RAID 0 does not support private hot spare disks.
  • Hard disk slot numbers range from 0 to 43. The slots selected for GlobalHSP, DedicateHSP, and DiskArray must be different.

DiskArray

Mandatory

Parameter list (RAIDArray)

String

Indicates the hard disk group. This parameter cannot be left empty. For example, the value 0;1 indicates slots 0 and 1.

NOTE:
  • You can create only one hard disk group for RAID 0, RAID 1, RAID 5, RAID 6, and RAID 1E.
  • Select at least one hard disk for RAID 0.
  • Select at least two hard disks for RAID 0 of LSI2308 or LSI3008.
  • LSI3004 supports only two hard disks.
  • Only two hard disks can be configured for RAID 1.
  • At least three hard disks are required for RAID 1E. The number of hard disks must be an odd number.
  • At least three hard disks are required for RAID 5.
  • At least three hard disks are required for RAID 6.
  • The number of RAID 10 hard disk groups ranges from 2 to 8. Each group contains two hard disks.
  • At least six hard disks must be configured for RAID 50. The number of required hard disk groups ranges from 2 to 8. Each group contains at least three hard disks, and the number of hard disks in each group must be the same.
  • At least six hard disks must be configured for RAID 60. The number of required hard disk groups ranges from 2 to 8. Each group contains at least three hard disks, and the number of hard disks in each group must be the same.
  • Hard disk slot numbers range from 0 to 43. The slots selected for GlobalHSP, DedicateHSP, and DiskArray must be different.

WritePolicy

Optional

Parameter list (RAIDArray)

String

Indicates the write policy. The options are as follows:

  • WriteBack
  • WriteThrough

    Default value: WriteBack

NOTE:
  • LSI2308 and LSI3008 do not support this attribute.
  • LSI3408, LSI3004, and LSI3416 only support WriteThrough.

ReadPolicy

Optional

Parameter list (RAIDArray)

String

Indicates the read policy. The options are as follows:

  • ReadAhead: normal prefetch
  • ReadAheadNone: no prefetch

    Default value: ReadAhead

NOTE:
  • LSI2308 and LSI3008 do not support this attribute.
  • LSI3408, LSI3004, and LSI3416 only support ReadAheadNone.

CachePolicy

Optional

Parameter list (RAIDArray)

String

Indicates the I/O policy. The options are as follows:

  • Cached: high-speed cache
  • Direct: direct I/O

    Default value: Cached

NOTE:
  • LSI2308 and LSI3008 do not support this attribute.
  • LSI3408, LSI3004, and LSI3416 only support Direct.

StripSize

Mandatory under conditions

Parameter list (RAIDArray)

String

Indicates the sector size. The options are as follows:

  • 64
  • 128
  • 256
  • 512
  • 1024
NOTE:
  • LSI3004, LSI3416, and LSI3516 support this attribute.
  • For LSI3004 and LSI3416, this field can only be set to 64.

PDCache

Mandatory under conditions

Parameter list (RAIDArray)

String

Indicates the hard disk cache policy. The options are as follows:

  • On
  • Off
  • Default: Retain the default value.
NOTE:

LSI3004, LSI3416, and LSI3516 support this attribute.

isCustom

Optional

Parameter list (RAIDArray)

boolean

Indicates whether LUN partitioning is customized. The options are as follows:

  • true
  • false

    Default value: false

NOTE:

LSI2308 and LSI3008 do not support this attribute.

LUNSize

Optional

Parameter list (RAIDArray)

String

This parameter is mandatory when isCustom is set to true. Example: 10000;20000;MAXSIZE

NOTE:
  • LSI2308 and LSI3008 do not support customized LUN partitioning.
  • A maximum of 64 LUNs can be configured in each RAID array.
  • The total capacity of LUN partitions cannot be greater than 96 TB, that is, 100,663,296 MB.
  • The unit for LUN partitioning is MB. MAXSIZE indicates the remaining capacity.

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

String

Indicates returned data. The value is null.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

Precautions

None

Example

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class CreateRaidTemplate
{
    private static final String CREATE_TEMPLATE_URL = "/rest/openapi/server/deploy/template";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        CreateRaidTemplateTest();
    }
    
    public static void CreateRaidTemplateTest() throws Exception
    {
        String openidURL = CREATE_TEMPLATE_URL;
        String method = "POST";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        
        //Example 1: Create a template named RAID_LSI3008_Template1. For detailed configuration, see the following example and comments.
        BasicNameValuePair[] parameters = 
            {
                new BasicNameValuePair("templateName", "RAID_LSI3008_Template1"),
                new BasicNameValuePair("templateType", "RAID"),
                new BasicNameValuePair("templateDesc", "This is a RAID LSI3008 template"),
                new BasicNameValuePair("templateProp", "{\r\n" + 
                        "    \"AdapterType\": \"LSI3008\",    \r\n" + 
                        "    \"DeleteOriginRAID\": true,    \r\n" + 
                        "    \"GlobalHSP\": \"\",               \r\n" + 
                        "    \"BootDrive\": \"0\",              \r\n" + 
                        "    \"SlotID\": \"0\",              \r\n" +
                        "    \"RAIDArray\": [\r\n" + 
                        "        {\r\n" + 
                        "            \"RAIDType\": \"0\",       \r\n" + 
                        "            \"DiskArray\": [\r\n" + 
                        "                {\r\n" + 
                        "                    \"DiskSlot\": \"0;1\"   \r\n" + 
                        "                }\r\n" + 
                        "            ]\r\n" + 
                        "        }\r\n" + 
                        "    ]\r\n" + 
                        "}")
            };
        //Example 2: Create a template named RAID_LSI3108_Template1. For detailed configuration, see the following example and comments.
        BasicNameValuePair[] parameters2 = 
            {
                new BasicNameValuePair("templateName", "RAID_LSI3108_Template1"),
                new BasicNameValuePair("templateType", "RAID"),
                new BasicNameValuePair("templateDesc", "This is a RAID LSI3108 template."),
                new BasicNameValuePair("templateProp", "{\r\n" + 
                        "    \"AdapterType\": \"LSI3108\",\r\n" + 
                        "    \"DeleteOriginRAID\": true,\r\n" + 
                        "    \"GlobalHSP\": \"0;1\",\r\n" + 
                        "    \"BootDrive\": \"2\",\r\n" + 
                        "    \"SlotID\": \"0\",              \r\n" +
                        "    \"RAIDArray\": [\r\n" + 
                        "        {\r\n" + 
                        "            \"RAIDType\": \"0\",\r\n" + 
                        "            \"DedicateHSP\": \"\",\r\n" + 
                        "            \"WritePolicy\": \"WriteBack\",\r\n" + 
                        "            \"ReadPolicy\": \"ReadAhead\",\r\n" + 
                        "            \"CachePolicy\": \"Cached\",\r\n" + 
                        "            \"isCustom\": false,\r\n" + 
                        "            \"DiskArray\": [\r\n" + 
                        "                {\r\n" + 
                        "                    \"DiskSlot\": \"2;3\"\r\n" + 
                        "                }\r\n" + 
                        "            ]\r\n" + 
                        "        },\r\n" + 
                        "        {\r\n" + 
                        "            \"RAIDType\": \"1\",\r\n" + 
                        "            \"DedicateHSP\": \"4;5\",\r\n" + 
                        "            \"WritePolicy\": \"WriteThrough\",\r\n" + 
                        "            \"ReadPolicy\": \"ReadAheadNone\",\r\n" + 
                        "            \"CachePolicy\": \"Direct\",\r\n" + 
                        "            \"isCustom\": false,\r\n" + 
                        "            \"DiskArray\": [\r\n" + 
                        "                {\r\n" + 
                        "                    \"DiskSlot\": \"6;7\"\r\n" + 
                        "                }\r\n" + 
                        "            ]\r\n" + 
                        "        },\r\n" + 
                        "        {\r\n" + 
                        "            \"RAIDType\": \"10\",\r\n" + 
                        "            \"DedicateHSP\": \"\",\r\n" + 
                        "            \"WritePolicy\": \"WriteBack\",\r\n" + 
                        "            \"ReadPolicy\": \"ReadAhead\",\r\n" + 
                        "            \"CachePolicy\": \"Cached\",\r\n" + 
                        "            \"isCustom\": true,\r\n" + 
                        "            \"LUNSize\": \"10000;20000;MAXSIZE\",\r\n" + 
                        "            \"DiskArray\": [\r\n" + 
                        "                {\r\n" + 
                        "                    \"DiskSlot\": \"8;9\"\r\n" + 
                        "                },\r\n" + 
                        "                {\r\n" + 
                        "                    \"DiskSlot\": \"10;11\"\r\n" + 
                        "                }\r\n" + 
                        "            ]\r\n" + 
                        "        }\r\n" + 
                        "    ]\r\n" + 
                        "}")
            };
        
        //Example 3: Create a template named RAID_LSI3004_Template1. For detailed configuration, see the following example and comments.
        BasicNameValuePair[] parameters3 = 
            {
                new BasicNameValuePair("templateName", "RAID_LSI3004_Template1"),
                new BasicNameValuePair("templateType", "RAID"),
                new BasicNameValuePair("templateDesc", "This is a RAID LSI3004 template."),
                new BasicNameValuePair("templateProp", "{\r\n" + 
                        "    \"AdapterType\": \"LSI3004\",\r\n" + 
                        "    \"DeleteOriginRAID\": true,\r\n" + 
                        "    \"RebuildRate\": \"\",\r\n" + 
                        "    \"MigrateRate\": \"\",\r\n" +
                        "    \"JBOD\": \"Off\",\r\n" +
                        "    \"Patrol\": \"Off\",\r\n" +
                        "    \"PatrolDelay\": \"\",\r\n" +
                        "    \"BootDrive\": \"2\",\r\n" + 
                        "    \"SlotID\": \"0\",              \r\n" +
                        "    \"RAIDArray\": [\r\n" + 
                        "        {\r\n" + 
                        "            \"RAIDType\": \"0\",\r\n" + 
                        "            \"WritePolicy\": \"WriteBack\",\r\n" + 
                        "            \"ReadPolicy\": \"ReadAhead\",\r\n" + 
                        "            \"CachePolicy\": \"Cached\",\r\n" + 
                        "            \"StripSize\": \"64\",\r\n" +
                        "            \"PDCache\": \"Defau;t\",\r\n" +
                        "            \"isCustom\": false,\r\n" + 
                        "            \"DiskArray\": [\r\n" + 
                        "                {\r\n" + 
                        "                    \"DiskSlot\": \"0;1\"\r\n" + 
                        "                }\r\n" + 
                        "            ]\r\n" + 
                        "        }\r\n" + 
                        "    ]\r\n" + 
                        "}")
            };
        
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters2);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    
    }
}

Response example:

REST_SUCCESS   
{
    "code": 0,
    "data": null,
    "resverd": null,
    "description": "create template success."
}

Create an HBA Configuration Template

Function

This interface is used to create an HBA configuration template.

URI

/rest/openapi/server/deploy/template

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

templateName

Mandatory

Parameter list

String

Indicates a template name. The value is a string of 6 to 32 characters, consisting of uppercase or lowercase letters, digits, hyphens (-), and underscores (_).

templateType

Mandatory

Parameter list

String

Indicates a template type. Enter HBA when creating an HBA template.

templateDesc

Optional

Parameter list

String

Indicates the template description. The value can contain a maximum of 127 characters.

templateProp

Mandatory

Parameter list

JSON<template>

Indicates template attributes. For details about how to set HBA attributes, see the HBA configuration description and example.

template configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

adapterModel

Mandatory

Parameter list (templateProp)

String

Indicates the HBA adapter model. The options are as follows:

  • LPE12000
  • LPE12002
  • LPE16000
  • LPE16002
  • QLE2560
  • QLE2562
  • QLE2670
  • QLE2672
  • MZ220
  • MZ221

slot

Mandatory

Parameter list (templateProp)

String

Indicates the HBA adapter slot. The options are as follows:

1 to 10

Port0

Mandatory

Parameter list (templateProp)

JSON<Port0-Port1>

Indicates the configuration for physical port 0 of the adapter. For details, see the configuration description and examples of Port0 and Port1.

NOTE:

The parameter specifies whether the operating system starts from SAN. If you enable the SAN boot function, you also need to set the target WWPN, WWNN, and LUN required for operating system startup. The settings take effect only when the target WWPN, WWNN, and LUN of the same priority are all set.

Port1

Optional

Parameter list (templateProp)

JSON<Port0-Port1>

Indicates the configuration for physical port 1 of the adapter. For details, see the configuration description and examples of Port0 and Port1.

NOTE:

This parameter is mandatory when adapterModel is set to LPE12002, LPE16002, QLE2562, QLE2672, MZ220, and MZ221.

The parameter specifies whether the operating system starts from SAN. If you enable the SAN boot function, you also need to set the target WWPN, WWNN, and LUN required for operating system startup. The settings take effect only when the target WWPN, WWNN, and LUN of the same priority are all set.

Port0 and Port1 configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

SANBoot

Mandatory

Parameter list (Port0 or Port1)

String

Indicates whether SANBoot is enabled. The options are as follows:

  • Enabled
  • Disabled

Target0-Target7

Optional

Parameter list (Port0 or Port1)

JSON<Target0-Target7>

Indicates settings of targets that are started in the system when the priorities are 0 to 7 (Target0 indicates the highest priority, and Target7 indicates the lowest priority). The parameters are valid only when the SANBoot function is enabled. For details, see the configuration for Target0-Target7 in the following table.

NOTE:

When the HBA model is LPE12000, LPE12002, LPE16000, LPE16002, or MZ220, Target0-Target7 can be set.

When the HBA model is QLE2560, QLE2562, QLE2670, QLE2672, or MZ221, Target0-Target3 can be set.

Target0-Target7 configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

TargetWWPN

Optional

Parameter list (Target0-Target7)

String

Indicates the target WWPN.

Format: XX:XX:XX:XX:XX:XX:XX:XX or XXXXXXXXXXXXXXXX, where X is a hexadecimal integer. An example of the target WWPN is 1A:2A:3A:4A:5A:6A:7A:8A.

NOTE:

When the HBA model is LPE12000, LPE12002, LPE16000, LPE16002, or MZ220, the settings take effect only when the target WWPN and LUN of the same priority are both set.

When the HBA model is QLE2560, QLE2562, QLE2670, QLE2672, or MZ221, the settings take effect only when the target WWPN, WWNN, and LUN of the same priority are all set.

TargetWWNN

Optional

Parameter list (Target0-Target7)

String

Indicates the target WWNN.

Format: XX:XX:XX:XX:XX:XX:XX:XX or XXXXXXXXXXXXXXXX, where X is a hexadecimal integer. An example of the target WWPN is 1A:2A:3A:4A:5A:6A:7A:8A.

NOTE:

When the HBA model is LPE12000, LPE12002, LPE16000, LPE16002, or MZ220, the settings take effect only when the target WWPN and LUN of the same priority are both set.

When the HBA model is QLE2560, QLE2562, QLE2670, QLE2672, or MZ221, the settings take effect only when the target WWPN, WWNN, and LUN of the same priority are all set.

TargetLUN

Optional

Parameter list (Target0-Target7)

String

Indicates the LUN to be scanned. If the target LUN contains system files, the operating system starts from the LUN.

Value range:

An integer ranging from 0 to 255

NOTE:

When the HBA model is LPE12000, LPE12002, LPE16000, LPE16002, or MZ220, the settings take effect only when the target WWPN and LUN of the same priority are both set.

When the HBA model is QLE2560, QLE2562, QLE2670, QLE2672, or MZ221, the settings take effect only when the target WWPN, WWNN, and LUN of the same priority are all set.

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

String

Indicates returned data. The value is null.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

Precautions

None

Example

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class CreateHBATemplate
{
    private static final String CREATE_TEMPLATE_URL = "/rest/openapi/server/deploy/template";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        CreateHBATemplateTest();
    }
    
    public static void CreateHBATemplateTest() throws Exception
    {
        String openidURL = CREATE_TEMPLATE_URL;
        String method = "POST";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        
        //Example 1: Create an HBA template named HBA-LPE12002_Template1 and configure all Target information. For detailed configuration, see the following example and comments.
        BasicNameValuePair[] parameters = 
            {
                new BasicNameValuePair("templateName", "HBA_LPE12002_Template1"),
                new BasicNameValuePair("templateType", "HBA"),
                new BasicNameValuePair("templateDesc", "This is a HBA template."),
                new BasicNameValuePair("templateProp", "{\r\n" + 
                        "  \"adapterModel\": \"LPE12002\",\r\n" + 
                        "  \"slot\": \"1\",\r\n" + 
                        "  \"Port0\": {\r\n" + 
                        "    \"SANBoot\": \"Enabled\",\r\n" + 
                        "    \"Target0\": {\r\n" + 
                        "      \"TargetWWPN\": \"11:11:11:11:11:11:11:11\",\r\n" + 
                        "      \"TargetLUN\": \"111\"\r\n" + 
                        "    },\r\n" + 
                        "    \"Target1\": {\r\n" + 
                        "      \"TargetWWPN\": \"22:22:22:22:22:22:22:22\",\r\n" + 
                        "      \"TargetLUN\": \"112\"\r\n" + 
                        "    },\r\n" + 
                        "    \"Target2\": {\r\n" + 
                        "      \"TargetWWPN\": \"33:33:33:33:33:33:33:33\",\r\n" + 
                        "      \"TargetLUN\": \"113\"\r\n" + 
                        "    },\r\n" + 
                        "    \"Target3\": {\r\n" + 
                        "      \"TargetWWPN\": \"44:44:44:44:44:44:44:44\",\r\n" + 
                        "      \"TargetLUN\": \"114\"\r\n" + 
                        "    },\r\n" + 
                        "    \"Target4\": { \r\n" + 
                        "      \"TargetWWPN\": \"55:55:55:55:55:55:55:55\", \r\n" + 
                        "      \"TargetLUN\": \"115\" \r\n" + 
                        "    }, \r\n" + 
                        "    \"Target5\": { \r\n" + 
                        "      \"TargetWWPN\": \"66:66:66:66:66:66:66:66\", \r\n" + 
                        "      \"TargetLUN\": \"116\" \r\n" + 
                        "    }, \r\n" + 
                        "    \"Target6\": { \r\n" + 
                        "      \"TargetWWPN\": \"77:77:77:77:77:77:77:77\", \r\n" + 
                        "      \"TargetLUN\": \"117\" \r\n" + 
                        "    }, \r\n" + 
                        "    \"Target7\": { \r\n" + 
                        "      \"TargetWWPN\": \"88:88:88:88:88:88:88:88\", \r\n" + 
                        "      \"TargetLUN\": \"118\" \r\n" + 
                        "    }  \r\n" + 
                        "  },\r\n" + 
                        "  \"Port1\": {\r\n" + 
                        "  \"SANBoot\": \"Disabled\"\r\n" + 
                        "  }\r\n" + 
                        "}")
            };
        //Example 2: Create an HBA template named HBA-LPE12002_Template2. Configure four targets for Port 1, and disable the function of startup from SAN for Port 2. For detailed configuration, see the following example and comments.
        BasicNameValuePair[] parameters2 = 
            {
                new BasicNameValuePair("templateName", "HBA_QLE2560_Template1"),
                new BasicNameValuePair("templateType", "HBA"),
                new BasicNameValuePair("templateDesc", "This is a HBA template."),
                new BasicNameValuePair("templateProp", "{\r\n" + 
                        "  \"adapterModel\": \"QLE2560\", \r\n" + 
                        "  \"slot\": \"3\", \r\n" + 
                        "  \"Port0\": { \r\n" + 
                        "    \"SANBoot\": \"Enabled\", \r\n" + 
                        "    \"Target0\": { \r\n" + 
                        "      \"TargetWWPN\": \"11:11:11:11:11:11:11:11\", \r\n" + 
                        "      \"TargetWWNN\": \"55:55:55:55:55:55:55:55\", \r\n" + 
                        "      \"TargetLUN\": \"111\" \r\n" + 
                        "    }, \r\n" + 
                        "    \"Target1\": { \r\n" + 
                        "      \"TargetWWPN\": \"22:22:22:22:22:22:22:22\", \r\n" + 
                        "      \"TargetWWNN\": \"66:66:66:66:66:66:66:66\", \r\n" + 
                        "      \"TargetLUN\": \"112\" \r\n" + 
                        "    }, \r\n" + 
                        "    \"Target2\": { \r\n" + 
                        "      \"TargetWWPN\": \"33:33:33:33:33:33:33:33\", \r\n" + 
                        "      \"TargetWWNN\": \"77:77:77:77:77:77:77:77\", \r\n" + 
                        "      \"TargetLUN\": \"113\" \r\n" + 
                        "    }, \r\n" + 
                        "    \"Target3\": { \r\n" + 
                        "      \"TargetWWPN\": \"44:44:44:44:44:44:44:44\", \r\n" + 
                        "      \"TargetWWNN\": \"88:88:88:88:88:88:88:88\", \r\n" + 
                        "      \"TargetLUN\": \"114\" \r\n" + 
                        "    } \r\n" + 
                        "  } \r\n" + 
                        "}   ")
            };
        
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    
    }
    
}

Response example:

REST_SUCCESS   
{
    "code": 0,
    "data": null,
    "resverd": null,
    "description": "create template success."
}

Create a CNA Configuration Template

Function

This interface is used to create a CNA configuration template.

URI

/rest/openapi/server/deploy/template

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

templateName

Mandatory

Parameter list

String

Indicates a template name. The value is a string of 6 to 32 characters, consisting of uppercase or lowercase letters, digits, hyphens (-), and underscores (_).

templateType

Mandatory

Parameter list

String

Indicates a template type. Enter CNA when creating a CNA template.

templateDesc

Optional

Parameter list

String

Indicates the template description. The value can contain a maximum of 127 characters.

templateProp

Mandatory

Parameter list

JSON<template>

Indicates template attributes. The attributes include adapterModel, MFState, MFState1, Slot, and Port0-Port3. For details, see the setting description and examples of CNA.

NOTE:

The MFState1 attribute is involved when adapterModel is set to MZ512.

template configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

adapterModel

Mandatory

Parameter list (templateProp)

String

Indicates the CNA adapter model. The options are as follows:

  • OCE11102
  • MZ510
  • MZ512
  • MZ910

Slot

Optional

Parameter list (templateProp)

String

Indicates the slot for the CNA adapter. The default value is 1.

The value is an integer ranging from 1 to 8.

MFState

Optional

Parameter list (templateProp)

String

Indicates whether to enable the MF function that supports multi-channel PFs (one PF indicates one logical channel). After this function is enabled, a physical port will be divided into four logical channels. Each logical channel can be set as a network port (NIC), FCoE, or iSCSI port.

The default value is Enabled. The options are as follows:

  • Enabled
  • Disabled
NOTE:

If MFState is set to Disabled, all physical ports contain only one logical channel (PF0) when the network port is a NIC port, and contain two logical channels (PF0 and PF1) when the network port is FCoE or iSCSI.

This function and SR-IOV cannot be enabled at the same time. When adapterModel is set to MZ910, this attribute is not involved.

When adapterModel is set to MZ512, this attribute can enable or disable the multi-channel function only for port 0 and port 1.

MFState1

Optional

Parameter list (templateProp)

String

Indicates whether to enable the MF function that supports multi-channel PFs (one PF indicates one logical channel). After this function is enabled, a physical port will be divided into four logical channels. Each logical channel can be set as a network port (NIC), FCoE, or iSCSI port.

The default value is Enabled. The options are as follows:

  • Enabled
  • Disabled
NOTE:

If MFState is set to Disabled, all physical ports contain only one logical channel (PF0) when the network port is a NIC port, and contain two logical channels (PF0 and PF1) when the network port is FCoE or iSCSI.

This function and SR-IOV cannot be enabled at the same time. When adapterModel is set to MZ910, this attribute is not involved.

When adapterModel is set to MZ512, this attribute can enable or disable the multi-channel function only for port 2 and port 3.

Port0-Port3

Mandatory

Parameter list (templateProp)

JSON<Port0-Port3>

Indicates port configuration. The options are as follows:

  • Port0
  • Port1
  • Port2
  • Port3
NOTE:
  1. The number of port parameters vary according to the values of adapterModel:

    If adapterModel is OCE11102 or MZ510, Port0 and Port1 are set.

    If adapterModel is MZ512 or MZ910, Port0-Port3 are set.

  2. For details about how to set parameters for a single port, see the setting description and examples of Port0 and Port1.

Port0-Port3 configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

PF0-PF3

Mandatory

Parameter list (Port)

JSON<PF0-PF3>

Indicates the PF logical channel property. The options are as follows:

  • PF0
  • PF1
  • PF2
  • PF3
NOTE:
  1. The number of PF parameters vary according to the values of adapterModel and MFState:

    If adapterModel is OCE11102, MZ510, or MZ512, and MFState is Enabled, the options are PF0-PF3.

    If adapterModel is OCE11102, MZ510, or MZ512, and MFState is Disabled, the option is PF0.

    If adapterModel is MZ910, the PF parameters are not involved.

  2. For details about how to set parameters for a single PF, see the setting description and examples of PF0-PF3.

PXEBoot

Optional

Parameter list (Port)

String

Indicates whether to enable the PXEBoot function. The default value is Enabled. The options are as follows:

  • Enabled
  • Disabled
NOTE:

This parameter applies only to physical ports and is available only to ports 0 and 1 of MZ910.

SANBoot

Optional

Parameter list (Port)

String

Indicates whether to enable the SANBoot function. The default value is Enabled. The options are as follows:

  • Enabled
  • Disabled

Note:

NOTE:

This parameter applies only to physical ports and is available only to ports 2 and 3 of MZ910.

Target0-Target7

Optional

Parameter list (Port)

String

Indicates settings of targets that are started in the system when the priorities are 0 to 7 (Target0 indicates the highest priority, and Target7 indicates the lowest priority). The parameters are valid only when the SANBoot function is enabled.

Value range:

Format:

TargetWWPN:XX:XX:XX:XX:XX:XX:XX:XX;TargetLUN:TargetLUNID or TargetWWPN:XXXXXXXXXXXXXXXX;TargetLUN:TargetLUNID

In the value format, X indicates a hexadecimal integer. An example of the target WWPN is 1A:2A:3A:4A:5A:6A:7A:8A.

TargetLUNID is an integer ranging from 0 to 255.

NOTE:
  1. TargetLUN indicates the LUN to be scanned. If the target LUN contains system files, the operating system starts from the LUN.
  2. The settings take effect only when the target WWPN and LUN of the same priority are both set.
  3. The parameters apply only to physical ports and are available only to ports 2 and 3 of MZ910 and when PortSANBoot is Enabled.

PF0, PF2, and PF3 configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

MinBandWidth

Optional

Parameter list (PF0/PF2/PF3)

String

Indicates the minimum bandwidth ratio of a single virtual network port. The default value is 25. The value can be an integer ranging from 1 to 100.

NOTE:

The total of the minimum bandwidth ratios of all virtual ports of the same physical port must be 100.

MaxBandWidth

Optional

Parameter list (PF0/PF2/PF3)

String

Indicates the maximum bandwidth ratio of a single virtual network port. The default value is 100. The value can be an integer ranging from 1 to 100.

NOTE:

The value of MinBandWidth cannot be greater than that of MaxBandWidth.

PFVLANID

Mandatory

Parameter list (PF0/PF2/PF3)

String

Indicates the VLAN ID. The options are as follows:

  • 2 to 4094
  • 0
NOTE:
  1. The parameter value varies depending on the PF type:

    If the PF type is NIC, the value is an integer ranging from 2 to 4094.

    If the PF type is iSCSI or FCoE, the value is 0.

  2. Every PF VALN ID must be unique.

PXEBoot

Optional

Parameter list (PF0)

String

Indicates whether to enable the PXEBoot function. The default value is Disabled. The options are as follows:

  • Enabled
  • Disabled
NOTE:

The parameter applies only to PF0.

SRIOV

Optional

Parameter list (PF0)

String

Indicates whether to enable the single-channel I/O virtualization function. The default value is Disabled. The options are as follows

  • Enabled
  • Disabled
NOTE:

Single-channel I/O virtualization cannot be enabled when MFState or MFState1 is enabled. This attribute cannot be set when MFState or MFState1 is Enabled.

When adapterModel is set to MZ910, this attribute is not involved.

The parameter applies only to PF0.

PF1 configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

PFType

Optional

Parameter list (PF1)

String

Indicates the type of the virtual port. The default value is NIC. The options are as follows:

  • NIC
  • iSCSI
  • FCoE

MinBandWidth

Optional

Parameter list (PF1)

String

Indicates the minimum bandwidth ratio of a single virtual network port. The default value is 25. The value can be an integer ranging from 1 to 100.

NOTE:

The total of the minimum bandwidth ratios of all virtual ports of the same physical port must be 100.

MaxBandWidth

Optional

Parameter list (PF1)

String

Indicates the maximum bandwidth ratio of a single virtual network port. The default value is 100. The value can be an integer ranging from 1 to 100.

NOTE:

The value of MinBandWidth cannot be greater than that of MaxBandWidth.

PFVLANID

Mandatory

Parameter list (PF1)

String

Indicates the VLAN ID. The options are as follows:

  • 2 to 4094
  • 0
NOTE:
  1. The parameter value varies depending on the PF type:

    If the PF type is NIC, the value is an integer ranging from 2 to 4094.

    If the PF type is iSCSI or FCoE, the value is 0.

  2. Every PF VALN ID must be unique.

Attributes dedicated to iSCSI

iSCSIBoot

Optional

Parameter list (PF1)

String

Indicates whether to enable the iSCSIBoot function. The default value is Disabled. The options are as follows:

  • Enabled
  • Disabled
NOTE:

This parameter is involved only when the type of PF1 is iSCSI.

Network

Mandatory

Parameter list (PF1)

JSON<Network>

Indicates the network configuration.

For details, see the Network configuration description.

NOTE:

This parameter is involved only when the type of PF1 is iSCSI.

Initiator

Mandatory

Parameter list (PF1)

JSON<Initiator>

Indicates the initiator configuration.

For details of the options, see the Initiator configuration description.

NOTE:

This parameter is involved only when the type of PF1 is iSCSI.

Target

Mandatory

Parameter list (PF1)

JSON<Target>

Indicates target configuration.

For details, see the Target configuration description.

NOTE:

This parameter is involved only when the type of PF1 is iSCSI.

Attributes dedicated to FCoE

SANBoot

Optional

Parameter list (PF1)

String

Indicates whether to enable the SANBoot function. The default value is Enabled. The options are as follows:

  • Enabled
  • Disabled
NOTE:

This parameter is involved only when the type of PF1 is FCoE.

Target0-Target7

Optional

Parameter list (PF1)

Sting

Indicates settings of targets that are started in the system when the priorities are 0 to 7 (Target0 indicates the highest priority, and Target7 indicates the lowest priority). The parameters are valid only when the SANBoot function is enabled.

Format:

TargetWWPN:XX:XX:XX:XX:XX:XX:XX:XX;TargetLUN:TargetLUNID or TargetWWPN:XXXXXXXXXXXXXXXX;TargetLUN:TargetLUNID

In the value format, X indicates a hexadecimal integer. An example of the target WWPN is 1A:2A:3A:4A:5A:6A:7A:8A.

TargetLUNID is an integer ranging from 0 to 255.

NOTE:
  1. TargetLUN indicates the LUN to be scanned. If the target LUN contains system files, the operating system starts from the LUN.
  2. The settings take effect only when the target WWPN and LUN of the same priority are both set.
  3. This parameter is involved only when the type of PF1 is FCoE.

Network configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

VLANEnabled

Optional

Parameter list (Network)

String

Indicates whether to enable the VLAN function. The default value is Disabled. The options are as follows:

  • Enabled
  • Disabled

VLANID

Mandatory

Parameter list (Network)

String

Indicates the VLAN ID. The value must be an integer ranging from 0 to 4094.

NOTE:

This parameter is valid only when VLANEnabled is Enabled.

Priority

Mandatory

Parameter list (Network)

String

Indicates the priority. The value must be an integer ranging from 0 to 7.

NOTE:

This parameter is valid only when VLANEnabled is Enabled.

DHCP

Optional

Parameter list (Network)

String

Indicates whether to enable the DHCP function. The default value is Disabled. The options are as follows:

  • Enabled
  • Disabled

IPAddress

Mandatory

Parameter list (Network)

String

Indicates the IPv4 address.

Rule:

The first octet in the IP address must be an integer from 1 to 223, and the other three octets must be integers from 0 to 255. The first octet cannot be 127 and the last octet cannot be 0.

NOTE:

This parameter is valid only when DHCP is Disabled.

SubnetMask

Mandatory

Parameter list (Network)

String

Indicates the subnet mask.

Enter the subnet mask according to the IP address.

NOTE:

This parameter is valid only when DHCP is Disabled.

DefaultGateway

Mandatory

Parameter list (Network)

String

Indicates the default gateway.

The first octet in the IP address must be an integer from 1 to 223, and the other three octets must be integers from 0 to 255. The first octet cannot be 127 and the last octet cannot be 0.

NOTE:

This parameter is valid only when DHCP is Disabled.

Initiator configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

InitiatorName

Mandatory

Parameter list (Initiator)

String

Indicates the initiator name.

The value is in the format of iqn.xx:MAC address. It can contain 11 to 223 characters, including digits (0-9), lowercase letters (a-z), uppercase letters (A-Z), periods (.), colons (:), and hyphens (-).

Example: iqn.1990-08.com.huawei:20-14-03-10-14-30

InitiatorAlias

Mandatory

Parameter list (Initiator)

String

Indicates the initiator alias. The value is a string of 0-31 characters, containing 0-9 and a-z.

HeaderDigest

Optional

Parameter list (Initiator)

String

Indicates whether to enable the header digest. The default value is Disabled. The options are as follows:

  • Enabled
  • Disabled

ImmediateData

Optional

Parameter list (Initiator)

String

Indicates whether to enable the immediate data. The default value is Enabled. The options are as follows:

  • Enabled
  • Disabled

DataDigest

Optional

Parameter list (Initiator)

String

Indicates whether to enable the data digest. The default value is Disabled. The options are as follows:

Enabled

Disabled

Auth

Optional

Parameter list (Initiator)

String

Indicates the authentication mode. The default value is none. The options are as follows:

  • 0: None

Target configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

TargetIP

Mandatory

Parameter list (Target)

String

Indicates the target IP address.

Only IPv4 addresses are supported. The first octet in the IPv4 address must be an integer from 1 to 223, and the other three octets must be integers from 0 to 255. The first octet cannot be 127 and the last octet cannot be 0.

TargetPort

Mandatory

Parameter list (Target)

String

Indicates the target port. The value must be an integer ranging from 1024 to 65535.

TargetName

Mandatory

Parameter list (Target)

String

Indicates the target name. The value is a string of 11-223 characters. The following characters are supported: 0-9, a-z, A-Z, periods (.), colons (:), and hyphens (-).

Login

Optional

Parameter list (Target)

String

Indicates whether to enable the login function. The default value is Enabled. The options are as follows:

  • Enabled
  • Disabled

Boot

Optional

Parameter list (Target)

String

Indicates whether to enable the boot function. The default value is Disabled. The options are as follows:

  • Enabled
  • Disabled

HeaderDigest

Optional

Parameter list (Target)

String

Indicates whether to enable the header digest. The default value is Disabled. The options are as follows:

  • Enabled
  • Disabled

ImmediateData

Optional

Parameter list (Target)

String

Indicates whether to enable the immediate data. The default value is Enabled. The options are as follows:

  • Enabled
  • Disabled

DataDigest

Optional

Parameter list (Target)

String

Indicates whether to enable the data digest. The default value is Disabled. The options are as follows:

  • Enabled
  • Disabled

Auth

Optional

Parameter list (Target)

String

Indicates the authentication mode. The default value is none. The options are as follows:

  • 0: None

ETO

Optional

Parameter list (Target)

String

Indicates the ETO. The default value is 30. The value must be an integer ranging from 0 to 3600.

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

String

Indicates returned data. The value is null.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

Precautions

None

Example

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class CreateCNATemplate
{
    private static final String CREATE_TEMPLATE_URL = "/rest/openapi/server/deploy/template";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        CreateCNATemplateTest();
    }
    
    public static void CreateCNATemplateTest() throws Exception
    {
        String openidURL = CREATE_TEMPLATE_URL;
        String method = "POST";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        
        //Example 1: Create a template named CNA_MZ510_Template and where MFState is Disabled.
        BasicNameValuePair[] parameters = 
            {
                new BasicNameValuePair("templateName", "CNA_MZ510_Template"),
                new BasicNameValuePair("templateType", "CNA"),
                new BasicNameValuePair("templateDesc", "This is a MZ510 template."),
                new BasicNameValuePair("templateProp", "{ \r\n" + 
                        "  \"adapterModel\": \"MZ510\", \r\n" + 
                        "  \"Slot\": \"1\", \r\n" + 
                        "  \"MFState\": \"Disabled\", \r\n" + 
                        "  \"Port0\": { \r\n" + 
                        "    \"PF0\": { \r\n" + 
                        "      \"PXEBoot\": \"Disabled\", \r\n" + 
                        "      \"PFType\": \"NIC\",\r\n" + 
                        "      \"SRIOV\": \"Enabled\"\r\n" + 
                        "    } \r\n" + 
                        "  }, \r\n" + 
                        "  \"Port1\": { \r\n" + 
                        "    \"PF0\": { \r\n" + 
                        "      \"PXEBoot\": \"Disabled\", \r\n" + 
                        "      \"PFType\": \"NIC\",  \r\n" + 
                        "\"SRIOV\": \"Enabled\"\r\n" + 
                        "    } \r\n" + 
                        "  } \r\n" + 
                        "}")
            };
        //Example 2: Create a template named CNA_OCE11102_Template and where the PF1 types of ports 0 and 1 are NIC.
        BasicNameValuePair[] parameters2 = 
            {
                new BasicNameValuePair("templateName", "CNA_OCE11102_Template2"),
                new BasicNameValuePair("templateType", "CNA"),
                new BasicNameValuePair("templateDesc", "This is a CNA template"),
                new BasicNameValuePair("templateProp", "{  \r\n" + 
                        "  \"adapterModel\":\"OCE11102\",   \r\n" + 
                        "  \"MFState\":\"Enabled\",  \r\n" + 
                        "  \"Slot\":\"1\",  \r\n" + 
                        "  \"Port0\":{  \r\n" + 
                        "    \"PF0\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"2\", \r\n" + 
                        "      \"PXEBoot\":\"Disabled\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF1\":{  \r\n" + 
                        "      \"PFType\":\"NIC\",  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"3\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF2\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"4\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF3\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"5\"  \r\n" + 
                        "    }  \r\n" + 
                        "  },  \r\n" + 
                        "  \"Port1\":{  \r\n" + 
                        "    \"PF0\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"6\", \r\n" + 
                        "      \"PXEBoot\":\"Disabled\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF1\":{  \r\n" + 
                        "      \"PFType\":\"NIC\",  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"7\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF2\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"8\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF3\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"9\"  \r\n" + 
                        "    }  \r\n" + 
                        "  }  \r\n" + 
                        "}")
            };
        //Example 3: Create a template named CNA_OCE11102_Template and where the PF1 types of ports 0 and 1 are FCoE.
        BasicNameValuePair[] parameters3 = 
            {
                new BasicNameValuePair("templateName", "CNA_OCE11102_Template3"),
                new BasicNameValuePair("templateType", "CNA"),
                new BasicNameValuePair("templateDesc", "This is template description"),
                new BasicNameValuePair("templateProp", "{  \r\n" + 
                        "  \"adapterModel\":\"OCE11102\",   \r\n" + 
                        "  \"MFState\":\"Enabled\",  \r\n" + 
                        "  \"Slot\": \"1\",  \r\n" + 
                        "  \"Port0\":{  \r\n" + 
                        "    \"PF0\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\": \"100\",  \r\n" + 
                        "      \"PFVLANID\":\"2\",  \r\n" + 
                        "      \"PXEBoot\":\"Disabled\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF1\":{  \r\n" + 
                        "      \"PFType\":\"FCoE\",  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"0\",  \r\n" + 
                        "      \"SANBoot\":\"Enabled\",  \r\n" + 
                        "      \"Target0\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:0\",  \r\n" + 
                        "      \"Target1\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:1\",  \r\n" + 
                        "      \"Target2\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:2\",  \r\n" + 
                        "      \"Target3\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:3\",  \r\n" + 
                        "      \"Target4\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:4\",  \r\n" + 
                        "      \"Target5\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:5\",  \r\n" + 
                        "      \"Target6\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:6\",  \r\n" + 
                        "      \"Target7\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:7\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF2\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"3\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF3\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"4\"  \r\n" + 
                        "    }  \r\n" + 
                        "  },  \r\n" + 
                        "  \"Port1\":{  \r\n" + 
                        "    \"PF0\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"5\",  \r\n" + 
                        "      \"PXEBoot\":\"Disabled\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF1\":{  \r\n" + 
                        "      \"PFType\":\"FCoE\",  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"0\",  \r\n" + 
                        "      \"SANBoot\":\"Disabled\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF2\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"6\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF3\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"7\"  \r\n" + 
                        "    }  \r\n" + 
                        "  }  \r\n" + 
                        "}")
            };
        //Example 4: Create a template named CNA_OCE11102_Template and where the PF1 types of ports 0 and 1 are iSCSI.
        BasicNameValuePair[] parameters4 = 
            {
                new BasicNameValuePair("templateName", "CNA_OCE11102_Template4"),
                new BasicNameValuePair("templateType", "CNA"),
                new BasicNameValuePair("templateDesc", "This is template description"),
                new BasicNameValuePair("templateProp", "{  \r\n" + 
                        "  \"adapterModel\":\"OCE11102\",  \r\n" + 
                        "  \"MFState\":\"Enabled\",  \r\n" + 
                        "  \"Slot\":\"1\",  \r\n" + 
                        "  \"Port0\":{  \r\n" + 
                        "    \"PF0\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"2\",  \r\n" + 
                        "      \"PXEBoot\":\"Disabled\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF1\":{  \r\n" + 
                        "      \"PFType\":\"iSCSI\",  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"0\",  \r\n" + 
                        "      \"iSCSIBoot\":\"Disabled\",  \r\n" + 
                        "      \"Network\":{  \r\n" + 
                        "        \"VLANEnabled\":\"Enabled\",  \r\n" + 
                        "        \"VLANID\":\"1\",  \r\n" + 
                        "        \"Priority\":\"7\",  \r\n" + 
                        "        \"DHCP\":\"Disabled\",  \r\n" + 
                        "        \"IPAddress\":\"192.168.1.123\",  \r\n" + 
                        "        \"SubnetMask\":\"255.255.0.0\",  \r\n" + 
                        "        \"DefaultGateway\":\"192.168.1.1\"  \r\n" + 
                        "      },  \r\n" + 
                        "      \"Initiator\":{  \r\n" + 
                        "        \"InitiatorName\":\"iqn.1990-08.com.huawei:20-00-00-00-00-00\",  \r\n" + 
                        "        \"InitiatorAlias\":\"initiatoralias\",  \r\n" + 
                        "        \"HeaderDigest\":\"Disabled\",  \r\n" + 
                        "        \"ImmediateData\":\"Enabled\",  \r\n" + 
                        "        \"DataDigest\":\"Disabled\",  \r\n" + 
                        "        \"Auth\":\"0\",  \r\n" +  
                        "      },  \r\n" + 
                        "      \"Target\":{  \r\n" + 
                        "        \"TargetIP\":\"192.168.123.123\",  \r\n" + 
                        "        \"TargetPort\":\"1024\",  \r\n" + 
                        "        \"TargetName\":\"targetnameexample\",  \r\n" + 
                        "        \"Login\":\"Enabled\",  \r\n" + 
                        "        \"Boot\":\"Disabled\",  \r\n" + 
                        "        \"HeaderDigest\":\"Disabled\",  \r\n" + 
                        "        \"ImmediateData\":\"Enabled\",  \r\n" + 
                        "        \"DataDigest\":\"Disabled\",  \r\n" + 
                        "        \"Auth\":\"0\",  \r\n" + 
                        "        \"ETO\":\"30\"  \r\n" + 
                        "      }  \r\n" + 
                        "   },  \r\n" + 
                        "    \"PF2\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"3\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF3\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"4\"  \r\n" + 
                        "    }  \r\n" + 
                        "  },  \r\n" + 
                        "  \"Port1\":{  \r\n" + 
                        "    \"PF0\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"5\",  \r\n" + 
                        "      \"PXEBoot\":\"Disabled\"  \r\n" + 
                        "    },   \r\n" + 
                        "    \"PF1\":{  \r\n" + 
                        "      \"PFType\":\"iSCSI\",  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"0\",  \r\n" + 
                        "      \"iSCSIBoot\":\"Enabled\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF2\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"6\"  \r\n" + 
                        "    },  \r\n" + 
                        "    \"PF3\":{  \r\n" + 
                        "      \"MinBandWidth\":\"25\",  \r\n" + 
                        "      \"MaxBandWidth\":\"100\",  \r\n" + 
                        "      \"PFVLANID\":\"7\"  \r\n" + 
                        "    }  \r\n" + 
                        "  }  \r\n" + 
                        "}")
            };
        //Example 5: Create a template named CNA_MZ910_Template.
        BasicNameValuePair[] parameters5 = 
            {
                new BasicNameValuePair("templateName", "Template_MZ910"),
                new BasicNameValuePair("templateType", "CNA"),
                new BasicNameValuePair("templateDesc", "This is template description"),
                new BasicNameValuePair("templateProp", "{  \r\n" + 
                        "  \"adapterModel\":\"MZ910\",  \r\n" + 
                        "  \"Slot\":\"1\",  \r\n" + 
                        "  \"Port0\":{  \r\n" + 
                        "    \"PXEBoot\":\"Enabled\"  \r\n" + 
                        "  },  \r\n" + 
                        "  \"Port1\":{  \r\n" + 
                        "   \"PXEBoot\":\"Disabled\"  \r\n" + 
                        "  },  \r\n" + 
                        "  \"Port2\":{  \r\n" + 
                        "    \"SANBoot\":\"Enabled\",  \r\n" + 
                        "    \"Target0\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:0\",  \r\n" + 
                        "    \"Target1\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:1\",  \r\n" + 
                        "    \"Target2\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:2\",  \r\n" + 
                        "    \"Target3\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:3\",  \r\n" + 
                        "    \"Target4\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:4\",  \r\n" + 
                        "    \"Target5\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:5\",  \r\n" + 
                        "    \"Target6\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:6\",  \r\n" + 
                        "    \"Target7\":\"TargetWWPN:1A:2A:3A:4A:5A:6A:7A:8A;TargetLUN:7\"  \r\n" + 
                        "  },  \r\n" + 
                        "  \"Port3\":{  \r\n" + 
                        "    \"SANBoot\":\"Disabled\"  \r\n" + 
                        "  }  \r\n" + 
                        "}")
            };
        //Example 6: Create a template named CNA_MZ512_Template and where MFState is Disabled and MFState1 is Enabled.
        BasicNameValuePair[] parameters6 = 
            {
                new BasicNameValuePair("templateName", "Template_MZ512"),
                new BasicNameValuePair("templateType", "CNA"),
                new BasicNameValuePair("templateDesc", "This is template description"),
                new BasicNameValuePair("templateProp", "{\r\n" + 
                        "            \"adapterModel\": \"MZ512\",\r\n" + 
                        "            \"Slot\": \"1\",\r\n" + 
                        "            \"MFState\": \"Disabled\",\r\n" + 
                        "            \"MFState1\": \"Enabled\",\r\n" + 
                        "            \"Port0\": {\r\n" + 
                        "                \"PF0\": {\r\n" + 
                        "                    \"PXEBoot\": \"Disabled\",\r\n" + 
                        "                    \"PFType\": \"NIC\",\r\n" + 
                        "                    \"SRIOV\": \"Enabled\"\r\n" + 
                        "                }\r\n" + 
                        "            },\r\n" + 
                        "            \"Port1\": {\r\n" + 
                        "                \"PF0\": {\r\n" + 
                        "                    \"PXEBoot\": \"Disabled\",\r\n" + 
                        "                    \"PFType\": \"NIC\",\r\n" + 
                        "                    \"SRIOV\": \"Enabled\"\r\n" + 
                        "                }\r\n" + 
                        "            },\r\n" + 
                        "            \"Port2\": {\r\n" + 
                        "                \"PF0\": {\r\n" + 
                        "                    \"MinBandWidth\": 25,\r\n" + 
                        "                    \"MaxBandWidth\": \"100\",\r\n" + 
                        "                    \"PXEBoot\": \"Disabled\",\r\n" + 
                        "                    \"PFType\": \"NIC\",\r\n" + 
                        "                    \"PFVLANID\": \"2\"\r\n" + 
                        "                },\r\n" + 
                        "                \"PF1\": {\r\n" + 
                        "                    \"MinBandWidth\": 25,\r\n" + 
                        "                    \"MaxBandWidth\": \"100\",\r\n" + 
                        "                    \"iSCSIBoot\": \"Disabled\",\r\n" + 
                        "                    \"PFType\": \"iSCSI\",\r\n" + 
                        "                    \"PFVLANID\": \"0\"\r\n" + 
                        "                },\r\n" + 
                        "                \"PF2\": {\r\n" + 
                        "                    \"MinBandWidth\": 25,\r\n" + 
                        "                    \"MaxBandWidth\": \"100\",\r\n" + 
                        "                    \"PFType\": \"NIC\",\r\n" + 
                        "                    \"PFVLANID\": \"3\"\r\n" + 
                        "                },\r\n" + 
                        "                \"PF3\": {\r\n" + 
                        "                    \"MinBandWidth\": 25,\r\n" + 
                        "                    \"MaxBandWidth\": \"100\",\r\n" + 
                        "                    \"PFType\": \"NIC\",\r\n" + 
                        "                    \"PFVLANID\": \"4\"\r\n" + 
                        "                }\r\n" + 
                        "            },\r\n" + 
                        "            \"Port3\": {\r\n" + 
                        "                \"PF0\": {\r\n" + 
                        "                    \"MinBandWidth\": 25,\r\n" + 
                        "                    \"MaxBandWidth\": \"100\",\r\n" + 
                        "                    \"PXEBoot\": \"Disabled\",\r\n" + 
                        "                    \"PFType\": \"NIC\",\r\n" + 
                        "                    \"PFVLANID\": \"5\"\r\n" + 
                        "                },\r\n" + 
                        "                \"PF1\": {\r\n" + 
                        "                    \"MinBandWidth\": 25,\r\n" + 
                        "                    \"MaxBandWidth\": \"100\",\r\n" + 
                        "                    \"iSCSIBoot\": \"Disabled\",\r\n" + 
                        "                    \"PFType\": \"iSCSI\",\r\n" + 
                        "                    \"PFVLANID\": \"0\"\r\n" + 
                        "                },\r\n" + 
                        "                \"PF2\": {\r\n" + 
                        "                    \"MinBandWidth\": 25,\r\n" + 
                        "                    \"MaxBandWidth\": \"100\",\r\n" + 
                        "                    \"PFType\": \"NIC\",\r\n" + 
                        "                    \"PFVLANID\": \"6\"\r\n" + 
                        "                },\r\n" + 
                        "                \"PF3\": {\r\n" + 
                        "                    \"MinBandWidth\": 25,\r\n" + 
                        "                    \"MaxBandWidth\": \"100\",\r\n" + 
                        "                    \"PFType\": \"NIC\",\r\n" + 
                        "                    \"PFVLANID\": \"7\"\r\n" + 
                        "                }\r\n" + 
                        "            }\r\n" + 
                        "        }")
            };
        
        
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters4);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    
    }
}

Response example:

REST_SUCCESS   
{
    "code": 0,
    "data": null,
    "resverd": null,
    "description": "create template success."
}

Create an iBMC Template

Function

This interface is used to create an iBMC configuration template.

URI

/rest/openapi/server/deploy/template

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

templateName

Mandatory

Parameter list

String

Indicates a template name. The value is a string of 6 to 32 characters, consisting of uppercase or lowercase letters, digits, hyphens (-), and underscores (_).

templateType

Mandatory

Parameter list

String

Indicates a template type. Enter iBMC when creating an iBMC configuration template. Template types include BIOS, RAID, HBA, CNA, POWER, NETWORK, OS, and IBMC.

templateDesc

Optional

Parameter list

String

Indicates the template description. The value can contain a maximum of 127 characters.

templateProp

Mandatory

Parameter list

JSON<template>

Indicates template attributes. For details of iBMC configuration attributes, see the following table and example.

template configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

systemBootOption

Mandatory

Parameter list (templateProp)

String

Indicates the system boot option. The options are as follows:

  • 0: PXE
  • 1: default value
  • 2: CD/DVD ROM
  • 3: hard disk
  • 4: floppy disk

dnsConfig

Optional

Parameter list (templateProp)

JSON<dnsConfig>

Indicates the DNS configuration. Set this parameter when the DNS service is selected.

ntpConfig

Optional

Parameter list (templateProp)

JSON<ntpConfig>

Indicates the NTP configuration. Set this parameter when the NTP service is selected.

ldapConfig

Optional

Parameter list (templateProp)

JSON<ldapConfig>

Indicates the LDAP configuration. Set this parameter when the LDAP service is selected.

dnsConfig configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

dnsSource

Mandatory

Parameter list (dnsConfig)

String

Indicates the DNS obtaining mode. The options are as follows:

  • 0: automatic
  • 1: manual

domainName

Mandatory

Parameter list (dnsConfig)

String

Indicates the domain name. This parameter is mandatory when dnsSource is set to 1.

primaryDnsServer

Mandatory

Parameter list (dnsConfig)

String

Indicates the primary DNS server. This parameter is mandatory when dnsSource is set to 1.

secondaryDnsServer

Optional

Parameter list (dnsConfig)

String

Indicates the secondary DNS server. This parameter is optional when dnsSource is set to 1.

ntpConfig configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

ntpStatus

Mandatory

Parameter list (ntpConfig)

String

Indicates the NTP status. The options are as follows:

  • true: enabled
  • false: disabled

ntpServerSource

Mandatory

Parameter list (ntpConfig)

String

Indicates the NTP service source. This parameter is mandatory when ntpStatus is set to true. The options are as follows:

  • 0: automatic
  • 1: manual

bindNtpIpProtocol

Mandatory

Parameter list (ntpConfig)

String

Indicates the NTP constraint IP protocol. This parameter is mandatory when ntpServerSource is set to 0. Input parameters do not contain this parameter when ntpServerSource is set to 1. The options are as follows:

  • 1: automatically obtains an IPv4 address.
  • 2: automatically obtains an IPv6 address.

primaryNtpServer

Mandatory

Parameter list (ntpConfig)

String

Indicates the primary NTP server. This parameter is mandatory when ntpServerSource is set to 1.

secondaryNtpServer

Optional

Parameter list (ntpConfig)

String

Indicates the secondary NTP server. This parameter is optional when ntpServerSource is set to 1.

ldapConfig configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

ldapStatus

Mandatory

Parameter list (ldapConfig)

String

Indicates the LDAP status. The options are as follows:

  • true: enabled
  • false: disabled

domainControllerAddress

Mandatory

Parameter list (ldapConfig)

String

Indicates the domain controller address. This parameter is mandatory when ldapStatus is set to true.

userDomain

Mandatory

Parameter list (ldapConfig)

String

Indicates the user domain. This parameter is mandatory when ldapStatus is true. Enter a string of 1 to 255 characters. The string is in the format of CN=XXX,DC=XXX,DC=XXX, where XXX cannot contain spaces or any of the following special characters: # ' , " &. The value can contain one or more DC=XXX strings.

roleGroup

Mandatory

Parameter list (ldapConfig)

JSON<roleGroup>

Indicates the role group. This parameter is mandatory when ldapStatus is true.

NOTE:

You can create one to five role groups.

roleGroup configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

roleGroupIndex

Mandatory

Parameter list (roleGroup)

String

Indicates the role group index.

The value ranges from 1 to 5.

For example, the value 1 indicates role group 1.

groupName

Mandatory

Parameter list (roleGroup)

String

Indicates the group name.

groupDomain

Mandatory

Parameter list (roleGroup)

String

Indicates the group domain. Enter a string of 1 to 255 characters. The string is in the format of CN=XXX,OU=XXX,DC=XXX,DC=XXX, where XXX cannot contain spaces or any of the following special characters: # ' , " &. The value can contain one or more DC=XXX strings.

groupPrivilege

Mandatory

Parameter list (roleGroup)

String

Indicates the group privilege. The options are as follows:

  • 1: common user
  • 2: operator
  • 3: administrator

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

String

Indicates returned data. The value is null.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

Precautions

None

Example

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class CreateiBMCTemplate
{
    private static final String CREATE_TEMPLATE_URL = "/rest/openapi/server/deploy/template";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        CreateiBMCTemplateTest();
    }
    
    public static void CreateiBMCTemplateTest() throws Exception
    {
        String openidURL = CREATE_TEMPLATE_URL;
        String method = "POST";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        
        //example 1: creating an iBMC template without service configuration
        BasicNameValuePair[] parameters = 
            {
                new BasicNameValuePair("templateName", "iBMC_Template1"),
                new BasicNameValuePair("templateType", "IBMC"),
                new BasicNameValuePair("templateDesc", "This is an iBMC template."),
                new BasicNameValuePair("templateProp", "{            \r\n" + 
                        "  \"systemBootOption\": \"1\"      \r\n" + 
                        "}")
            };
        //example 2: creating an iBMC template with NTP configuration
        BasicNameValuePair[] parameters2 = 
            {
                new BasicNameValuePair("templateName", "iBMC_Template2"),
                new BasicNameValuePair("templateType", "IBMC"),
                new BasicNameValuePair("templateDesc", "This is an iBMC template."),
                new BasicNameValuePair("templateProp", "{       \r\n" + 
                        "  \"systemBootOption\": \"1\",       \r\n" + 
                        "  \"ntpConfig\":                 \r\n" + 
                        "  {                   \r\n" + 
                        "    \"ntpStatus\": \"true\",                      \r\n" + 
                        "    \"ntpServerSource\": \"1\",                       \r\n" + 
                        "    \"primaryNtpServer\": \"192.168.9.1\",                   \r\n" + 
                        "    \"secondaryNtpServer\": \"192.168.9.2\"            \r\n" + 
                        "  }   \r\n" + 
                        "}")
            };
        //example 3: creating an iBMC template with DNS configuration
        BasicNameValuePair[] parameters3 = 
            {
                new BasicNameValuePair("templateName", "iBMC_Template3"),
                new BasicNameValuePair("templateType", "IBMC"),
                new BasicNameValuePair("templateDesc", "This is an iBMC template."),
                new BasicNameValuePair("templateProp", "{ \r\n" + 
                        "    \"systemBootOption\": \"1\", \r\n" + 
                        "    \"dnsConfig\":              \r\n" + 
                        "         { \r\n" + 
                        "                \"dnsSource\": \"1\",    \r\n" + 
                        "                \"domainName\": \"aaa\", \r\n" + 
                        "                \"primaryDnsServer\": \"192.168.9.1\",  \r\n" + 
                        "                \"secondaryDnsServer\": \"192.168.9.2\" \r\n" + 
                        "         } \r\n" + 
                        "}")
            };
        //example 4: creating an iBMC template with LDAP configuration
        BasicNameValuePair[] parameters4 = 
            {
                new BasicNameValuePair("templateName", "iBMC_Template4"),
                new BasicNameValuePair("templateType", "IBMC"),
                new BasicNameValuePair("templateDesc", "This is an iBMC template."),
                new BasicNameValuePair("templateProp", "{ \r\n" + 
                        "    \"systemBootOption\": \"1\", \r\n" + 
                        "    \"ldapConfig\":  \r\n" + 
                        "         { \r\n" + 
                        "                \"ldapStatus\": \"true\", \r\n" + 
                        "                \"domainControllerAddress\": \"192.168.9.1\",            \r\n" + 
                        "                \"userDomain\": \"CN=111,DC=111,DC=111\", \r\n" + 
                        "                \"roleGroup\":  \r\n" + 
                        "                [      \r\n" + 
                        "                    { \r\n" + 
                        "                        \"roleGroupIndex\": \"1\",     \r\n" + 
                        "                        \"groupName\": \"aaa\",     \r\n" + 
                        "                        \"groupDomain\": \"CN=111,OU=111,DC=111,DC=111\",\r\n" + 
                        "                        \"groupPrivilege\": \"3\" \r\n" + 
                        "                    }, \r\n" + 
                        "                    {     \r\n" + 
                        "                        \"roleGroupIndex\": \"2\", \r\n" + 
                        "                        \"groupName\": \"aaa\", \r\n" + 
                        "                        \"groupDomain\": \"CN=111,OU=111,DC=111,DC=111\",\r\n" + 
                        "                        \"groupPrivilege\": \"3\" \r\n" + 
                        "                    } \r\n" + 
                        "                ] \r\n" + 
                        "         } \r\n" + 
                        "}")
            };
        
        //example 5: creating an iBMC template with NTP, DNS, and LDAP configurations
        BasicNameValuePair[] parameters5 = 
            {
                new BasicNameValuePair("templateName", "iBMC_Template5"),
                new BasicNameValuePair("templateType", "IBMC"),
                new BasicNameValuePair("templateDesc", "This is an iBMC template."),
                new BasicNameValuePair("templateProp", "{\r\n" + 
                        "    \"systemBootOption\": \"1\",\r\n" + 
                        "    \"ntpConfig\": {\r\n" + 
                        "        \"ntpStatus\": \"true\",\r\n" + 
                        "        \"ntpServerSource\": \"1\",\r\n" + 
                        "        \"primaryNtpServer\": \"192.168.9.1\",\r\n" + 
                        "        \"secondaryNtpServer\": \"192.168.9.2\"\r\n" + 
                        "    },\r\n" + 
                        "    \"dnsConfig\": {\r\n" + 
                        "        \"dnsSource\": \"1\",\r\n" + 
                        "        \"domainName\": \"aaa\",\r\n" + 
                        "        \"primaryDnsServer\": \"192.168.9.1\",\r\n" + 
                        "        \"secondaryDnsServer\": \"192.168.9.2\"\r\n" + 
                        "    },\r\n" + 
                        "    \"ldapConfig\": {\r\n" + 
                        "        \"ldapStatus\": \"true\",\r\n" + 
                        "        \"domainControllerAddress\": \"192.168.9.1\",\r\n" + 
                        "        \"userDomain\": \"CN=111,DC=111,DC=111\",\r\n" + 
                        "        \"roleGroup\": [\r\n" + 
                        "            {\r\n" + 
                        "                \"roleGroupIndex\": \"1\",\r\n" + 
                        "                \"groupName\": \"aaa\",\r\n" + 
                        "                \"groupDomain\": \"CN=111,OU=111,DC=111,DC=111\",\r\n" + 
                        "                \"groupPrivilege\": \"3\"\r\n" + 
                        "            },\r\n" + 
                        "            {\r\n" + 
                        "                \"roleGroupIndex\": \"2\",\r\n" + 
                        "                \"groupName\": \"aaa\",\r\n" + 
                        "                \"groupDomain\": \"CN=111,OU=111,DC=111,DC=111\",\r\n" + 
                        "                \"groupPrivilege\": \"3\"\r\n" + 
                        "            }\r\n" + 
                        "        ]\r\n" + 
                        "    }\r\n" + 
                        "}")
            };
        
        
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters5);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    
    }
    
}

Response example:

REST_SUCCESS   
{
    "code": 0,
    "data": null,
    "resverd": null,
    "description": "create template success."
}

Create a Power Control Template

Function

This interface is used to create a power control template.

URI

/rest/openapi/server/deploy/template

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

templateName

Mandatory

Parameter list

String

Indicates a template name. The value is a string of 6 to 32 characters, consisting of uppercase or lowercase letters, digits, hyphens (-), and underscores (_).

templateType

Mandatory

Parameter list

String

Indicates a template type. Enter POWER when creating a power control template. Template types include BIOS, RAID, HBA, CNA, POWER, NETWORK, OS, and IBMC.

templateDesc

Optional

Parameter list

String

Indicates the template description. The value can contain a maximum of 127 characters.

templateProp

Mandatory

Parameter list

JSON<template>

Indicates the template attributes for the power configuration.

template configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

powerPolicy

Optional

Parameter list (newTemplateProp)

String

Indicates a power policy. The options are as follows:

  • 0: power-on
  • 1: power-off
  • 2: restart

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

String

Indicates returned data. The value is null.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

Precautions

None

Example

Request example:

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class CreatePowerOnOffTemplate
{
    private static final String CREATE_TEMPLATE_URL = "/rest/openapi/server/deploy/template";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        CreatePowerOnOffTemplate();
    }
    
    public static void CreatePowerOnOffTemplate() throws Exception
    {
        String openidURL = CREATE_TEMPLATE_URL;
        String method = "POST";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        
        
        BasicNameValuePair[] parameters = 
            {
                new BasicNameValuePair("templateName", "POWER_Template1"),
                new BasicNameValuePair("templateType", "POWER"),
                new BasicNameValuePair("templateDesc", "This is a POWER template."),
                new BasicNameValuePair("templateProp", "{ \r\n" + 
                        "    \"powerPolicy\":\"1\"   \r\n" + 
                        "}")
            };
          
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    
    }
}

Response example:

REST_SUCCESS   
{
    "code": 0,
    "data": null,
    "resverd": null,
    "description": "create template success."
}

Create an OS Template

Function

This interface is used to create an operating system (OS) configuration template.

URI

/rest/openapi/server/deploy/template

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

templateName

Mandatory

Parameter list

String

Indicates a template name. The value is a string of 6 to 32 characters, consisting of uppercase or lowercase letters, digits, hyphens (-), and underscores (_).

templateType

Mandatory

Parameter list

String

Indicates a template type. Enter OS when creating an OS configuration template. Template types include BIOS, RAID, HBA, CNA, POWER, NETWORK, OS, and IBMC.

templateDesc

Optional

Parameter list

String

Indicates the template description. The value can contain a maximum of 127 characters.

templateProp

Mandatory

Parameter list

JSON<template>

Indicates template attributes. For details of operating system configuration attributes, see the following table and example.

template configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

osType

Mandatory

Parameter list (templateProp)

String

Indicates the OS type. The options are as follows:

  • 1: Windows Server
  • 2: SUSE Linux Enterprise Server (SLES)
  • 3: Red Hat Enterprise Linux (RHEL)
  • 4: CentOS
  • 6: VMware ESXi 5.5/6.0/6.5/6.7
  • 7: Ubuntu

softSourceName

Mandatory

Parameter list (templateProp)

String

Indicates the name of a software source. The value must contain 6 to 32 characters, consisting of only letters, digits, underscores (_), and hyphens (-).

admPassword

Mandatory

Parameter list (templateProp)

String

Indicates the administrator password. The value must contain 8 to 32 characters and contain at least two types of the following characters: uppercase letters, lowercase letters, digits, and special characters ` ~ ! @ ¥ % ...... & * ( ) - _ = + | [ { } ] ; : ' " , < . > / ? #

confirmPassword

Mandatory

Parameter list (templateProp)

String

Indicates the confirmation password. The confirmation password must be the same as the administrator password.

cdKey

Optional

Parameter list (templateProp)

String

Indicates the CD key. This parameter can be set only when osType is Windows Server or VMware ESXi 5.5/6.0/6.5/6.7.

osDeployPolicy

Mandatory

Parameter list (templateProp)

String

Indicates the OS deployment device. The options are as follows:

  • 0: USB device
  • 1: hard disk
  • 2: SAN Boot
NOTE:

When osType is VMware ESXi 5.5/6.0/6.5/6.7, the options 0 and 1 are available.

disk

Optional

Parameter list (templateProp)

JSON<disk>

Indicates the partitioning settings. This parameter is mandatory when osType is Windows Server, SUSE Linux, Red Hat, or CentOS.

software

Mandatory

Parameter list (templateProp)

String

Indicates the installation of the iBMA software, which is deployed together with the operating system. If the iBMA software needs to be deployed, the value is ibma. Otherwise, leave this parameter empty.

NOTE:

Supported operating system versions are as follows:

  • Windows Server 2008 R2 x64
  • Windows Server 2012 x64
  • Windows Server 2012 R2 x64
  • SUSE Linux Enterprise 12 SP1 x64
  • SUSE Linux Enterprise 12 SP2 x64
  • SUSE Linux Enterprise 12 SP3 x64
  • Red Hat Linux Enterprise 6.7 x64
  • Red Hat Linux Enterprise 6.8 x64
  • Red Hat Linux Enterprise 6.9 x64
  • Red Hat Linux Enterprise 7.2 x64
  • Red Hat Linux Enterprise 7.3 x64
  • Red Hat Linux Enterprise 7.4 x64
  • Red Hat Linux Enterprise 7.5 x64
  • CentOS Linux Enterprise 6.9 x64
  • CentOS Linux Enterprise 7.2 x64
  • CentOS Linux Enterprise 7.3 x64
  • CentOS Linux Enterprise 7.4 x64
  • CentOS Linux Enterprise 7.5 x64
  • Ubuntu Linux Enterprise 14.04 x64

disk configuration

Parameter

Mandatory/Optional

Location

Value Type

Description

serialNumber

Mandatory

Parameter list (disk)

String

Indicates a disk serial number.

NOTE:

At least one disk must be set with the serial number 1. The serial numbers of other disks are different. When osType is Windows Server, other disk serial numbers can range from 2 to 20. When osType is SUSE Linux, Red Hat, or CentOS, other disk serial numbers can range from 2 to 13.

paritions

Mandatory

Parameter list (disk)

JSON<paritions>

Indicates a partition.

NOTE:

For the disk whose serialNumber is 1, when osType is Windows Server, the disk must contain at least one partition; when osType is SUSE Linux, Red Hat, or CentOS, the disk must contain at least two partitions. For other disks, when osType is Windows Server, each disk can contain one to 19 partitions; when osType is SUSE Linux, Red Hat, or CentOS, each disk must contain at least one partition.

paritions configuration (osType: Windows Server)

Parameter

Mandatory/Optional

Location

Value Type

Description

serialNumber

Mandatory

Parameter list (paritions)

String

Indicates a partition serial number. The serial number ranges from 1 to 20.

fileSystem

Mandatory

Parameter list (paritions)

String

Indicates a file system type. The options are as follows:

  • 0: NTFS
  • 1: FAT32
NOTE:

For partition C, this parameter must be set to 0. For other partitions, this parameter can be 0 or 1.

driver

Mandatory

Parameter list (paritions)

String

Indicates a partition name. The value ranges from C to V.

NOTE:

The first disk must contain at least one partition, and the partition name must be C. If other parameters are added to the first disk, name them from D to V in sequence. For other disks, name their partitions from D to V and ensure that their partition names are different from those used by the first disk.

capacity

Mandatory

Parameter list (paritions)

String

Indicates the capacity.

NOTE:

The capacity of drive C ranges from 32 GB to 2000 GB, or 32,000 MB to 2,000,000 MB. For other partitions, when fileSystem is 1, the capacity ranges from 1 GB to 32 GB or 100 MB to 32,000 MB. When fileSystem is 0, the capacity ranges from 1 GB to 1000 GB or 100 MB to 999,999 MB.

isUseFreeCapacity

Mandatory

Parameter list (paritions)

String

Indicates whether to use the remaining capacity. The options are as follows:

  • true: Use the remaining capacity.
  • false: Do not use the remaining capacity.
NOTE:

Set this parameter to true only when the current partition is the last partition of a hard disk and fileSystem is 0. For other cases, set this parameter to false.

unit

Mandatory

Parameter list (paritions)

String

Indicates a capacity unit. The options are as follows:

  • 1: GB
  • 2: MB

paritions configuration (osType: SUSE Linux)

Parameter

Mandatory/Optional

Location

Value Type

Description

serialNumber

Mandatory

Parameter list (paritions)

String

Indicates the serial number of a mount point. The serial numbers of the two mandatory mount points must be 1 and 2, and the serial numbers of other mount points range from 3 to 14.

fileSystem

Mandatory

Parameter list (paritions)

String

Indicates a file system type. The options are as follows:

  • 0: swap
  • 1: reiser
  • 2: ext2
  • 3: ext3
  • 4: ext4
NOTE:

For the swap mount point, fileSystem can only be 0. For other mount points, fileSystem can be 1, 2, 3, or 4.

driver

Mandatory

Parameter list (paritions)

String

Indicates the name of a mount point. The options are swap, /, /home, /user, /opt, /boot, /media, /tmp, /var, and /srv.

NOTE:

The first disk must have at least two mount points (swap and \). For other mount points, select other mount point names or manually enter mount point names. Note that each mount point name must be unique. The mount point names of other disks cannot be duplicate with those used by the first disk. Except the swap and / mount points, the names of other mount points can be /home, /user, /opt, /boot, /media, /tmp, /var, /srv, or other customized names. A customized mount point name must start with a slash (/) and consists of no more than 255 characters, including digits, letters, and underscores (_). The mount point names are restricted by the operating system.

capacity

Mandatory

Parameter list (paritions)

String

Indicates the capacity.

NOTE:

The capacity of the / mount point ranges from 10,000 MB to 999,999 MB or 10 GB to 1000 GB. The capacity of any other mount point ranges from 100 MB to 999,999 MB or 1 GB to 1000 GB.

isUseFreeCapacity

Mandatory

Parameter list (paritions)

String

Indicates whether to use the remaining capacity. The options are as follows:

  • true: Use the remaining capacity.
  • false: Do not use the remaining capacity.
NOTE:

If the current mount point is the / mount point or the last mount point of a hard disk, select true. For other cases, select false. For the swap mount point, this parameter can only be false.

unit

Mandatory

Parameter list (paritions)

String

Indicates a capacity unit. The options are as follows:

  • 1: GB
  • 2: MB

paritions configuration (osType: CentOS or Red Hat)

Parameter

Mandatory/Optional

Location

Value Type

Description

serialNumber

Mandatory

Parameter list (paritions)

String

Indicates the serial number of a mount point. The serial numbers of the two mandatory mount points must be 1 and 2, and the serial numbers of other mount points range from 3 to 14.

fileSystem

Mandatory

Parameter list (paritions)

String

Indicates a file system type. The options are as follows:

  • 0: swap
  • 2: ext2
  • 3: ext3
  • 4: ext4
NOTE:

For the swap mount point, fileSystem can only be 0. For other mount points, fileSystem can be 2, 3, or 4.

driver

Mandatory

Parameter list (paritions)

String

Indicates the name of a mount point. The options are swap, /, /home, /user, /opt, /boot, /media, /tmp, /var, and /srv.

NOTE:

The first disk must have at least two mount points (swap and \). For other mount points, select other mount point names or manually enter mount point names. Note that each mount point name must be unique. The mount point names of other disks cannot be duplicate with those used by the first disk. Except the swap and / mount points, the names of other mount points can be /home, /user, /opt, /boot, /media, /tmp, /var, /srv, or other customized names. A customized mount point name must start with a slash (/) and consists of no more than 255 characters, including digits, letters, and underscores (_).

capacity

Mandatory

Parameter list (paritions)

String

Indicates the capacity.

NOTE:

The capacity of the / mount point ranges from 10,000 MB to 999,999 MB or 10 GB to 1000 GB. The capacity of any other mount point ranges from 100 MB to 999,999 MB or 1 GB to 1000 GB.

isUseFreeCapacity

Mandatory

Parameter list (paritions)

String

Indicates whether to use the remaining capacity. The options are as follows:

  • true: Use the remaining capacity.
  • false: Do not use the remaining capacity.
NOTE:

If the current mount point is the / mount point or the last mount point of a hard disk, select true. For other cases, select false. For the swap mount point, this parameter can only be false.

unit

Mandatory

Parameter list (paritions)

String

Indicates a capacity unit. The options are as follows:

  • 1: GB
  • 2: MB

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

String

Indicates returned data. The value is null.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

Precautions

None

Example

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class CreateOSTemplate
{
    private static final String CREATE_TEMPLATE_URL = "/rest/openapi/server/deploy/template";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        CreateOSTemplateTest();
    }
    
    public static void CreateOSTemplateTest() throws Exception
    {
        String openidURL = CREATE_TEMPLATE_URL;
        String method = "POST";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        
        //example 1: creating an OS template with the software source Windows
        BasicNameValuePair[] parameters = 
            {
                new BasicNameValuePair("templateName", "OS_Template1"),
                new BasicNameValuePair("templateType", "OS"),
                new BasicNameValuePair("templateDesc", "This is an OS template."),
                new BasicNameValuePair("templateProp", "{ \r\n" + 
                        "    \"osType\": \"1\", \r\n" + 
                        "    \"softSourceName\": \"OS_Software1\",\r\n" + 
                        "    \"admPassword\": \"Huawei@123\", \r\n" + 
                        "    \"confirmPassword\": \"Huawei@123\", \r\n" + 
                        "    \"cdKey\": \"\",   \r\n" + 
                        "    \"osDeployPolicy\": \"1\",   \r\n" +
                        "    \"software\": \"\",    \r\n" +                   
                        "    \"disk\": [                    {\r\n" + 
                        "            \"serialNumber\": 1,\r\n" + 
                        "            \"paritions\": [\r\n" + 
                        "                {\r\n" + 
                        "                    \"serialNumber\": 1,\r\n" + 
                        "                    \"fileSystem\": \"0\",\r\n" + 
                        "                    \"driver\": \"C:\",\r\n" + 
                        "                    \"capacity\": \"32\",\r\n" + 
                        "                    \"unit\": \"1\",\r\n" + 
                        "                    \"isUseFreeCapacity\": false\r\n" + 
                        "                },\r\n" + 
                        "                {\r\n" + 
                        "                    \"serialNumber\": 2,\r\n" + 
                        "                    \"fileSystem\": \"0\",\r\n" + 
                        "                    \"driver\": \"D:\",\r\n" + 
                        "                    \"capacity\": \"50\",\r\n" + 
                        "                    \"unit\": \"1\",\r\n" + 
                        "                    \"isUseFreeCapacity\": false\r\n" + 
                        "                }\r\n" + 
                        "            ]\r\n" + 
                        "        }\r\n" + 
                        "    ]  \r\n" + 
                        "}")
            };
        //example 2: creating an OS template with the software source SLES
        BasicNameValuePair[] parameters2 = 
            {
                new BasicNameValuePair("templateName", "OS_Template2"),
                new BasicNameValuePair("templateType", "OS"),
                new BasicNameValuePair("templateDesc", "This is an OS template."),
                new BasicNameValuePair("templateProp", "{ \r\n" + 
                        "       \"osType\":\"2\",  \r\n" + 
                        "       \"softSourceName\":\"suse11\", \r\n" +
                        "       \"software\": \"\",    \r\n" + 
                        "       \"admPassword\":\"Huawei@123\",\r\n" + 
                        "       \"confirmPassword\": \"Huawei@123\",\r\n" + 
                        "       \"osDeployPolicy\":\"1\",\r\n" + 
                        "       \"disk\":\r\n" + 
                        "        [\r\n" + 
                        "           {\r\n" + 
                        "             \"serialNumber\":1,\r\n" + 
                        "             \"paritions\":\r\n" + 
                        "              [\r\n" + 
                        "                 {\r\n" + 
                        "                   \"serialNumber\":1,\r\n" + 
                        "                   \"fileSystem\":\"0\",\r\n" + 
                        "                   \"driver\":\"swap\",   \r\n" + 
                        "                   \"capacity\":\"50\",\r\n" + 
                        "                   \"unit\":\"1\",\r\n" + 
                        "                   \"isUseFreeCapacity\":false\r\n" + 
                        "                 },\r\n" + 
                        "                 {\r\n" + 
                        "                   \"serialNumber\":2,\r\n" + 
                        "                   \"fileSystem\":\"3\",\r\n" + 
                        "                   \"driver\":\"/\", \r\n" + 
                        "                   \"capacity\":\"50\",\r\n" + 
                        "                   \"unit\":\"1\",\r\n" + 
                        "                   \"isUseFreeCapacity\":false\r\n" + 
                        "                 }\r\n" + 
                        "              ]\r\n" + 
                        "           }\r\n" + 
                        "       ]\r\n" + 
                        "}")
            };
        
        //example 3: creating an OS template with the software source VMware 6.0
        BasicNameValuePair[] parameters3 = 
            {
                new BasicNameValuePair("templateName", "OS_Template3"),
                new BasicNameValuePair("templateType", "OS"),
                new BasicNameValuePair("templateDesc", "This is an OS template."),
                new BasicNameValuePair("templateProp", "{ \r\n" + 
                        "       \"osType\":\"6\",  \r\n" +
                        "       \"software\": \"\",    \r\n" + 
                        "       \"softSourceName\":\"wmware\", \r\n" + 
                        "       \"admPassword\":\"Changeme_123\",\r\n" + 
                        "       \"confirmPassword\":\"Changeme_123\",\r\n" + 
                        "       \"osDeployPolicy\":1\r\n" + 
                        "}")
            };
        
        
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters3);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    
    }
}

Response example:

REST_SUCCESS   
{
    "code": 0,
    "data": null,
    "resverd": null,
    "description": "create template success."
}

Create a Configuration Task

Function

This interface is used to create a configuration task.

URI

/rest/openapi/server/deploy/task

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

templates

Mandatory

Parameter list

String

Indicates the list of templates to be configured. If multiple templates are configured, separate the template names with semicolons (;) and ensure that the templates are of different types. The options are as follows:

  • BIOS: BIOS template
  • RAID: RAID template
  • POWER: power template
  • HBA: HBA template
  • CNA: CNA template
  • NETWORK: network template
  • IBMC: iBMC template
  • OS: OS template

dn

Optional

Parameter list

String

Indicates a unique server identifier. This parameter is mandatory when the template list (templates) does not contain the batch BMC IP address configuration template for network configuration. Example:

"NE=xxx"

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

JSON<data>

Indicates the task name data.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

data description

Field

Value Type

Description

taskName

String

Indicates a task name automatically generated by the interface. It is the unique identifier of a task. The format is as follows: API@DeployTask_Current system time (ms)

Precautions

After a task is created, the system takes about 1 minute for preparation, and the task status is idle during the preparation. When the preparation is complete, the system starts the task and updates the task status to running. A maximum of 10 tasks can run in the system at the same time. Excessive tasks will be placed in the waiting queue based on their creation time.

Example

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class CreateDeployTask
{
    private static final String CREATE_DEPLOY_TASK_URL = "/rest/openapi/server/deploy/task";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        CreateDeployTaskTest();
    }
    public static void CreateDeployTaskTest() throws Exception
    {
        String openidURL = CREATE_DEPLOY_TASK_URL;
        String method = "POST";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        //example 1: creating a BIOS configuration template
        BasicNameValuePair[] parameters = 
            {
                new BasicNameValuePair("templates", "BIOS_Template1"),
                new BasicNameValuePair("dn", "NE=34603615")
            };

        //example 2: creating an OS template and a power control configuration task
        BasicNameValuePair[] parameters2 = 
            {
                new BasicNameValuePair("templates", "OS_Template1;POWER_Template1"),
                new BasicNameValuePair("dn", "NE=34603615;NE=34603117")
            };       
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters2);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    }
}

Response example:

REST_SUCCESS   
{
    "code": 0,
    "data": {
        "taskName": "API@DeployTask_1506381462137"
    },
    "resverd": null,
    "description": "create task success."
}

Query the Configuration Template List Information

Function

This interface is used to query the configuration template list information.

URI

/rest/openapi/server/deploy/template/list

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

pageNo

Optional

Parameter list

int

Indicates the page number. The default value is 1.

pageSize

Optional

Parameter list

int

Indicates the number of records on a page. The default value is 20.

templateType

Optional

Parameter list

String

Indicates the template type.

This parameter is left blank by default.

The options are as follows:

  • If this parameter is left blank, it indicates all templates.
  • BIOS: BIOS template
  • RAID: RAID template
  • POWER: power template
  • HBA: HBA template
  • CNA: CNA template
  • NETWORK: network template
  • IBMC: iBMC template
  • OS: OS template

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

totalNum

int

Indicates the total number of templates.

data

JSON<data>

Indicates the template list data.

description

String

Indicates the description of the interface invoking result.

data description

Field

Value Type

Description

templateName

String

Indicates the template name.

templateType

String

Indicates the template type.

templateDesc

String

Indicates the template description.

Precautions

None

Example

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class QueryTemplateList
{
    private static final String QUERY_TEMPLATE_LIST_URL = "/rest/openapi/server/deploy/template/list";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        QueryTemplateListTest();
    }
    
    public static void QueryTemplateListTest() throws Exception
    {
        String openidURL = QUERY_TEMPLATE_LIST_URL;
        String method = "GET";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        

        //example 1: Query the BIOS template.
        BasicNameValuePair[] parameters = 
            {
                new BasicNameValuePair("pageNo", "1"),
                new BasicNameValuePair("pageSize", "20"),
                new BasicNameValuePair("templateType", "BIOS")
            };

        //example 2: Query the BIOS template.
        BasicNameValuePair[] parameters2 = 
            {
                new BasicNameValuePair("pageNo", "1"),
                new BasicNameValuePair("pageSize", "20"),
                new BasicNameValuePair("templateType", "OS")
            };       
        
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters2);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    
    }
}

Response example 1: Querying the BIOS template

REST_SUCCESS   
{
     "code":0,
     "totalNum":3,
     "description":"Operation success." 
     "data": 
     [ 
      {
         "templateName":"BIOS_Template1",
         "templateType":"BIOS",
         "templateDesc":"This is BIOS template1."
       },
       { 
         "templateName":"BIOS_Template2", 
         "templateType":"BIOS", 
         "templateDesc":"This is BIOS template2." 
       }, 
       { 
         "templateName":"BIOS_Template3",
         "templateType":"BIOS",
         "templateDesc":"This is BIOS template3." 
        } 
     ] 
}

Response example 2: Querying the OS template

REST_SUCCESS   
{
     "code":0,
     "totalNum":3,
     "description": "Operation success.",
     "data": 
     [ 
      {
         "templateName":"OS_Template1",
         "templateType":"OS",
         "templateDesc":"This is OS template1."
       },
       { 
         "templateName":"OS_Template2", 
         "templateType":"OS", 
         "templateDesc":"This is OS template2." 
       }, 
       { 
         "templateName":"OS_Template3",
         "templateType":"OS",
         "templateDesc":"This is OS template3." 
        } 
     ] 
}

Query the Configuration Template Details

Function

This interface is used to query the configuration template details.

URI

/rest/openapi/server/deploy/template/detail

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

templateName

Mandatory

Parameter list

String

Indicates the name of the template whose details are to be queried.

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

JSON<data>

Indicates the template detailed data.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

data configuration

Field

Value Type

Description

templateName

String

Indicates the template name.

templateType

String

Indicates the template type.

templateDesc

String

Indicates the template description.

templateProp

JSON<templateProp>

Indicates the template attribute. Different templates have different attributes. Template attributes must be consistent with the parameters in the template creation requests.

Precautions

None

Example

Request example:

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class QueryTemplateDetail
{
    private static final String QUERY_TEMPLATE_DETAIL_URL = "/rest/openapi/server/deploy/template/detail";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        QueryTemplateDetailTest();
    }
    
    public static void QueryTemplateDetailTest() throws Exception
    {
        String openidURL = QUERY_TEMPLATE_DETAIL_URL;
        String method = "GET";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        
        
        BasicNameValuePair[] parameters = 
            {
                new BasicNameValuePair("templateName", "POWER_Template1")

            };
 
        
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    
    }
}

Response example:

REST_SUCCESS  
{
    "code": 0,
    "data": {
        "templateName": "POWER_Template1",
        "templateType": "POWER",
        "templateDesc": "as",
        "templateProp": {
            "powerPolicy": 1
        }
    },
    "resverd": null,
    "description": "Operation success."
}

Query the Details of a Configuration Task

Function

This interface is used to query the details of a configuration task.

URI

/rest/openapi/server/deploy/task/detail

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

taskName

Mandatory

Parameter list

String

Indicates the name of the task whose details are to be queried.

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

JSON<data>

Indicates the task detailed data.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

data description

Field

Value Type

Description

taskName

String

Indicates a task name automatically generated by the interface. The task name is the unique identifier of a task.

templates

String

Indicates the templates added in the task. Separate template names with semicolons (;). This parameter is only available for template tasks.

taskStatus

String

Indicates the task status. The options are as follows:

  • Idle: The task has not been started.
  • Running: The task is in progress.
  • Complete: The task is finished.

taskCode

int

Indicates the task execution result. The options are as follows:

  • 0: successful
  • -2: The task is partially successful.
  • Others: The task failed.

taskResult

String

Indicates the task execution result. If taskStatus is Idle or Running, this field is left blank. If taskStatus is Complete, the options are as follows:

  • Success
  • Failed
  • Partion Success: partial success

deviceDetails

JSON<deviceDetails>

Indicates the task execution result of a device, including dn, sn, deviceName, deployStatus, deployResult, deployResultDetail, and deployedDeviceProgress. For details, see deviceList description.

taskType

String

Indicates the task type. The options are as follows:

  • 1: template task
  • 2: batch replication task

sourceDetails

JSON< sourceDetails >

Indicates the replication source information of a batch replication task, including copyType and replicateOrigin. This parameter is available only for batch replication tasks. For details, see the sourceDetails data description table.

deviceDetails description:

Field

Value Type

Description

dn

String

Indicates the unique server identifier, for example, NE=xxx. The DNs of multiple devices are separated by semicolons (;).

deviceProgress

int

Indicates the task execution progress. The value ranges from 0 to 100.

deviceResult

String

Indicates the OS configuration deployment task execution result of a device. If the task status is Running, this field is left blank. If the task status is Complete, the options are as follows:

  • Success
  • Failed

errorDetail

String

Indicates the task execution result. If the task status is Idle or Running, this parameter is left blank. If the task status is Complete, the value is Deployment succeeded when the task is successful, and the value is the failure cause when the task failed.

errorCode

String

Indicates the task execution result. If the task status is Idle or Running, this parameter is left blank. If the task status is Complete, the value is 0 when the task is successful, and the value is an error code corresponding to errorDetail when the task failed.

sourceDetails description

Field

Value Type

Description

copyType

String

Indicates the replication type. If multiple types exist, separate them with commas (,). This parameter is available only for batch replication tasks.

replicateOrigin

String

Indicates the replication source. The value indicates the dn value of the source device. It is a unique identifier of a server, for example, NE=xxx.

Precautions

None

Example

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class QueryDeployTaskDetail
{
    private static final String QUERY_DEPLOY_TASK_DETAIL_URL = "/rest/openapi/server/deploy/task/detail";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        QueryDeployTaskDetailTest();
    }
    
    public static void QueryDeployTaskDetailTest() throws Exception
    {
        String openidURL = QUERY_DEPLOY_TASK_DETAIL_URL;
        String method = "GET";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        
        
        BasicNameValuePair[] parameters = 
            {
                new BasicNameValuePair("taskName", "API@DeployTask_15063048339559")

            };
 
        
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    
    }
}

Response example 1: Query the power control template deployment task and the task is successful.

REST_SUCCESS   
{
    "code": 0,
    "data": {
        "taskName": "API@DeployTask_15063048339559",
        "templates": "shangxiadian",
        "taskType": "1",
        "deviceDetails": [
            {
                "dn": "NE=34603049",
                "deviceProgress": 100,
                "deviceResult": "Success",
                "errorDetail": "Deployment succeeded.",
                "errorCode": 0
            }
        ],
        "taskStatus": "Complete",
        "taskResult": "Success",
        "taskCode": 0
    },
    "resverd": null,
    "description": "get task detail success."
}

Response example 2: Query the OS template deployment task and the task is successful.

REST_SUCCESS    
{      
    "code":0,      
    "data":      
    {        
       "taskName":"API@DeployTask_15063048339559",        
       "templates":"OS_Template", 
       "taskType": "1",
       "deviceDetails": [ 
            { 
                "dn": "NE=34603310", 
                "deviceProgress": 100, 
                "deviceResult": "Success", 
                "errorDetail": "Deployment succeeded.", 
                "errorCode": 0 
            } 
        ], 
        "taskStatus": "Complete", 
        "taskResult": "Success", 
        "taskCode": 0   
    }, 
    "resverd": null,      
    "description":"Get task detail success."    
}

Response example 3: Query the OS template deployment task and the task failed.

REST_SUCCESS    
{ 
    "code": 0, 
    "data": { 
        "taskName": "API@DeployTask_15063048339559", 
        "templates": "OS_Template1", 
        "taskType": "1",
        "deviceDetails": [ 
            { 
                "dn": "NE=34603113", 
                "deviceProgress": 100, 
                "deviceResult": "Failed", 
                "errorDetail": "eSight terminated unexpectedly.", 
                "errorCode": 148401 
            } 
        ], 
        "taskStatus": "Complete", 
        "taskResult": "Failed", 
        "taskCode": -1 
    }, 
    "resverd": null, 
    "description": "get task detail success." 
}

Delete a Configuration Template

Function

This interface is used to delete a configuration template.

URI

/rest/openapi/server/deploy/template/del

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

templateName

Mandatory

Parameter list

String

Indicates the name of the template to be deleted.

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

String

Indicates returned data. The value is null.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

Precautions

None

Example

Request example:

package com.huawei.nms.openapi.demo.server.config;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

public class DeleteTemplate
{
    private static final String DELETE_TEMPLATE_URL = "/rest/openapi/server/deploy/template/del";
    public static void main(String[] args) throws Exception
    {
        // TODO Auto-generated method stub
        Login.login();
        DeleteTemplateTest();
    }
    
    public static void DeleteTemplateTest() throws Exception
    {
        String openidURL = DELETE_TEMPLATE_URL;
        String method = "POST";
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        
        
        BasicNameValuePair[] parameters = 
            {
                new BasicNameValuePair("templateName", "Power_Template1")

            };
 
        
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    
    }
}

Response example:

REST_SUCCESS   
{
    "code": 0,
    "data": null,
    "resverd": null,
    "description": "delete template successed."
}

Delete a Configuration Task

Function

This interface is used to delete a configuration task.

URI

/rest/openapi/server/deploy/task/del

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the eSight login interface of the security management module to obtain the value of this parameter.

taskName

Mandatory

Parameter list

String

Indicates the name of the task to be deleted.

Result

Field

Value Type

Description

code

long

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed (For details, see the interface return code list.)

data

String

Indicates returned data. The value is null.

resverd

String

Indicates a reserved field. The value is null.

description

String

Indicates the description of the interface invoking result.

Precautions