guides:user:scenarios:cmd_parse_cisco
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| guides:user:scenarios:cmd_parse_cisco [2019/12/24 08:31] – created bdorlandt | guides:user:scenarios:cmd_parse_cisco [2024/07/03 12:31] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Command parsing on Cisco IOS finding interfaces and ports ===== | ||
| + | |||
| + | The goal of this example is to find interfaces that belong to specific vlans. | ||
| + | |||
| + | Create a new Command Job and save it using a desired name. | ||
| + | |||
| + | ==== Command Job ==== | ||
| + | The job is " | ||
| + | |||
| + | < | ||
| + | ! | ||
| + | </ | ||
| + | |||
| + | ==== Parsing template parsevlan ==== | ||
| + | The command that is used is //show vlan | i user|data// | ||
| + | |||
| + | This parse template will match specifically on the word " | ||
| + | |||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | ==== Parsing template intfnumber ==== | ||
| + | |||
| + | The command //show int switchport | i Name: | ||
| + | |||
| + | In this parsing template and '' | ||
| + | '' | ||
| + | |||
| + | < | ||
| + | Name: < | ||
| + | Access Mode VLAN: < | ||
| + | </ | ||
| + | |||
| + | Make sure to read the [[menu: | ||
| + | ==== Job scenario ==== | ||
| + | < | ||
| + | Description Parsing vlan and interfaces on < | ||
| + | task := scn_parse_vlan_intf | ||
| + | </ | ||
| + | |||
| + | ==== Scenario scn_parse_vlan_intf ==== | ||
| + | < | ||
| + | # Test whether node is live and reachable | ||
| + | reachable -n < | ||
| + | if < | ||
| + | LogAction -n < | ||
| + | stop | ||
| + | endif | ||
| + | LogAction -n < | ||
| + | |||
| + | |||
| + | < | ||
| + | < | ||
| + | |||
| + | foreach < | ||
| + | log -m "vlan: < | ||
| + | | ||
| + | < | ||
| + | |||
| + | < | ||
| + | foreach < | ||
| + | log -m " | ||
| + | log -m "vlan: << | ||
| + | if "<< | ||
| + | log -m " | ||
| + | | ||
| + | config_create -n < | ||
| + | if < | ||
| + | Logaction -n < | ||
| + | Stop | ||
| + | endif | ||
| + | | ||
| + | endeach | ||
| + | endeach | ||
| + | |||
| + | log -m " | ||
| + | config_exec -n < | ||
| + | if < | ||
| + | Logaction -n < | ||
| + | Stop | ||
| + | endif | ||
| + | |||
| + | end | ||
| + | </ | ||
| + | |||
| + | Some things to note: \\ | ||
| + | * '' | ||
| + | * Config is being generated for every interface in addition and once completely done, it will be pushed to the device. | ||
| + | * '' | ||