annet 0.16.11__tar.gz → 0.16.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of annet might be problematic. Click here for more details.
- {annet-0.16.11/annet.egg-info → annet-0.16.13}/PKG-INFO +1 -1
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/common/client.py +3 -1
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/common/storage_opts.py +8 -2
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/provider.py +3 -2
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/v37/storage.py +7 -0
- {annet-0.16.11 → annet-0.16.13}/annet/implicit.py +1 -1
- {annet-0.16.11 → annet-0.16.13}/annet/output.py +18 -4
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/cisco.rul +3 -0
- {annet-0.16.11 → annet-0.16.13/annet.egg-info}/PKG-INFO +1 -1
- {annet-0.16.11 → annet-0.16.13}/AUTHORS +0 -0
- {annet-0.16.11 → annet-0.16.13}/LICENSE +0 -0
- {annet-0.16.11 → annet-0.16.13}/MANIFEST.in +0 -0
- {annet-0.16.11 → annet-0.16.13}/README.md +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/fetchers/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/fetchers/stub/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/fetchers/stub/fetcher.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/file/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/file/provider.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/common/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/common/manufacturer.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/common/models.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/common/query.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/common/status_client.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/v24/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/v24/storage.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/adapters/netbox/v37/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annet.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/command.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/diff.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/errors.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/filter_acl.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/jsontools.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/lib.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/netdev/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/netdev/db.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/netdev/devdb/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/netdev/devdb/data/devdb.json +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/netdev/views/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/netdev/views/dump.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/netdev/views/hardware.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/output.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/patching.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/rbparser/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/rbparser/acl.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/rbparser/deploying.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/rbparser/ordering.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/rbparser/platform.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/rbparser/syntax.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/rulebook/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/rulebook/common.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/tabparser.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/annlib/types.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/api/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/argparse.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/bgp_models.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/cli.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/cli_args.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/configs/context.yml +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/configs/logging.yaml +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/connectors.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/deploy.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/diff.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/executor.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/filtering.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/gen.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/generators/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/generators/base.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/generators/common/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/generators/common/initial.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/generators/entire.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/generators/exceptions.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/generators/jsonfragment.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/generators/partial.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/generators/perf.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/generators/ref.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/generators/result.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/hardware.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/lib.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/mesh/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/mesh/basemodel.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/mesh/device_models.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/mesh/executor.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/mesh/match_args.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/mesh/models_converter.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/mesh/peer_models.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/mesh/registry.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/parallel.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/patching.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/reference.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/arista/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/arista/iface.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/aruba/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/aruba/ap_env.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/aruba/misc.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/b4com/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/b4com/file.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/cisco/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/cisco/iface.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/cisco/misc.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/cisco/vlandb.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/common.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/deploying.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/huawei/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/huawei/aaa.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/huawei/bgp.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/huawei/iface.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/huawei/misc.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/huawei/vlandb.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/juniper/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/nexus/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/nexus/iface.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/patching.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/ribbon/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/routeros/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/routeros/file.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/arista.deploy +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/arista.order +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/arista.rul +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/aruba.deploy +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/aruba.order +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/aruba.rul +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/b4com.deploy +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/b4com.order +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/b4com.rul +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/cisco.deploy +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/cisco.order +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/huawei.deploy +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/huawei.order +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/huawei.rul +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/juniper.rul +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/nexus.deploy +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/nexus.order +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/nexus.rul +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/nokia.rul +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/optixtrans.deploy +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/optixtrans.order +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/optixtrans.rul +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/pc.deploy +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/pc.order +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/pc.rul +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/ribbon.deploy +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/ribbon.rul +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/routeros.order +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/rulebook/texts/routeros.rul +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/storage.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/tabparser.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/text_term_format.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/tracing.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet/types.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet.egg-info/SOURCES.txt +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet.egg-info/dependency_links.txt +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet.egg-info/entry_points.txt +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet.egg-info/requires.txt +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet.egg-info/top_level.txt +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet_generators/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet_generators/example/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet_generators/example/lldp.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet_generators/mesh_example/__init__.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet_generators/mesh_example/bgp.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/annet_generators/mesh_example/mesh_logic.py +0 -0
- {annet-0.16.11 → annet-0.16.13}/requirements.txt +0 -0
- {annet-0.16.11 → annet-0.16.13}/setup.cfg +0 -0
- {annet-0.16.11 → annet-0.16.13}/setup.py +0 -0
|
@@ -79,9 +79,11 @@ def collect(func: Func, field: str = "", batch_size: int = 100) -> Func:
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
class BaseNetboxClient(RequestsClient):
|
|
82
|
-
def __init__(self, url: str, token: str):
|
|
82
|
+
def __init__(self, url: str, token: str, insecure: bool = False):
|
|
83
83
|
url = url.rstrip("/") + "/api/"
|
|
84
84
|
session = Session()
|
|
85
|
+
if insecure:
|
|
86
|
+
session.verify = False
|
|
85
87
|
if token:
|
|
86
88
|
session.headers["Authorization"] = f"Token {token}"
|
|
87
89
|
super().__init__(url, session)
|
|
@@ -5,12 +5,18 @@ DEFAULT_URL = "http://localhost"
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class NetboxStorageOpts:
|
|
8
|
-
def __init__(self, url: str, token: str):
|
|
8
|
+
def __init__(self, url: str, token: str, insecure: bool = False):
|
|
9
9
|
self.url = url
|
|
10
10
|
self.token = token
|
|
11
|
+
self.insecure = insecure
|
|
11
12
|
|
|
12
13
|
@classmethod
|
|
13
14
|
def parse_params(cls, conf_params: Optional[dict[str, str]], cli_opts: Any):
|
|
14
15
|
url = os.getenv("NETBOX_URL") or conf_params.get("url") or DEFAULT_URL
|
|
15
16
|
token = os.getenv("NETBOX_TOKEN", "").strip() or conf_params.get("token") or ""
|
|
16
|
-
|
|
17
|
+
insecure = False
|
|
18
|
+
if insecure_env := os.getenv("NETBOX_INSECURE", "").lower():
|
|
19
|
+
insecure = insecure_env in ("true", "1", "t")
|
|
20
|
+
else:
|
|
21
|
+
insecure = bool(conf_params.get("insecure") or False)
|
|
22
|
+
return cls(url=url, token=token, insecure=insecure)
|
|
@@ -12,7 +12,7 @@ from .v37.storage import NetboxStorageV37
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def storage_factory(opts: NetboxStorageOpts) -> Storage:
|
|
15
|
-
client = NetboxStatusClient(opts.url, opts.token)
|
|
15
|
+
client = NetboxStatusClient(opts.url, opts.token, opts.insecure)
|
|
16
16
|
try:
|
|
17
17
|
status = client.status()
|
|
18
18
|
except ClientError as e:
|
|
@@ -27,9 +27,10 @@ def storage_factory(opts: NetboxStorageOpts) -> Storage:
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
class NetboxProvider(StorageProvider, AdapterWithName, AdapterWithConfig):
|
|
30
|
-
def __init__(self, url: Optional[str] = None, token: Optional[str] = None):
|
|
30
|
+
def __init__(self, url: Optional[str] = None, token: Optional[str] = None, insecure: bool = False):
|
|
31
31
|
self.url = url
|
|
32
32
|
self.token = token
|
|
33
|
+
self.insecure = insecure
|
|
33
34
|
|
|
34
35
|
@classmethod
|
|
35
36
|
def with_config(cls, **kwargs: Dict[str, Any]) -> T:
|
|
@@ -2,6 +2,7 @@ from logging import getLogger
|
|
|
2
2
|
from typing import Any, Optional, List, Union, Dict
|
|
3
3
|
from ipaddress import ip_interface
|
|
4
4
|
from collections import defaultdict
|
|
5
|
+
import ssl
|
|
5
6
|
|
|
6
7
|
from adaptix import P
|
|
7
8
|
from adaptix.conversion import impl_converter, link, link_constant
|
|
@@ -86,9 +87,15 @@ def extend_ip_address(
|
|
|
86
87
|
|
|
87
88
|
class NetboxStorageV37(Storage):
|
|
88
89
|
def __init__(self, opts: Optional[NetboxStorageOpts] = None):
|
|
90
|
+
ctx: ssl.con | ssl.SSLContext = None
|
|
91
|
+
if opts.insecure:
|
|
92
|
+
ctx = ssl.create_default_context()
|
|
93
|
+
ctx.check_hostname = False
|
|
94
|
+
ctx.verify_mode = ssl.CERT_NONE
|
|
89
95
|
self.netbox = NetboxV37(
|
|
90
96
|
url=opts.url,
|
|
91
97
|
token=opts.token,
|
|
98
|
+
ssl_context=ctx,
|
|
92
99
|
)
|
|
93
100
|
self._all_fqdns: Optional[list[str]] = None
|
|
94
101
|
|
|
@@ -46,6 +46,7 @@ def _implicit_tree(device):
|
|
|
46
46
|
!user-interface vty ~
|
|
47
47
|
protocol inbound all
|
|
48
48
|
netconf
|
|
49
|
+
port link-flap trigger error-down
|
|
49
50
|
"""
|
|
50
51
|
elif device.hw.Huawei.NE:
|
|
51
52
|
text = """
|
|
@@ -136,7 +137,6 @@ def _implicit_tree(device):
|
|
|
136
137
|
text += r"""
|
|
137
138
|
!interface
|
|
138
139
|
no shutdown
|
|
139
|
-
no ip address
|
|
140
140
|
"""
|
|
141
141
|
if device.hw.Cisco.Catalyst:
|
|
142
142
|
# this configuration is not visible in running-config when enabled
|
|
@@ -2,9 +2,12 @@ import abc
|
|
|
2
2
|
import os
|
|
3
3
|
import posixpath
|
|
4
4
|
import sys
|
|
5
|
-
from typing import List, Optional, Tuple, Type
|
|
5
|
+
from typing import Dict, List, Optional, Tuple, Type
|
|
6
|
+
from urllib.parse import urlparse
|
|
6
7
|
|
|
7
8
|
import colorama
|
|
9
|
+
from contextlog import get_logger
|
|
10
|
+
|
|
8
11
|
from annet.annlib.output import ( # pylint: disable=unused-import
|
|
9
12
|
LABEL_NEW_PREFIX,
|
|
10
13
|
OutputWriter,
|
|
@@ -17,8 +20,6 @@ from annet.annlib.output import ( # pylint: disable=unused-import
|
|
|
17
20
|
print_err_label,
|
|
18
21
|
print_label,
|
|
19
22
|
)
|
|
20
|
-
from contextlog import get_logger
|
|
21
|
-
|
|
22
23
|
from annet.cli_args import FileOutOptions, QueryOptions
|
|
23
24
|
from annet.connectors import Connector
|
|
24
25
|
from annet.storage import Device, storage_connector
|
|
@@ -112,9 +113,11 @@ class OutputDriverBasic(OutputDriver):
|
|
|
112
113
|
if label.startswith(os.sep):
|
|
113
114
|
# just in case.
|
|
114
115
|
label = label.lstrip(os.sep)
|
|
116
|
+
|
|
115
117
|
if os.sep not in label:
|
|
116
118
|
# vendor config
|
|
117
119
|
label = os.path.basename(label)
|
|
120
|
+
|
|
118
121
|
else:
|
|
119
122
|
# entire generated file
|
|
120
123
|
parts = label.split(os.sep)
|
|
@@ -125,6 +128,7 @@ class OutputDriverBasic(OutputDriver):
|
|
|
125
128
|
if query_result_count > 1 or arg_out.dest_force_create_dir:
|
|
126
129
|
label = os.path.join(hostname, label)
|
|
127
130
|
file_dest = os.path.join(dest, "errors") if is_fail else dest
|
|
131
|
+
|
|
128
132
|
out_file = os.path.normpath(os.path.join(file_dest, label))
|
|
129
133
|
logger.info("writing '%s'", out_file)
|
|
130
134
|
dirname = os.path.dirname(out_file)
|
|
@@ -164,12 +168,22 @@ class OutputDriverBasic(OutputDriver):
|
|
|
164
168
|
>>>
|
|
165
169
|
```
|
|
166
170
|
"""
|
|
171
|
+
|
|
167
172
|
# NOTE: с полученным `config_path` работаем через `posixpath`, а не через `os.path`, потому что
|
|
168
173
|
# entire-путь POSIX-специфичный; но в конце формируем путь через `os.path` для текущей платформы
|
|
169
174
|
if not posixpath.abspath(config_path):
|
|
170
175
|
raise RuntimeError(f"Want absolute config path, but relative received: {config_path}")
|
|
176
|
+
|
|
171
177
|
cfg_files = self.cfg_file_names(device)
|
|
172
|
-
|
|
178
|
+
|
|
179
|
+
parsed_config_path = urlparse(config_path)
|
|
180
|
+
scheme, config_path = parsed_config_path.scheme or "file", parsed_config_path.path
|
|
181
|
+
|
|
173
182
|
relative_config_path = posixpath.relpath(config_path, "/")
|
|
183
|
+
if scheme != "file":
|
|
184
|
+
host = parsed_config_path.hostname + f":{parsed_config_path.port}" if parsed_config_path.port else ""
|
|
185
|
+
relative_config_path = os.path.join(host, relative_config_path)
|
|
186
|
+
|
|
174
187
|
dest_config_path_parts = [cfg_files[0]] + relative_config_path.split(posixpath.sep)
|
|
188
|
+
|
|
175
189
|
return os.path.join(*dest_config_path_parts)
|
|
@@ -45,6 +45,7 @@ no snmp-server sysobjectid type stack-oid
|
|
|
45
45
|
interface Loopback
|
|
46
46
|
ipv6 address *
|
|
47
47
|
ip address ~
|
|
48
|
+
! no ip address
|
|
48
49
|
|
|
49
50
|
# SVI/Subifs/Lagg
|
|
50
51
|
interface */(Vlan|Ethernet.*\.|port-channel.*\.?)\d+$/ %diff_logic=cisco.iface.diff
|
|
@@ -53,6 +54,7 @@ interface */(Vlan|Ethernet.*\.|port-channel.*\.?)\d+$/ %diff_logic=cisco.iface.d
|
|
|
53
54
|
ipv6 address *
|
|
54
55
|
ipv6 nd ~ %logic=cisco.misc.no_ipv6_nd_suppress_ra
|
|
55
56
|
ip address ~
|
|
57
|
+
! no ip address
|
|
56
58
|
mtu
|
|
57
59
|
|
|
58
60
|
# Physical
|
|
@@ -65,6 +67,7 @@ interface */\w*Ethernet[0-9\/]+$/ %logic=common.permanent %diff_logic=cisco.
|
|
|
65
67
|
ipv6 link-local
|
|
66
68
|
ipv6 address *
|
|
67
69
|
ip address ~
|
|
70
|
+
! no ip address
|
|
68
71
|
channel-group
|
|
69
72
|
mtu
|
|
70
73
|
storm-control * level
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|