< Home

Stack Status Change Event Subscription

Interface Name

Stack status change event subscription

Application Phase

Subscription phase

API Prototype

result1_value, result2_description = ops.device.subscribe(tag, slot, event)

Description

Parameter

Description

Value

tag

Indicates conditions.

The value is a string of 1 to 12 case-insensitive characters, consists of letters, digits, and underscores (_), and starts with a letter. The value cannot be one of the following: "", None, and, or, andnot. The value cannot contain \0.

slot

Indicates the slot ID.

The value is a character string, such as slot 0.

event

Indicates the stack status change event.

The value is of the enumerated type:

  • PLUGIN: A member switch is added to the stack.

  • PLUGOUT: A member switch exits from the stack.

  • REGISTERED: A member switch is registered in the stack.

  • RESET: A member switch is restarted in the stack.

Return Value

The result1_value and result2_description in the API prototype indicate return values.

The result1_value is the first return value, 0 indicates success, and 1 indicates failure.

The result2_description is the second return value, indicating the failure cause. It is returned only when the first return value is 1.

Usage Description

If multiple simple events are defined using the ops.device.subscribe API in the subscription phase, but the simple events are not combined through the Multi-Condition Combination API, the Python script assistant cannot be configured.

Using the stack status change event subscription, you can monitor events related to the member switch with a specified stack ID in the stack, including registration, addition, removal, and reset of a member switch.

Example

When the member switch with stack ID 2 exits from the stack, you can trigger the corresponding action.

value, descri_str = ops.device.subscribe("stack", "slot 2", "PLUGOUT")
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >