Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

v1.1.0 #110

Merged
merged 11 commits into from
Mar 22, 2022
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Default owner(s) of all files in this repository
* @itdependsnetworks @chipn @jeffkala @matt852 @qduk @jdrew82
* @itdependsnetworks @jeffkala @matt852 @qduk @jdrew82
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9"]
nautobot-version: ["1.0.3"]
python-version: ["3.7", "3.8", "3.9"]
nautobot-version: ["1.2.8"]
env:
INVOKE_NAUTOBOT_PLUGIN_CHATOPS_PANORAMA_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_PLUGIN_CHATOPS_PANORAMA_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
fail-fast: true
matrix:
python-version: ["3.7"]
nautobot-version: ["1.0.3"]
nautobot-version: ["1.2.8"]
env:
INVOKE_NAUTOBOT_PLUGIN_CHATOPS_PANORAMA_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_PLUGIN_CHATOPS_PANORAMA_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
Expand All @@ -148,8 +148,8 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9"]
nautobot-version: ["1.0.3"]
python-version: ["3.7", "3.8", "3.9"]
nautobot-version: ["1.2.8"]
env:
INVOKE_NAUTOBOT_PLUGIN_CHATOPS_PANORAMA_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_PLUGIN_CHATOPS_PANORAMA_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The [PyInvoke](http://www.pyinvoke.org/) library is used to provide some helper

* `nautobot_ver`: the version of Nautobot to use as a base for any built docker containers (default: 1.0.1)
* `project_name`: the default docker compose project name (default: nautobot_plugin_chatops_panorama)
* `python_ver`: the version of Python to use as a base for any built docker containers (default: 3.6)
* `python_ver`: the version of Python to use as a base for any built docker containers (default: 3.7)
* `local`: a boolean flag indicating if invoke tasks should be run on the host or inside the docker containers (default: False, commands will be run in docker containers)
* `compose_dir`: the full path to a directory containing the project compose files
* `compose_files`: a list of compose files applied in order (see [Multiple Compose files](https://docs.docker.com/compose/extends/#multiple-compose-files) for more information)
Expand Down
4 changes: 2 additions & 2 deletions invoke.example.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
nautobot_plugin_chatops_panorama:
project_name: "nautobot-plugin-chatops-panorama"
nautobot_ver: "1.0.1"
nautobot_ver: "1.2.8"
local: false
python_ver: "3.6"
python_ver: "3.7"
compose_dir: "development"
compose_files:
- "docker-compose.requirements.yml"
Expand Down
2 changes: 1 addition & 1 deletion nautobot_plugin_chatops_panorama/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Plugin declaration for nautobot_plugin_chatops_panorama."""

__version__ = "1.0.0"
__version__ = "1.1.0"

from nautobot.extras.plugins import PluginConfig

Expand Down
13 changes: 11 additions & 2 deletions nautobot_plugin_chatops_panorama/utils/panorama.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,15 @@ def get_devices(connection: Panorama) -> dict:
"""
dev_list = connection.refresh_devices(include_device_groups=False)

group_names = [device.name for device in connection.refresh_devices()]
group_names = []
devices = connection.refresh_devices()
for device in devices:
try:
# AttributeError thrown if device is not in a device group
group_names.append(device.name)
except AttributeError:
continue

group_xml_obj = connection.op("show devicegroups")
groups_and_devices = {}
for group in group_names:
Expand All @@ -111,13 +119,14 @@ def get_devices(connection: Panorama) -> dict:
connection.add(device)
device_system_info = device.show_system_info()["system"]
# system_setting = device.find("", SystemSettings)
# TODO: Add support for virtual firewall (vsys PA's) on same physical device
_device_dict[device_system_info["hostname"]] = {
"hostname": device_system_info["hostname"],
"serial": device_system_info["serial"],
"group_name": group_name,
"ip_address": device_system_info["ip-address"],
"status": device.is_active(),
# TODO (hackathon): Grab this via proxy to firewall to grab get_system_info()
# TODO: Grab this via proxy to firewall to grab get_system_info()
"model": device_system_info["model"],
"os_version": device_system_info["sw-version"],
}
Expand Down
27 changes: 2 additions & 25 deletions nautobot_plugin_chatops_panorama/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
from netutils.protocol_mapper import PROTO_NAME_TO_NUM

from django_rq import job
from nautobot.dcim.models import Device, Interface
from nautobot.dcim.models import Interface
from nautobot_chatops.choices import CommandStatusChoices
from nautobot_chatops.workers import handle_subcommands, subcommand_of

from panos.firewall import Firewall
from panos.errors import PanDeviceError

from nautobot_plugin_chatops_panorama.constant import ALLOWED_OBJECTS

from nautobot_plugin_chatops_panorama.utils.panorama import (
connect_panorama,
get_devices,
Expand All @@ -38,28 +36,6 @@ def palo_logo(dispatcher):
return dispatcher.image_element(dispatcher.static_url(PALO_LOGO_PATH), alt_text=PALO_LOGO_ALT)


def prompt_for_panos_device_group(dispatcher, command, connection):
"""Prompt user for panos device group to check for groups from."""
group_names = [device.name for device in connection.refresh_devices()]
dispatcher.prompt_from_menu(command, "Select Panorama Device Group", [(grp, grp) for grp in group_names])
return CommandStatusChoices.STATUS_SUCCEEDED


def prompt_for_object_type(dispatcher, command):
"""Prompt user for type of object to validate."""
dispatcher.prompt_from_menu(
command, "Select an allowed object type", [(object_type, object_type) for object_type in ALLOWED_OBJECTS]
)
return CommandStatusChoices.STATUS_SUCCEEDED


def prompt_for_nautobot_device(dispatcher, command):
"""Prompt user for firewall device within Nautobot."""
_devices = Device.objects.all()
dispatcher.prompt_from_menu(command, "Select a Nautobot Device", [(dev.name, str(dev.id)) for dev in _devices])
return CommandStatusChoices.STATUS_SUCCEEDED


def prompt_for_device(dispatcher, command, conn):
"""Prompt the user to select a Palo Alto device."""
_devices = get_devices(connection=conn)
Expand Down Expand Up @@ -529,6 +505,7 @@ def capture_traffic(
# ---------------------------------------------------
# Get parameters used to filter packet capture
# ---------------------------------------------------
# TODO: This needs to be removed and the interfaces pulled dynamically from Panorama
_interfaces = Interface.objects.filter(device__name=device)
interface_list = [(intf.name, intf.name) for intf in _interfaces]

Expand Down
Loading