Skip to content

Commit

Permalink
Merge pull request #321 from networktocode/nn_updates_sep6
Browse files Browse the repository at this point in the history
Updating Dependencies
  • Loading branch information
jvanderaa authored Oct 23, 2023
2 parents 1b731e2 + a6bb91c commit fa7b260
Show file tree
Hide file tree
Showing 31 changed files with 2,079 additions and 1,979 deletions.
84 changes: 42 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,49 @@ jobs:
black:
env:
INVOKE_LOCAL: "True"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v5"
- name: "Linting: Black"
run: "poetry run invoke black"
bandit:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
env:
INVOKE_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v5"
- name: "Linting: Bandit"
run: "poetry run invoke bandit"
needs:
- "black"
pydocstyle:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
env:
INVOKE_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v5"
- name: "Linting: pydocstyle"
run: "poetry run invoke pydocstyle"
needs:
- "black"
flake8:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
env:
INVOKE_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v2"
uses: "actions/setup-python@v4"
with:
python-version: "3.9"
- name: "Install Python Packages for Linting"
Expand All @@ -65,25 +65,25 @@ jobs:
needs:
- "black"
yamllint:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
env:
INVOKE_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v5"
- name: "Linting: yamllint"
run: "poetry run invoke yamllint"
needs:
- "black"
build:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v5"
- name: "Build Container"
run: "poetry run invoke build-image"
needs:
Expand All @@ -92,12 +92,12 @@ jobs:
- "flake8"
- "yamllint"
pylint:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v5"
- name: "Build Container"
run: "poetry run invoke build-image"
- name: "Linting: Pylint"
Expand All @@ -109,14 +109,14 @@ jobs:
fail-fast: true
matrix:
python-version: ["3.8", "3.9"]
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
env:
PYTHON_VER: "${{ matrix.python-version }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v5"
- name: "Build Container"
run: "poetry run invoke build-image"
- name: "Run Tests"
Expand All @@ -125,15 +125,15 @@ jobs:
- "pylint"
integration_nautobot:
name: "Integration Test - Nautobot"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
strategy:
matrix:
nautobot-version: ["1.2.12", "1.3.6", "1.4.10", "1.5.18", "latest"]
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v2"
uses: "actions/setup-python@v4"
with:
python-version: "3.9"
- name: "Run Install"
Expand All @@ -153,12 +153,12 @@ jobs:
- "pytest"
integration_netbox210:
name: "Integration Test - NetBox 2.10"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v2"
uses: "actions/setup-python@v4"
with:
python-version: "3.9"
- name: "Run Install"
Expand All @@ -177,12 +177,12 @@ jobs:
- "pytest"
integration_netbox29:
name: "Integration Test - NetBox 2.9"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v2"
uses: "actions/setup-python@v4"
with:
python-version: "3.9"
- name: "Run Install"
Expand All @@ -201,12 +201,12 @@ jobs:
- "pytest"
integration_netbox28:
name: "Integration Test - NetBox 2.8"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v2"
uses: "actions/setup-python@v4"
with:
python-version: "3.9"
- name: "Run Install"
Expand All @@ -225,13 +225,13 @@ jobs:
- "pytest"
publish_gh:
name: "Publish to GitHub"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v2"
uses: "actions/setup-python@v4"
with:
python-version: "3.9"
- name: "Install Python Packages for Publishing"
Expand All @@ -257,13 +257,13 @@ jobs:
- "integration_netbox28"
publish_pypi:
name: "Push Package to PyPI"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v2"
uses: "actions/setup-python@v4"
with:
python-version: "3.9"
- name: "Install Python Packages"
Expand Down
1 change: 0 additions & 1 deletion network_importer/adapters/nautobot_api/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ def load_nautobot_prefix(self, site):
prefixes = self.nautobot.ipam.prefixes.filter(site=site.name, status="active")

for nb_prefix in prefixes:

