-
Notifications
You must be signed in to change notification settings - Fork 11
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
Html out #531
Conversation
…ubeSet) holding all connections including src_peers, dst_peers and protocols Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com>
Added optimized_denied_ingress_props and optimized_denied_egress_props (in addition to allowed ones). Improved non_captured_conns computation Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com>
…_HC_set # Conflicts: # nca/CoreDS/CanonicalHyperCubeSet.py
Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com> Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com> Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com>
Fixed protocol handling: 0 is a valid protocol number (HOPOPT). Allowing any protocol in the range [0...255], though ProtocolNameResolver does not contain names of all of the possible 256 protocols. Fixed handling non-captured peers in K8S (cannot be handled as denied). Signed-off-by: Tanya <tatyana@il.ibm.com>
…r dst_peers dimensions is all values). Added optimization for fw_rules_map - join different entries having the same values (fw_rules). Signed-off-by: Tanya <tatyana@il.ibm.com>
1. To represent No connections, do not build TcpLikeProperties (TcpLikeProperties with no dimensions represent All connections). 2. Support subsets in query in optimized solution. 3. For comparison of optimized solution to the original one, add connections from peers to themselves. 4. More accurate comparison for 'dot' connectivity queries. 5. Generalized convert_named_ports (to not assume dimensions order) 6. Handling the possibility when projection on one dimension is empty. Signed-off-by: Tanya <tatyana@il.ibm.com>
Properly handling HostEPs in optimized TcpLikeProperties. Signed-off-by: Tanya <tatyana@il.ibm.com>
…perties) Fixed handling of non-captured pods in optimized solution. Added using True/False HC_set (make_all_properties()/make_empty_properties()) Signed-off-by: Tanya <tatyana@il.ibm.com>
'false' - only original run 'true' - only optimized run 'debug'- both runs and comparison of their results. Printing parsing time, queries time and total run time. Signed-off-by: Tanya <tatyana@il.ibm.com>
Workaround for the bug in HC set: using mutual contained_in, instead of == Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com> Signed-off-by: Tanya <tatyana@il.ibm.com>
…for -opt=debug option) Added more debug prints. Better handling of peer_set copying in TcpLikeProperties. Signed-off-by: Tanya <tatyana@il.ibm.com>
Further optimization - calculating ref_ip_blocks only in non-optimized run. Signed-off-by: Tanya <tatyana@il.ibm.com>
Improved comments. Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Tanya <tatyana@il.ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a few initial comments.
- add basic tests with output of svg file
@@ -321,7 +325,7 @@ def nca_main(argv=None): | |||
help='A list of labels to subset the query by') | |||
parser.add_argument('--ghe_token', '--gh_token', type=str, help='A valid token to access a GitHub repository') | |||
parser.add_argument('--output_format', '-o', type=str, | |||
help='Output format specification (txt, txt_no_fw_rules, csv, md, dot, jpg or yaml). ' | |||
help='Output format specification (txt, txt_no_fw_rules, csv, md, dot, jpg, html or yaml). ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the new html
format in the relevant readme files, possibly also include some explanation (and also assumption that graphviz is installed?)
@@ -327,6 +393,218 @@ def create_output(self, elements_relations): | |||
self._highlight_tag(related_tag, related_tag_info.t_class) | |||
self._save_tag_file(tag_soup, tag_info) | |||
|
|||
HTML_TEMPLATE = ''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this template be saved in a separate file?
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
Signed-off-by: Shmulik Froimovich <Shmulik.Froimovich@ibm.com>
@@ -59,13 +60,13 @@ class ElementRelations: | |||
highlights: set = field(default_factory=set) | |||
explanation: list = field(default_factory=set) | |||
|
|||
def __init__(self, svg_file_name, output_directory): | |||
def __init__(self, svg_file_name, output_directory, expl_xml=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the new arg to documentation.
@@ -62,6 +64,23 @@ def print_query_output(self, output, supported_output_formats=None): | |||
print(f'Command {dot_cmd_string}\n did not create {path}\n', file=sys.stderr) | |||
if os.path.isfile(tmp_dot_file): | |||
os.remove(tmp_dot_file) | |||
elif self.outputFormat == 'html': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trying to run the following command from cli:
python -m nca --connectivity -r tests/fw_rules_tests/podlist/ns_list.json -r tests/fw_rules_tests/podlist/pods_list_4.json -r tests/fw_rules_tests/policies/test2-networkpolicy.yaml -o html -f test2.html
but getting:
Failed to create a svg file: test2.html
'NoneType' object is not iterable
Command dot test2.html.nca_tmp.dot -Tsvg -otest2.html.nca_tmp.svg
did not create test2.html
- I do have
dot
installed on my env - we should avoid the error
'NoneType' object is not iterable
even ifdot
is not installed
Signed-off-by: haim-kermany <haim.kermany@gmail.com>
if alphabet_str: | ||
fqdn_regex = r"(?=.{1,254}$)[A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?(\.[A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?)*[.]?" | ||
fqdn_regex = "^((?!-)[A-Za-z0-9-]+(?<!-).)+[A-Za-z0-9.]+" |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
No description provided.