SDK Your Net Corporation Hellopics Example: hellopics-mgmt Documentation



This is a sample application that is part of the sync-hellopics-apps package and one of the three parts to the hellopics application which demonstrates simple JUNOS MP-SDK functionality, with a focus on component communication. There are generally (but not by requirement) three components to an MP-SDK application. Two components run on the Multi-Services PIC, namely the data and control components. These components only have access to the MP-SDK libraries. The third component, called the management component, runs on the routing engine (RE) and is in fact an RE-SDK application that may simply communicate with the other two. It only has access to the RE-SDK libraries. Of course some libraries are part of both sets like libconn for example.

The purpose of the hellopics application is to pass hello messages in a cycle between the three components. The management component operates on a 60-second interval timer. It initiates a hello message carrying a sequence number as data upon the timer expiry event. The first hello message is sent to the data component, the second to the control component, and the direction remains alternating.

hellopics-mgmt is a small daemon running on the RE. It is a good starting point for beginners to the JUNOS MP-SDK. It demonstrates the usual RE-SDK libraries, and it provides the 'show sync hellopics statistics' command to show some basic statistics about the hello messages. It does a good job of demonstrating libconn to communicate between an MP-SDK application's components.

The management component in particular starts a server listening for a connection from the data component and from the control component. Upon establishing a session through this server connection, the session is unidentified. The first message it expects for a new session is the one containing the ID of the component that started the session. It will not process any messages from a connection (session) until it is identified. Once this happens, it responds to peer-information-request messages by sending the opposite peer's information. If a connection from the opposite peer has not been made, it will send the information when it connects. It also listens for messages indicating that the other components are ready to receive hello messages. The other components only send these when they are acting as clients for a connection and they are fully ready. When the management component has received a ready message from both components it starts the interval timer to start generating the hello messages.

If the management component is about to send a hello message before the last one was received, then it increments a messages-missed counter. Upon sending the hello message, it increments a messages-sent counter. If a hello message is received and its sequence number matches the last one sent, then it increments a messages-missed counter. Lastly, if a hello message is received and its sequence number does not match the last one sent, then it increments a messages-out-of-order counter. The messages received out of order would, therefore, also get counted as missed. These four statistics counters are reported by the command made available by this daemon.

High Availability functionality has been added to the management component. The purpose of this functionality is to demonstrate the continuation of RE service even after the Master RE fails or there is a mastership switchover. The management component on the Master RE is the master daemon (all the processing is done by this daemon) and the management component on the Backup RE is the backup daemon (this daemon remains passive). The backup daemon just synchronizes its state with the master daemon. If Routing Engine mastership switchover/failover takes place then the management component needs to be notified about the mastership switchover. Here the backup component takes over as master and the master becomes backup.

user@router> show sync hellopics statistics
Hello PICs Cycled-Message Statistics:
  Sent Message: 2
  Received Messages: 2
  Dropped Messages: 0
  Missed Messages Received Out of Order: 0

2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:26:58 2010 for SDK Your Net Corporation Hellopics Example: hellopics-mgmt 1.0 by Doxygen 1.5.1