Skip to content

Commit

Permalink
simplify_output -> simplify_graph
Browse files Browse the repository at this point in the history
Signed-off-by: haim-kermany <[email protected]>
  • Loading branch information
haim-kermany committed Aug 2, 2023
1 parent 11db439 commit 089b9ef
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions nca/FWRules/ConnectivityGraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,19 +330,19 @@ def get_connections_without_fw_rules_txt_format(self, connectivity_msg=None, exc
lines_list.extend(sorted(list(lines)))
return '\n'.join(lines_list)

def get_connectivity_dot_format_str(self, connectivity_restriction=None, simplify_output=False):
def get_connectivity_dot_format_str(self, connectivity_restriction=None, simplify_graph=False):
"""
:param Union[str,None] connectivity_restriction: specify if connectivity is restricted to
TCP / non-TCP , or not
:param simplify_output[bool, False] whether to simplify the dot output graph
:param simplify_graph[bool, False] whether to simplify the dot output graph
:rtype str
:return: a string with content of dot format for connectivity graph
"""
restriction_title = f', for {connectivity_restriction} connections' if connectivity_restriction else ''
query_title = f'{self.output_config.queryName}/' if self.output_config.queryName else ''
name = f'{query_title}{self.output_config.configName}{restriction_title}'

dot_graph = DotGraph(name, do_not_subgraph=simplify_output)
dot_graph = DotGraph(name, do_not_subgraph=simplify_graph)
peers_groups = self._get_equals_groups()
# we are going to treat a peers_group as one peer.
# the first peer in the peers_group is representing the group
Expand Down
2 changes: 1 addition & 1 deletion nca/Utils/OutputConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, output_config_dict=None, query_name=''):
default_output_config = {'fwRulesRunInTestMode': False, 'fwRulesDebug': False,
'fwRulesGroupByLabelSinglePod': False, 'fwRulesFilterSystemNs': False,
'fwRulesMaxIter': 10, 'outputFormat': 'txt', 'outputPath': None,
'simplifyOutput': False, 'fwRulesOverrideAllowedLabels': None, 'prURL': None,
'simplifyGraph': False, 'fwRulesOverrideAllowedLabels': None, 'prURL': None,
'connectivityFilterIstioEdges': True, 'outputEndpoints': 'deployments',
'subset': {}, 'explain': None, 'fullExplanation': False, 'excludeIPv6Range': True}

Expand Down
4 changes: 2 additions & 2 deletions nca/nca_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def run_args(args): # noqa: C901

output_config = OutputConfiguration({'outputFormat': args.output_format or 'txt',
'outputPath': args.file_out or None,
'simplifyOutput': args.simplify_output or False,
'simplifyGraph': args.simplify_graph or False,
'prURL': args.pr_url or None,
'outputEndpoints': args.output_endpoints,
'subset': {},
Expand Down Expand Up @@ -327,7 +327,7 @@ def nca_main(argv=None):
parser.add_argument('--file_out', '-f', type=str, help='A file path to which output is redirected')
parser.add_argument('--expected_output', type=str, help='A file path of the expected query output,'
'relevant only with --connectivity and --semantic_diff')
parser.add_argument('--simplify_output', action='store_true',
parser.add_argument('--simplify_graph', action='store_true',
help='simplify the connectivity graph,'
'relevant only when output_format is dot or jpg')
parser.add_argument('--pr_url', type=str, help='The full api url for adding a PR comment')
Expand Down
2 changes: 1 addition & 1 deletion tests/fw_rules_tests/policies/poc1-scheme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ queries:
outputConfiguration:
outputFormat: dot
outputPath: null
simplifyOutput: true
simplifyGraph: true
fwRulesRunInTestMode: false
expectedOutput: expected_output/poc1-scheme_output.dot
- name: connectivity_map_csv
Expand Down

0 comments on commit 089b9ef

Please sign in to comment.