Exemple #1
0
def step_impl(context):
    print("/!\\/!\\ Facts YAML file should be equal to o0303 /!\\/!\\")
    assert not _compare_facts(host_keys=FACTS_DATA_HOST_KEY,
                              hostname="leaf05",
                              groups=['ios'],
                              facts_host_data=context.o0303,
                              test=True)
Exemple #2
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()
Exemple #3
0
def step_impl(context):
    assert _compare_facts(host_keys=FACTS_DATA_HOST_KEY,
                          hostname="leaf02",
                          groups=['nxos'],
                          facts_host_data=context.o0704,
                          test=True)
Exemple #4
0
def step_impl(context):
    assert _compare_facts(host_keys=FACTS_DATA_HOST_KEY,
                          hostname="spine03",
                          groups=['iosxr'],
                          facts_host_data=context.o0404,
                          test=True)