Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
def step_impl(context):
    assert _compare_bgp(host_keys=BGP_SESSIONS_HOST_KEY,
                        hostname="leaf05",
                        groups=['ios'],
                        bgp_host_data=context.o0304,
                        test=True)
Ejemplo n.º 3
0
def step_impl(context):
    assert _compare_bgp(host_keys=BGP_SESSIONS_HOST_KEY,
                        hostname="spine02",
                        groups=['extreme_vsp'],
                        bgp_host_data=context.o0204,
                        test=True)