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


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


Configuration Guide - Device Management

CloudEngine 12800 and 12800E V200R003C00

This document describes the configurations of Device Management, including device status query, hardware management, Information Center Configuration, NTP, Synchronous Ethernet Configuration, Fault Management Configuration, Energy-Saving Management Configuration, Performance Management Configuration, Maintenance Assistant Configuration, and OPS Configuration.

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).
Example for Configuring an Assistant for Automatic Health Check (Using a Python Script)

Example for Configuring an Assistant for Automatic Health Check (Using a Python Script)

Networking Requirements

As shown in Figure 9-3, the remote server is a TFTP server. SwitchA and the TFTP server have reachable routes to each other. To reduce maintenance workload, configure SwitchA to automatically collect health information and send it to the TFTP server for analysis.

Figure 9-3 Networking for automatic health check

The TFTP protocol will bring risk to device security. The SFTP mode is recommended.

Configuration Roadmap

The configuration roadmap is as follows:
  1. Make a Python script, upload, and install it on SwitchA.

  2. Create a script assistant.


  1. Make a Python script.

    # Make a Python script named

    In the Python script, set the trigger condition as timer and the task as executing commands to collect device information, including hardware status, route status, and interface link status, and to send the information to the TFTP server. The Python script is as follows:
    # Define the function of the trigger condition.
    def ops_condition(_ops):
    	_ops.timer.cron("con1","0 1 * * * *")      # Set the timer event.
    # Define the functions of tasks.
    def ops_execute(_ops):
    	handle, err_desp  =      # Open the CLI channel.
    	_ops.cli.execute(handle,"display device > health.txt")      # Execute CLIs.
    	_ops.cli.execute(handle,"display health >> health.txt")
    	_ops.cli.execute(handle,"display ip routing-table >> health.txt")
    	_ops.cli.execute(handle,"display lldp neighbor brief >> health.txt")
    	_ops.cli.execute(handle,"tftp put health.txt")
    	ret = _ops.cli.close(handle)      # Close the CLI channel.
    	return 0

  2. Upload and install the Python script.

    # Configure SwitchA functioning as a TFTP client to download the Python script file from the TFTP server. The Python script is stored on the TFTP server.

    <HUAWEI> system-view
    [~HUAWEI] sysname SwitchA
    [*HUAWEI] commit
    [~SwitchA] quit
    <SwitchA> tftp get
    Info: Transfer file in binary mode.
    Please wait for a while...
    /    635 bytes transferred
    Info: Downloaded the file successfully.

    # Install the Python script on SwitchA.

    <SwitchA> ops install file

  3. Configure a script assistant.

    <SwitchA> system-view
    [~SwitchA] ops
    [~SwitchA-ops] script-assistant python
    [*SwitchA-ops] commit
    [~SwitchA-ops] return

  4. Verify the configuration.

    # Verify the assistant configuration.

    <SwitchA> display ops assistant verbose name
    Assistant information
      Name                 :
      State                : ready
      Type                 : script
      Default assistant    : no
     Running statistics
      Running times        : 0
      Queue size/(free)    : 10/(10)
      Skip for queue full  : 0
      Skip for delay       : 0
      Skip for suppression : 0
      Skip for error       : 0
     Execute information
      Task abstract        : : ops_execute()
     Trigger control
      Occurs threshold     : 1
      Period (s)           : 0
      Delay (s)            : 0
      Suppress max         : 0
      Hits in period       : 0
     Condition information
      Correlate expression : con1
      Condition tag        : con1
        Condition type     : timer
        Subscribe result   : success
        Occurs threshold   : 0
        Period (s)         : 0
        Hits in period     : 0

Configuration Files

  • Configuration file of SwitchA

    sysname SwitchA
     script-assistant python
Updated: 2019-05-05

Document ID: EDOC1100004193

Views: 70875

Downloads: 26

Average rating:
This Document Applies to these Products

Related Version

Related Documents

Previous Next