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).
Alarm Management Interfaces

Alarm Management Interfaces

This topic describes the fault management (FM) interfaces.

The process of alarm development through open APIs is as follows:
  1. Define alarms: Alarm definitions include:
    • Maintaining the relationship between alarm groups and NE types.
    • Archiving the alarm static information.
  2. Report alarms: Report defined alarms to the eSight.
  3. Display alarms: Users can set search criteria to query information about current alarms on the alarm display page.
  4. Acknowledge or clear alarms: Users can acknowledge or clear alarms on the alarm display page.

Add or Modify an Alarm Group

Function

This interface is used to add or modify the alarm groups with specified IDs.

Modifying alarm groups does not delete the original NE types, but add NE types. To delete existing NE types, you must delete the alarm group, and then an alarm group that contains desired NE types.

URI

/rest/openapi/AlarmGroup/{groupId}

  • This interface applies only to third-party alarms and is not applicable to other alarm group IDs.
  • Third-party alarm groups IDs must be within the range of 0x1098C5F1–0x1098ED00.
  • In the URL, groupId is the third-party alarm group id, which is the unique identifier of alarm grouping. For example, /rest/openapi/AlarmGroup/278457600 indicates that the alarm group with groupId being 278457600 is added or modified.

Access Method

PUT

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Value Range

openid

Mandatory

Request message header

String

Indicates the session identifier. It is used for open API authentication.

NOTE:

A third-party invokes the login interface (section Log In to the eSight) for security management to obtain this parameter.

moType

Mandatory

Parameter list

String

Indicates the NE type.

NOTE:

Separate NE types with a comma (,), for example, moType1,moType2,moType3.

Result

Field

Value Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • others: failed. Code 1001 indicates that the license is invalid; code 1002 indicates that the license does not support the open API function; code 1204 indicates that authentication fails.

data

list

Here is null.

description

String

Indicates the description of the returned result.

Precautions

None

Example

When you run this demo to add or modify an alarm group, the database data may be affected. Change the parameter values as required.

package com.huawei.nms.openapi.demo.fm;

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;


/**
 * Add or Modify an Alarm Group
 */
public class AddAlarmGroup {
 private static final String FM_ALARM_GROUP = "/rest/openapi/AlarmGroup";

 public static void main(String[] args) throws Exception {
  Login.login();
  alarmGroup_add_update_one_correct_moType_Test();
 }

 public static void alarmGroup_add_update_one_correct_moType_Test() throws Exception {
  //set the group ID
  int iGroupId = 278457600;
  //set the URL and method
  String openidURL = FM_ALARM_GROUP + "/" + iGroupId;
  String method = "PUT";
  
  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //set parameters
  BasicNameValuePair[] parameters =
        {
                new BasicNameValuePair("moType", "moType11")
        };
  
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }
}

The returned result is as follows:

{
    "code": 0, 
    "data": null, 
    "description": "Operation success."
}

Delete an Alarm Group

Function

This interface is used to delete alarm groups with specified IDs.

URI

/rest/openapi/AlarmGroup/{groupId}

  • This interface applies only to third-party alarms and is not applicable to other alarm group IDs.
  • Third-party alarm groups IDs must be within the range of 0x1098C5F1–0x1098ED00.
  • In the URL, groupId is the alarm group id. For example, /rest/openapi/AlarmGroup/278457600 indicates that the alarm group with groupId being 278457600 is deleted.

Access Method

DELETE

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Value Range

openid

Mandatory

Request message header

String

Indicates the session identifier. It is used for open API authentication.

NOTE:

A third-party invokes the login interface (section Log In to the eSight) for security management to obtain this parameter.

Result

Field

Value Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • others: failed. Code 1001 indicates that the license is invalid; code 1002 indicates that the license does not support the open API function; code 1204 indicates that authentication fails.

data

String

Indicates the description of the data.

description

String

Indicates the description of the returned result.

Precautions

None

Example

When you run this demo to delete an alarm group, the database data may be affected. Change the parameter values as required.

package com.huawei.nms.openapi.demo.fm;


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;

/**
 * Delete an Alarm Group
 */
public class DeleteAlarmGroup {
 private static final String FM_ALARM_GROUP = "/rest/openapi/AlarmGroup";

 public static void main(String[] args) throws Exception {
  Login.login();
  alarmGroup_delete_one_Test();
 }

 public static void alarmGroup_delete_one_Test() throws Exception {
  //set the group ID
  int iGroupId = 278457600;
  //set the URL and method
  String openidURL = FM_ALARM_GROUP + "/" + iGroupId;
  String method = "DELETE";
  
  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //set parameters
  BasicNameValuePair[] parameters = null;
   
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }
}

The returned result is as follows:

{
    "code": 0, 
    "data": "1 record deleted.", 
    "description": "put done."
}

Query Static Information on Alarms with Specified GroupIDs

Query Static Information on Alarms with Specified GroupIDs

Function

This interface is used to query information on alarms with specified IDs.

URI

/rest/openapi/alarmtaticInfo/{groupId}

  • This interface applies only to third-party alarms and is not applicable to other alarm group IDs.
  • Third-party alarm groups IDs must be within the range of 0x1098C5F1–0x1098ED00.
  • In the URL, groupId is the alarm group id, which is the unique identifier of alarm grouping. For example, /rest/openapi/alarmtaticInfo/278457600 indicates that static information about the alarm with groupId being 278457600 is queried.

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Value Range

openid

Mandatory

Request message header

String

Indicates the session identifier. It is used for open API authentication.

NOTE:

A third-party invokes the login interface (section Log In to the eSight) for security management to obtain this parameter.

alarmId

Optional

Parameter list

int

Indicates the alarm ID. Ensure that IDs are unique in the same alarm group for alarms generated from devices of integration suppliers and agents.

