Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Using Custom Scripts to Support HA VIP in an L3 Environment

    One application for NorthStar’s ability to execute custom scripts is the extension of NorthStar support for HA VIP into an L3 environment. If NorthStar determines that it is the active node, it executes the scripts that reside in the post_active directory. Similarly, if NorthStar is a backup node, it executes the scripts that reside in the post_backup directory. The locations of the directories are:

    • /opt/northstar/utils/custom_scripts/post_active

      After a failover, or when HA is restarted, NorthStar executes all scripts in this directory if it is the active node.

    • /opt/northstar/utils/custom_scripts/post_backup

      After a failover, or when HA is restarted, NorthStar executes all scripts in this directory if it is the backup node.

    • /opt/northstar/utils/examples

      This directory contains the following sample Python-based scripts:

      • start_advertise_vip_route.py
      • stop_advertise_vip_route.py

    One script in the examples directory advertises the VIP address to the gateway router; the other withdraws it. The sample scripts need to be modified according to your requirements and environment. We assume that you have already configured the NorthStar public key into JunosVM, so the scripts do not need to be configured with a password. The scripts use the default username (northstar) and IP address (172.16.16.2) that are configured on JunosVM. If the username or IP address are different, you must edit the scripts accordingly. Each example script connects to the JunosVM and commits the configuration based on whether it is used to advertise or stop the advertisement of the VIP address. These scripts are executed by the ha_agent.

    The scripts in a directory are executed in sort order which is something to keep in mind when naming your scripts (if the order of execution matters).

    Note: All scripts must have executable permission and pcs:pcs ownership. The maximum run time of a script is 60 seconds.

    The example script was developed using the Junos PyEZ Python library which simplifies script creation for use in a Junos environment. You must download and install PyEZ before you can use it. For instructions on installing PyEZ for your own use, see Installing Junos PyEZ.

    Modified: 2017-07-05