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

    Developing a JET Application

    You can choose any editor for developing the JET application. For example, you can use the PyCharm IDE or Eclipse to develop and debug Python applications, or use a text editor (such as vi) to write a Python file. Also, you can use any programming framework that you prefer.

    For a tutorial on building a JET application that has no dependency on C or C++ modules and does not have to be signed, see the Juniper Extension Toolkit Getting Started Guide.

    For more information on JET notification APIs, see the Juniper Extension Toolkit API Guide.

    For JET applications that support notification subscription, you can choose the appropriate create method and subscribe to it.

    For running JET Python applications on a device running Junos OS, you can configure command-line arguments for the file. For example, if you had the following script, you can supply the arguments from the Junos CLI using the arguments configuration statement at the [edit system extensions extension-service application file filename hierarchy level:

    import argparse
     
    def main():
        parser = argparse.ArgumentParser(description='This is a demo script.')
     
        parser.add_argument('-arg1', required=True)
        parser.add_argument('-arg2', required=True)
     
        args = parser.parse_args()
     
        print args.arg1
        print args.arg2
     
    if __name__ == '__main__':
        main()
    

    To configure the arguments in the CLI:

    1. Enter configuration mode.
      user@device> configureEntering configuration mode[edit]user@device#
    2. Configure the command-line arguments.
      user@device# set system extensions extension-service application file cmdline_args.py argument “-arg1 foo -arg2 goo”
    3. Commit.
      user@device# commit
    4. Start the application.
      user@device# exituser@device> request extension-service start cmdline_args.py
      Extension-service application 'cmdline_args.py' started with pid: 99418
      foo
      goo
      

    Modified: 2016-11-09