From c5ac91429b39750d9e8ec8b9ed8635feb9e9be1e Mon Sep 17 00:00:00 2001 From: Fabrizio Chessa Date: Fri, 5 Dec 2025 00:42:41 +0100 Subject: [PATCH] Update YAML configurations and improve .gitignore for workshop files --- .gitignore | 10 +++++- .../disaster_yamls/csr/csr1000v-1.yaml | 30 +++++++++------- .../disaster_yamls/nxos/nx-osv-1.yaml | 27 +++++++++------ .../initial_yamls/csr/csr1000v-1.yaml | 34 +++++++++++-------- .../initial_yamls/nxos/nx-osv-1.yaml | 31 +++++++++++------ robot_compare_snapshot.robot | 6 ++-- robot_initial_snapshot.robot | 4 +-- workshop.md | 4 +-- 8 files changed, 89 insertions(+), 57 deletions(-) diff --git a/.gitignore b/.gitignore index ba783ee..06e45cc 100644 --- a/.gitignore +++ b/.gitignore @@ -110,4 +110,12 @@ pts_json pts.json # diff files -diff_* \ No newline at end of file +diff_* + +# labs created by workshop +disaster/ +learnt/ +diff/ +initial_output/ +current_output/ +parser_diff/ \ No newline at end of file diff --git a/mocked_devices/disaster_yamls/csr/csr1000v-1.yaml b/mocked_devices/disaster_yamls/csr/csr1000v-1.yaml index 6d08edb..d1bfca9 100644 --- a/mocked_devices/disaster_yamls/csr/csr1000v-1.yaml +++ b/mocked_devices/disaster_yamls/csr/csr1000v-1.yaml @@ -1,11 +1,13 @@ execute: commands: - "config term": + config term: new_state: config - "term length 0": "" - "term width 511": "" - "term width 0": "" - "terminal session-timeout 0": "" + term length 0: "" + term width 511: "" + term width 0: "" + terminal session-timeout 0: "" + service result: "" + no logging console: "" dir: "Directory of bootflash:/\r\n\r\n 11 drwx 16384 Jul 18 2018\ \ 07:49:17 +00:00 lost+found\r\n325121 drwx 4096 Jan 18 2019\ \ 20:42:46 +00:00 .installer\r\n 12 -rw- 392479704 Jul 18 2018 07:50:04\ @@ -283,8 +285,8 @@ execute: \n\r\n% dampening not enabled for base\r\n\r\nFor address family: MVPNv4 Unicast\r\ \n\r\n% dampening not enabled for base\r\n\r\nFor address family: MVPNv6 Unicast\r\ \n\r\n% dampening not enabled for base" - 'show ip bgp template peer-policy ': No templates configured - 'show ip bgp template peer-session ': No templates configured + show ip bgp template peer-policy: No templates configured + show ip bgp template peer-session: No templates configured show ip igmp groups detail: "\r\nFlags: L - Local, U - User, SG - Static Group,\ \ VG - Virtual Group,\r\n SS - Static Source, VS - Virtual Source,\r\n\ \ Ac - Group accounted towards access control limit" @@ -848,16 +850,18 @@ execute: \ hard disk at bootflash:.\r\n0K bytes of WebUI ODM Files at webui:.\r\n\r\n\ Configuration register is 0x2102" show vlan: "show vlan\r\n% Incomplete command." + show version | include operating mode: "" show vrf detail: '' show vrf detail | inc \(VRF: '' - prompt: switch# + prompt: "csr1000v-1#" config: prompt: "csr1000v-1(config)#" commands: - "no logging console": "" - "line console 0": "" - "exec-timeout 0": "" - "terminal width 511": "" - "end": + no logging console: "" + line console 0: "" + line vty 0 4: "" + exec-timeout 0: "" + terminal width 511: "" + end: new_state: execute \ No newline at end of file diff --git a/mocked_devices/disaster_yamls/nxos/nx-osv-1.yaml b/mocked_devices/disaster_yamls/nxos/nx-osv-1.yaml index 01c7945..f48a1e4 100644 --- a/mocked_devices/disaster_yamls/nxos/nx-osv-1.yaml +++ b/mocked_devices/disaster_yamls/nxos/nx-osv-1.yaml @@ -1,10 +1,13 @@ execute: commands: - "term length 0": "" - "term width 511": "" - "term width 0": "" - "terminal session-timeout 0": "" - "config term": + term length 0: "" + term width 511: "" + term width 0: "" + terminal session-timeout 0: "" + service result: "" + no logging console: "" + line vty: "" + config term: new_state: config dir: " 4096 Feb 25 20:49:04 2016 .patch/\r\n 16384 Feb 25 20:44:49\ \ 2016 lost+found/\r\n 4096 Feb 26 10:11:16 2016 scripts/\r\n 33615360\ @@ -4856,14 +4859,16 @@ execute: \ 1 --\r\nEthernet3/48 default \ \ 1 --\r\nmgmt0 management \ \ 2 --" - prompt: switch# + prompt: "nx-osv-1#" config: prompt: "nx-osv-1(config)#" commands: - "no logging console": "" - "line console": "" - "exec-timeout 0": "" - "terminal width 511": "" - "end": + no logging console: "" + line console: "" + line vty: "" + exec-timeout 0: "" + terminal width 511: "" + service result: "" + end: new_state: execute \ No newline at end of file diff --git a/mocked_devices/initial_yamls/csr/csr1000v-1.yaml b/mocked_devices/initial_yamls/csr/csr1000v-1.yaml index 76ee5e6..594fb52 100644 --- a/mocked_devices/initial_yamls/csr/csr1000v-1.yaml +++ b/mocked_devices/initial_yamls/csr/csr1000v-1.yaml @@ -1,11 +1,13 @@ execute: commands: - "config term": + config term: new_state: config - "term length 0": "" - "term width 511": "" - "term width 0": "" - "terminal session-timeout 0": "" + term length 0: "" + term width 511: "" + term width 0: "" + terminal session-timeout 0: "" + service result: "" + no logging console: "" dir: "Directory of bootflash:/\r\n\r\n 11 drwx 16384 Jul 18 2018\ \ 07:49:17 +00:00 lost+found\r\n325121 drwx 4096 Jan 18 2019\ \ 20:42:46 +00:00 .installer\r\n 12 -rw- 392479704 Jul 18 2018 07:50:04\ @@ -283,8 +285,8 @@ execute: \n\r\n% dampening not enabled for base\r\n\r\nFor address family: MVPNv4 Unicast\r\ \n\r\n% dampening not enabled for base\r\n\r\nFor address family: MVPNv6 Unicast\r\ \n\r\n% dampening not enabled for base" - 'show ip bgp template peer-policy ': No templates configured - 'show ip bgp template peer-session ': No templates configured + show ip bgp template peer-policy: "No templates configured" + show ip bgp template peer-session: "No templates configured" show ip igmp groups detail: "\r\nFlags: L - Local, U - User, SG - Static Group,\ \ VG - Virtual Group,\r\n SS - Static Source, VS - Virtual Source,\r\n\ \ Ac - Group accounted towards access control limit" @@ -884,16 +886,20 @@ execute: \ hard disk at bootflash:.\r\n0K bytes of WebUI ODM Files at webui:.\r\n\r\n\ Configuration register is 0x2102" show vlan: "show vlan\r\n% Incomplete command." - show vrf detail: '' + show version | include operating mode: "" + show install summary: "" + show vrf: "" + show vrf detail: "" show vrf detail | inc \(VRF: '' - prompt: switch# + prompt: "csr1000v-1#" config: prompt: "csr1000v-1(config)#" commands: - "no logging console": "" - "line console 0": "" - "exec-timeout 0": "" - "terminal width 511": "" - "end": + no logging console: "" + line console 0: "" + line vty 0 4: "" + exec-timeout 0: "" + terminal width 511: "" + end: new_state: execute \ No newline at end of file diff --git a/mocked_devices/initial_yamls/nxos/nx-osv-1.yaml b/mocked_devices/initial_yamls/nxos/nx-osv-1.yaml index 3cddb10..eb12238 100644 --- a/mocked_devices/initial_yamls/nxos/nx-osv-1.yaml +++ b/mocked_devices/initial_yamls/nxos/nx-osv-1.yaml @@ -1,10 +1,13 @@ execute: commands: - "term length 0": "" - "term width 511": "" - "term width 0": "" - "terminal session-timeout 0": "" - "config term": + term length 0: "" + term width 511: "" + term width 0: "" + terminal session-timeout 0: "" + service result: "" + no logging console: "" + line vty: "" + config term: new_state: config dir: " 4096 Feb 25 20:49:04 2016 .patch/\r\n 16384 Feb 25 20:44:49\ \ 2016 lost+found/\r\n 4096 Feb 26 10:11:16 2016 scripts/\r\n 33615360\ @@ -4766,6 +4769,10 @@ execute: \ -------------------------------------------" show vlan id 1-3967 vn-segment: " ^\r\n% Invalid\ \ command at '^' marker." + show vrf all: "VRF-Name VRF-ID State Reason \ + \ \r\ndefault 1 Up -- \ + \ \r\nmanagement 2 Up \ + \ --" show vrf: "VRF-Name VRF-ID State Reason \ \ \r\ndefault 1 Up -- \ \ \r\nmanagement 2 Up \ @@ -4875,14 +4882,16 @@ execute: \ 1 --\r\nEthernet3/48 default \ \ 1 --\r\nmgmt0 management \ \ 2 --" - prompt: switch# + prompt: "nx-osv-1#" config: prompt: "nx-osv-1(config)#" commands: - "no logging console": "" - "line console": "" - "exec-timeout 0": "" - "terminal width 511": "" - "end": + no logging console: "" + line console: "" + line vty: "" + exec-timeout 0: "" + terminal width 511: "" + service result: "" + end: new_state: execute \ No newline at end of file diff --git a/robot_compare_snapshot.robot b/robot_compare_snapshot.robot index 4c3dbf5..e5e5d6e 100644 --- a/robot_compare_snapshot.robot +++ b/robot_compare_snapshot.robot @@ -3,8 +3,8 @@ *** Settings *** # Importing test libraries, resource files and variable files. -Library genie.libs.robot.GenieRobot Library pyats.robot.pyATSRobot +Library genie.libs.robot.GenieRobot *** Variables *** @@ -23,7 +23,7 @@ Connect connect to device "csr1000v-1" Profile the devices - Profile the system for "bgp;config;interface;platform;ospf;arp;vrf;vlan" on devices "nx-osv-1;csr1000v-1" as "./new_snapshot" + Profile the system for "bgp;config;interface;platform;ospf;arp;vrf;vlan" on devices "nx-osv-1;csr1000v-1" as "./disaster_snapshot/snap" Compare snapshots - Compare profile "./good_snapshot" with "./new_snapshot" on devices "nx-osv-1;csr1000v-1" + Compare profile "./good_snapshot/snap" with "./disaster_snapshot/snap" on devices "nx-osv-1;csr1000v-1" diff --git a/robot_initial_snapshot.robot b/robot_initial_snapshot.robot index 218b914..3fa035d 100644 --- a/robot_initial_snapshot.robot +++ b/robot_initial_snapshot.robot @@ -3,8 +3,8 @@ *** Settings *** # Importing test libraries, resource files and variable files. -Library genie.libs.robot.GenieRobot Library pyats.robot.pyATSRobot +Library genie.libs.robot.GenieRobot *** Variables *** @@ -23,4 +23,4 @@ Connect connect to device "csr1000v-1" Profile the devices - Profile the system for "bgp;config;interface;platform;ospf;arp;vrf;vlan" on devices "nx-osv-1;csr1000v-1" as "./good_snapshot" + Profile the system for "bgp;config;interface;platform;ospf;arp;vrf;vlan" on devices "nx-osv-1;csr1000v-1" as "./good_snapshot/snap" diff --git a/workshop.md b/workshop.md index 912a3c2..dd78449 100644 --- a/workshop.md +++ b/workshop.md @@ -148,12 +148,12 @@ disastrous state, under the `disaster` folder. Now, perform a diff of the states before and after disaster occurance. ```bash -pyats diff learnt disaster +pyats diff learnt disaster --output diff ``` You can clearly see that the OSPF and interface operational state has changed. -With an editor, open the two files: +With an editor, open the two files under `diff` folder: * `diff_interface_nxos_nx-osv-1_ops.txt` * `diff_ospf_nxos_nx-osv-1_ops.txt`