Result

Field

Value Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • others: failed. Code 1001 indicates that the license is invalid; code 1002 indicates that the license does not support the open API function; code 1204 indicates that authentication fails.

data

InternalRtnAlarmStaticInfo

Indicates the alarm static information.

description

String

Indicates the description of the returned result.

The object InternalRtnAlarmStaticInfo contains the following information.

Field

Value Type

Description

groupId

int

Indicates the alarm group ID.

alarmId

int

Indicates the alarm ID.

eventType

String

Indicates the alarm type. The options are as follows:

  • COMMUNICATIONS_ALARM: communications alarm
  • EQUIPMENT_ALARM: equipment alarm
  • PROCESSING_ERROR_ALARM: processing error alarm
  • QUALITY_OF_SERVICE_ALARM: quality of service alarm
  • ENVIRONMENTAL_ALARM: environmental alarm
  • INTEGRITY_VIOLATION: integrity violation
  • OPERATIONAL_VIOLATION: operational violation
  • PHYSICAL_VIOLATION: physical violation
  • SECURITY_VIOLATION: security violation
  • TIME_DOMAIN_VIOLATION: time domain violation

perceivedSeverity

String

Indicates the alarm severity. The options are as follows:

  • INDETERMINATE: indeterminate
  • CRITICAL: critical
  • MAJOR: major
  • MINOR: minor
  • WARNING: suggestion

clearedType

String

Indicates the alarm clearance type. The options are as follows:

  • ADAC: ADAC (automatically detected and automatically cleared)
  • ADMC: ADMC (automatically detected and manually cleared)

alarmName

String

Indicates the alarm name.

probableCause

int

Indicates the probable cause of an alarm.

objectInstance

String

Indicates the alarm location information.

proposedRepairActions

String

Indicates the suggestion for rectifying the fault mapping the alarm.

Precautions

None

Example

package com.huawei.nms.openapi.demo.fm;

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;


/**
 * Query Static Information on Alarms with Specified GroupIDs
 */

public class QueryAlarmStaticInfoById {
 private static final String FM_ALARM_STATIC = "/rest/openapi/alarmtaticInfo";

 public static void main(String[] args) throws Exception {
  Login.login();
  getAlarmStaticInfoByIdTest();
 }

 public static void getAlarmStaticInfoByIdTest() throws Exception {
  //set the group ID
  int iGroupId = 278457600;
  //set the URL and method
  String openidURL = FM_ALARM_STATIC + "/" + iGroupId;
  String method = "GET";
  
  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //set parameters
  BasicNameValuePair[] parameters =
        {
                new BasicNameValuePair("alarmId", "1333300018"),
                new BasicNameValuePair("alarmName", ""), 
                new BasicNameValuePair("severity", ""), 
                new BasicNameValuePair("pageSize", ""), 
                new BasicNameValuePair("pageNo", "")
        };
  
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }

}

The returned result is as follows:

{
    "code": 0, 
    "data": [
        {
            "groupId": 10000, 
            "alarmId": 80001, 
            "eventType": "COMMUNICATIONS_ALARM", 
            "severity": "CRITICAL", 
            "clearedType": "ADAC",
            "alarmName": "Auto backup failed", 
            "probableCause": 50011, 
            "objectInstance": null, 
            "proposedRepairActions": null

        }
    ], 
    "description": "Operation success."
}

Query Alarm Static Information based on Parameter Settings

Function

The interface is used to query alarm static information based on parameter settings.

URI

/rest/openapi/alarmtaticInfo

  • This interface applies only to third-party alarms and is not applicable to other alarm group IDs.
  • Third-party alarm groups IDs must be within the range of 0x1098C5F1–0x1098ED00.

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Value Range

openid

Mandatory

Request message header

String

Indicates the session identifier. It is used for open API authentication.

NOTE:

A third-party invokes the login interface (section Log In to the eSight) for security management to obtain this parameter.

groupId

Mandatory

Parameter list

int

Indicates the alarm group ID, which is the unique identifier of alarm grouping.

NOTE:

Third-party alarm groups IDs must be within the range of 0x1098C5F1–0x1098ED00.

alarmId

Optional

Parameter list

String

Indicates the alarm ID. Ensure that IDs are unique in the same alarm group for alarms generated from devices of integration suppliers and agents.

NOTE:

The alarm group ID and alarm ID function as a primary key. If a parameter contains the alarmId, only the static information on the corresponding alarm is queried.

alarmName

Optional

Parameter list

String

Indicates the alarm name. It supports fuzzy match of character strings.

severity

Optional

Parameter list

String

Indicates the alarm severity. The options are:

  • 0: indeterminate
  • 1: critical
  • 2: major
  • 3: minor
  • 4: suggestion
NOTE:

Separate alarm severities with a comma (,), for example, 1,2,3.

pageSize

Optional

Parameter list

int

Indicates the number of records on each page. The number ranges from 10 to 100 and the default value is 20.

pageNo

Optional

Parameter list

int

Indicates the page number for the page-based query. The number starts from 1 and the default value is 1.

NOTE:

If pageNo is equal to 0 or less than 0, the default value is used.

rosInternalFrameworkUrlPathParam

Optional

Parameter list

String

Indicates that users can query alarm static information based on preset criteria.
  • If this parameter is empty, the RosReturnPages structure is returned when multiple alarm static information records are queried based on preset criteria.
  • If this parameter is not empty, the static information about an alarm is queried based on the preset criteria (alarmId is mandatory) and the RosReturn structure is returned.

isAllGroup

Optional

Parameter list

Boolean

Indicates whether to verify the third-party alarm group range 0x1098C5F1-0x1098ED00. The options are as follows:
  • true: No verification is performed.
  • false: Perform the verification.

The default value is false.

