annet 3.1.4__tar.gz → 3.3.0__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-3.1.4/annet.egg-info → annet-3.3.0}/PKG-INFO +2 -2
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/v42/models.py +6 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/v42/storage.py +27 -1
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/rulebook/common.py +4 -86
- {annet-3.1.4 → annet-3.3.0}/annet/generators/__init__.py +45 -39
- {annet-3.1.4 → annet-3.3.0}/annet/generators/entire.py +5 -15
- {annet-3.1.4 → annet-3.3.0}/annet/generators/perf.py +9 -18
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/base.py +6 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/arista.py +14 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/aruba.py +13 -0
- annet-3.3.0/annet/vendors/library/b4com.py +46 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/cisco.py +11 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/h3c.py +10 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/huawei.py +13 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/iosxr.py +11 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/juniper.py +11 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/nexus.py +11 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/nokia.py +10 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/optixtrans.py +6 -10
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/pc.py +12 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/ribbon.py +11 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/routeros.py +13 -0
- {annet-3.1.4 → annet-3.3.0/annet.egg-info}/PKG-INFO +2 -2
- {annet-3.1.4 → annet-3.3.0}/annet.egg-info/requires.txt +1 -1
- {annet-3.1.4 → annet-3.3.0}/setup.py +1 -1
- annet-3.1.4/annet/vendors/library/b4com.py +0 -27
- {annet-3.1.4 → annet-3.3.0}/AUTHORS +0 -0
- {annet-3.1.4 → annet-3.3.0}/LICENSE +0 -0
- {annet-3.1.4 → annet-3.3.0}/MANIFEST.in +0 -0
- {annet-3.1.4 → annet-3.3.0}/README.md +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/fetchers/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/fetchers/stub/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/fetchers/stub/fetcher.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/file/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/file/provider.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/common/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/common/adapter.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/common/client.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/common/manufacturer.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/common/models.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/common/query.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/common/status_client.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/common/storage_base.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/common/storage_opts.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/provider.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/v24/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/v24/models.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/v24/storage.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/v37/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/v37/models.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/v37/storage.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/v41/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/v41/models.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/v41/storage.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/adapters/netbox/v42/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annet.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/command.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/diff.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/errors.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/filter_acl.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/jsontools.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/lib.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/netdev/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/netdev/db.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/netdev/devdb/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/netdev/devdb/data/devdb.json +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/netdev/views/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/netdev/views/dump.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/netdev/views/hardware.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/output.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/patching.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/rbparser/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/rbparser/acl.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/rbparser/deploying.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/rbparser/ordering.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/rbparser/platform.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/rbparser/syntax.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/rulebook/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/tabparser.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/annlib/types.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/api/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/argparse.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/bgp_models.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/cli.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/cli_args.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/configs/context.yml +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/configs/logging.yaml +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/connectors.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/deploy.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/deploy_ui.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/diff.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/executor.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/filtering.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/gen.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/generators/base.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/generators/common/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/generators/common/initial.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/generators/exceptions.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/generators/jsonfragment.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/generators/partial.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/generators/ref.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/generators/result.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/hardware.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/implicit.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/lib.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/mesh/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/mesh/basemodel.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/mesh/device_models.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/mesh/executor.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/mesh/match_args.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/mesh/models_converter.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/mesh/peer_models.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/mesh/port_processor.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/mesh/registry.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/output.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/parallel.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/patching.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/reference.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl/action.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl/condition.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl/match_builder.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl/policy.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl/result.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl/routemap.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl/statement_builder.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl_generators/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl_generators/aspath.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl_generators/community.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl_generators/cumulus_frr.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl_generators/entities.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl_generators/execute.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl_generators/policy.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl_generators/prefix_lists.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rpl_generators/rd.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/arista/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/arista/aaa.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/arista/iface.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/aruba/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/aruba/ap_env.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/aruba/misc.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/b4com/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/b4com/file.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/b4com/iface.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/cisco/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/cisco/iface.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/cisco/misc.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/cisco/vlandb.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/common.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/deploying.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/huawei/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/huawei/aaa.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/huawei/bgp.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/huawei/iface.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/huawei/misc.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/huawei/vlandb.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/juniper/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/nexus/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/nexus/iface.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/patching.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/routeros/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/routeros/file.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/arista.deploy +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/arista.order +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/arista.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/aruba.deploy +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/aruba.order +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/aruba.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/b4com.deploy +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/b4com.order +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/b4com.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/cisco.deploy +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/cisco.order +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/cisco.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/huawei.deploy +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/huawei.order +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/huawei.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/iosxr.deploy +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/iosxr.order +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/iosxr.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/juniper.order +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/juniper.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/nexus.deploy +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/nexus.order +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/nexus.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/nokia.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/optixtrans.deploy +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/optixtrans.order +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/optixtrans.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/pc.deploy +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/pc.order +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/pc.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/ribbon.deploy +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/ribbon.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/routeros.order +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/rulebook/texts/routeros.rul +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/storage.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/text_term_format.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/tracing.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/types.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/library/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet/vendors/registry.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet.egg-info/SOURCES.txt +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet.egg-info/dependency_links.txt +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet.egg-info/entry_points.txt +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet.egg-info/top_level.txt +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet_generators/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet_generators/example/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet_generators/example/hostname.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet_generators/example/lldp.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet_generators/mesh_example/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet_generators/mesh_example/bgp.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet_generators/mesh_example/mesh_logic.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet_generators/rpl_example/__init__.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet_generators/rpl_example/generator.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet_generators/rpl_example/items.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet_generators/rpl_example/mesh.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/annet_generators/rpl_example/route_policy.py +0 -0
- {annet-3.1.4 → annet-3.3.0}/requirements.txt +0 -0
- {annet-3.1.4 → annet-3.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: annet
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.3.0
|
|
4
4
|
Summary: annet
|
|
5
5
|
Home-page: https://github.com/annetutil/annet
|
|
6
6
|
License: MIT
|
|
@@ -21,7 +21,7 @@ Requires-Dist: yarl>=1.8.2
|
|
|
21
21
|
Requires-Dist: adaptix==3.0.0b7
|
|
22
22
|
Requires-Dist: dataclass-rest==0.4
|
|
23
23
|
Provides-Extra: netbox
|
|
24
|
-
Requires-Dist: annetbox[sync]>=0.
|
|
24
|
+
Requires-Dist: annetbox[sync]>=0.4.0; extra == "netbox"
|
|
25
25
|
Dynamic: home-page
|
|
26
26
|
Dynamic: license
|
|
27
27
|
Dynamic: license-file
|
|
@@ -3,6 +3,7 @@ from datetime import datetime, timezone
|
|
|
3
3
|
from typing import Optional
|
|
4
4
|
from annet.adapters.netbox.common.models import InterfaceType, IpFamily, Label, Prefix, Entity
|
|
5
5
|
from annet.adapters.netbox.v41.models import InterfaceV41, IpAddressV41, NetboxDeviceV41
|
|
6
|
+
import annetbox.v42.models
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
@dataclass
|
|
@@ -61,3 +62,8 @@ class NetboxDeviceV42(NetboxDeviceV41):
|
|
|
61
62
|
connected_endpoints=[],
|
|
62
63
|
mode=None,
|
|
63
64
|
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# should be unified in case of netbox update
|
|
68
|
+
Vrf = annetbox.v42.models.Vrf
|
|
69
|
+
Vlan = annetbox.v42.models.Vlan
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import ssl
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
2
4
|
from adaptix import P
|
|
3
5
|
from adaptix.conversion import get_converter, link, link_constant, link_function
|
|
4
6
|
from annetbox.v42 import client_sync
|
|
@@ -6,7 +8,8 @@ from annetbox.v42 import models as api_models
|
|
|
6
8
|
|
|
7
9
|
from annet.adapters.netbox.common.adapter import NetboxAdapter, get_device_breed, get_device_hw
|
|
8
10
|
from annet.adapters.netbox.common.storage_base import BaseNetboxStorage
|
|
9
|
-
from annet.adapters.netbox.
|
|
11
|
+
from annet.adapters.netbox.common.storage_opts import NetboxStorageOpts
|
|
12
|
+
from annet.adapters.netbox.v42.models import InterfaceV42, NetboxDeviceV42, PrefixV42, IpAddressV42, Vlan, Vrf
|
|
10
13
|
from annet.storage import Storage
|
|
11
14
|
|
|
12
15
|
|
|
@@ -79,8 +82,21 @@ class NetboxV42Adapter(NetboxAdapter[NetboxDeviceV42, InterfaceV42, IpAddressV42
|
|
|
79
82
|
def list_ipprefixes(self, prefixes: list[str]) -> list[PrefixV42]:
|
|
80
83
|
return self.convert_ip_prefixes(self.netbox.ipam_all_prefixes(prefix=prefixes).results)
|
|
81
84
|
|
|
85
|
+
def list_all_vrfs(self) -> list[Vrf]:
|
|
86
|
+
return self.netbox.ipam_all_vrfs().results
|
|
87
|
+
|
|
88
|
+
def list_all_vlans(self) -> list[Vlan]:
|
|
89
|
+
return self.netbox.ipam_all_vlans().results
|
|
90
|
+
|
|
82
91
|
|
|
83
92
|
class NetboxStorageV42(BaseNetboxStorage[NetboxDeviceV42, InterfaceV42, IpAddressV42, PrefixV42]):
|
|
93
|
+
netbox: NetboxV42Adapter
|
|
94
|
+
|
|
95
|
+
def __init__(self, opts: Optional[NetboxStorageOpts] = None):
|
|
96
|
+
super().__init__(opts)
|
|
97
|
+
self._all_vlans: list[Vlan] | None = None
|
|
98
|
+
self._all_vrfs: list[Vrf] | None = None
|
|
99
|
+
|
|
84
100
|
def _init_adapter(
|
|
85
101
|
self,
|
|
86
102
|
url: str,
|
|
@@ -89,3 +105,13 @@ class NetboxStorageV42(BaseNetboxStorage[NetboxDeviceV42, InterfaceV42, IpAddres
|
|
|
89
105
|
threads: int,
|
|
90
106
|
) -> NetboxAdapter[NetboxDeviceV42, InterfaceV42, IpAddressV42, PrefixV42]:
|
|
91
107
|
return NetboxV42Adapter(self, url, token, ssl_context, threads)
|
|
108
|
+
|
|
109
|
+
def resolve_all_vlans(self) -> list[Vlan]:
|
|
110
|
+
if self._all_vlans is None:
|
|
111
|
+
self._all_vlans = self.netbox.list_all_vlans()
|
|
112
|
+
return self._all_vlans
|
|
113
|
+
|
|
114
|
+
def resolve_all_vrfs(self) -> list[Vrf]:
|
|
115
|
+
if self._all_vrfs is None:
|
|
116
|
+
self._all_vrfs = self.netbox.list_all_vrfs()
|
|
117
|
+
return self._all_vrfs
|
|
@@ -2,9 +2,9 @@ import os
|
|
|
2
2
|
import typing
|
|
3
3
|
from collections import OrderedDict as odict
|
|
4
4
|
|
|
5
|
-
from annet.annlib.command import
|
|
6
|
-
|
|
5
|
+
from annet.annlib.command import Command, CommandList
|
|
7
6
|
from annet.types import Op
|
|
7
|
+
from annet.vendors import registry_connector
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
# =====
|
|
@@ -287,87 +287,5 @@ class ApplyItem(typing.NamedTuple):
|
|
|
287
287
|
after: CommandList
|
|
288
288
|
|
|
289
289
|
|
|
290
|
-
def apply(hw, do_commit, do_finalize,
|
|
291
|
-
|
|
292
|
-
if hw.Huawei:
|
|
293
|
-
before.add_cmd(Command("system-view"))
|
|
294
|
-
if do_commit and (hw.Huawei.CE or hw.Huawei.NE):
|
|
295
|
-
after.add_cmd(Command("commit"))
|
|
296
|
-
after.add_cmd(Command("q"))
|
|
297
|
-
if do_finalize:
|
|
298
|
-
after.add_cmd(Command("save", timeout=20))
|
|
299
|
-
elif hw.Arista:
|
|
300
|
-
before.add_cmd(Command("conf s"))
|
|
301
|
-
if do_commit:
|
|
302
|
-
after.add_cmd(Command("commit"))
|
|
303
|
-
else:
|
|
304
|
-
after.add_cmd(Command("abort")) # просто exit оставит висеть configure session
|
|
305
|
-
if do_finalize:
|
|
306
|
-
after.add_cmd(Command("write memory"))
|
|
307
|
-
elif hw.ASR or hw.XRV or hw.XR:
|
|
308
|
-
# коммит сам сохраняет изменения в стартап do_finalize не применим
|
|
309
|
-
before.add_cmd(Command("configure exclusive"))
|
|
310
|
-
if do_commit:
|
|
311
|
-
after.add_cmd(Command("commit"))
|
|
312
|
-
after.add_cmd(Command("exit"))
|
|
313
|
-
elif hw.Cisco or hw.Nexus:
|
|
314
|
-
# классический ios и nxos не умеет коммиты
|
|
315
|
-
before.add_cmd(Command("conf t"))
|
|
316
|
-
after.add_cmd(Command("exit"))
|
|
317
|
-
if do_finalize:
|
|
318
|
-
after.add_cmd(Command("copy running-config startup-config", timeout=40))
|
|
319
|
-
elif hw.Juniper:
|
|
320
|
-
# коммит сам сохраняет изменения в стартап do_finalize не применим
|
|
321
|
-
before.add_cmd(Command("configure exclusive"))
|
|
322
|
-
if do_commit:
|
|
323
|
-
after.add_cmd(Command("commit", timeout=30))
|
|
324
|
-
after.add_cmd(Command("exit"))
|
|
325
|
-
elif hw.PC:
|
|
326
|
-
if hw.soft.startswith(("Cumulus", "SwitchDev")):
|
|
327
|
-
if os.environ.get("ETCKEEPER_CHECK", False):
|
|
328
|
-
before.add_cmd(Command("etckeeper check"))
|
|
329
|
-
elif hw.Nokia:
|
|
330
|
-
# коммит сам сохраняет изменения в стартап do_finalize не применим
|
|
331
|
-
before.add_cmd(Command("configure private"))
|
|
332
|
-
if do_commit:
|
|
333
|
-
after.add_cmd(Command("commit"))
|
|
334
|
-
elif hw.RouterOS:
|
|
335
|
-
# FIXME: пока не удалось победить \x1b[c после включения safe mode
|
|
336
|
-
# if len(cmds) > 99:
|
|
337
|
-
# raise Exception("RouterOS does not support more 100 actions in safe mode")
|
|
338
|
-
# before.add_cmd(RosDevice.SAFE_MODE)
|
|
339
|
-
pass
|
|
340
|
-
# after.add_cmd(RosDevice.SAFE_MODE)
|
|
341
|
-
elif hw.Aruba:
|
|
342
|
-
before.add_cmd(Command("conf t"))
|
|
343
|
-
after.add_cmd(Command("end"))
|
|
344
|
-
if do_commit:
|
|
345
|
-
after.add_cmd(Command("commit apply"))
|
|
346
|
-
if do_finalize:
|
|
347
|
-
after.add_cmd(Command("write memory"))
|
|
348
|
-
elif hw.Ribbon:
|
|
349
|
-
# коммит сам сохраняет изменения в стартап do_finalize не применим
|
|
350
|
-
before.add_cmd(Command("configure exclusive"))
|
|
351
|
-
if do_commit:
|
|
352
|
-
after.add_cmd(Command("commit", timeout=30))
|
|
353
|
-
after.add_cmd(Command("exit"))
|
|
354
|
-
elif hw.B4com.CS2148P:
|
|
355
|
-
before.add_cmd(Command("conf t"))
|
|
356
|
-
after.add_cmd(Command("end"))
|
|
357
|
-
if do_finalize:
|
|
358
|
-
after.add_cmd(Command("write", timeout=40))
|
|
359
|
-
elif hw.B4com:
|
|
360
|
-
before.add_cmd(Command("conf t"))
|
|
361
|
-
if do_commit:
|
|
362
|
-
after.add_cmd(Command("commit"))
|
|
363
|
-
after.add_cmd(Command("end"))
|
|
364
|
-
if do_finalize:
|
|
365
|
-
after.add_cmd(Command("write", timeout=40))
|
|
366
|
-
elif hw.H3C:
|
|
367
|
-
before.add_cmd(Command("system-view"))
|
|
368
|
-
if do_finalize:
|
|
369
|
-
after.add_cmd(Command("save force", timeout=90))
|
|
370
|
-
else:
|
|
371
|
-
raise Exception("unknown hw %s" % hw)
|
|
372
|
-
|
|
373
|
-
return before, after
|
|
290
|
+
def apply(hw, do_commit, do_finalize, path):
|
|
291
|
+
return registry_connector.get().match(hw).apply(hw, do_commit, do_finalize, path)
|
|
@@ -157,7 +157,7 @@ def run_partial_generators(
|
|
|
157
157
|
|
|
158
158
|
|
|
159
159
|
@tracing.function(name="run_partial_generator")
|
|
160
|
-
def _run_partial_generator(gen: "PartialGenerator", run_args: GeneratorPartialRunArgs) ->
|
|
160
|
+
def _run_partial_generator(gen: "PartialGenerator", run_args: GeneratorPartialRunArgs) -> GeneratorPartialResult | None:
|
|
161
161
|
logger = get_logger(generator=_make_generator_ctx(gen))
|
|
162
162
|
device = run_args.device
|
|
163
163
|
output = ""
|
|
@@ -207,7 +207,9 @@ def _run_partial_generator(gen: "PartialGenerator", run_args: GeneratorPartialRu
|
|
|
207
207
|
|
|
208
208
|
if run_args.use_acl:
|
|
209
209
|
try:
|
|
210
|
-
with tracing_connector.get().start_as_current_span(
|
|
210
|
+
with tracing_connector.get().start_as_current_span(
|
|
211
|
+
"apply_acl", tracer_name=__name__, min_duration="0.01"
|
|
212
|
+
) as acl_span:
|
|
211
213
|
tracing_connector.get().set_device_attributes(acl_span, run_args.device)
|
|
212
214
|
config = patching.apply_acl(
|
|
213
215
|
config=config,
|
|
@@ -265,8 +267,8 @@ def check_entire_generators_required_packages(gens, device_packages: FrozenSet[s
|
|
|
265
267
|
|
|
266
268
|
@tracing.function
|
|
267
269
|
def run_file_generators(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
+
gens: Iterable[Union["JSONFragment", "Entire"]],
|
|
271
|
+
device: "Device",
|
|
270
272
|
) -> RunGeneratorResult:
|
|
271
273
|
"""Run generators that generate files or file parts."""
|
|
272
274
|
ret = RunGeneratorResult()
|
|
@@ -295,21 +297,22 @@ def run_file_generators(
|
|
|
295
297
|
@tracing.function(min_duration="0.5")
|
|
296
298
|
def _run_entire_generator(gen: "Entire", device: "Device") -> Optional[GeneratorResult]:
|
|
297
299
|
logger = get_logger(generator=_make_generator_ctx(gen))
|
|
298
|
-
if not gen.supports_device(device):
|
|
299
|
-
logger.info("generator %s is not supported for device %s", gen, device.hostname)
|
|
300
|
-
return
|
|
301
|
-
|
|
302
300
|
span = tracing_connector.get().get_current_span()
|
|
303
301
|
if span:
|
|
304
302
|
tracing_connector.get().set_device_attributes(span, device)
|
|
305
303
|
tracing_connector.get().set_dimensions_attributes(span, gen, device)
|
|
306
304
|
|
|
307
|
-
path = gen.path(device)
|
|
308
|
-
if not path:
|
|
309
|
-
raise RuntimeError("entire generator should return non-empty path")
|
|
310
|
-
|
|
311
|
-
logger.info("Generating ENTIRE ...")
|
|
312
305
|
with GeneratorPerfMesurer(gen, trace_min_duration="0.5") as pm:
|
|
306
|
+
if not gen.supports_device(device):
|
|
307
|
+
logger.debug("generator %s is not supported for device %s", gen, device.hostname)
|
|
308
|
+
return
|
|
309
|
+
|
|
310
|
+
path = gen.path(device)
|
|
311
|
+
if not path:
|
|
312
|
+
raise RuntimeError("entire generator should return non-empty path")
|
|
313
|
+
|
|
314
|
+
logger.info("Generating ENTIRE ...")
|
|
315
|
+
|
|
313
316
|
output = gen(device)
|
|
314
317
|
|
|
315
318
|
return GeneratorEntireResult(
|
|
@@ -329,35 +332,37 @@ def _make_generator_ctx(gen):
|
|
|
329
332
|
|
|
330
333
|
|
|
331
334
|
def _run_json_fragment_generator(
|
|
332
|
-
|
|
333
|
-
|
|
335
|
+
gen: "JSONFragment",
|
|
336
|
+
device: "Device",
|
|
334
337
|
) -> Optional[GeneratorResult]:
|
|
335
338
|
logger = get_logger(generator=_make_generator_ctx(gen))
|
|
336
|
-
|
|
337
|
-
logger.info("generator %s is not supported for device %s", gen, device.hostname)
|
|
338
|
-
return
|
|
339
|
-
|
|
340
|
-
path = gen.path(device)
|
|
341
|
-
if not path:
|
|
342
|
-
raise RuntimeError("json fragment generator should return non-empty path")
|
|
343
|
-
|
|
344
|
-
acl_item_or_list_of_items = gen.acl(device)
|
|
345
|
-
safe_acl_item_or_list_of_items = gen.acl_safe(device)
|
|
346
|
-
if not acl_item_or_list_of_items:
|
|
347
|
-
raise RuntimeError("json fragment generator should return non-empty acl")
|
|
348
|
-
if isinstance(acl_item_or_list_of_items, list):
|
|
349
|
-
acl = acl_item_or_list_of_items
|
|
350
|
-
else:
|
|
351
|
-
acl = [acl_item_or_list_of_items]
|
|
352
|
-
if isinstance(safe_acl_item_or_list_of_items, list):
|
|
353
|
-
acl_safe = safe_acl_item_or_list_of_items
|
|
354
|
-
else:
|
|
355
|
-
acl_safe = [safe_acl_item_or_list_of_items]
|
|
356
|
-
|
|
357
|
-
logger.info("Generating JSON_FRAGMENT ...")
|
|
339
|
+
|
|
358
340
|
with GeneratorPerfMesurer(gen) as pm:
|
|
341
|
+
if not gen.supports_device(device):
|
|
342
|
+
logger.info("generator %s is not supported for device %s", gen, device.hostname)
|
|
343
|
+
return
|
|
344
|
+
|
|
345
|
+
path = gen.path(device)
|
|
346
|
+
if not path:
|
|
347
|
+
raise RuntimeError("json fragment generator should return non-empty path")
|
|
348
|
+
|
|
349
|
+
acl_item_or_list_of_items = gen.acl(device)
|
|
350
|
+
safe_acl_item_or_list_of_items = gen.acl_safe(device)
|
|
351
|
+
if not acl_item_or_list_of_items:
|
|
352
|
+
raise RuntimeError("json fragment generator should return non-empty acl")
|
|
353
|
+
if isinstance(acl_item_or_list_of_items, list):
|
|
354
|
+
acl = acl_item_or_list_of_items
|
|
355
|
+
else:
|
|
356
|
+
acl = [acl_item_or_list_of_items]
|
|
357
|
+
if isinstance(safe_acl_item_or_list_of_items, list):
|
|
358
|
+
acl_safe = safe_acl_item_or_list_of_items
|
|
359
|
+
else:
|
|
360
|
+
acl_safe = [safe_acl_item_or_list_of_items]
|
|
361
|
+
|
|
362
|
+
logger.info("Generating JSON_FRAGMENT ...")
|
|
363
|
+
|
|
359
364
|
config = gen(device)
|
|
360
|
-
|
|
365
|
+
reload_cmds = gen.get_reload_cmds(device)
|
|
361
366
|
return GeneratorJSONFragmentResult(
|
|
362
367
|
name=gen.__class__.__name__,
|
|
363
368
|
tags=gen.TAGS,
|
|
@@ -407,7 +412,8 @@ def _load_gen_module(module_path: str):
|
|
|
407
412
|
except ModuleNotFoundError as e:
|
|
408
413
|
try: # maybe it's a path to module
|
|
409
414
|
module_abs_path = os.path.abspath(module_path)
|
|
410
|
-
module = importlib.machinery.SourceFileLoader(re.sub(r"[./]", "_", module_abs_path).strip("_"),
|
|
415
|
+
module = importlib.machinery.SourceFileLoader(re.sub(r"[./]", "_", module_abs_path).strip("_"),
|
|
416
|
+
module_abs_path).load_module()
|
|
411
417
|
except ModuleNotFoundError:
|
|
412
418
|
raise e
|
|
413
419
|
return module
|
|
@@ -3,19 +3,10 @@ from __future__ import annotations
|
|
|
3
3
|
import pkgutil
|
|
4
4
|
import re
|
|
5
5
|
import types
|
|
6
|
-
from typing import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Optional,
|
|
11
|
-
Set,
|
|
12
|
-
Union,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
from annet.lib import (
|
|
16
|
-
flatten,
|
|
17
|
-
mako_render,
|
|
18
|
-
)
|
|
6
|
+
from typing import FrozenSet, Iterable, List, Optional, Set, Union
|
|
7
|
+
|
|
8
|
+
from annet.lib import flatten, mako_render
|
|
9
|
+
|
|
19
10
|
from .base import BaseGenerator, _filter_str
|
|
20
11
|
from .exceptions import NotSupportedDevice
|
|
21
12
|
|
|
@@ -39,8 +30,7 @@ class Entire(BaseGenerator):
|
|
|
39
30
|
def run(self, device) -> Union[None, str, Iterable[Union[str, tuple]]]:
|
|
40
31
|
raise NotImplementedError
|
|
41
32
|
|
|
42
|
-
def reload(self, device) -> Optional[
|
|
43
|
-
str]: # pylint: disable=unused-argument
|
|
33
|
+
def reload(self, device) -> Optional[str]: # pylint: disable=unused-argument
|
|
44
34
|
return
|
|
45
35
|
|
|
46
36
|
def get_reload_cmds(self, device) -> str:
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
1
|
import time
|
|
4
|
-
from typing import
|
|
5
|
-
Optional,
|
|
6
|
-
Union,
|
|
7
|
-
)
|
|
2
|
+
from typing import Optional, Union
|
|
8
3
|
|
|
9
4
|
from annet import tracing
|
|
10
5
|
from annet.tracing import tracing_connector
|
|
11
|
-
from annet.types import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
)
|
|
15
|
-
from .entire import Entire
|
|
16
|
-
from .partial import PartialGenerator
|
|
6
|
+
from annet.types import GeneratorPartialRunArgs, GeneratorPerf
|
|
7
|
+
|
|
8
|
+
from .base import BaseGenerator
|
|
17
9
|
|
|
18
10
|
|
|
19
11
|
class GeneratorPerfMesurer:
|
|
20
12
|
def __init__(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
self,
|
|
14
|
+
gen: BaseGenerator,
|
|
15
|
+
run_args: Optional[GeneratorPartialRunArgs] = None,
|
|
16
|
+
trace_min_duration: tracing.MinDurationT = None
|
|
25
17
|
):
|
|
26
18
|
self._gen = gen
|
|
27
19
|
self._run_args = run_args
|
|
@@ -44,8 +36,7 @@ class GeneratorPerfMesurer:
|
|
|
44
36
|
self._span = self._span_ctx.__enter__() # pylint: disable=unnecessary-dunder-call
|
|
45
37
|
|
|
46
38
|
if self._span:
|
|
47
|
-
self._span.set_attributes(
|
|
48
|
-
{"generator.class": self._gen.__class__.__name__})
|
|
39
|
+
self._span.set_attributes({"generator.class": self._gen.__class__.__name__})
|
|
49
40
|
if self._run_args:
|
|
50
41
|
tracing_connector.get().set_device_attributes(
|
|
51
42
|
self._span, self._run_args.device,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import abc
|
|
2
2
|
from typing import ClassVar
|
|
3
3
|
|
|
4
|
+
from annet.annlib.command import CommandList
|
|
4
5
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
5
6
|
from annet.annlib.tabparser import CommonFormatter
|
|
6
7
|
|
|
@@ -12,6 +13,11 @@ class AbstractVendor(abc.ABC):
|
|
|
12
13
|
def match(self) -> list[str]:
|
|
13
14
|
raise NotImplementedError
|
|
14
15
|
|
|
16
|
+
def apply(
|
|
17
|
+
self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str
|
|
18
|
+
) -> tuple[CommandList, CommandList]:
|
|
19
|
+
return CommandList(), CommandList()
|
|
20
|
+
|
|
15
21
|
@property
|
|
16
22
|
@abc.abstractmethod
|
|
17
23
|
def reverse(self) -> str:
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import AristaFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,19 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class AristaVendor(AbstractVendor):
|
|
9
10
|
NAME = "arista"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("conf s"))
|
|
16
|
+
if do_commit:
|
|
17
|
+
after.add_cmd(Command("commit"))
|
|
18
|
+
else:
|
|
19
|
+
after.add_cmd(Command("abort")) # просто exit оставит висеть configure session
|
|
20
|
+
if do_finalize:
|
|
21
|
+
after.add_cmd(Command("write memory"))
|
|
22
|
+
|
|
23
|
+
return before, after
|
|
24
|
+
|
|
11
25
|
def match(self) -> list[str]:
|
|
12
26
|
return ["Arista"]
|
|
13
27
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import ArubaFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,18 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class ArubaVendor(AbstractVendor):
|
|
9
10
|
NAME = "aruba"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("conf t"))
|
|
16
|
+
after.add_cmd(Command("end"))
|
|
17
|
+
if do_commit:
|
|
18
|
+
after.add_cmd(Command("commit apply"))
|
|
19
|
+
if do_finalize:
|
|
20
|
+
after.add_cmd(Command("write memory"))
|
|
21
|
+
|
|
22
|
+
return before, after
|
|
23
|
+
|
|
11
24
|
def match(self) -> list[str]:
|
|
12
25
|
return ["Aruba"]
|
|
13
26
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
2
|
+
from annet.annlib.netdev.views.hardware import HardwareView
|
|
3
|
+
from annet.annlib.tabparser import B4comFormatter
|
|
4
|
+
from annet.vendors.base import AbstractVendor
|
|
5
|
+
from annet.vendors.registry import registry
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@registry.register
|
|
9
|
+
class B4ComVendor(AbstractVendor):
|
|
10
|
+
NAME = "b4com"
|
|
11
|
+
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
if hw.B4com.CS2148P:
|
|
16
|
+
before.add_cmd(Command("conf t"))
|
|
17
|
+
after.add_cmd(Command("end"))
|
|
18
|
+
if do_finalize:
|
|
19
|
+
after.add_cmd(Command("write", timeout=40))
|
|
20
|
+
else:
|
|
21
|
+
before.add_cmd(Command("conf t"))
|
|
22
|
+
if do_commit:
|
|
23
|
+
after.add_cmd(Command("commit"))
|
|
24
|
+
after.add_cmd(Command("end"))
|
|
25
|
+
if do_finalize:
|
|
26
|
+
after.add_cmd(Command("write", timeout=40))
|
|
27
|
+
|
|
28
|
+
return before, after
|
|
29
|
+
|
|
30
|
+
def match(self) -> list[str]:
|
|
31
|
+
return ["B4com"]
|
|
32
|
+
|
|
33
|
+
@property
|
|
34
|
+
def reverse(self) -> str:
|
|
35
|
+
return "no"
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def hardware(self) -> HardwareView:
|
|
39
|
+
return HardwareView("B4com")
|
|
40
|
+
|
|
41
|
+
def make_formatter(self, **kwargs) -> B4comFormatter:
|
|
42
|
+
return B4comFormatter(**kwargs)
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def exit(self) -> str:
|
|
46
|
+
return "exit"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import CiscoFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,16 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class CiscoVendor(AbstractVendor):
|
|
9
10
|
NAME = "cisco"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("conf t"))
|
|
16
|
+
after.add_cmd(Command("exit"))
|
|
17
|
+
if do_finalize:
|
|
18
|
+
after.add_cmd(Command("copy running-config startup-config", timeout=40))
|
|
19
|
+
|
|
20
|
+
return before, after
|
|
21
|
+
|
|
11
22
|
def match(self) -> list[str]:
|
|
12
23
|
return ["Cisco"]
|
|
13
24
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import HuaweiFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,15 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class H3CVendor(AbstractVendor):
|
|
9
10
|
NAME = "h3c"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("system-view"))
|
|
16
|
+
if do_finalize:
|
|
17
|
+
after.add_cmd(Command("save force", timeout=90))
|
|
18
|
+
|
|
19
|
+
return before, after
|
|
20
|
+
|
|
11
21
|
def match(self) -> list[str]:
|
|
12
22
|
return ["H3C"]
|
|
13
23
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import HuaweiFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,18 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class HuaweiVendor(AbstractVendor):
|
|
9
10
|
NAME = "huawei"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("system-view"))
|
|
16
|
+
if do_commit and (hw.Huawei.CE or hw.Huawei.NE):
|
|
17
|
+
after.add_cmd(Command("commit"))
|
|
18
|
+
after.add_cmd(Command("q"))
|
|
19
|
+
if do_finalize:
|
|
20
|
+
after.add_cmd(Command("save", timeout=20))
|
|
21
|
+
|
|
22
|
+
return before, after
|
|
23
|
+
|
|
11
24
|
def match(self) -> list[str]:
|
|
12
25
|
return ["Huawei"]
|
|
13
26
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import AsrFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,16 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class IosXrVendor(AbstractVendor):
|
|
9
10
|
NAME = "iosxr"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("configure exclusive"))
|
|
16
|
+
if do_commit:
|
|
17
|
+
after.add_cmd(Command("commit"))
|
|
18
|
+
after.add_cmd(Command("exit"))
|
|
19
|
+
|
|
20
|
+
return before, after
|
|
21
|
+
|
|
11
22
|
def match(self) -> list[str]:
|
|
12
23
|
return ["Cisco.ASR", "Cisco.XR", "Cisco.XRV"]
|
|
13
24
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import JuniperFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,16 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class JuniperVendor(AbstractVendor):
|
|
9
10
|
NAME = "juniper"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("configure exclusive"))
|
|
16
|
+
if do_commit:
|
|
17
|
+
after.add_cmd(Command("commit", timeout=30))
|
|
18
|
+
after.add_cmd(Command("exit"))
|
|
19
|
+
|
|
20
|
+
return before, after
|
|
21
|
+
|
|
11
22
|
def match(self) -> list[str]:
|
|
12
23
|
return ["Juniper"]
|
|
13
24
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import NexusFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,16 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class NexusVendor(AbstractVendor):
|
|
9
10
|
NAME = "nexus"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("conf t"))
|
|
16
|
+
after.add_cmd(Command("exit"))
|
|
17
|
+
if do_finalize:
|
|
18
|
+
after.add_cmd(Command("copy running-config startup-config", timeout=40))
|
|
19
|
+
|
|
20
|
+
return before, after
|
|
21
|
+
|
|
11
22
|
def match(self) -> list[str]:
|
|
12
23
|
return ["Cisco.Nexus"]
|
|
13
24
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import NokiaFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,15 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class NokiaVendor(AbstractVendor):
|
|
9
10
|
NAME = "nokia"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("configure private"))
|
|
16
|
+
if do_commit:
|
|
17
|
+
after.add_cmd(Command("commit"))
|
|
18
|
+
|
|
19
|
+
return before, after
|
|
20
|
+
|
|
11
21
|
def match(self) -> list[str]:
|
|
12
22
|
return ["Nokia"]
|
|
13
23
|
|