diff --git a/.github/ISSUE_TEMPLATE/documentation_change.yaml b/.github/ISSUE_TEMPLATE/documentation_change.yaml index 84ded74..2f8656e 100644 --- a/.github/ISSUE_TEMPLATE/documentation_change.yaml +++ b/.github/ISSUE_TEMPLATE/documentation_change.yaml @@ -1,6 +1,6 @@ --- name: 📖 Documentation Change -description: Suggest an addition or modification to the NetBox access-list plugin documentation +description: Suggest an addition or modification to the NetBox Access Lists plugin documentation title: "[Docs]: " labels: ["documentation"] body: diff --git a/README.md b/README.md index 093cd9f..daaa042 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # netbox-access-lists -A NetBox plugin for Access-List management +A NetBox plugin for Access List management ## Origin diff --git a/netbox_access_lists/__init__.py b/netbox_access_lists/__init__.py index 7d4ea90..3b49054 100644 --- a/netbox_access_lists/__init__.py +++ b/netbox_access_lists/__init__.py @@ -7,7 +7,7 @@ from extras.plugins import PluginConfig class NetBoxAccessListsConfig(PluginConfig): name = 'netbox_access_lists' - verbose_name = 'Access-Lists' + verbose_name = 'Access Lists' description = 'Manage simple ACLs in NetBox' version = '0.1' base_url = 'access-lists' diff --git a/netbox_access_lists/choices.py b/netbox_access_lists/choices.py index 71a4b7e..086c665 100644 --- a/netbox_access_lists/choices.py +++ b/netbox_access_lists/choices.py @@ -14,7 +14,7 @@ __all__ = ( class ACLActionChoices(ChoiceSet): """ - Defines the choices availble for the Access-List plugin specific to ACL default_action. + Defines the choices availble for the Access Lists plugin specific to ACL default_action. """ ACTION_DENY = 'deny' ACTION_PERMIT = 'permit' @@ -29,7 +29,7 @@ class ACLActionChoices(ChoiceSet): class ACLRuleActionChoices(ChoiceSet): """ - Defines the choices availble for the Access-List plugin specific to ACL rule actions. + Defines the choices availble for the Access Lists plugin specific to ACL rule actions. """ ACTION_DENY = 'deny' ACTION_PERMIT = 'permit' @@ -44,7 +44,7 @@ class ACLRuleActionChoices(ChoiceSet): class ACLTypeChoices(ChoiceSet): """ - Defines the choices availble for the Access-List plugin specific to ACL type. + Defines the choices availble for the Access Lists plugin specific to ACL type. """ CHOICES = [ ('extended', 'Extended', 'purple'), @@ -54,7 +54,7 @@ class ACLTypeChoices(ChoiceSet): class ACLProtocolChoices(ChoiceSet): """ - Defines the choices availble for the Access-List plugin specific to ACL Rule protocol. + Defines the choices availble for the Access Lists plugin specific to ACL Rule protocol. """ CHOICES = [ ('icmp', 'ICMP', 'purple'), diff --git a/netbox_access_lists/forms/bulk_edit.py b/netbox_access_lists/forms/bulk_edit.py index d984e46..56c1f34 100644 --- a/netbox_access_lists/forms/bulk_edit.py +++ b/netbox_access_lists/forms/bulk_edit.py @@ -57,7 +57,7 @@ from ..models import AccessList # # fieldsets = [ # ('Host Details', ('region', 'site_group', 'site', 'device')), -# ('Access-List Details', ('type', 'default_action', 'add_tags', 'remove_tags')), +# ('Access List Details', ('type', 'default_action', 'add_tags', 'remove_tags')), # ] # # @@ -67,7 +67,7 @@ from ..models import AccessList # help_texts = { # 'default_action': 'The default behavior of the ACL.', # 'name': 'The name uniqueness per device is case insensitive.', -# 'type': mark_safe('*Note: CANNOT be changed if ACL Rules are assoicated to this Access-List.'), +# 'type': mark_safe('*Note: CANNOT be changed if ACL Rules are assoicated to this Access List.'), # } # # def clean(self): # Not working given you are bulkd editing multiple forms diff --git a/netbox_access_lists/forms/models.py b/netbox_access_lists/forms/models.py index ddec355..c2e645d 100644 --- a/netbox_access_lists/forms/models.py +++ b/netbox_access_lists/forms/models.py @@ -57,7 +57,7 @@ class AccessListForm(NetBoxModelForm): fieldsets = [ ('Host Details', ('region', 'site_group', 'site', 'device')), - ('Access-List Details', ('name', 'type', 'default_action', 'tags')), + ('Access List Details', ('name', 'type', 'default_action', 'tags')), ] class Meta: @@ -66,7 +66,7 @@ class AccessListForm(NetBoxModelForm): help_texts = { 'default_action': 'The default behavior of the ACL.', 'name': 'The name uniqueness per device is case insensitive.', - 'type': mark_safe('*Note: CANNOT be changed if ACL Rules are assoicated to this Access-List.'), + 'type': mark_safe('*Note: CANNOT be changed if ACL Rules are assoicated to this Access List.'), } def clean(self): @@ -90,7 +90,7 @@ class AccessListForm(NetBoxModelForm): class ACLStandardRuleForm(NetBoxModelForm): """ - GUI form to add or edit Standard Access-List. + GUI form to add or edit Standard Access List. Requires an access_list, an index, and ACL rule type. See the clean function for logic on other field requirements. """ @@ -100,7 +100,7 @@ class ACLStandardRuleForm(NetBoxModelForm): 'type': 'standard' }, help_text=mark_safe('*Note: This field will only display Standard ACLs.'), - label='Access-List', + label='Access List', ) source_prefix = DynamicModelChoiceField( queryset=Prefix.objects.all(), @@ -114,7 +114,7 @@ class ACLStandardRuleForm(NetBoxModelForm): ) fieldsets = ( - ('Access-List Details', ('access_list', 'description', 'tags')), + ('Access List Details', ('access_list', 'description', 'tags')), ('Rule Definition', ('index', 'action', 'remark', 'source_prefix')), ) @@ -152,7 +152,7 @@ class ACLStandardRuleForm(NetBoxModelForm): class ACLExtendedRuleForm(NetBoxModelForm): """ - GUI form to add or edit Extended Access-List. + GUI form to add or edit Extended Access List. Requires an access_list, an index, and ACL rule type. See the clean function for logic on other field requirements. """ @@ -162,7 +162,7 @@ class ACLExtendedRuleForm(NetBoxModelForm): 'type': 'extended' }, help_text=mark_safe('*Note: This field will only display Extended ACLs.'), - label='Access-List', + label='Access List', ) tags = DynamicModelMultipleChoiceField( queryset=Tag.objects.all(), @@ -181,7 +181,7 @@ class ACLExtendedRuleForm(NetBoxModelForm): label='Destination Prefix', ) fieldsets = ( - ('Access-List Details', ('access_list', 'description', 'tags')), + ('Access List Details', ('access_list', 'description', 'tags')), ('Rule Definition', ('index', 'action', 'remark', 'source_prefix', 'source_ports', 'destination_prefix', 'destination_ports', 'protocol',)), ) diff --git a/netbox_access_lists/migrations/0001_initial.py b/netbox_access_lists/migrations/0001_initial.py index a1d4a58..e95f69f 100644 --- a/netbox_access_lists/migrations/0001_initial.py +++ b/netbox_access_lists/migrations/0001_initial.py @@ -14,7 +14,7 @@ __all__ = ( class Migration(migrations.Migration): """ - Defines the migrations required for the initial setup of the access-list plugin and its associated django models. + Defines the migrations required for the initial setup of the access lists plugin and its associated django models. """ initial = True @@ -42,6 +42,7 @@ class Migration(migrations.Migration): options={ 'ordering': ('name', 'device'), 'unique_together': {('name', 'device')}, + 'verbose_name': 'Access List', }, ), migrations.CreateModel( @@ -62,6 +63,7 @@ class Migration(migrations.Migration): options={ 'ordering': ('access_list', 'index'), 'unique_together': {('access_list', 'index')}, + 'verbose_name': 'ACL Standard Rule', }, ), migrations.CreateModel( @@ -86,6 +88,7 @@ class Migration(migrations.Migration): options={ 'ordering': ('access_list', 'index'), 'unique_together': {('access_list', 'index')}, + 'verbose_name': 'ACL Extended Rule', }, ), ] diff --git a/netbox_access_lists/models/access_list_rules.py b/netbox_access_lists/models/access_list_rules.py index e5e6fb4..417f720 100644 --- a/netbox_access_lists/models/access_list_rules.py +++ b/netbox_access_lists/models/access_list_rules.py @@ -25,7 +25,7 @@ class ACLRule(NetBoxModel): access_list = models.ForeignKey( on_delete=models.CASCADE, to=AccessList, - verbose_name='Access-List', + verbose_name='Access List', ) index = models.PositiveIntegerField() remark = models.CharField( @@ -57,8 +57,13 @@ class ACLRule(NetBoxModel): return ACLRuleActionChoices.colors.get(self.action) class Meta: + """ + Define the common model properties: + - as an abstract model + - ordering + - unique together + """ abstract = True - default_related_name='%(class)ss' ordering = ('access_list', 'index') unique_together = ('access_list', 'index') @@ -75,6 +80,16 @@ class ACLStandardRule(ACLRule): """ return reverse('plugins:netbox_access_lists:aclstandardrule', args=[self.pk]) + class Meta(ACLRule.Meta): + """ + Define the model properties adding to or overriding the inherited class: + - default_related_name for any FK relationships + - verbose name (for displaying in the GUI) + - verbose name plural (for displaying in the GUI) + """ + default_related_name='aclstandardrules' + verbose_name='ACL Standard Rule' + verbose_name_plural='ACL Standard Rules' class ACLExtendedRule(ACLRule): """ @@ -116,3 +131,14 @@ class ACLExtendedRule(ACLRule): def get_protocol_color(self): return ACLProtocolChoices.colors.get(self.protocol) + + class Meta(ACLRule.Meta): + """ + Define the model properties adding to or overriding the inherited class: + - default_related_name for any FK relationships + - verbose name (for displaying in the GUI) + - verbose name plural (for displaying in the GUI) + """ + default_related_name='aclextendedrules' + verbose_name='ACL Extended Rule' + verbose_name_plural='ACL Extended Rules' diff --git a/netbox_access_lists/models/access_lists.py b/netbox_access_lists/models/access_lists.py index bc3c7e2..6572600 100644 --- a/netbox_access_lists/models/access_lists.py +++ b/netbox_access_lists/models/access_lists.py @@ -15,7 +15,7 @@ __all__ = ( class AccessList(NetBoxModel): """ - Model defintion for Access-Lists. + Model defintion for Access Lists. """ name = models.CharField( max_length=100 @@ -42,6 +42,9 @@ class AccessList(NetBoxModel): class Meta: ordering = ('name', 'device') unique_together = ('name', 'device') + default_related_name='accesslists' + verbose_name='Access List' + verbose_name_plural='Access Lists' def __str__(self): return self.name diff --git a/netbox_access_lists/navigation.py b/netbox_access_lists/navigation.py index 4d6f5f1..0ba5610 100644 --- a/netbox_access_lists/navigation.py +++ b/netbox_access_lists/navigation.py @@ -43,19 +43,19 @@ aclextendedrule_butons = [ menu_items = ( PluginMenuItem( link='plugins:netbox_access_lists:accesslist_list', - link_text='Access-Lists', + link_text='Access Lists', buttons=accesslist_buttons ), - # Comment out Standard Access-List rule to force creation in the ACL view + # Comment out Standard Access List rule to force creation in the ACL view PluginMenuItem( link='plugins:netbox_access_lists:aclstandardrule_list', - link_text='Standard Access-List Rules', + link_text='ACL Standard Rule', buttons=aclstandardrule_butons ), - # Comment out Extended Access-List rule to force creation in the ACL view + # Comment out Extended Access List rule to force creation in the ACL view PluginMenuItem( link='plugins:netbox_access_lists:aclextendedrule_list', - link_text='Extended Access-List Rules', + link_text='ACL Extended Rules', buttons=aclextendedrule_butons ), ) diff --git a/netbox_access_lists/templates/inc/device/access_lists.html b/netbox_access_lists/templates/inc/device/access_lists.html index 374abba..7bdb9b9 100644 --- a/netbox_access_lists/templates/inc/device/access_lists.html +++ b/netbox_access_lists/templates/inc/device/access_lists.html @@ -1,13 +1,13 @@