Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace capirca dependency with aerleon #237

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/236.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated all references of `capirca` to `aerleon`.
2 changes: 2 additions & 0 deletions changes/236.dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removed capirca dependency.
Added aerleon dependency.
2 changes: 1 addition & 1 deletion development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
# Each key in the dictionary is the name of an installed App and its value is a dictionary of settings.
# PLUGINS_CONFIG = {
# "nautobot_firewall_models": {
# "capirca_os_map": {
# "aerleon_os_map": {
# "cisco_ios": "cisco",
# "arista_eos": "arista",
# }
Expand Down
6 changes: 3 additions & 3 deletions docs/admin/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ PLUGINS_CONFIG = {
"nautobot_firewall_models": {
"default_status": "Active",
"allowed_status": ["Active"], # default shown, `[]` allows all
"capirca_remark_pass": True,
"capirca_os_map": {
"aerleon_remark_pass": True,
"aerleon_os_map": {
"cisco_ios": "cisco",
"arista_eos": "arista",
},
# "custom_capirca": "my.custom.func", # provides ability to overide capirca logic
# "custom_aerleon": "my.custom.func", # provides ability to overide aerleon logic
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/user/app_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ An app for [Nautobot](https://github.com/nautobot/nautobot) that is meant to mod
- Layer 4 firewall policies
- Extended access control lists
- NAT policies
- Generation of firewall configurations, via Capirca
- Generation of firewall configurations, via Aerleon

Future development will include the ability to onboard an existing access list from a device and the ability to generate device configuration.

Expand Down
4 changes: 2 additions & 2 deletions nautobot_firewall_models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class NautobotFirewallModelsConfig(NautobotAppConfig):
min_version = "2.0.0"
max_version = "2.9999"
default_settings = {
"capirca_remark_pass": True,
"capirca_os_map": {},
"aerleon_remark_pass": True,
"aerleon_os_map": {},
"allowed_status": ["Active"],
"protect_on_delete": True,
}
Expand Down
6 changes: 3 additions & 3 deletions nautobot_firewall_models/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ class Meta:
fields = "__all__"


class CapircaPolicySerializer(NautobotModelSerializer):
"""CapircaPolicy Serializer."""
class AerleonPolicySerializer(NautobotModelSerializer):
"""AerleonPolicy Serializer."""

class Meta:
"""Meta attributes."""

model = models.CapircaPolicy
model = models.AerleonPolicy
fields = "__all__"


Expand Down
2 changes: 1 addition & 1 deletion nautobot_firewall_models/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
router.register("address-object-group", views.AddressObjectGroupViewSet)
router.register("application-object", views.ApplicationObjectViewSet)
router.register("application-object-group", views.ApplicationObjectGroupViewSet)
router.register("capirca-policy", views.CapircaPolicyViewSet)
router.register("aerleon-policy", views.AerleonPolicyViewSet)
router.register("fqdn", views.FQDNViewSet)
router.register("ip-range", views.IPRangeViewSet)
router.register("nat-policy-rule", views.NATPolicyRuleViewSet)
Expand Down
10 changes: 5 additions & 5 deletions nautobot_firewall_models/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ class NATPolicyViewSet(NautobotModelViewSet):
filterset_class = filters.NATPolicyFilterSet


class CapircaPolicyViewSet(ModelViewSet):
"""CapircaPolicy viewset."""
class AerleonPolicyViewSet(ModelViewSet):
"""AerleonPolicy viewset."""

queryset = models.CapircaPolicy.objects.all()
serializer_class = serializers.CapircaPolicySerializer
filterset_class = filters.CapircaPolicyFilterSet
queryset = models.AerleonPolicy.objects.all()
serializer_class = serializers.AerleonPolicySerializer
filterset_class = filters.AerleonPolicyFilterSet


###########################
Expand Down
4 changes: 2 additions & 2 deletions nautobot_firewall_models/app-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"Active"
]
},
"capirca_remark_pass": {
"aerleon_remark_pass": {
"type": "boolean",
"default": true
},
"capirca_os_map": {
"caerleon_os_map": {
"type": "object",
"default": {}
},
Expand Down
66 changes: 33 additions & 33 deletions nautobot_firewall_models/constants.py
Original file line number Diff line number Diff line change
@@ -1,124 +1,124 @@
"""Constants file."""
from django.conf import settings

# This is used to map the slug of the platform in the customers environment to the expected name that Capirca is looking for
CAPIRCA_OS_MAPPER = {}
# This is used to map the slug of the platform in the customers environment to the expected name that Aerleon is looking for
AERLEON_OS_MAPPER = {}

PLUGIN_CFG = settings.PLUGINS_CONFIG.get("nautobot_firewall_models", {})

if PLUGIN_CFG.get("capirca_os_map"):
CAPIRCA_OS_MAPPER = PLUGIN_CFG["capirca_os_map"]
if PLUGIN_CFG.get("aerleon_os_map"):
AERLEON_OS_MAPPER = PLUGIN_CFG["aerleon_os_map"]

# This is used to determine which status slug names are valid
ALLOW_STATUS = ["Active"]
if PLUGIN_CFG.get("allowed_status"):
ALLOW_STATUS = PLUGIN_CFG["allowed_status"]

# This is used to whitelist actions that align with Capirca
# This is used to whitelist actions that align with Aerleon
ACTION_MAP = {"allow": "accept", "deny": "deny", "drop": "reject"} # no next or reject-with-tcp-rst
# This is used to transpose string booleans to Capirca expectations
# This is used to transpose string booleans to Aerleon expectations
LOGGING_MAP = {"true": "true", "false": "disable"}

# This is used to provide hints (for type), and dotted string back (for lib) to Capirca
CAPIRCA_MAPPER = {
# This is used to provide hints (for type), and dotted string back (for lib) to Aerleon
AERLEON_MAPPER = {
"arista": {
"lib": "capirca.lib.arista.Arista",
"lib": "aerleon.lib.arista.Arista",
"type": "filter-name",
},
"aruba": {
"lib": "capirca.lib.aruba.Aruba",
"lib": "aerleon.lib.aruba.Aruba",
"type": "filter-name",
},
"brocade": {
"lib": "capirca.lib.brocade.Brocade",
"lib": "aerleon.lib.brocade.Brocade",
"type": "filter-name",
},
"cisco": {
"lib": "capirca.lib.cisco.Cisco",
"lib": "aerleon.lib.cisco.Cisco",
"type": "filter-name",
},
"ciscoasa": {
"lib": "capirca.lib.ciscoasa.CiscoASA",
"lib": "aerleon.lib.ciscoasa.CiscoASA",
"type": "filter-name",
},
"cisconx": {
"lib": "capirca.lib.cisconx.ciscoNX",
"lib": "aerleon.lib.cisconx.ciscoNX",
"type": "filter-name",
},
"cloudarmor": {
"lib": "capirca.lib.cloudarmor.CloudArmor",
"lib": "aerleon.lib.cloudarmor.CloudArmor",
"type": "filter_type",
},
"gce": {
"lib": "capirca.lib.gce.GCE",
"lib": "aerleon.lib.gce.GCE",
"type": "filter-name",
},
"gcp_hf": {
"lib": "capirca.lib.gcp.GCP",
"lib": "aerleon.lib.gcp.GCP",
"type": "filter-name",
},
"ipset": {
"lib": "capirca.lib.ipset.Ipset",
"lib": "aerleon.lib.ipset.Ipset",
"type": "direction",
},
"iptables": {
"lib": "capirca.lib.iptables.Iptables",
"lib": "aerleon.lib.iptables.Iptables",
"type": "direction",
},
"juniper": {
"lib": "capirca.lib.juniper.Juniper",
"lib": "aerleon.lib.juniper.Juniper",
"type": "filter-name",
},
"juniperevo": {
"lib": "capirca.lib.juniperevo.JuniperEvo",
"lib": "aerleon.lib.juniperevo.JuniperEvo",
"type": "filter-name",
},
"junipermsmpc": {
"lib": "capirca.lib.junipermsmpc.JuniperMSMPC",
"lib": "aerleon.lib.junipermsmpc.JuniperMSMPC",
"type": "filter-name",
},
"srx": {
"lib": "capirca.lib.junipersrx.JuniperSRX",
"lib": "aerleon.lib.junipersrx.JuniperSRX",
"type": "zone",
},
"k8s": {
"lib": "capirca.lib.k8s.K8s",
"lib": "aerleon.lib.k8s.K8s",
"type": "direction",
},
"nftables": {
"lib": "capirca.lib.nftables.Nftables",
"lib": "aerleon.lib.nftables.Nftables",
"type": "address_family",
},
"nsxv": {
"lib": "capirca.lib.nsxv.Nsxv",
"lib": "aerleon.lib.nsxv.Nsxv",
"type": "filter-name",
},
"packetfilter": {
"lib": "capirca.lib.packetfilter.PacketFilter",
"lib": "aerleon.lib.packetfilter.PacketFilter",
"type": "filter-name",
},
"paloalto": {
"lib": "capirca.lib.paloaltofw.PaloAltoFW",
"lib": "aerleon.lib.paloaltofw.PaloAltoFW",
"type": "zone",
},
"pcap": {
"lib": "capirca.lib.pcap.PcapFilter",
"lib": "aerleon.lib.pcap.PcapFilter",
"type": "filter-name",
},
"speedway": {
"lib": "capirca.lib.speedway.Speedway",
"lib": "aerleon.lib.speedway.Speedway",
"type": "direction",
},
"srxlo": {
"lib": "capirca.lib.srxlo.SRXlo",
"lib": "aerleon.lib.srxlo.SRXlo",
"type": "filter-name",
},
"windows_advfirewall": {
"lib": "capirca.lib.windows_advfirewall.WindowsAdvFirewall",
"lib": "aerleon.lib.windows_advfirewall.WindowsAdvFirewall",
"type": "direction",
},
"windows_ipsec": {
"lib": "capirca.lib.windows_ipsec.WindowsIPSec",
"lib": "aerleon.lib.windows_ipsec.WindowsIPSec",
"type": "filter-name",
},
}
6 changes: 3 additions & 3 deletions nautobot_firewall_models/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ class Meta:
fields = [i.name for i in model._meta.get_fields() if not isinstance(i, GenericRelation)]


class CapircaPolicyFilterSet(NautobotFilterSet):
"""Filter for CapircaPolicy."""
class AerleonPolicyFilterSet(NautobotFilterSet):
"""Filter for AerleonPolicy."""

device = NaturalKeyOrPKMultipleChoiceFilter(
field_name="device",
Expand All @@ -224,7 +224,7 @@ class CapircaPolicyFilterSet(NautobotFilterSet):
class Meta:
"""Meta attributes for filter."""

model = models.CapircaPolicy
model = models.AerleonPolicy
fields = [i.name for i in model._meta.get_fields() if not isinstance(i, GenericRelation)]


Expand Down
32 changes: 16 additions & 16 deletions nautobot_firewall_models/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,18 +894,18 @@ class Meta:
]


# CapircaPolicy
# AerleonPolicy


class CapircaPolicyForm(LocalContextModelForm, NautobotModelForm):
"""Filter Form for CapircaPolicy instances."""
class AerleonPolicyForm(LocalContextModelForm, NautobotModelForm):
"""Filter Form for AerleonPolicy instances."""

device = DynamicModelChoiceField(queryset=Device.objects.all())

class Meta:
"""Boilerplate form Meta data for compliance rule."""

model = models.CapircaPolicy
model = models.AerleonPolicy
fields = (
"device",
"pol",
Expand All @@ -915,30 +915,30 @@ class Meta:
)


class CapircaPolicyFilterForm(LocalContextFilterForm, NautobotFilterForm):
"""Form for CapircaPolicy instances."""
class AerleonPolicyFilterForm(LocalContextFilterForm, NautobotFilterForm):
"""Form for AerleonPolicy instances."""

model = models.CapircaPolicy
model = models.AerleonPolicy

q = forms.CharField(required=False, label="Search")


class CapircaPolicyBulkEditForm(LocalContextModelBulkEditForm, NautobotBulkEditForm):
"""BulkEdit form for CapircaPolicy instances."""
class AerleonPolicyBulkEditForm(LocalContextModelBulkEditForm, NautobotBulkEditForm):
"""BulkEdit form for AerleonPolicy instances."""

pk = forms.ModelMultipleChoiceField(queryset=models.CapircaPolicy.objects.all(), widget=forms.MultipleHiddenInput)
pk = forms.ModelMultipleChoiceField(queryset=models.AerleonPolicy.objects.all(), widget=forms.MultipleHiddenInput)

class Meta:
"""Boilerplate form Meta data for CapircaPolicy."""
"""Boilerplate form Meta data for AerleonPolicy."""

nullable_fields = []


class CapircaPolicyCSVForm(CustomFieldModelCSVForm):
"""CSV Form for CapircaPolicy instances."""
class AerleonPolicyCSVForm(CustomFieldModelCSVForm):
"""CSV Form for AerleonPolicy instances."""

class Meta:
"""Boilerplate form Meta data for CapircaPolicy."""
"""Boilerplate form Meta data for AerleonPolicy."""

model = models.CapircaPolicy
fields = models.CapircaPolicy.csv_headers
model = models.AerleonPolicy
fields = models.AerleonPolicy.csv_headers
10 changes: 5 additions & 5 deletions nautobot_firewall_models/homepage.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Adds App items to homepage."""
from nautobot.core.apps import HomePageItem, HomePagePanel

from nautobot_firewall_models.models import Policy, PolicyRule, CapircaPolicy, NATPolicy, NATPolicyRule
from nautobot_firewall_models.models import Policy, PolicyRule, AerleonPolicy, NATPolicy, NATPolicyRule

layout = (
HomePagePanel(
Expand All @@ -25,12 +25,12 @@
permissions=["nautobot_firewall_models.view_natpolicy"],
),
HomePageItem(
name="Capirca Policies",
model=CapircaPolicy,
name="Aerleon Policies",
model=AerleonPolicy,
weight=300,
link="plugins:nautobot_firewall_models:capircapolicy_list",
link="plugins:nautobot_firewall_models:aerleonpolicy_list",
description="Firewall Policies",
permissions=["nautobot_firewall_models.view_capircapolicy"],
permissions=["nautobot_firewall_models.view_aerleonpolicy"],
),
HomePageItem(
name="Security Rules",
Expand Down
Loading