Result

Field

Value Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • others: failed. Code 1001 indicates that the license is invalid; code 1002 indicates that the license does not support the open API function; code 1204 indicates that authentication fails.

data

List<InternalRtnAlarmStaticInfo>

Indicates the alarm static information.

description

String

Indicates the description of the returned result.

pageSize

int

Indicates the number of records of the current page.

totalPage

int

Indicates the total pages of records that meet search criteria.

currentPage

int

Indicate the current page, which starts from 1.

The object InternalRtnAlarmStaticInfo contains the following information.

Field

Value Type

Description

groupId

int

Indicates the alarm group ID.

alarmId

int

Indicates the alarm ID.

eventType

String

Indicates the alarm type. The options are as follows:

  • COMMUNICATIONS_ALARM: communications alarm
  • EQUIPMENT_ALARM: equipment alarm
  • PROCESSING_ERROR_ALARM: processing error alarm
  • QUALITY_OF_SERVICE_ALARM: quality of service alarm
  • ENVIRONMENTAL_ALARM: environmental alarm
  • INTEGRITY_VIOLATION: integrity violation
  • OPERATIONAL_VIOLATION: operational violation
  • PHYSICAL_VIOLATION: physical violation
  • SECURITY_VIOLATION: security violation
  • TIME_DOMAIN_VIOLATION: time domain violation

perceivedSeverity

String

Indicates the alarm severity. The options are as follows:

  • INDETERMINATE: indeterminate
  • CRITICAL: critical
  • MAJOR: major
  • MINOR: minor
  • WARNING: suggestion

clearedType

String

Indicates the alarm clearance type. The options are as follows:

  • ADAC: ADAC (automatically detected and automatically cleared)
  • ADMC: ADMC (automatically detected and manually cleared)

alarmName

String

Indicates the alarm name.

probableCause

int

Indicates the probable cause of an alarm.

objectInstance

String

Indicates the alarm location information.

proposedRepairActions

String

Indicates the suggestion for rectifying the fault mapping the alarm.

Precautions

None

Example

package com.huawei.nms.openapi.demo.fm;

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;

/**
 * Query Alarm Static Information based on Parameter Settings
 */
public class QueryAlarmStaticInfo {
 private static final String FM_ALARM_STATIC = "/rest/openapi/alarmtaticInfo";

 public static void main(String[] args) throws Exception {
  Login.login();
  getAlarmStaticInfoTest();
 }

 public static void getAlarmStaticInfoTest() throws Exception {
  //set the URL and method
  String openidURL = FM_ALARM_STATIC;
  String method = "GET";
  
  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //set parameters
  BasicNameValuePair[] parameters =
        {
                new BasicNameValuePair("groupId", "278457600"), 
                new BasicNameValuePair("alarmId", ""),
                new BasicNameValuePair("pageSize", ""), 
                new BasicNameValuePair("pageNo", "")
        };
  
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }
}

The returned result is as follows:

{
    "code": 0, 
    "data": [
        {
            "groupId": 10000, 
            "alarmId": 80001, 
            "eventType": "COMMUNICATIONS_ALARM", 
            "severity": "CRITICAL", 
            "clearedType": "ADAC",
            "alarmName": "Auto backup failed", 
            "probableCause": 50011, 
            "objectInstance": null, 
            "proposedRepairActions": null

        }
    ], 
    "description": "Operation success.", 
    "pageSize": 20, 
    "totalPage": 1, 
    "currentPage": 1
}

Add or Update Static Information on Alarms with Specified GroupID

Function

This interface is used to add or update information on alarms with specified IDs.

URI

/rest/openapi/alarmtaticInfo/{groupId}

  • This interface applies only to third-party alarms and is not applicable to other alarm group IDs.
  • Third-party alarm groups IDs must be within the range of 0x1098C5F1–0x1098ED00.
  • In the URL, groupId is the third-party alarm group id, which is the unique identifier of alarm grouping. For example, /rest/openapi/alarmtaticInfo/278457600 indicates that static information about the alarm with groupId being 278457600 is added or updated.

Access Method

PUT

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Value Range

openid

Mandatory

Request message header

String

Indicates the session identifier. It is used for open API authentication.

NOTE:

A third-party invokes the login interface (section Log In to the eSight) for security management to obtain this parameter.

alarmId

Mandatory

Parameter list

int

Indicates the alarm ID. Ensure that IDs are unique in the same alarm group for alarms generated from devices of integration suppliers and agents.

eventType

Mandatory

Parameter list

int

Indicates the alarm type. The options are as follows:

  • 1: communications alarm
  • 2: equipment alarm
  • 3: processing error alarm
  • 4: quality of service alarm
  • 5: environmental alarm
  • 6: integrity violation
  • 7: operational violation
  • 8: physical violation
  • 9: security violation
  • 10: time domain violation

severity

Mandatory

Parameter list

int

Indicates the alarm severity. The options are as follows:

  • 1: critical
  • 2: major
  • 3: minor
  • 4: suggestion

alarmName

Mandatory

Parameter list

String

Indicates the alarm name.

clearedType

Mandatory

Parameter list

int

Indicates the alarm clearance type. The options are as follows:

  • 1: ADAC (automatically detected and automatically cleared)
  • 2: ADMC (automatically detected and manually cleared)

objectInstance

Optional

Parameter list

String

Indicates the alarm location information.

NOTE:

This parameter is required only when the alarm static information mapping a specified ID is modified.

proposedRepairActions

Optional

Parameter list

String

Indicates the suggestion for rectifying the fault mapping the alarm.

probableCause

Mandatory

Parameter list

int

Indicates the probable cause of an alarm.

NOTE:

The value must be greater than or equal to 60000.

Result

Field

Value Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • others: failed. Code 1001 indicates that the license is invalid; code 1002 indicates that the license does not support the open API function; code 1204 indicates that authentication fails.

data

String

Indicates the description of the data.

description

String

Indicates the description of the returned result.

Precautions

None

Example

When you run this demo to add or modify static alarm information about a specified alarm group ID, the database data may be affected. Change the parameter values as required.

package com.huawei.nms.openapi.demo.fm;

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;


/**
 * Add or Update Static Information on Alarms with Specified GroupID
 */

public class AddAlarmStaticInfoById {
 private static final String FM_ALARM_STATIC = "/rest/openapi/alarmtaticInfo";

 public static void main(String[] args) throws Exception {
  Login.login();
  getAlarmStaticInfoByIdTest();
 }

 public static void getAlarmStaticInfoByIdTest() throws Exception {
  //set the group ID
  int iGroupId = 278457600;
  //set the URL and method
  String openidURL = FM_ALARM_STATIC + "/" + iGroupId;
  String method = "PUT";
  
  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //set parameters
  BasicNameValuePair[] parameters =
        {
                new BasicNameValuePair("alarmId", "1333300018"),
                new BasicNameValuePair("eventType", "1"), 
                new BasicNameValuePair("severity", "1"), 
                new BasicNameValuePair("alarmName", "alarm name 1"), 
                new BasicNameValuePair("clearedType", "2"),
                new BasicNameValuePair("objectInstance", "objectInstance1"), 
                new BasicNameValuePair("proposedRepairActions", "proposedRepairActions1"), 
                new BasicNameValuePair("probableCause", "60000") 
        };
  
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }
}

The returned result is as follows:

{
    "code": 0, 
    "data": "add 1333300018 static info.", 
    "description": "Operation success."
}

Delete Static Information on Alarms with Specified GroupID

Function

This interface is used to delete information on alarms with specified IDs.

URI

/rest/openapi/alarmtaticInfo/{groupId}

  • This interface applies only to third-party alarms and is not applicable to other alarm group IDs.
  • Third-party alarm groups IDs must be within the range of 0x1098C5F1–0x1098ED00.
  • In the URL, groupId is the alarm group id, which is the unique identifier of alarm grouping. For example, /rest/openapi/alarmtaticInfo/278457600 indicates that static information about the alarm with groupId being 278457600 is deleted.

Access Method

DELETE

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Value Range

openid

Mandatory

Request message header

String

Indicates the session identifier. It is used for open API authentication.

NOTE:

A third-party invokes the login interface (section Log In to the eSight) for security management to obtain this parameter.

alarmId

Optional

Parameter list

int

Indicates the alarm ID. Ensure that IDs are unique in the same alarm group for alarms generated from devices of integration suppliers and agents.

Result

Field

Value Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • others: failed. Code 1001 indicates that the license is invalid; code 1002 indicates that the license does not support the open API function; code 1204 indicates that authentication fails.

data

list

Here is null.

description

String

Indicates the description of the returned result.

Precautions

None

Example

When you run this demo to delete static alarm information about a specified alarm group ID, the database data may be affected. Change the parameter values as required.

package com.huawei.nms.openapi.demo.fm;

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;


/**
 * Delete Static Information on Alarms with Specified GroupID
 */

public class DeleteAlarmStaticInfoById {
 private static final String FM_ALARM_STATIC = "/rest/openapi/alarmtaticInfo";

 public static void main(String[] args) throws Exception {
  Login.login();
  deleteAlarmStaticInfoByIdTest();
 }

 public static void deleteAlarmStaticInfoByIdTest() throws Exception {
  //set the group ID
  int iGroupId = 278457600;
  //set the URL and method
  String openidURL = FM_ALARM_STATIC + "/" + iGroupId;
  String method = "DELETE";
  
  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //set parameters
  BasicNameValuePair[] parameters = null;
  
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }
}

The returned result is as follows:

{
    "code": 0, 
    "data": null, 
    "description": "Operation success."
}

Report Alarms

Function

This interface is used to report alarms.

URI

/rest/openapi/alarm

  • This interface applies only to third-party alarms and is not applicable to other alarm group IDs.
  • Third-party alarm groups IDs must be within the range of 0x1098C5F1–0x1098ED00.

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Value Range

openid

Mandatory

Request message header

String

Indicates the session identifier. It is used for open API authentication.

NOTE:

A third-party invokes the login interface (section Log In to the eSight) for security management to obtain this parameter.

category

Mandatory

Parameter list

String

Indicates the alarm category. The options are as follows:

  • 1: Alarms are reported.
  • 2: Alarms are cleared.

neDN

Mandatory

Parameter list

String

Indicates the unique ID of an alarm source.

neType

Mandatory

Parameter list

String

Indicates the alarm source type.

groupId

Mandatory

Parameter list

int

Indicates the third-party alarm group ID.

NOTE:

Third-party alarm groups IDs must be within the range of 0x1098C5F1–0x1098ED00.

alarmId

Mandatory

Parameter list

int

Indicates the alarm ID.

objectInstance

Mandatory

Parameter list

String

Indicates the alarm location information.

eventTime

Mandatory

Parameter list

long

Indicates the UTC time (unit: ms) when an alarm is generated.

moDN

Optional

Parameter list

String

Indicates the managed object.

additionalInformation

Optional

Parameter list

String

Indicates the additional information about an alarm.

additionalText

Optional

Parameter list

String

Indicates the additional text of an alarm.

devCsn

Optional

Parameter list

int

Indicates the serial number of an alarm on a device.

clearedType

Optional

Parameter list

int

Indicates the alarm clearance type. The options are as follows:

  • 1: ADAC (automatically detected and automatically cleared)
  • 2: ADMC (automatically detected and manually cleared)
NOTICE:

The parameter is used if the static alarm information mapping the alarm ID is not found. Otherwise, the parameter value is overwritten by the static alarm information. The static alarm information mapping the alarm ID can be get through the interface "Query Static Information on Alarms with Specified GroupIDs".

alarmName

Optional

Parameter list

String

Indicates the alarm name.

NOTICE:
  • The parameter is used if the static alarm information mapping the alarm ID is not found. Otherwise, the parameter value is overwritten by the static alarm information. The static alarm information mapping the alarm ID can be get through the interface "Query Static Information on Alarms with Specified GroupIDs".
  • If alarmId does not exist in the alarm static information, then alarmName is mandatory.

severity

Optional

Parameter list

int

Indicates the alarm severity. The options are as follows:

  • 0: indeterminate
  • 1: critical
  • 2: major
  • 3: minor
  • 4: suggestion
  • 5: cleared
NOTICE:

The parameter is used if the static alarm information mapping the alarm ID is not found. Otherwise, the parameter value is overwritten by the static alarm information. The static alarm information mapping the alarm ID can be get through the interface "Query Static Information on Alarms with Specified GroupIDs".

eventType

Mandatory

Parameter list

int

Indicates the alarm type. The options are as follows:

  • 1: communications alarm
  • 2: equipment alarm
  • 3: processing error alarm
  • 4: quality of service alarm
  • 5: environmental alarm
  • 6: integrity violation
  • 7: operational violation
  • 8: physical violation
  • 9: security violation
  • 10: time domain violation
NOTICE:

The parameter is used if the static alarm information mapping the alarm ID is not found. Otherwise, the parameter value is overwritten by the static alarm information. The static alarm information mapping the alarm ID can be get through the interface "Query Static Information on Alarms with Specified GroupIDs".

probableCause

Optional

Parameter list

int

Indicates the probable cause of an alarm.

NOTICE:

The parameter is used if the static alarm information mapping the alarm ID is not found. Otherwise, the parameter value is overwritten by the static alarm information. The static alarm information mapping the alarm ID can be get through the interface "Query Static Information on Alarms with Specified GroupIDs".

proposedRepairActions

Optional

Parameter list

String

Indicates the suggestion for rectifying the fault mapping the alarm.

NOTICE:

The parameter is used if the static alarm information mapping the alarm ID is not found. Otherwise, the parameter value is overwritten by the static alarm information. The static alarm information mapping the alarm ID can be get through the interface "Query Static Information on Alarms with Specified GroupIDs".

Result

Field

Value Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • others: failed. Code 1001 indicates that the license is invalid; code 1002 indicates that the license does not support the open API function; code 1204 indicates that authentication fails.

data

list

Here is null.

description

String

Indicates the description of the returned result.

Precautions

None

Example

When you run this demo to report an alarm, the database data may be affected. Change the parameter values as required.

package com.huawei.nms.openapi.demo.fm;

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;


/**
 * Report Alarms
 */
public class PushAlarm {
 private static final String FM_ALARM = "/rest/openapi/alarm";

 public static void main(String[] args) throws Exception {
  Login.login();
  pushalarm_one_Test();
 }

 public static void pushalarm_one_Test() throws Exception {
  //set the URL and method
  String openidURL = FM_ALARM;
  String method = "POST";
  
  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //set parameters
  BasicNameValuePair[] parameters =
        {
                new BasicNameValuePair("category", "1"), 
                new BasicNameValuePair("neDN", "neDN111"), 
                new BasicNameValuePair("neType", "neType11"), 
                new BasicNameValuePair("groupId", "278457600"), 
                new BasicNameValuePair("alarmId", "22222"), 
                new BasicNameValuePair("objectInstance", "objectInstance11"), 
                new BasicNameValuePair("eventTime", System.currentTimeMillis() + ""),                 
                new BasicNameValuePair("moDN", "OS=1"), 
                new BasicNameValuePair("additionalInformation", "additionalInformation11"), 
                new BasicNameValuePair("additionalText", "additionalText11"),
                new BasicNameValuePair("devCsn", "33333"),
                new BasicNameValuePair("clearedType", "1"),
                new BasicNameValuePair("alarmName", "alarmName11"),
                new BasicNameValuePair("severity", "1"),
                new BasicNameValuePair("eventType", "1"),
                new BasicNameValuePair("probableCause", "1111"),
                new BasicNameValuePair("proposedRepairActions", "proposedRepairActions11")
        };
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }
}

The returned result is as follows:

{
    "code": 0, 
    "data": null, 
    "description": "Operation success."
}

Query Alarm Information based on Parameter Settings

Function

This interface is used to query alarm information based on parameter settings.

URI

/rest/openapi/alarm

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Value Range

openid

Mandatory

Request message header

String

Indicates the session identifier. It is used for open API authentication.

NOTE:

A third-party invokes the login interface (section Log In to the eSight) for security management to obtain this parameter.

neDN

Optional

Parameter list

String

Indicates the unique ID of an alarm source. It supports fuzzy match of character strings.

severity

Optional

Parameter list

String

Indicates the alarm severity. The options are as follows:

  • 0: indeterminate
  • 1: critical
  • 2: major
  • 3: minor
  • 4: suggestion
NOTE:

Separate alarm severities with a comma (,), for example, 1,2,3.

clearStatus

Optional

Parameter list

int

Indicates the clear state. The options are as follows:

  • 0: uncleared
  • 1: cleared

ackStatus

Optional

Parameter list

int

Indicates the acknowledgment state. The options are as follows:

  • 0: unacknowledged
  • 1: acknowledged

startTime

Optional

Parameter list

long

Indicates the start UTC time (unit: ms) when an alarm occurs the first time.

endTime

Optional

Parameter list

long

Indicates the end UTC time (unit: ms) when an alarm occurs the first time.

