Merge branch 'bugfix/1587-hardcoded-agent' into feature/1575-docstring-param-desc
This commit is contained in:
@@ -116,3 +116,27 @@ class AccessControlList:
|
|||||||
rule = ACLRule(_permission, _source_ip, _dest_ip, _protocol, str(_port))
|
rule = ACLRule(_permission, _source_ip, _dest_ip, _protocol, str(_port))
|
||||||
hash_value = hash(rule)
|
hash_value = hash(rule)
|
||||||
return hash_value
|
return hash_value
|
||||||
|
|
||||||
|
def get_relevant_rules(self, _source_ip_address, _dest_ip_address, _protocol, _port):
|
||||||
|
"""Get all ACL rules that relate to the given arguments.
|
||||||
|
|
||||||
|
:param _source_ip_address: the source IP address to check
|
||||||
|
:param _dest_ip_address: the destination IP address to check
|
||||||
|
:param _protocol: the protocol to check
|
||||||
|
:param _port: the port to check
|
||||||
|
:return: Dictionary of all ACL rules that relate to the given arguments
|
||||||
|
:rtype: Dict[str, ACLRule]
|
||||||
|
"""
|
||||||
|
relevant_rules = {}
|
||||||
|
|
||||||
|
for rule_key, rule_value in self.acl.items():
|
||||||
|
if self.check_address_match(rule_value, _source_ip_address, _dest_ip_address):
|
||||||
|
if (
|
||||||
|
rule_value.get_protocol() == _protocol or rule_value.get_protocol() == "ANY" or _protocol == "ANY"
|
||||||
|
) and (
|
||||||
|
str(rule_value.get_port()) == str(_port) or rule_value.get_port() == "ANY" or str(_port) == "ANY"
|
||||||
|
):
|
||||||
|
# There's a matching rule.
|
||||||
|
relevant_rules[rule_key] = rule_value
|
||||||
|
|
||||||
|
return relevant_rules
|
||||||
|
|||||||
@@ -165,7 +165,8 @@ def transform_change_obs_readable(obs):
|
|||||||
os_states = [SoftwareState(i).name for i in obs[:, 2]]
|
os_states = [SoftwareState(i).name for i in obs[:, 2]]
|
||||||
new_obs = [ids, operating_states, os_states]
|
new_obs = [ids, operating_states, os_states]
|
||||||
|
|
||||||
for service in range(3, obs.shape[1]):
|
# changed range(3,...) to range(4,...) because we added file system which was new since ADSP
|
||||||
|
for service in range(4, obs.shape[1]):
|
||||||
# Links bit/s don't have a service state
|
# Links bit/s don't have a service state
|
||||||
service_states = [SoftwareState(i).name if i <= 4 else i for i in obs[:, service]]
|
service_states = [SoftwareState(i).name if i <= 4 else i for i in obs[:, service]]
|
||||||
new_obs.append(service_states)
|
new_obs.append(service_states)
|
||||||
|
|||||||
Reference in New Issue
Block a user