Skip to content

Commit

Permalink
Specify default simple_action for policy rules
Browse files Browse the repository at this point in the history
1]. Get the action list dict and update value for simple_action.
2]. Pass the simple_action while configuring policy.

Change-Id: I6a37425cc84ad2ab5619474c31d1aee8c1821b8d
Closes-Bug: 1717580
  • Loading branch information
Senthilnathan Murugappan committed Sep 18, 2017
1 parent 7d24206 commit c9efbc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions common/servicechain/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,11 @@ def config_svc_chain(self,
si_fq_name_list = [si_fixture.fq_name_str]

if service_type == 'analyzer':
action_list = {'mirror_to': {'analyzer_name': si_fq_name_list[0]}}
action_list = {'simple_action' : 'pass',
'mirror_to': {'analyzer_name': si_fq_name_list[0]}}
else:
action_list = {'apply_service': si_fq_name_list}
action_list = {'simple_action' : 'pass',
'apply_service': si_fq_name_list}
rules = [
{
'direction': '<>',
Expand Down
6 changes: 4 additions & 2 deletions fixtures/policy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ def serialize(obj):
for key in rule_dict:
new_rule[key] = rule_dict[key]
# end for
action_list_dict = rule_dict.get('action_list', {})
new_rule['action_list'][
'simple_action'] = rule_dict.get('simple_action')
'simple_action'] = action_list_dict.get('simple_action', 'pass')
if 'qos_action' in rule_dict:
new_rule['action_list'][
'qos_action'] = rule_dict['qos_action']
Expand Down Expand Up @@ -366,8 +367,9 @@ def _set_policy_api(self, policy_name, rules_list, policy_obj=None):
for key in rule_dict:
new_rule[key] = rule_dict[key]
# end for
action_list_dict = rule_dict.get('action_list', {})
new_rule['action_list'][
'simple_action'] = rule_dict.get('simple_action')
'simple_action'] = action_list_dict.get('simple_action', 'pass')
if 'qos_action' in rule_dict:
new_rule['action_list'][
'qos_action'] = rule_dict['qos_action']
Expand Down

0 comments on commit c9efbc2

Please sign in to comment.