alarmName

Optional

Parameter list

String

Indicates the alarm name. It supports fuzzy match of character strings.

alarmSource

Optional

Parameter list

String

Indicates the alarm source name. It supports fuzzy match of character strings.

location

Optional

Parameter list

String

Indicates the location information, for example, building 13 in area A. It supports fuzzy match of character strings.

locations

Optional

Parameter list

String

Indicates the locating information collection, which is a JSON string converted from List<String>.

NOTE:

The location and locations fields form an AND (&) relationship. You can select either field. It is not advisable to select both fields.

pageSize

Optional

Parameter list

int

Indicates the number of records on each page. The number ranges from 10 to 100 and the default value is 20.

NOTE:

If pageSize is less than 10 or more than 100, the default value is used.

pageNo

Optional

Parameter list

int

Indicates the page number for the page-based query. The number starts from 1 to 999 and the default value is 1.

Result

Field

Value Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • others: failed. Code 1001 indicates that the license is invalid; code 1002 indicates that the license does not support the open API function; code 1204 indicates that authentication fails.

data

List<InternalRtnAlarmInfo>

Indicates the alarm record list.

description

String

Indicates the description of the returned result.

pageSize

int

Indicates the number of records of the current page.

totalPage

int

Indicates the total pages of records that meet search criteria.

currentPage

int

Indicate the current page, which starts from 1.

The object InternalRtnAlarmInfo contains the following information.

Field

Value Type

Description

ackTime

long

Indicates the UTC time (unit: ms) in the NMS when an alarm is acknowledged. It is null when the alarm is not acknowledged.

ackUser

String

Indicates the user who acknowledges the alarm.

acked

boolean

Specifies whether an alarm is acknowledged.

additionalInformation

String

Indicates the additional information about an alarm.

additionalText

String

Indicates the additional text of an alarm.

alarmId

int

Indicates the alarm ID.

alarmName

String

Indicates the alarm name.

alarmSN

int

Indicates the serial number of an alarm.

arrivedTime

long

Indicates the UTC time (unit: ms) when an alarm is arrived.

clearUser

String

Indicates the user who clears the alarm.

cleared

boolean

Specifies whether an alarm is cleared.

clearedTime

long

Indicates the UTC time (unit: ms) when an alarm is cleared.

If the alarm is cleared manually, the clearedTime

is the NMS time; if the alarm is cleared automatically, the clearedTime is the device time.

It is null when the alarm is not cleared.

clearedType

int

Indicates the alarm clearance type. The options are as follows:

  • 1: ADAC (automatically detected and automatically cleared)
  • 2: ADMC (automatically detected and manually cleared)

commentTime

long

Indicates the comment time, which is the UTC time. The value is accurate to millisecond.

commentUser

String

Indicates the commentuser.

comments

String

Indicates the comments.

devCsn

int

Indicates the serial number of an alarm on a device.

eventTime

long

Indicates the UTC time (unit: ms) when an alarm is generated.

NOTE:

This field is the time when the first alarm is generated and will not update with the same type of alarm. The field is not updated when the alarm is cleared or acknowledged.

eventType

int

Indicates the alarm type. The options are as follows:

  • 1: communications alarm
  • 2: equipment alarm
  • 3: processing error alarm
  • 4: quality of service alarm
  • 5: environmental alarm
  • 6: integrity violation
  • 7: operational violation
  • 8: physical violation
  • 9: security violation
  • 10: time domain violation

latestLogTime

long

Indicates the last occurrence time (UTC time).

moDN

String

Indicates the unique DN of the minimum fault source.

moName

String

Indicates the name of a managed object.

neDN

String

Indicates the unique ID of an alarm source.

neName

String

Indicates the name of an alarm source.

neType

String

Indicates the alarm source type.

objectInstance

String

Indicates the alarm location information.

perceivedSeverity

int

Indicates the alarm severity. The options are as follows:

  • 0: indeterminate
  • 1: critical
  • 2: major
  • 3: minor
  • 4: suggestion

probableCause

int

Indicates the probable cause of an alarm, and it may be null.

probableCauseStr

String

Indicates the description for probable cause of an alarm.

proposedRepairActions

String

Indicates the suggestion for rectifying the fault mapping the alarm.

alarmGroupId

String

Indicates the alarm group ID.

Precautions

None

Example

package com.huawei.nms.openapi.demo.fm;

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;


/**
 * Query Alarm Information based on Parameter Settings
 */
public class QueryAlarm {
 private static final String FM_ALARM = "/rest/openapi/alarm";

 public static void main(String[] args) throws Exception {
  Login.login();
  postGetAlarmTest();
 }

 static void postGetAlarmTest() throws Exception {
  //set the URL and method
  String openidURL = FM_ALARM;
  String method = "GET";
  
  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //set parameters
  BasicNameValuePair[] parameters =
        {
                new BasicNameValuePair("severity", ""), 
                new BasicNameValuePair("clearStatus", ""), 
                new BasicNameValuePair("ackStatus", ""), 
                new BasicNameValuePair("startTime", ""), 
                new BasicNameValuePair("endTime", ""), 
                new BasicNameValuePair("alarmName", ""), 
                new BasicNameValuePair("alarmSource", ""), 
                new BasicNameValuePair("location", ""), 
                new BasicNameValuePair("pageSize", ""), 
                new BasicNameValuePair("pageNo", "")
                new BasicNameValuePair("neDN", "")
        };
  
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }
}

The returned result is as follows:

