Deutsch |
---|
Beschreibung:Dieses Skript zeigt, wie man mit Listen von Werten in Variablen umgeht. Liste der verwendeten Variablen:Add-in Code: |
This script shows a way to handle lists of values inside variables.
english
// Store lists as comma (,) separated values: |
---|
// REMOTE_NAMES = name001,name002,name003,name004,... |
---|
// HINT: no spaces in the above! |
---|
// HINT: make sure both lists have the same length! |
---|
// HINT: both lists need to be ordered, such that each entry at position 'index' corresponds to the other (001 -> name001, ...) |
---|
// split the lists into javascript arrays: |
---|
var serials = context.vars.REMOTE_SERIALS.split(","); |
---|
var names = context.vars.REMOTE_NAMES.split(","); |
---|
serials.forEach(function (serial, index) { |
---|
// Exmaple: Set add a table row for each serial: |
---|
// /Setup/VPN/Certificates-and-Keys/IKE-Keys -> 1.2.19.5.3 |
---|
var ikeKeysTable = config.getTableByOid("1.2.19.5.3"); |
---|
var ikeKeysTableRow = ikeKeysTable.createNewRow(); |
---|
ikeKeysTableRow.setByOids({ |
---|
// access the other list via index: |
---|
: 16 chars from ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789 |
---|
6: "9", // Local-ID-Type 6: "9", // Local-ID-Type : No-Identity (0), IPv4-Address (1), IPv6-Address (5), Domain-Name (2), Email-Address (3), Distinguished-Name (9), Key-ID (11) 7: "VPN3", // Local-Identity : 254 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!"$%&'()*+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz ` 5: "9", // Remote-ID-Type : No-Identity (0), IPv4-Address (1), IPv6-Address (5), Domain-Name (2), Email-Address (3), Distinguished-Name (9), Key-ID (11)
|
---|
2: "serialNumber=" + serial, // Remote-Identity
|
---|
7"VPN3", // Local-Identity : 254from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!"$%&'()*+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz ` 3: "", // Shared-Sec : 64 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~! |
---|
"$%&'()*+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz ` |
---|
5: "9", 4: "" // Shared-Sec-File : 20 chars from ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz` }); ikeKeysTable.addOrMerge(ikeKeysTableRow); });
};
|
---|
Add-in als JSON-Datei: View file |
---|
name | variable_as_list.json |
---|
height | 150 |
---|
|
|
Englisch |
---|
Description:This script shows a way to handle lists of values inside variables. List of used variables:Add-in code:
/** * @param {Config} config * @param {Context} context * Do not edit this comment or parameter types. Required for code suggestions */ exports.main = function (config, context) {
|
---|
// Remote-ID-Type
2: "serialNumber=" + serial, Remote
3: "", // Shared-Sec : 64
4:""
};Add-in as JSON file: View file |
---|
name | variable_as_list.json |
---|
height | 150 |
---|
|
|