guides:user:scenarios:scn_cond_loop
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| guides:user:scenarios:scn_cond_loop [2019/12/24 08:33] – created bdorlandt | guides:user:scenarios:scn_cond_loop [2024/07/03 12:31] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Scenario with conditionals and a loop ===== | ||
| + | |||
| + | < | ||
| + | # Comments that follow after a hash will be ignored | ||
| + | [parameters] | ||
| + | # Assign a static value | ||
| + | ring_node = rng00cs01 | ||
| + | version = "ipvpn 1.1" | ||
| + | |||
| + | [scenario] | ||
| + | # assign a value, which could be changed later on | ||
| + | <cpe> := switch1 | ||
| + | # create a list | ||
| + | < | ||
| + | < | ||
| + | # create a list of nodes from a relation | ||
| + | < | ||
| + | |||
| + | |||
| + | Description <cpe> test scenario | ||
| + | |||
| + | config_create -n <cpe> -t ring_interface -f < | ||
| + | if < | ||
| + | log -m " | ||
| + | < | ||
| + | else | ||
| + | < | ||
| + | endif | ||
| + | |||
| + | # foreach loop | ||
| + | log -m " | ||
| + | foreach < | ||
| + | log -m " | ||
| + | if "< | ||
| + | log -m " | ||
| + | next | ||
| + | endif | ||
| + | | ||
| + | # or: if ! < | ||
| + | if "< | ||
| + | log -m " | ||
| + | last | ||
| + | endif | ||
| + | | ||
| + | config_create -n <cpe> -t pe_template -f < | ||
| + | if < | ||
| + | log -m " | ||
| + | < | ||
| + | else | ||
| + | < | ||
| + | endif | ||
| + | | ||
| + | foreach <tmp> in < | ||
| + | log -m "node <tmp> is on done list" | ||
| + | endeach | ||
| + | log -m " | ||
| + | endeach | ||
| + | |||
| + | log -m " | ||
| + | |||
| + | if < | ||
| + | log -m " | ||
| + | stop | ||
| + | endif | ||
| + | </ | ||