{
    "code": 0, 
    "data": [
        {
            "ackTime": null, 
            "ackUser": null, 
            "acked": false, 
            "additionalInformation": null, 
            "additionalText": "License is invalid,please refresh your license.", 
            "alarmId": 999999995, 
            "alarmName": "License is invalid", 
            "alarmSN": 0, 
            "arrivedTime": 1372043825455, 
            "clearUser": null, 
            "cleared": true, 
            "clearedTime": 1372043968000, 
            "clearedType": 1, 
            "commentTime": 0, 
            "commentUser": "", 
            "comments": "", 
            "devCsn": null, 
            "eventTime": 1372043825000, 
            "eventType": 9, 
            "latestLogTime": 1372043825000, 
            "moDN": "OS=1", 
            "moName": "LocalNMS", 
            "neDN": "OS=1", 
            "neName": "LocalNMS", 
            "neType": "OMS", 
            "objectInstance": null, 
            "perceivedSeverity": 2, 
            "probableCause": 614, 
            "probableCauseStr": "xxxxx",
            "proposedRepairActions": null,
            "alarmGroupId": "10000"
        }, 
        {
            "ackTime": null, 
            "ackUser": null, 
            "acked": false, 
            "additionalInformation": "percentage=90.0,limit=80", 
            "additionalText": null, 
            "alarmId": 505001003, 
            "alarmName": "Disk Usage Is High", 
            "alarmSN": 2, 
            "arrivedTime": 1372043830459, 
            "clearUser": null, 
            "cleared": false, 
            "clearedTime": null, 
            "clearedType": 1, 
            "commentTime": 0, 
            "commentUser": "", 
            "comments": "", 
            "devCsn": null, 
            "eventTime": 1372043824000, 
            "eventType": 4, 
            "latestLogTime": 1372408242000, 
            "moDN": "OS=1", 
            "moName": "LocalNMS", 
            "neDN": "OS=1", 
            "neName": "LocalNMS", 
            "neType": "OMS", 
            "objectInstance": "Server name=szxy1g684281,Server IP=10.66.90.144,File System=D:\\", 
            "perceivedSeverity": 2, 
            "probableCause": 207, 
            "probableCauseStr": "xxxxx",
            "proposedRepairActions": null,
            "alarmGroupId": "10000"
        }
    ], 
    "description": "Operation success.", 
    "pageSize": 20, 
    "totalPage": 1, 
    "currentPage": 1
}

Query Information on Alarms with Specified SNs

Function

This interface is used to query information on alarms with specified SNs.

URI

/rest/openapi/alarm/{sn}

In the URL, sn is the alarm sequence number. For example, /rest/openapi/alarm/1 indicates that information about the alarm with SN being 1 is queried.

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Value Range

openid

Mandatory

Request message header

String

Indicates the session identifier. It is used for open API authentication.

NOTE:

A third-party invokes the login interface (section Log In to the eSight) for security management to obtain this parameter.

Result

Field

Value Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • others: failed. Code 1001 indicates that the license is invalid; code 1002 indicates that the license does not support the open API function; code 1204 indicates that authentication fails.

data

List<InternalRtnAlarmInfo>

Indicates the alarm record list.

description

String

Indicates the description of the returned result.

The object InternalRtnAlarmInfo contains the following information.

Field

Value Type

Description

ackTime

long

Indicates the UTC time (unit: ms) in the NMS when an alarm is acknowledged. It is null when the alarm is not acknowledged.

ackUser

String

Indicates the user who acknowledge the alarm.

acked

boolean

Specifies whether a alarm is acknowledged.

additionalInformation

String

Indicates the additional information about an alarm.

additionalText

String

Indicates the additional text of an alarm.

alarmId

int

Indicates the alarm ID.

alarmName

String

Indicates the alarm name.

alarmSN

int

Indicates the serial number of an alarm.

arrivedTime

long

Indicates the UTC time (unit: ms) when an alarm is arrived.

clearUser

String

Indicates the user who clear the alarm.

cleared

boolean

Specifies whether a alarm is cleared.

clearedTime

long

Indicates the UTC time (unit: ms) when an alarm is cleared.

If the alarm is cleared manually, the clearedTime

is the NMS time; if the alarm is cleared automatically, the clearedTime is the device time.

It is null when the alarm is not cleared.

clearedType

int

Indicates the alarm clearance type. The options are as follows:

  • 1: ADAC (automatically detected and automatically cleared)
  • 2: ADMC (automatically detected and manually cleared)

commentTime

String

Indicates the commenttime.

commentUser

String

Indicates the commentuser.

comments

String

Indicates the comments.

devCsn

int

Indicates the serial number of an alarm on a device.

eventTime

long

Indicates the UTC time (unit: ms) when an alarm is generated.

NOTE:

This field is the time when the first alarm is geneated and will not update with the same type of alarm. The field is not updated when the alarm is cleared or acknowledged.

eventType

int

Indicates the alarm type. The options are as follows:

  • 1: communications alarm
  • 2: equipment alarm
  • 3: processing error alarm
  • 4: quality of service alarm
  • 5: environmental alarm
  • 6: integrity violation
  • 7: operational violation
  • 8: physical violation
  • 9: security violation
  • 10: time domain violation

latestLogTime

long

Indicates the lastlogtime.

moDN

String

Indicates the unique DN of the minimum fault source.

moName

String

Indicates the name of a managed object.

neDN

String

Indicates the unique ID of an alarm source.

neName

String

Indicates the name of an alarm source.

neType

String

Indicates the alarm source type.

objectInstance

String

Indicates the alarm location information.

perceivedSeverity

int

Indicates the alarm severity. The options are as follows:

  • 0: indeterminate
  • 1: critical
  • 2: major
  • 3: minor
  • 4: suggestion

probableCause

int

Indicates the probable cause of an alarm.

probableCauseStr

String

Indicates the description for probable cause of an alarm.

proposedRepairActions

String

Indicates the suggestion for rectifying the fault mapping the alarm.

alarmGroupId

String

Indicates the alarm group ID.

Precautions

None

Example

package com.huawei.nms.openapi.demo.fm;

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;


/**
 * Query Information on Alarms with Specified SNs
 */
public class QueryAlarmBySN {
 private static final String FM_ALARM = "/rest/openapi/alarm";

 public static void main(String[] args) throws Exception {
  Login.login();
  postGetAlarmSnTest();
 }

 public static void postGetAlarmSnTest() throws Exception {
  //set the alarm SN
  int alarmSN = 200005;
  //set the URL and method
  String openidURL = FM_ALARM + "/" + alarmSN;
  String method = "GET";

  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, null);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }
}

The returned result is as follows:

{
    "code": 0, 
    "data": [
        {
            "ackTime": null, 
            "ackUser": null, 
            "acked": false, 
            "additionalInformation": "additionalInformation11", 
            "additionalText": "additionalText11", 
            "alarmId": 22222, 
            "alarmName": "alarmName11", 
            "alarmSN": 5, 
            "arrivedTime": 1372122790111, 
            "clearUser": null, 
            "cleared": false, 
            "clearedTime": null, 
            "clearedType": 1, 
            "commentTime": 0, 
            "commentUser": "", 
            "comments": "", 
            "devCsn": null, 
            "eventTime": 1372122786000, 
            "eventType": 1, 
            "latestLogTime": 1372122786000, 
            "moDN": "OS=1", 
            "moName": "LocalNMS", 
            "neDN": "OS=1", 
            "neName": "LocalNMS", 
            "neType": "OMS", 
            "objectInstance": "objectInstance11", 
            "perceivedSeverity": 1, 
            "probableCause": 1111, 
            "probableCauseStr": "xxxxx",
            "proposedRepairActions": "proposedRepairActions11",
            "alarmGroupId": "10000"
        }
    ], 
    "description": "Operation success."
}

Acknowledge Alarms

Function

This interface is used to acknowledge alarms.

URI

/rest/openapi/alarm/{sn}

In the URL, sn is the alarm sequence number. For example, /rest/openapi/alarm/1 indicates that the alarm with SN being 1 is acknowledged.

Access Method

PUT

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Value Range

openid

Mandatory

Request message header

String

Indicates the session identifier. It is used for open API authentication.

NOTE:

A third-party invokes the login interface (section Log In to the eSight) for security management to obtain this parameter.

operateType

Mandatory

Parameter list

int

Indicates the alarm operation. The options are as follows:

  • 1: acknowledge
  • 2: clear

operateUser

Optional

Parameter list

String

Indicates the operator. The default value is obtained from the authentication token.

Result

Field

Value Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • others: failed. Code 1001 indicates that the license is invalid; code 1002 indicates that the license does not support the open API function; code 1204 indicates that authentication fails.

data

list

Here is null.

description

String

Indicates the description of the returned result.

Precautions

None

Example

When you run this demo to acknowledge an alarm, the database data may be affected. Change the parameter values as required.

package com.huawei.nms.openapi.demo.fm;

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;


/**
 * Acknowledge Alarms
 */
public class AckAlarm {
 private static final String FM_ALARM = "/rest/openapi/alarm";

 public static void main(String[] args) throws Exception {
  Login.login();
  postAckAlarmTest();
 }

 public static void postAckAlarmTest() throws Exception {
  //set alarm SN
  int alarmSN = 1202103;
  //set the URL and method
  String openidURL = FM_ALARM + "/" + alarmSN;
  String method = "PUT";
  
  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //set parameters
  BasicNameValuePair[] parameters =
        {
                new BasicNameValuePair("operateType", "1"), 
                new BasicNameValuePair("operateUser", "user01")
        };
  
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }
}

The returned result is as follows:

{
    "code": 0, 
    "data": null, 
    "description": "Operation success."
}

Clear Alarms

Function

This interface is used to clear alarms.

URI

/rest/openapi/alarm/{sn}

In the URL, sn is the alarm sequence number. For example, /rest/openapi/alarm/1 indicates that the alarm with SN being 1 is cleared.

Access Method

PUT

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Value Range

openid

Mandatory

Request message header

String

Indicates the session identifier. It is used for open API authentication.

NOTE:

A third-party invokes the login interface (section Log In to the eSight) for security management to obtain this parameter.

operateType

Mandatory

Parameter list

int

Indicates the alarm operation. The options are as follows:

  • 1: acknowledge
  • 2: clear

operateUser

Optional

Parameter list

String

Indicates the operator. The default value is obtained from the authentication token.

Result

Field

Value Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • others: failed. Code 1001 indicates that the license is invalid; code 1002 indicates that the license does not support the open API function; code 1204 indicates that authentication fails.

data

list

Here is null.

description

String

Indicates the description of the returned result.

Precautions

None

Example

When you run this demo to clear an alarm, the database data may be affected. Change the parameter values as required.

package com.huawei.nms.openapi.demo.fm;

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;


/**
 * Clear Alarms
 */
public class ClearAlarm {
 private static final String FM_ALARM = "/rest/openapi/alarm";

 public static void main(String[] args) throws Exception {
  Login.login();
  postClearAlarmTest();
 }

 public static void postClearAlarmTest() throws Exception {
  //set alarm SN
  int alarmSN = 5;
  //set the URL and method
  String openidURL = FM_ALARM + "/" + alarmSN;  
  String method = "PUT";
  
  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //set parameters
  BasicNameValuePair[] parameters =
        {
                new BasicNameValuePair("operateType", "2"), 
                new BasicNameValuePair("operateUser", "user01")
        };
  
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }
}

The returned result is as follows:

{
    "code": 0, 
    "data": null, 
    "description": "Operation success."
}
Translation
Download
Updated: 2019-10-30

Document ID: EDOC1100044386

Views: 15461

Downloads: 83

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next