Skip to content
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

[config]: Filter table from input config while config validation\DPB #1020

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

praveen-li
Copy link

@praveen-li praveen-li commented Jul 31, 2020

Changes:
-- Filter table, which does not impact Back-End, from input config
while config validation or while Dynamic Port Breakout(DPB).
-- Ask for confirmation from user while DPB, only when deleted ports
exists in extra tables[i.e in tables without YANG].
-- Test for filter Table.
-- Filter BREAKOUT_CFG table while DPB, because back-end does not process
BREAKOUT_CFG table.

Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com

- What I did
-- Filter table, which does not impact Back-End, from input config
while config validation or while Dynamic Port Breakout(DPB).
-- Ask for confirmation from user while DPB, only when deleted ports
exists in extra tables[i.e in tables without YANG].
-- Test for filter Table.
-- Filter BREAKOUT_CFG table while DPB, because back-end does not process
BREAKOUT_CFG table.

- How I did it
Added a function which filter predefined tables from config. There predefined tables do not impact back-end, so better to filter them.

Change in config/main.py to ask for user permission when any table exists in config for which YANG models are not written. Note: Now, We ask user confirmation only if delete PORTs exist in these extra tables.

Added test code.

- How to verify it

Test First Approach: Wrote the test first to Make Sure, It fails without fix:

   def test_extra_brk_cfg_tables_cases(self):
        # make sure no prompt with LOCK
        curConfig = dict(configDbJson)
        brk_cfg = { "BREAKOUT_CFG": {
                    "Ethernet0": {
                        "brkout_mode": "1x100G[40G]"
                    }
                  }
                }
        self.updateConfig(curConfig, brk_cfg)
        prevLen = len(curConfig)
        cm = self.config_mgmt_dpb(curConfig)
        # Assert LOCK is removed from Input Config
>       assert (len(cm.configdbJsonIn) ==  prevLen-1) and \
            'BREAKOUT_CFG' not in cm.configdbJsonIn.keys()
E       AssertionError: assert (6 == (6 - 1))
E        +  where 6 = len({'ACL_TABLE': {'NO-NSW-PACL-TEST': {'policy_desc': 'NO-NSW-PACL-TEST', 'ports': ['Ethernet11'], 'stage': 'INGRESS', 't...66', ...}, 'Ethernet10': {'lanes': '75', 'speed': '25000'}, 'Ethernet11': {'lanes': '76', 'speed': '25000'}, ...}, ...})
E        +    where {'ACL_TABLE': {'NO-NSW-PACL-TEST': {'policy_desc': 'NO-NSW-PACL-TEST', 'ports': ['Ethernet11'], 'stage': 'INGRESS', 't...66', ...}, 'Ethernet10': {'lanes': '75', 'speed': '25000'}, 'Ethernet11': {'lanes': '76', 'speed': '25000'}, ...}, ...} = <config_mgmt.ConfigMgmtDPB instance at 0x7f702c1829e0>.configdbJsonIn


Now After Fix, it build fine.

make[1]: Leaving directory '/home/pchaudha/srcCode/azure_myforks/sonic-buildimage'
pchaudha@server05:/home/pchaudha/srcCode/azure_myforks/sonic-buildimage$ date
Fri Jul 31 12:48:57 PDT 2020
pchaudha@server05:/home/pchaudha/srcCode/azure_myforks/sonic-buildimage$ ls -l target/python-debs/python-sonic-utilities_1.2-1_all.deb
-rw-r--r-- 1 pchaudha pchaudha 182780 Jul 31 12:48 target/python-debs/python-sonic-utilities_1.2-1_all.deb
pchaudha@server05:/home/pchaudha/srcCode/azure_myforks/sonic-buildimage$

- Previous command output (if the output of a command-line utility has changed)

- New command output (if the output of a command-line utility has changed)

@praveen-li praveen-li force-pushed the filter_notBackEnd_impactingTable branch from dd9fa08 to 8a6275f Compare August 3, 2020 16:38
@praveen-li
Copy link
Author

force push due to rebasing.

@lguohan
Copy link
Contributor

lguohan commented Aug 12, 2020

retest this please

@praveen-li
Copy link
Author

@lguohan @jleveque @daall
Kindly review when possible, this changes has its own tests, so we are good here. Thx

@jleveque jleveque changed the title [config/main.py]: Filter table from input config while config validat… [config]: Filter table from input config while config validation\DPB Aug 31, 2020
@praveen-li
Copy link
Author

Gentle Reminder for review.

@praveen-li
Copy link
Author

retest this please

@praveen-li
Copy link
Author

@jleveque : kindly review needed to fix one not needed check in DPB.

jleveque
jleveque previously approved these changes Feb 17, 2021
@jleveque
Copy link
Contributor

Retest this please

@jleveque
Copy link
Contributor

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…ion\DPB.

Changes:
-- Filter table, which does not impact Back-End, from input config
   while config validation or while Dynamic Port Breakout(DPB).
-- Ask for confirmation from user while DPB, only when deleted ports
   exists in extra tables[i.e in tables without YANG].
-- Test for filter Table.
-- Filter BREAKOUT_CFG table while DPB, because back-end does not process
   BREAKOUT_CFG table.

Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com
@praveen-li
Copy link
Author

Force pushed due to rebasing.
Fixing a test as well.

@allas-nvidia
Copy link
Contributor

Can someone merge it, please
And it should be in 202012.
Thanks

@@ -78,6 +78,30 @@ def test_break_out(self):
self.dpb_port4_4x25G_2x50G_f_l(curConfig)
return

def test_extra_brk_cfg_tables_cases(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have 3 different test cases:
1> Tables that we should ignore specifically even with/without Yang, and no warning. (we probably don't need this based on my latest comments: sonic-net/sonic-buildimage#6801 (comment) ), and I don't see other cases.
2> Tables that does not have Yang models but not depending on port to be deleted. By default , it should continue with warning.
3> Tables that does not have Yang models but depending on the port to be deleted. It should ask user to confirm.

void
"""
# nonConfigTables should not be considered in Input Config.
nonConfigTables = ['BREAKOUT_CFG']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on sonic-net/sonic-buildimage#6801 (comment) , I would suggest we don't do anything specific for this table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants