From d9feb67e02553e703b6a278b2aadde1104352eb5 Mon Sep 17 00:00:00 2001 From: Christopher McCarthy Date: Mon, 4 Sep 2023 11:20:40 +0000 Subject: [PATCH] Apply suggestions from code review --- src/primaite/simulator/network/hardware/nodes/router.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/primaite/simulator/network/hardware/nodes/router.py b/src/primaite/simulator/network/hardware/nodes/router.py index 26ba01ae..fa1a0858 100644 --- a/src/primaite/simulator/network/hardware/nodes/router.py +++ b/src/primaite/simulator/network/hardware/nodes/router.py @@ -81,12 +81,11 @@ class AccessControlList(SimComponent): def __init__(self, **kwargs) -> None: if not kwargs.get("implicit_action"): kwargs["implicit_action"] = ACLAction.DENY - if not kwargs.get("max_acl_rules"): - kwargs["max_acl_rules"] = 25 + kwargs["implicit_rule"] = ACLRule(action=kwargs["implicit_action"]) - kwargs["_acl"] = [None] * (kwargs["max_acl_rules"] - 1) super().__init__(**kwargs) + self._acl = [None] * (self.max_acl_rules - 1) def describe_state(self) -> Dict: """ @@ -145,7 +144,7 @@ class AccessControlList(SimComponent): :param int position: The position of the rule to be removed. :raises ValueError: When the position is out of bounds. """ - if 0 <= position < self.max_acl_rules: + if 0 <= position < self.max_acl_rules - 1: self._acl[position] = None else: raise ValueError(f"Position {position} is out of bounds.")