- Added check in access_control_list.py which sets implicit permission to NA if boolean is False
- Changed the defaults in training_config.py so that each scenario has an EXPLICIT ALLOW rule as default implicit rule
- Updated the test_seeding_and_deterministic_session.py because of change no2 adds an extra rule to that scenario
This commit is contained in:
SunilSamra
2023-07-17 10:27:56 +01:00
parent ab45c7e3f9
commit 3e7f6cc98d
3 changed files with 21 additions and 17 deletions

View File

@@ -17,12 +17,11 @@ class AccessControlList:
# Bool option in main_config to decide to use implicit rule or not # Bool option in main_config to decide to use implicit rule or not
self.apply_implicit_rule: bool = apply_implicit_rule self.apply_implicit_rule: bool = apply_implicit_rule
# Implicit ALLOW or DENY firewall spec # Implicit ALLOW or DENY firewall spec
if self.apply_implicit_rule:
self.acl_implicit_permission = implicit_permission
else:
self.acl_implicit_permission = "NA"
# Last rule in the ACL list # Last rule in the ACL list
self.acl_implicit_permission = implicit_permission
# Maximum number of ACL Rules in ACL
self.max_acl_rules: int = max_acl_rules
# A list of ACL Rules
self._acl: List[Union[ACLRule, None]] = [None] * (self.max_acl_rules - 1)
# Implicit rule # Implicit rule
self.acl_implicit_rule = None self.acl_implicit_rule = None
if self.apply_implicit_rule: if self.apply_implicit_rule:
@@ -31,6 +30,11 @@ class AccessControlList:
elif self.acl_implicit_permission == RulePermissionType.ALLOW: elif self.acl_implicit_permission == RulePermissionType.ALLOW:
self.acl_implicit_rule = ACLRule("ALLOW", "ANY", "ANY", "ANY", "ANY") self.acl_implicit_rule = ACLRule("ALLOW", "ANY", "ANY", "ANY", "ANY")
# Maximum number of ACL Rules in ACL
self.max_acl_rules: int = max_acl_rules
# A list of ACL Rules
self._acl: List[Union[ACLRule, None]] = [None] * (self.max_acl_rules - 1)
@property @property
def acl(self): def acl(self):
"""Public access method for private _acl. """Public access method for private _acl.

View File

@@ -100,10 +100,10 @@ class TrainingConfig:
"Stable Baselines3 learn/eval output verbosity level" "Stable Baselines3 learn/eval output verbosity level"
# Access Control List/Rules # Access Control List/Rules
apply_implicit_rule: str = False apply_implicit_rule: str = True
"User choice to have Implicit ALLOW or DENY." "User choice to have Implicit ALLOW or DENY."
implicit_acl_rule: RulePermissionType = RulePermissionType.DENY implicit_acl_rule: RulePermissionType = RulePermissionType.ALLOW
"ALLOW or DENY implicit firewall rule to go at the end of list of ACL list." "ALLOW or DENY implicit firewall rule to go at the end of list of ACL list."
max_number_acl_rules: int = 30 max_number_acl_rules: int = 30

View File

@@ -26,16 +26,16 @@ def test_seeded_learning(temp_primaite_session):
now work. If not, then you've got a bug :). now work. If not, then you've got a bug :).
""" """
expected_mean_reward_per_episode = { expected_mean_reward_per_episode = {
1: -30.703125, 1: -90.703125,
2: -29.94140625, 2: -91.15234375,
3: -27.91015625, 3: -87.5,
4: -29.66796875, 4: -92.2265625,
5: -32.44140625, 5: -94.6875,
6: -30.33203125, 6: -91.19140625,
7: -26.25, 7: -88.984375,
8: -22.44140625, 8: -88.3203125,
9: -30.3125, 9: -112.79296875,
10: -28.359375, 10: -100.01953125,
} }
with temp_primaite_session as session: with temp_primaite_session as session: