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 11

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).
Message Notification Description

Message Notification Description

Overview

eSight uses the HTTP/HTTPS protocol to send information about changes (including the add, modify, and delete operations) in subscribed resources, power-on and power-off information about the eSight system, and keepalive information to third-party systems. In this way, third-party systems can synchronize the status of resources managed by eSight in a timely manner.

Message Aggregation

To improve message sending efficiency, the notification function aggregates consecutive same-type messages generated in a short time period into the data field in sequence that the messages are cached, and then sends the messages as one notification message.

The data field is a JSON data array. Third-party systems must process this field as a data array so that the aggregated messages can be correctly identified.

The aggregated messages must meet the following conditions:

  1. They aim at the same third-party system.
  2. More than one message is cached.
  3. The messages have the same ResourceURI value and msgType value.
  4. The number of messages does not exceed the maximum specified in the configuration file.
  5. The message objects in the message list for the data field are sorted in sequence that the messages are cached.

Message Sending

When connecting to a third-party system that employs whitelist restrictions, the eSight can send notifications subscribed using OpenAPI with a specified IP address.

  • Application scenario:

    The eSight is installed in active/standby mode. On the GUI, users can configure the IP address for sending notifications subscribed using OpenAPI.

  • The configuration rules are as follows:
    1. On the eSight server, open the child files of $HOME_PATH$\etc\oms.nbi\system_integration_config.xml and change the value of uiSupportMultipleIP to false. (When this parameter is set to true, the IP address for sending notifications subscribed using OpenAPI cannot be specified.)
    2. On the main menu, choose System > System Settings > Northbound Integration. In the navigation pane, choose Local System Settings. Change the value of IP address, and click Apply.

Message Receiving

After a third-party system successfully processes the messages, the third-party system immediately returns a 200 OK message.

The sending rules are as follows:

  1. A time-consuming operation may cause message sending timeout and message resending. When the configured number of attempts is exceeded, message sending stops. After a third-party system receives messages, it is recommended that the third-party system return a 200 OK message and then initiate a thread to process the messages.
  2. If the message system receives a non-200 return code, the message system considers that the third-party system fails to receive messages and stops sending messages.
  3. Messages that fail to be sent are cached in the eSight for third-party systems to trigger message resending.
  4. Third-party systems can subscribe to any message to resume message sending.

Decryption Example

If you configure http-encryption.key and http-encryption.iv in the eSight installation directory/AppBase/etc/oms.ros/ros.web.notification.xml file and use the AES128 algorithm to encrypt the data field in HTTP packets, the third-party system must decrypt the data before use.

private static String decrypt(String data){
  String result = "";

  // Note: The following two key strings are added by referring to etc/oms.ros/ros.web.notification.xml and must be in plaintext.
  String decryptedKey = "E5DF96DE53ED56CBAE25368624DC25Ef";
  String decryptedIv = "E2CDBCA5693654EF2E6F38693653564E";
  // Obtain the result and values of KEY and IV. 
  final byte[] key = strToBytes( decryptedKey.toUpperCase() );
  final byte[] iv = strToBytes( decryptedIv.toUpperCase() );
  try {
  // Obtain the key generator.
   KeyGenerator kgen = KeyGenerator.getInstance("AES", "SunJCE");

   SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG", "SUN");
   secureRandom.setSeed( key );
   // Initialization
   kgen.init( 128, secureRandom );
   // Algorithm parameters
   AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv);
   // Generate an encryption key.
   SecretKey secretKey = kgen.generateKey();
   // Encryptor
   Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding", "SunJCE");
   // Initialize the encryptor.
   cipher.init( Cipher.DECRYPT_MODE, secretKey, paramSpec);
   // Obtain the decryption result.
   byte[] res = cipher.doFinal(strToBytes(data));
   try {
    result = new String( res,"UTF-8" );
   } catch (UnsupportedEncodingException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
  } catch( final GeneralSecurityException e ) {
   e.printStackTrace();
   result = null;
  }
  return result;
 }
 public static byte[] strToBytes(final String str)
    {
        // Verify parameter settings.
        if (null == str || str.isEmpty() || !str.matches("[0-9a-zA-Z]{1,}"))
        {
            return null;
        }

        // Convert into uppercase letters.
        final String upperCaseString = str.toUpperCase(Locale.US);

         // String length
        final int strLen = upperCaseString.length();

        // Encrypted array
        final byte[] bytes = new byte[16];

         // Cyclically calculate the encrypted value.
        for (int i = 0; i < (strLen / 2); i++)
        {
            // High and low bits
            int high = charToHex(upperCaseString.charAt(i * 2));
            int low = charToHex(upperCaseString.charAt(i * 2 + 1));
            // Obtain the result.
            bytes[i] = (byte) ((high << 4) | low);
        }

        return bytes;
    }

/**
     Convert * char into a hexadecimal number. The value can contain only digits and uppercase letters.
     * 
     * @param ch character
     * @return indicates the returned value.
     */
    private static int charToHex(final char ch)
    {
        if (Character.isUpperCase(ch))
        {
            // Uppercase letters
            return ch - 'A' + 10;
        }
        else
        {
            // Digits
            return ch - '0';
        }
    }
Download
Updated: 2019-12-13

Document ID: EDOC1100044386

Views: 21078

Downloads: 92

Average rating:
This Document Applies to these Products

Related Version

Related Documents

Share
Previous Next