def compare_config(self, protocols_selected) -> None: self.call_get_generic(protocols_selected) w = list() for prot in protocols_selected.split(','): for d in self.devices: if prot.lower() == "vrf": r = _compare_vrf( host_keys=self.nornir.inventory.hosts[d].keys(), hostname=d, groups=self.nornir.inventory.hosts[d].groups, vrf_host_data=self.nornir.inventory.hosts.get(d).get( VRF_DATA_KEY)) if r: w.append(d) elif prot.lower() == "facts": r = _compare_facts( host_keys=self.nornir.inventory.hosts[d].keys(), hostname=d, groups=self.nornir.inventory.hosts[d].groups, facts_host_data=self.nornir.inventory.hosts.get(d).get( FACTS_DATA_HOST_KEY)) if r: w.append(d) elif prot.lower() == "bgp": r = _compare_bgp( host_keys=self.nornir.inventory.hosts[d].keys(), hostname=d, groups=self.nornir.inventory.hosts[d].groups, bgp_host_data=self.nornir.inventory.hosts.get(d).get( BGP_SESSIONS_HOST_KEY)) if r: w.append(d) else: print(f"@({prot}) is unavailable from CLI.") printline() print("@The following devices have the same configuration " f"that defined in the source of truth : \n@{w}.") printline()
def step_impl(context): assert _compare_vrf(host_keys=VRF_DATA_KEY, hostname="leaf03", groups=['eos'], vrf_host_data=context.o0004, test=True)
def step_impl(context): assert _compare_vrf(host_keys=VRF_DATA_KEY, hostname="spine03", groups=['iosxr'], vrf_host_data=context.o0404, test=True)
def step_impl(context): assert _compare_vrf(host_keys=VRF_DATA_KEY, hostname="spine02", groups=['extreme_vsp'], vrf_host_data=context.o0204, test=True)
def step_impl(context): assert _compare_vrf(host_keys=VRF_DATA_KEY, hostname="leaf01", groups=['linux'], vrf_host_data=context.o0102, test=True)