guides:user:scenarios:scn_cond_loop
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 <pe_nodes> := <hostname@local_pe_nodes> <pe_nodes> += <cpe> # create a list of nodes from a relation <ring_nodes> += <hostname@local_ring_nodes> Description <cpe> test scenario config_create -n <cpe> -t ring_interface -f <ring_node>.cfg if <error> log -m "failed to create cpe <cpe> config" <fail> += <cpe> else <done> += <cpe> endif # foreach loop log -m "creating config pe-nodes" foreach <pe_node> in <pe_nodes> log -m "pe-node: <pe-node>" if "<pe_node> == <cpe>" log -m "skipping cpe <cpe> node as pe-node" next endif # or: if ! <pe_node> if "<pe_node> == ''" log -m "aborting on blank pe-node" last endif config_create -n <cpe> -t pe_template -f <pe_node>.cfg if <error> log -m "failed to gen cfg for pe-node <pe_node>" <fail> += <pe_node> else <done> += <pe_node> endif foreach <tmp> in <done> log -m "node <tmp> is on done list" endeach log -m "starting next loop" endeach log -m "generated configs for: <done>" if <fail> log -m "failed configs for: <fail>" stop endif
guides/user/scenarios/scn_cond_loop.txt · Last modified: 2024/07/03 12:31 by 127.0.0.1