[Draft] Config Push - new modifiers and actions in 2.4

Beta release announcements and discussion around them
Post Reply
User avatar
Tomas
Posts: 1149
Joined: Sat Jun 25, 2016 12:33 pm

Wed May 03, 2023 12:30 am

Hi everyone,

For 2.4, we are planning to rework how behavior modifiers work in Mass Config Push. This relates to the current way modifiers work, and improves upon the current syntax. We are also introducing a new concept of "actions", which will replace how control sequences are sent currently.

We would love your feedback on the changes. Here is our current plan:

All available macros:

Code: Select all

$() - modifiers and actions
$[] - built-in constants
${} - user variables
Modifiers and actions:
Modifiers: Modifiers are two-word macros and must always be at the end of a line. Multiple consecutive modifiers are allowed. A single modifier can only be declared once.

Code: Select all

Allowed modifiers:
wait-echo, wait-reply, enter, fail-on-error

example: $(enter yes)

valid usage: show version$(enter no)
invalid usage: show $(wait-reply no) version
Actions: Actions are two-word macros and can be placed at any position in a line.

Code: Select all

Allowed actions:
delay, send

example: $(delay 100), $(send 0x01)
Built-in constants:
Constants are single-word macros and can be placed at any position in a line. Only available pre-defined constants can be used. Constants are device's properties, hence a relevant constant will always contain the requested data for each device.

Code: Select all

Available constants:
address, description, vendor, type, model, zone-name, zone-description, zone-id
User variables:
Variables are single-word macros and can be placed at any position in a line. Any variable name (single-word, without space) can be used, and you defines these in GUI (Devices > Variables).

Code: Select all

example: ${foo}, ${bar}

usage example:
interface vlan ${vlan-id}
set description ${vlan-description}
User avatar
Tomas
Posts: 1149
Joined: Sat Jun 25, 2016 12:33 pm

Wed May 03, 2023 12:41 am

The point of these changes is to introduce consistent handling of behavior modifiers, constants and variables in Config Push, and to introduce new things (like the new action concept, and constants as a whole). All modifiers now for example have a default value of "yes", so understanding how they behave should be much easier for new users. As an example,

Code: Select all

show version
is equivalent to

Code: Select all

show version$(wait-echo yes)$(wait-reply yes)$(enter yes)$(fail-on-error yes)
Before 2.4 (in current stable releases), this is a bit more messy, as you have "$[enter]" and "$[no-enter]" as separate macros, and you could for example declare both on a single line, which gets messy fast.

Full documentation for the new macros will be available on the Wiki closer to the 2.4 release. For now, here is an (on purpose complex) example of a combination of all of these concepts in a Config Push preset:

Code: Select all

show firmware
firmware apply os-$[vendor]-$[type]-${os-version}.img$(wait-reply no)
$(delay 1000)y$(delay 1000)y$(enter no)$(wait-echo no)
boot set os-$[vendor]-$[type]-${os-version}.img$(fail-on-error no)
show firmware
reboot now
y$(delay 250)$(enter no)$(wait-echo no)$(wait-reply no)
Post Reply