Variables

To further extend the use of Add-Ins we have the possibility to use variables. These can be used as read-only values within Add-In scripts.

A variable consists of

  • name
  • type
  • value

A variable can be set/overwritten on the following levels, with ascending order:

  • Location
  • Network
  • Device

For this, open the respective Variables view, and add the defined variables.

Defining a Variable Type

A variable is either of type string or can have a custom type.

To define a new type click on the Variable Types button.

Next, click on Add new type.

Give the type a name (e.g. Switch), and add a number of selectable variable values, for example:

  • enabled -> on
  • disabled -> off

Click on Save to save your variable type.

Review your types, then close the dialog to return to the variables page.

Defining a Variable

To define a new variable click on the Variable definition button. Provide a variable name and select the variable type from the drop down list.

Select the default value of the variable from the previously defined selections of the variable type. Select the checkbox Use as password if you want to hide the contents within the UI with asterisks (***).

Click on the checkbox to save your variable definition.

Using variables

Now, you can use your variable in the following way:

exports.main = function (config, context) {

     // access the variables value:
     if (context.vars.wlanState == "on") {
          // TODO: enable wlan interface here
     }

};

System variables

System variables manage specific aspects of the smart configuration.

  • All System variables (with the exception of the variable UF_DEFAULT_IF) can be modified in the Project specifications.
  • System variables cannot be modified by Add-in scripts (Read-Only).
  • System variables are only available for the Network and Device layers.
  • System variables can only be used for status queries (the configuration is to be rolled out, if the System variable equals a certain value).

Example for a status query: The following code snippet shows the general approach for a status query. Change the variables “Systemvariable” and “Value” according to your needs. Enter the actual Addin code under the commented line “Code will be executed, if variable is met.”.

/**
 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
*/
 exports.main = function (config, context) {

     if Systemvariable == ("Value"){

            //Code will be executed, if variable is met.

     };

};

Available System variables:

  • INITIAL_TEST_MODE_ENABLED:

    • Enables a 300 second test mode for initial configuration rollout (enabled by default).
    • Can be modified with the setting Testmode after initial configuration rollout in the menu Project specifications -> Device startup.
  • PASSWORD:

    • Global Main device password.
    • Can be modified in the menu Project specifications -> Basic.
  • UF_CLEAR_DEFAULT_CFG:

    • Disables default interfaces of a Unified Firewall during configuration rollout (disabled by default).
    • Can be modified with the setting Disable default networks during configuration rollout to LANCOM R&S®Unified Firewalls in the menu Project specifications -> Device startup.
  • UF_DEFAULT_IF:

    • Default interface for network rollout via the LANCOM Management Cloud.
    • The default interface is eth1 and can only be changed via the API.
  • LMC_DOMAIN:

    • URL setting for private LMC instances.
  • UF_ETH0_NETWORKS ... UF_ETH10_NETWORKS:

    • Network assignment to ETH port of the Unified Firewalls.
  • VPN_IDENTITY_SEPARATOR:

    • Symbol used for the automatic VPN creation: (e.g with the default "@": ALL@HQ__).

results matching ""

    No results matching ""