prefix = self.prefix(
prefix=nb_prefix.prefix,
site_name=site.name,
Expand Down
1 change: 0 additions & 1 deletion network_importer/adapters/netbox_api/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ def load_netbox_prefix(self, site):
prefixes = self.netbox.ipam.prefixes.filter(site=site.name, status="active")

for nb_prefix in prefixes:

prefix = self.prefix(
prefix=nb_prefix.prefix,
site_name=site.name,
Expand Down
5 changes: 0 additions & 5 deletions network_importer/adapters/network_importer/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def load(self):

# Create all devices and site object from Nornir Inventory
for hostname, host in self.nornir.inventory.hosts.items():

if len(self.bfi.q.nodeProperties(nodes=f'"{hostname}"').answer()) == 0:
self.nornir.inventory.hosts[hostname].has_config = False
LOGGER.warning("Unable to find information for %s in Batfish, SKIPPING", hostname)
Expand Down Expand Up @@ -121,7 +120,6 @@ def load_batfish_device(self, device):
if config.SETTINGS.main.import_vlans:
bf_vlans = self.bfi.q.switchedVlanProperties(nodes=f'"{device.name}"').answer()
for bf_vlan in bf_vlans.frame().itertuples():

if config.SETTINGS.main.import_vlans in ["config", True]:
vlan, created = self.get_or_add(
self.vlan(name=f"vlan-{bf_vlan.VLAN_ID}", vid=bf_vlan.VLAN_ID, site_name=site.name)
Expand Down Expand Up @@ -402,7 +400,6 @@ def load_batfish_cable(self):
p2p_links = self.bfi.q.layer3Edges().answer()
existing_cables = []
for link in p2p_links.frame().itertuples():

if link.Interface.hostname not in device_names:
continue

Expand Down Expand Up @@ -544,9 +541,7 @@ def is_cable_side_valid(cable, side):

cables = self.get_all(self.cable)
for cable in list(cables):

for side in ["a", "z"]:

if not is_cable_side_valid(cable, side):
break

Expand Down
1 change: 0 additions & 1 deletion network_importer/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def order_children_interface(cls, children):
intfs_regs[action].append(child_name)

elif action in ["update", "create"]:

if "is_lag" in child.source_attrs and child.source_attrs["is_lag"]:
intfs_lags[action].append(child_name)
elif "is_lag_member" in child.source_attrs and child.source_attrs["is_lag_member"]:
Expand Down
1 change: 0 additions & 1 deletion network_importer/drivers/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def convert_cisco_genie_lldp_neighbors_details(device_name, data):

# intf_name = canonical_interface_name(intf_name)
for nei_intf_name in list(intf_data["port_id"].keys()):

# nei_intf_name_long = canonical_interface_name(nei_intf_name)
if is_interface_lag(nei_intf_name):
LOGGER.debug(
Expand Down
2 changes: 0 additions & 2 deletions network_importer/drivers/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def get_neighbors(task: Task) -> Result: # pylint: disable=too-many-return-stat
LOGGER.debug("Executing get_neighbor for %s (%s)", task.host.name, task.host.platform)

if config.SETTINGS.main.import_cabling == "lldp":

try:
result = task.run(task=napalm_get, getters=["lldp_neighbors"])
except: # noqa: E722 # pylint: disable=bare-except
Expand All @@ -82,7 +81,6 @@ def get_neighbors(task: Task) -> Result: # pylint: disable=too-many-return-stat
return Result(host=task.host, result={"neighbors": neighbors})

if config.SETTINGS.main.import_cabling == "cdp":

try:
result = task.run(task=netmiko_send_command, command_string="show cdp neighbors detail", use_genie=True)
except NornirSubTaskError:
Expand Down
1 change: 0 additions & 1 deletion network_importer/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def print_all(self):
perflog_file_path = config.SETTINGS.logs.performance_log_directory + "/" + perflog_filename

with open(perflog_file_path, "w") as file_:

if self.nbr_devices:
file_.write(f"Report for {self.nbr_devices} devices\n")

Expand Down
1 change: 0 additions & 1 deletion network_importer/processors/get_neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ def subtask_instance_completed(self, task: Task, host: Host, result: MultiResult

interfaces = list(result[0].result["neighbors"].keys())
for interface in interfaces:

neighbors = result[0].result["neighbors"][interface]

if len(neighbors) > 1:
Expand Down
Loading

0 comments on commit fa7b260

Please sign in to comment.