Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Package JET Applications

After application development is complete, write the JavaScript Object Notation (JSON) file describing the content to build and package the application before deploying it on the device. JSON is a lightweight data-interchange format. It is easy for humans to read and write, and also easy for machines to parse and generate. For more details, see https://www.json.org.

JSON files consist of a collection of attributes are included inside a set of curly braces. Attributes use two structures:

  • A collection of key-value pairs.

  • An ordered list of values.

Read further to learn about each of the attributes contained in the JSON format for application packaging.

Main Section Attributes

The top block of the JSON file is the main section of the file. It consists of mandatory and optional attributes.

Mandatory Attributes

Table 1 describes the mandatory attributes that all JSON files for application packaging must have in the main section. The following is an example of a simple application JSON file containing only the mandatory attributes:

Table 1: Mandatory Attributes in the JSON File Main Section

Attribute

Description

Example Values

"app-name"

Specify the name of the application.

"sample_pyapp"

"app-path"

Specify the path to the application’s implementation directory. All paths should be relative to sandbox src.

"python/sample_pyapp"

"language"

Specify the language used for developing the application.

"python", "c", "c++"

"main-scripts"

This is a list attributes. Specify the filename or filenames of the main script or scripts that run on the device (do not specify the module here). The main script files will be deployed under the /var/db/scripts/jet path on the device.

["foo.py", "bar.py"]

"app-type"

Specify whether an application is to be a standalone program or a daemon.

"standalone" or "daemon"

"sign"

Indicate whether the application is to be signed or unsigned.

"yes" or "no"

"os-type"

Specify whether the application is to be deployed on legacy Junos OS (bsd6) or Junos OS with upgraded FreeBSD (bsd10).

"bsd6", bsd10, or "bsd11"

"target-arch"

Specify the target architecture on which the application is to be deployed.

"i386", "powerpc", "octeon", "xlr", or "arm"

"description"

Write a brief (one-line) description about the application. This will be displayed in the show version operational command output.

"Simple Python test app"

Optional Attributes

Table 2 describes the optional attributes you can include in the main section of the JSON file for application packaging. The following is an example main section with mandatory and optional attributes:

Table 2: Optional Attributes in the JSON File Main Section

Attribute

Description

Example Values

"c-compiler-flags"

Specify the list of C compiler flags, if any. Compilation flags can be defined for the main section, dependent libraries (dep-libs), or dependent Python modules (dep-py-modules).

"flag1 flag2 flag3"

"c++-compiler-flags"

Specify the list of C++ compiler flags, if any. Compilation flags can be defined for the main section, dependent libraries (dep-libs), or dependent Python modules (dep-py-modules).

"flag1 flag2 flag3"

"linker-flags"

Specify the list of linker flags, if any. Use these flags to specify additional libraries to link to or additional link-specific flags that are required during linking, You can define linker-specific flags either in the main section or in the dep-py-modules section.

"flag1 flag2 flag3"

Source Attributes

Table 3 shows two source attributes you can use to specify source files for the application package. The following is an example Python application with additional module files to be deployed, along with the main script file:

Table 3: Source Attributes You Can Use in a JSON File

Attribute

Description

Example Values

"srcs"

Specify the list of additional source files. For Python applications, these source files are the additional module files. For C or C++ applications, these source files are the source files to be compiled to generate lib/binary. Each entry should be a key-value pair, where the key is the path of the source files and the value is an array of source filenames.

"srcs": { 
      "python/sample_pyapp": ["a.py", "b.py"], 
     "python/sample_pyapp/temp": ["temp1.py", "temp2.py"] 
} 

"extn-srcs"

This section is applicable only for Python. Specify the list of C or C++ module files to be compiled. Each entry should be a key-value pair, where the key is the path of the source files and the value is an array of source filenames.

"extn-srcs": { 
    "python/sample_pyapp": ["foo.c", "bar.c"], 
    "python/sample_pyapp/temp": ["1.cpp", "2.cpp"] 
       }

Dependent Libraries

You must compile any dependent libraries available in the dependent libraries (dep-libs) section. The library generated from this JSON code is packaged with the application. The dep-libs section is an array of multiple library dependencies, each composed of the following key-name pairs:

  • "lib-name" is the name of the library.

  • "lib-path" is the path of the library source code in the development sandbox.

  • "srcs" is a key-value pair in which the path is the key and its value is a list of source files.

The following is an example of a dep-libs attribute:

Dependent Python Modules

The dependent Python modules (dep-py-modules) attribute is used only for Python applications. This attribute contains any dependent Python modules that need to be compiled and packaged with the application. The dep-py-modules attribute is an array in which you can specify multiple Python module dependencies. Each dependency is composed of the following objects:

  • "py-module-name" is the name of the Python module.

  • "py-module-path" is the path of the Python module source code in the development sandbox.

  • "srcs" is a key-value pair in which the path is the key and its value is a list of source files.

  • "extn-srcs" is a key-value pair in which the path is the key and its value is a list of Python extension source files.

The following is an example of a dep-py-modules attribute: