diff --git a/.readthedocs.yaml b/.readthedocs.yaml index b758f18..628e4a7 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -18,10 +18,10 @@ sphinx: # Python requirements required to build the docs python: install: - - method: pip - path: . - method: pip path: . extra_requirements: - docs + - method: pip + path: . system_packages: true diff --git a/tests/Data/SAMPLE_ARISTA_EOS_IP/arista_eos/ceos1.txt b/tests/Data/SAMPLE_ARISTA_EOS_IP/arista_eos/ceos1.txt new file mode 100644 index 0000000..85ee0d3 --- /dev/null +++ b/tests/Data/SAMPLE_ARISTA_EOS_IP/arista_eos/ceos1.txt @@ -0,0 +1,93 @@ +ceos1#show run +! Command: show running-config +! device: ceos1 (cEOSLab, EOS-4.26.0F-21792469.4260F (engineering build)) +! +transceiver qsfp default-mode 4x10G +! +service routing protocols model ribd +! +agent Bfd shutdown +agent PowerManager shutdown +agent LedPolicy shutdown +agent Thermostat shutdown +agent PowerFuse shutdown +agent StandbyCpld shutdown +agent LicenseManager shutdown +! +no logging console +logging host 1.1.1.1 514 +logging host 1.2.3.4 514 +logging host 1.2.3.5 514 +logging host 1.2.3.6 514 +logging host 2.2.2.2 514 +logging host 4.3.2.1 514 +logging host 5.5.5.5 514 +logging host 7.7.7.7 514 +logging host 9.9.9.9 514 +! +logging level AAA informational +! +hostname ceos1 +! +ntp server 1.1.1.1 +ntp server 1.1.1.2 +ntp server 1.1.1.10 +ntp server 1.1.1.11 +ntp server 2.2.2.2 +ntp server 2.2.2.3 +ntp server 3.3.3.3 +ntp server 3.3.3.4 +ntp server 4.3.2.1 +ntp server 6.6.6.6 +ntp server 7.7.7.7 +ntp server 7.7.7.8 +! +snmp-server location "North West Hall DC1" +snmp-server local-interface Ethernet1 +snmp-server host 1.2.3.4 version 2c test +snmp-server host 1.2.3.5 version 2c test +! +spanning-tree mode mstp +! +no aaa root +! +username nornir privilege 15 secret sha512 $6$EkriX8oB5g3Midq4$ErOpqzIWT7FxiW1IkSNQKS8gEqsn9HsbRVm8.Zw47y3Xm9a.GywP9zPF/avyTBBS8c5/ZSMMj/6BHL64KcW2I1 +! +interface Ethernet1 + description Configured by NETCONF + mtu 9200 + no switchport + ip address 10.0.1.4/24 +! +interface Loopback1 + ip address 1.1.1.1/24 +! +interface Loopback2 + description Lopback2 for Customer 27123 + ip address 2.2.2.2/24 +! +interface Loopback3 + description Customer #56924 service + ip address 1.2.3.4/24 +! +interface Loopback1000 +! +no ip routing +! +management api http-commands + protocol http + no shutdown +! +management api gnmi + transport grpc default +! +management api netconf + transport ssh def +! +end +ceos1# show ip arp vrf all + +VRF: default +Address Age (sec) Hardware Addr Interface +10.0.1.3 0:00:16 0242.0a00.0103 Ethernet1 +ceos1# \ No newline at end of file diff --git a/tests/Data/SAMPLE_ARISTA_EOS_IP/arista_eos/ceos2.txt b/tests/Data/SAMPLE_ARISTA_EOS_IP/arista_eos/ceos2.txt new file mode 100644 index 0000000..43496d3 --- /dev/null +++ b/tests/Data/SAMPLE_ARISTA_EOS_IP/arista_eos/ceos2.txt @@ -0,0 +1,90 @@ +ceos2#show run +! Command: show running-config +! device: ceos2 (cEOSLab, EOS-4.26.0F-21792469.4260F (engineering build)) +! +transceiver qsfp default-mode 4x10G +! +service routing protocols model ribd +! +agent Bfd shutdown +agent PowerManager shutdown +agent LedPolicy shutdown +agent Thermostat shutdown +agent PowerFuse shutdown +agent StandbyCpld shutdown +agent LicenseManager shutdown +! +no logging console +logging host 1.1.1.2 514 +logging host 1.2.3.4 514 +logging host 1.2.3.5 514 +logging host 1.2.3.6 514 +logging host 2.2.2.1 514 +logging host 4.3.2.1 514 +logging host 5.5.5.5 514 +logging host 7.7.7.7 514 +logging host 9.9.9.9 514 +! +hostname ceos2 +! +ntp server 1.1.1.1 +ntp server 1.1.1.2 +ntp server 1.1.1.10 +ntp server 1.2.3.4 +ntp server 2.2.2.2 +ntp server 2.2.2.3 +ntp server 3.3.3.3 +ntp server 3.3.3.4 +ntp server 4.3.2.1 +ntp server 6.6.6.6 +ntp server 7.7.7.7 +ntp server 7.7.7.8 +! +snmp-server location "East City Warehouse" +snmp-server local-interface Ethernet1 +snmp-server host 1.2.3.4 version 2c test +snmp-server host 1.2.3.5 version 2c test +! +spanning-tree mode mstp +! +no aaa root +! +username nornir privilege 15 secret sha512 $6$EkriX8oB5g3Midq4$ErOpqzIWT7FxiW1IkSNQKS8gEqsn9HsbRVm8.Zw47y3Xm9a.GywP9zPF/avyTBBS8c5/ZSMMj/6BHL64KcW2I1 +! +interface Ethernet1 + description Configured by NETCONF + mtu 9200 + no switchport + ip address 10.0.1.5/24 +! +interface Loopback100 + description MGMT Range xYz + ip address 100.12.3.4/22 +! +interface Loopback101 + description NTU workstation service + ip address 1.101.2.2/32 +! +interface Loopback102 + description Customer ID 67123A5 + ip address 5.5.5.5/24 +! +no ip routing +! +management api http-commands + protocol http + no shutdown +! +management api gnmi + transport grpc default +! +management api netconf + transport ssh def +! +end +ceos2# show ip arp vrf all + +VRF: default +Address Age (sec) Hardware Addr Interface +10.0.1.3 0:00:32 0242.0a00.0103 Ethernet1 +ceos2# \ No newline at end of file diff --git a/tests/Output/should_be_test_ip_drawing_yed_data_dict_arista_eos.graphml b/tests/Output/should_be_test_ip_drawing_yed_data_dict_arista_eos.graphml new file mode 100644 index 0000000..cece53e --- /dev/null +++ b/tests/Output/should_be_test_ip_drawing_yed_data_dict_arista_eos.graphml @@ -0,0 +1,265 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ceos1Device + + {"id": "ceos1"} + + + + + + + 10.0.1.0/24Subnet + + {"id": "10.0.1.0/24"} + + + + + + + 10.0.1.3ARP entry + + { + "ARP:ceos1:Eth1": { + "age": "0:00:16", + "ip": "10.0.1.3", + "mac": "02:42:0a:00:01:03" + }, + "ARP:ceos2:Eth1": { + "age": "0:00:32", + "ip": "10.0.1.3", + "mac": "02:42:0a:00:01:03" + } +}{"id": "10.0.1.0/24:10.0.1.3"} + + + + + + + 1.1.1.0/24Subnet + + {"id": "1.1.1.0/24"} + + + + + + + 2.2.2.0/24Subnet + + {"id": "2.2.2.0/24"} + + + + + + + 1.2.3.0/24Subnet + + {"id": "1.2.3.0/24"} + + + + + + + ceos2Device + + {"id": "ceos2"} + + + + + + + 100.12.0.0/22Subnet + + {"id": "100.12.0.0/22"} + + + + + + + 1.101.2.2/32Lo101global + + {"id": "1.101.2.2/32"} + + + + + + + 5.5.5.0/24Subnet + + {"id": "5.5.5.0/24"} + + + + + + 10.0.1.4/24 + + + { + "ceos1:Eth1": { + "ip": "10.0.1.4", + "netmask": "24", + "network": "10.0.1.0/24", + "port_description": "Configured by NETCONF" + } +}{"sid": "10.0.1.0/24", "tid": "ceos1", "id": "d6cb425b615bbb60753f91755454120d"} + + + + + + + + {"sid": "10.0.1.0/24:10.0.1.3", "tid": "10.0.1.0/24", "id": "6894e63a978239f83a897e80a9d7f53c"} + + + + + + 1.1.1.1/24 + + + { + "ceos1:Lo1": { + "ip": "1.1.1.1", + "netmask": "24", + "network": "1.1.1.0/24" + } +}{"sid": "1.1.1.0/24", "tid": "ceos1", "id": "3b6921daca628c16f39384d2ff428689"} + + + + + + 2.2.2.2/24 + + + { + "ceos1:Lo2": { + "ip": "2.2.2.2", + "netmask": "24", + "network": "2.2.2.0/24", + "port_description": "Lopback2 for Customer 27123" + } +}{"sid": "2.2.2.0/24", "tid": "ceos1", "id": "c67cdcd47e7cb2eca9f9789add0934e2"} + + + + + + 1.2.3.4/24 + + + { + "ceos1:Lo3": { + "ip": "1.2.3.4", + "netmask": "24", + "network": "1.2.3.0/24", + "port_description": "Customer #56924 service" + } +}{"sid": "1.2.3.0/24", "tid": "ceos1", "id": "815fd916d2b571a12c01d2e85b8369ad"} + + + + + + 10.0.1.5/24 + + + { + "ceos2:Eth1": { + "ip": "10.0.1.5", + "netmask": "24", + "network": "10.0.1.0/24", + "port_description": "Configured by NETCONF" + } +}{"sid": "10.0.1.0/24", "tid": "ceos2", "id": "79876d8391cd2ee45083cd61b221a403"} + + + + + + 100.12.3.4/22 + + + { + "ceos2:Lo100": { + "ip": "100.12.3.4", + "netmask": "22", + "network": "100.12.0.0/22", + "port_description": "MGMT Range xYz" + } +}{"sid": "100.12.0.0/22", "tid": "ceos2", "id": "3f9945273dc46dcf3848dc7065e41e95"} + + + + + + + + { + "ceos2:Lo101": { + "ip": "1.101.2.2", + "netmask": "32", + "network": "1.101.2.2/32", + "port_description": "NTU workstation service" + } +}{"sid": "1.101.2.2/32", "tid": "ceos2", "id": "5555ac8694419646202a80abcdf7ee3c"} + + + + + + 5.5.5.5/24 + + + { + "ceos2:Lo102": { + "ip": "5.5.5.5", + "netmask": "24", + "network": "5.5.5.0/24", + "port_description": "Customer ID 67123A5" + } +}{"sid": "5.5.5.0/24", "tid": "ceos2", "id": "ece914370596f178456878d8253b690b"} + + + + + \ No newline at end of file diff --git a/tests/test_cli_ip_data_plugin.py b/tests/test_cli_ip_data_plugin.py index 46e0c3c..cc6774b 100644 --- a/tests/test_cli_ip_data_plugin.py +++ b/tests/test_cli_ip_data_plugin.py @@ -762,4 +762,23 @@ def test_ip_drawing_yed_data_dict_cisco_xr(): with open("./Output/should_be_test_ip_drawing_yed_data_dict_cisco_xr.graphml") as should_be: assert normalize_xml(produced.read()) == normalize_xml(should_be.read()) -# test_ip_drawing_yed_data_dict_cisco_xr() \ No newline at end of file +# test_ip_drawing_yed_data_dict_cisco_xr() + + + +def test_ip_drawing_yed_data_dict_arista_eos(): + data = {"arista_eos": []} + with open("./Data/SAMPLE_ARISTA_EOS_IP/arista_eos/ceos1.txt") as f: + data["arista_eos"].append(f.read()) + with open("./Data/SAMPLE_ARISTA_EOS_IP/arista_eos/ceos2.txt") as f: + data["arista_eos"].append(f.read()) + config = {"add_arp": True} + drawing = create_yed_diagram() + drawer = cli_ip_data(drawing, **config) + drawer.work(data) + drawer.drawing.dump_file(filename="test_ip_drawing_yed_data_dict_arista_eos.graphml", folder="./Output/") + with open ("./Output/test_ip_drawing_yed_data_dict_arista_eos.graphml") as produced: + with open("./Output/should_be_test_ip_drawing_yed_data_dict_arista_eos.graphml") as should_be: + assert normalize_xml(produced.read()) == normalize_xml(should_be.read()) + +# test_ip_drawing_yed_data_dict_arista_eos() \ No newline at end of file