From 394adfbe8f62851cb71528cbc8bb934a7ebb3697 Mon Sep 17 00:00:00 2001 From: Daniel Bacher Date: Thu, 5 Nov 2020 17:13:31 +0100 Subject: [PATCH] add test case get_config_sanitized for SG500-28-K9 see #38 --- .../SG500-28-K9/expected_result.json | 5 + .../SG500-28-K9/show_running_config.txt | 154 ++++++++++++++++++ .../SG500-28-K9/show_startup_config.txt | 154 ++++++++++++++++++ 3 files changed, 313 insertions(+) create mode 100644 test/unit/mocked_data/test_get_config_sanitized/SG500-28-K9/expected_result.json create mode 100644 test/unit/mocked_data/test_get_config_sanitized/SG500-28-K9/show_running_config.txt create mode 100644 test/unit/mocked_data/test_get_config_sanitized/SG500-28-K9/show_startup_config.txt diff --git a/test/unit/mocked_data/test_get_config_sanitized/SG500-28-K9/expected_result.json b/test/unit/mocked_data/test_get_config_sanitized/SG500-28-K9/expected_result.json new file mode 100644 index 0000000..a59ddbb --- /dev/null +++ b/test/unit/mocked_data/test_get_config_sanitized/SG500-28-K9/expected_result.json @@ -0,0 +1,5 @@ +{ + "candidate": "", + "running": "\nssd-control-start\nssd config\nssd file passphrase control unrestricted\nno ssd file integrity control\nssd-control-end cb0a3fdb1f3a1af4e4430033719968c0\n!\nvlan database\nvlan 10,20,30\nexit\nvoice vlan oui-table add 0001e3 Siemens_AG_phone________\nvoice vlan oui-table add 00036b Cisco_phone_____________\nvoice vlan oui-table add 00096e Avaya___________________\nvoice vlan oui-table add 000fe2 H3C_Aolynk______________\nvoice vlan oui-table add 0060b9 Philips_and_NEC_AG_phone\nvoice vlan oui-table add 00d01e Pingtel_phone___________\nvoice vlan oui-table add 00e075 Polycom/Veritel_phone___\nvoice vlan oui-table add 00e0bb 3Com_phone______________\nhostname switch1\nusername cisco password encrypted privilege 15\nip ssh server\nip ssh password-auth\nsnmp-server server\nsnmp-server community \n!\ninterface vlan 10\n ip address 10.0.3.5 255.0.0.0\n!\ninterface gigabitethernet1/1/1\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/2\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/3\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/4\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/5\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/6\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/7\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/8\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/9\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/10\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/11\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/12\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/13\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/14\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/15\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/16\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/17\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/18\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/19\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/20\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/21\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/22\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/23\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/24\n switchport mode access\n switchport access vlan 30\n!\ninterface gigabitethernet1/1/25\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/26\n spanning-tree disable\n spanning-tree link-type point-to-point\n switchport trunk allowed vlan add 10,30\n switchport trunk native vlan 20\n macro description switch\n !next command is internal.\n macro auto smartport dynamic_type switch\n!\ninterface gigabitethernet1/1/27\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/28\n spanning-tree disable\n switchport mode access\n switchport access vlan 20\n!\nexit", + "startup": "\nssd-control-start\nssd config\nssd file passphrase control unrestricted\nno ssd file integrity control\nssd-control-end cb0a3fdb1f3a1af4e4430033719968c0\n!\nvlan database\nvlan 10,20,30\nexit\nvoice vlan oui-table add 0001e3 Siemens_AG_phone________\nvoice vlan oui-table add 00036b Cisco_phone_____________\nvoice vlan oui-table add 00096e Avaya___________________\nvoice vlan oui-table add 000fe2 H3C_Aolynk______________\nvoice vlan oui-table add 0060b9 Philips_and_NEC_AG_phone\nvoice vlan oui-table add 00d01e Pingtel_phone___________\nvoice vlan oui-table add 00e075 Polycom/Veritel_phone___\nvoice vlan oui-table add 00e0bb 3Com_phone______________\nhostname switch1\nusername cisco password encrypted privilege 15\nip ssh server\nip ssh password-auth\nsnmp-server server\nsnmp-server community \n!\ninterface vlan 10\n ip address 10.0.3.5 255.0.0.0\n!\ninterface gigabitethernet1/1/1\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/2\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/3\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/4\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/5\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/6\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/7\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/8\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/9\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/10\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/11\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/12\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/13\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/14\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/15\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/16\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/17\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/18\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/19\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/20\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/21\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/22\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/23\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/24\n switchport mode access\n switchport access vlan 30\n!\ninterface gigabitethernet1/1/25\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/26\n spanning-tree disable\n spanning-tree link-type point-to-point\n switchport trunk allowed vlan add 10,30\n switchport trunk native vlan 20\n macro description switch\n !next command is internal.\n macro auto smartport dynamic_type switch\n!\ninterface gigabitethernet1/1/27\n switchport mode access\n switchport access vlan 20\n!\ninterface gigabitethernet1/1/28\n spanning-tree disable\n switchport mode access\n switchport access vlan 20\n!\nexit" +} diff --git a/test/unit/mocked_data/test_get_config_sanitized/SG500-28-K9/show_running_config.txt b/test/unit/mocked_data/test_get_config_sanitized/SG500-28-K9/show_running_config.txt new file mode 100644 index 0000000..a2c1765 --- /dev/null +++ b/test/unit/mocked_data/test_get_config_sanitized/SG500-28-K9/show_running_config.txt @@ -0,0 +1,154 @@ +config-file-header +switch1 +v1.3.5.58 / R750_NIK_1_35_647_358 +CLI v1.0 +set system mode switch queues-mode 4 + +file SSD indicator encrypted +@ +ssd-control-start +ssd config +ssd file passphrase control unrestricted +no ssd file integrity control +ssd-control-end cb0a3fdb1f3a1af4e4430033719968c0 +! +vlan database +vlan 10,20,30 +exit +voice vlan oui-table add 0001e3 Siemens_AG_phone________ +voice vlan oui-table add 00036b Cisco_phone_____________ +voice vlan oui-table add 00096e Avaya___________________ +voice vlan oui-table add 000fe2 H3C_Aolynk______________ +voice vlan oui-table add 0060b9 Philips_and_NEC_AG_phone +voice vlan oui-table add 00d01e Pingtel_phone___________ +voice vlan oui-table add 00e075 Polycom/Veritel_phone___ +voice vlan oui-table add 00e0bb 3Com_phone______________ +hostname switch1 +username cisco password encrypted dddd5d7b474d2c78ebbb833789c4bfd721edf4bf privilege 15 +ip ssh server +ip ssh password-auth +snmp-server server +snmp-server community findit ro view Default +! +interface vlan 10 + ip address 10.0.3.5 255.0.0.0 +! +interface gigabitethernet1/1/1 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/2 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/3 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/4 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/5 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/6 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/7 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/8 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/9 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/10 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/11 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/12 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/13 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/14 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/15 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/16 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/17 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/18 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/19 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/20 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/21 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/22 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/23 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/24 + switchport mode access + switchport access vlan 30 +! +interface gigabitethernet1/1/25 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/26 + spanning-tree disable + spanning-tree link-type point-to-point + switchport trunk allowed vlan add 10,30 + switchport trunk native vlan 20 + macro description switch + !next command is internal. + macro auto smartport dynamic_type switch +! +interface gigabitethernet1/1/27 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/28 + spanning-tree disable + switchport mode access + switchport access vlan 20 +! +exit diff --git a/test/unit/mocked_data/test_get_config_sanitized/SG500-28-K9/show_startup_config.txt b/test/unit/mocked_data/test_get_config_sanitized/SG500-28-K9/show_startup_config.txt new file mode 100644 index 0000000..a2c1765 --- /dev/null +++ b/test/unit/mocked_data/test_get_config_sanitized/SG500-28-K9/show_startup_config.txt @@ -0,0 +1,154 @@ +config-file-header +switch1 +v1.3.5.58 / R750_NIK_1_35_647_358 +CLI v1.0 +set system mode switch queues-mode 4 + +file SSD indicator encrypted +@ +ssd-control-start +ssd config +ssd file passphrase control unrestricted +no ssd file integrity control +ssd-control-end cb0a3fdb1f3a1af4e4430033719968c0 +! +vlan database +vlan 10,20,30 +exit +voice vlan oui-table add 0001e3 Siemens_AG_phone________ +voice vlan oui-table add 00036b Cisco_phone_____________ +voice vlan oui-table add 00096e Avaya___________________ +voice vlan oui-table add 000fe2 H3C_Aolynk______________ +voice vlan oui-table add 0060b9 Philips_and_NEC_AG_phone +voice vlan oui-table add 00d01e Pingtel_phone___________ +voice vlan oui-table add 00e075 Polycom/Veritel_phone___ +voice vlan oui-table add 00e0bb 3Com_phone______________ +hostname switch1 +username cisco password encrypted dddd5d7b474d2c78ebbb833789c4bfd721edf4bf privilege 15 +ip ssh server +ip ssh password-auth +snmp-server server +snmp-server community findit ro view Default +! +interface vlan 10 + ip address 10.0.3.5 255.0.0.0 +! +interface gigabitethernet1/1/1 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/2 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/3 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/4 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/5 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/6 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/7 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/8 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/9 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/10 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/11 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/12 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/13 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/14 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/15 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/16 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/17 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/18 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/19 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/20 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/21 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/22 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/23 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/24 + switchport mode access + switchport access vlan 30 +! +interface gigabitethernet1/1/25 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/26 + spanning-tree disable + spanning-tree link-type point-to-point + switchport trunk allowed vlan add 10,30 + switchport trunk native vlan 20 + macro description switch + !next command is internal. + macro auto smartport dynamic_type switch +! +interface gigabitethernet1/1/27 + switchport mode access + switchport access vlan 20 +! +interface gigabitethernet1/1/28 + spanning-tree disable + switchport mode access + switchport access vlan 20 +! +exit