From c293978390dd89a65f87e25c7bb9248020e024a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Torres=20M=C3=ADguez?= Date: Sun, 7 Feb 2021 23:31:05 +0100 Subject: [PATCH] Semana 12- 07/02/2021 --- m01_basics/l_06_comparisons.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/m01_basics/l_06_comparisons.py b/m01_basics/l_06_comparisons.py index c4d128f4..ef189fe6 100644 --- a/m01_basics/l_06_comparisons.py +++ b/m01_basics/l_06_comparisons.py @@ -4,6 +4,7 @@ from random import randint, uniform from datetime import datetime devices = create_devices(num_subnets=2, num_devices=25) +print("\n MUESTRA TODOS LOS DISPOSITIVOS CREADOS: ") print("\n NAME VENDOR : OS IP ADDRESS VERSION") print(" ----- ------- ----- -------------- -----------") for device in devices: @@ -11,6 +12,9 @@ for device in devices: f'{device["name"]:>7} {device["vendor"]:>10} : {device["os"]:<6} {device["ip"]:<15} {device["version"]}' ) + + +print("\n MUESTRA LOS DISPOSITIVOS EXCEPTO CISCO: ") print("\n NAME VENDOR : OS IP ADDRESS VERSION") print(" ----- ------- ----- -------------- -----------") for device in devices: @@ -19,6 +23,8 @@ for device in devices: f'{device["name"]:>7} {device["vendor"]:>10} : {device["os"]:<6} {device["ip"]:<15} {device["version"]}' ) + + print("\n----- Starting comparison of device names --------------------") for index, device_a in enumerate(devices): for device_b in devices[index+1:]: @@ -26,7 +32,10 @@ for index, device_a in enumerate(devices): print(f"Found match! {device_a['name']} for both {device_a['ip']} and {device_b['ip']}") print("----- Comparison of device names completed") -print("\n----- Create table of arbitrary 'standard' versions for each vendor:os - Resumen de versiones --------------------") + + + +print("\n----- Create table of arbitrary 'standard' versions for each vendor:os - Resumen de versiones diferentes --------------------") standard_versions = dict() for device in devices: vendor_os = device["vendor"] + ":" + device["os"] @@ -34,7 +43,10 @@ for device in devices: standard_versions[vendor_os] = device["version"] pprint(standard_versions) -print("\n----- Create list of non-compliant device OS versions for each vendor:os --------------------") + + + +print("\n----- Create list of non-compliant device OS versions for each vendor:os - Versiones diferentes a las standar --------------------") non_compliant_devices = dict() for vendor_os, _ in standard_versions.items(): non_compliant_devices[vendor_os] = [] @@ -46,6 +58,10 @@ for device in devices: pprint(non_compliant_devices) + + + + print("\n\n----- Assignment, copy, and deep copy --------------------") devices2 = devices devices[0]["name"] = "this is a dumb device name" @@ -77,6 +93,9 @@ else: print(" ---> Result: I can do whatever I want with my copy, without touching the original!!") + + + new_set_of_devices = create_devices(num_subnets=2, num_devices=25) if new_set_of_devices == devices: print(" Huh?")