Beispiel #1
0
    def get_registered(origin: str,
                       target: str,
                       collection: str,
                       name=None) -> "Auditor":

        key = (name or "default", origin, target, collection)
        cls = _registered_plugins[_PLUGIN_NAME].get(key) or Auditor

        return cls(
            origin=get_collection(get_source(origin), collection),
            target=get_collection(get_source(target), collection),
        )
Beispiel #2
0
#      Copyright (C) 2020  Jeremy Schulman
#
#      This program is free software: you can redistribute it and/or modify
#      it under the terms of the GNU General Public License as published by
#      the Free Software Foundation, either version 3 of the License, or
#      (at your option) any later version.
#
#      This program is distributed in the hope that it will be useful,
#      but WITHOUT ANY WARRANTY; without even the implied warranty of
#      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#      GNU General Public License for more details.
#
#      You should have received a copy of the GNU General Public License
#      along with this program.  If not, see <https://www.gnu.org/licenses/>.

from nauti.source import get_source
from nauti.config import load_default_config_file
from nauti.collection import get_collection

load_default_config_file()

nb = get_source("netbox")
nb_col = get_collection(nb, "devices")
Beispiel #3
0
from nauti.source import get_source
from nauti.config import load_default_config_file
from nauti.collection import get_collection
from nauti.diff import diff

load_default_config_file()

cp = get_source("clearpass")
cp_devs = get_collection(cp, "devices")
Beispiel #4
0
        async def wrapper(**options):
            src_col = get_collection(get_source(origin), collection)
            trg_col = get_collection(get_source(target), collection)

            async with src_col.source, trg_col.source:
                return await coro(src_col, trg_col, **options)
Beispiel #5
0
#      GNU General Public License for more details.
#
#      You should have received a copy of the GNU General Public License
#      along with this program.  If not, see <https://www.gnu.org/licenses/>.

from nauti.source import get_source
from nauti.config import load_default_config_file
from nauti.collection import get_collection
from nauti.diff import diff

load_default_config_file()

shared_fields = ("hostname", "site", "os_name", "ipaddr")
shared_keys = ("hostname",)

cp_devs = get_collection(get_source("clearpass", timeout=5), "devices")
await cp_devs.source.login()
await cp_devs.fetch()
cp_devs.make_keys(*shared_keys)


def tr_nb_rec(item):

    os_name = item["os_name"]
    item["os_name"] = {"iosxe": "ios-xe", "nxos": "nx-os"}.get(os_name, os_name)


def nb_filter_item(item) -> bool:
    tr_nb_rec(item)
    if not item["os_name"]:
        return False
Beispiel #6
0
#      Copyright (C) 2020  Jeremy Schulman
#
#      This program is free software: you can redistribute it and/or modify
#      it under the terms of the GNU General Public License as published by
#      the Free Software Foundation, either version 3 of the License, or
#      (at your option) any later version.
#
#      This program is distributed in the hope that it will be useful,
#      but WITHOUT ANY WARRANTY; without even the implied warranty of
#      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#      GNU General Public License for more details.
#
#      You should have received a copy of the GNU General Public License
#      along with this program.  If not, see <https://www.gnu.org/licenses/>.

from nauti.source import get_source
from nauti.config import load_default_config_file
from nauti.collection import get_collection

load_default_config_file()

src = get_source("ipfabric")
src_col = get_collection(src, "devices")