[db_migrator] Remove hardcoded config and migrate config from minigraph#2887
[db_migrator] Remove hardcoded config and migrate config from minigraph#2887vaibhavhd merged 8 commits intosonic-net:masterfrom
Conversation
scripts/db_migrator.py
Outdated
| # RESTAPI - add missing key | ||
| if not self.minigraph_data or 'RESTAPI' not in self.minigraph_data: | ||
| return | ||
| RESTAPI = self.minigraph_data['RESTAPI'] |
scripts/db_migrator.py
Outdated
| # load config data from minigraph to get the default/hardcoded values from minigraph.py | ||
| # this is to avoid duplicating the hardcoded these values in db_migrator | ||
| self.minigraph_data = None | ||
| if os.path.isfile(MINIGRAPH_FILE): |
There was a problem hiding this comment.
Added a new testcase for missing minigraph. We can discuss what other fields are expected/unexpected in L2 switch's case and add a test for that in future PR. What do you suggest?
There was a problem hiding this comment.
Add a test for L2 switch in future is okay.
There was a problem hiding this comment.
As per offline discussion: from unit test level the test for missing minigraph and absence of default entries is sufficient. L2 switch config and functionality needs to be tested separately as part of sonic-mgmt test. Raised a test gap for this: sonic-net/sonic-mgmt#8777
scripts/db_migrator.py
Outdated
| # this is to avoid duplicating the hardcoded these values in db_migrator | ||
| self.minigraph_data = None | ||
| if os.path.isfile(MINIGRAPH_FILE): | ||
| self.minigraph_data = parse_xml(MINIGRAPH_FILE) |
There was a problem hiding this comment.
Do you need to protect against parse_xml throwing error?
tests/db_migrator_test.py
Outdated
| dbconnector.dedicated_dbs['CONFIG_DB'] = os.path.join(mock_db_path, 'config_db', 'cross_branch_upgrade_without_mg_2_0_2_expected.json') | ||
| expected_db = Db() | ||
|
|
||
| expected_db |
There was a problem hiding this comment.
Removed here, and also in the old testcase.
…ph (#2887) Microsoft ADO: 18217044 This PR is follow up to an old PR: #2515 This PR addresses two issues: Not migrating RESTAPI, TELEMETRY, DEVICE_METADATA entries if they are not supported in target image's minigraph.py. Not migrating these entries if minigraph.xml file is missing. Not maintaining the config for these tables in two different places. Currently db migrator has its own constants, and minigraph.py maintains its own. How I did it This change removes hardcoding config in migrator code, and migrating the config for RESTAPI, TELEMETRY, DEVICE_METADATA from minigraph generator. How to verify it Tested on a physical device.
Update sonic-utilities submodule pointer to include the following: * ff380e0 [hash]: Implement GH frontend ([sonic-net#2580](sonic-net/sonic-utilities#2580)) * 61bad06 [db_migrator] Set correct CURRENT_VERSION, extend UT ([sonic-net#2895](sonic-net/sonic-utilities#2895)) * 6b8ee47 [CLI][Show][BGP] Show BGP Change for no neighbor scenario ([sonic-net#2885](sonic-net/sonic-utilities#2885)) * 73d8d63 [doc] Update Command-Reference.md, change show bgp peer command to show bfd peer ([sonic-net#2750](sonic-net/sonic-utilities#2750)) * 7bc08c2 [db_migrator] Remove hardcoded config and migrate config from minigraph ([sonic-net#2887](sonic-net/sonic-utilities#2887)) * b1aa942 [generate_dump]: Enhance show techsupport for Marvell platform ([sonic-net#2676](sonic-net/sonic-utilities#2676)) * 316b14c Add support for secure upgrade ([sonic-net#2698](sonic-net/sonic-utilities#2698)) * dc2945b [dns] Implement config and show commands for static DNS. ([sonic-net#2737](sonic-net/sonic-utilities#2737)) * 8414a70 [chassis][multi asic] change acl_loader to use tcp socket for db communication ([sonic-net#2525](sonic-net/sonic-utilities#2525)) * 0b629ba Revert [chassis][voq] Clear fabric counters queue/port (2789) ([sonic-net#2882](sonic-net/sonic-utilities#2882)) * 3ba8241 [db_migtrator] Add migration of FLEX_COUNTER_DELAY_STATUS during 1911->master upgrade + fast-reboot. Add UT. ([sonic-net#2839](sonic-net/sonic-utilities#2839)) * fceef2e [chassis][voq] Clear fabric counters queue/port ([sonic-net#2789](sonic-net/sonic-utilities#2789)) Signed-off-by: dgsudharsan <sudharsand@nvidia.com>
Update sonic-utilities submodule pointer to include the following: * ff380e0 [hash]: Implement GH frontend ([#2580](sonic-net/sonic-utilities#2580)) * 61bad06 [db_migrator] Set correct CURRENT_VERSION, extend UT ([#2895](sonic-net/sonic-utilities#2895)) * 6b8ee47 [CLI][Show][BGP] Show BGP Change for no neighbor scenario ([#2885](sonic-net/sonic-utilities#2885)) * 73d8d63 [doc] Update Command-Reference.md, change show bgp peer command to show bfd peer ([#2750](sonic-net/sonic-utilities#2750)) * 7bc08c2 [db_migrator] Remove hardcoded config and migrate config from minigraph ([#2887](sonic-net/sonic-utilities#2887)) * b1aa942 [generate_dump]: Enhance show techsupport for Marvell platform ([#2676](sonic-net/sonic-utilities#2676)) * 316b14c Add support for secure upgrade ([#2698](sonic-net/sonic-utilities#2698)) * dc2945b [dns] Implement config and show commands for static DNS. ([#2737](sonic-net/sonic-utilities#2737)) * 8414a70 [chassis][multi asic] change acl_loader to use tcp socket for db communication ([#2525](sonic-net/sonic-utilities#2525)) * 0b629ba Revert [chassis][voq] Clear fabric counters queue/port (2789) ([#2882](sonic-net/sonic-utilities#2882)) * 3ba8241 [db_migtrator] Add migration of FLEX_COUNTER_DELAY_STATUS during 1911->master upgrade + fast-reboot. Add UT. ([#2839](sonic-net/sonic-utilities#2839)) * fceef2e [chassis][voq] Clear fabric counters queue/port ([#2789](sonic-net/sonic-utilities#2789)) Signed-off-by: dgsudharsan <sudharsand@nvidia.com>
…ph (#2887) Microsoft ADO: 18217044 This PR is follow up to an old PR: #2515 This PR addresses two issues: Not migrating RESTAPI, TELEMETRY, DEVICE_METADATA entries if they are not supported in target image's minigraph.py. Not migrating these entries if minigraph.xml file is missing. Not maintaining the config for these tables in two different places. Currently db migrator has its own constants, and minigraph.py maintains its own. How I did it This change removes hardcoding config in migrator code, and migrating the config for RESTAPI, TELEMETRY, DEVICE_METADATA from minigraph generator. How to verify it Tested on a physical device.
|
This commit could not be cleanly cherry-pick to 202012. Please raise another PR on that branch. |
…ph (sonic-net#2887) Microsoft ADO: 18217044 This PR is follow up to an old PR: sonic-net#2515 This PR addresses two issues: Not migrating RESTAPI, TELEMETRY, DEVICE_METADATA entries if they are not supported in target image's minigraph.py. Not migrating these entries if minigraph.xml file is missing. Not maintaining the config for these tables in two different places. Currently db migrator has its own constants, and minigraph.py maintains its own. How I did it This change removes hardcoding config in migrator code, and migrating the config for RESTAPI, TELEMETRY, DEVICE_METADATA from minigraph generator. How to verify it Tested on a physical device.
|
caused UT failure in internal branch sync, @vaibhavhd { |
|
Cherry-pick to 202012 PR: #2924 |
…ph (#2887) (#2924) Microsoft ADO: 18217044 This PR is follow up to an old PR: #2515 This PR addresses two issues: Not migrating RESTAPI, TELEMETRY, DEVICE_METADATA entries if they are not supported in target image's minigraph.py. Not migrating these entries if minigraph.xml file is missing. Not maintaining the config for these tables in two different places. Currently db migrator has its own constants, and minigraph.py maintains its own. How I did it This change removes hardcoding config in migrator code, and migrating the config for RESTAPI, TELEMETRY, DEVICE_METADATA from minigraph generator. How to verify it Tested on a physical device.
…ph (sonic-net#2887) Microsoft ADO: 18217044 This PR is follow up to an old PR: sonic-net#2515 This PR addresses two issues: Not migrating RESTAPI, TELEMETRY, DEVICE_METADATA entries if they are not supported in target image's minigraph.py. Not migrating these entries if minigraph.xml file is missing. Not maintaining the config for these tables in two different places. Currently db migrator has its own constants, and minigraph.py maintains its own. How I did it This change removes hardcoding config in migrator code, and migrating the config for RESTAPI, TELEMETRY, DEVICE_METADATA from minigraph generator. How to verify it Tested on a physical device.
…ph (#2887) Microsoft ADO: 18217044 This PR is follow up to an old PR: #2515 This PR addresses two issues: Not migrating RESTAPI, TELEMETRY, DEVICE_METADATA entries if they are not supported in target image's minigraph.py. Not migrating these entries if minigraph.xml file is missing. Not maintaining the config for these tables in two different places. Currently db migrator has its own constants, and minigraph.py maintains its own. How I did it This change removes hardcoding config in migrator code, and migrating the config for RESTAPI, TELEMETRY, DEVICE_METADATA from minigraph generator. How to verify it Tested on a physical device.
Update sonic-utilities submodule pointer to include the following: * ff380e0 [hash]: Implement GH frontend ([sonic-net#2580](sonic-net/sonic-utilities#2580)) * 61bad06 [db_migrator] Set correct CURRENT_VERSION, extend UT ([sonic-net#2895](sonic-net/sonic-utilities#2895)) * 6b8ee47 [CLI][Show][BGP] Show BGP Change for no neighbor scenario ([sonic-net#2885](sonic-net/sonic-utilities#2885)) * 73d8d63 [doc] Update Command-Reference.md, change show bgp peer command to show bfd peer ([sonic-net#2750](sonic-net/sonic-utilities#2750)) * 7bc08c2 [db_migrator] Remove hardcoded config and migrate config from minigraph ([sonic-net#2887](sonic-net/sonic-utilities#2887)) * b1aa942 [generate_dump]: Enhance show techsupport for Marvell platform ([sonic-net#2676](sonic-net/sonic-utilities#2676)) * 316b14c Add support for secure upgrade ([sonic-net#2698](sonic-net/sonic-utilities#2698)) * dc2945b [dns] Implement config and show commands for static DNS. ([sonic-net#2737](sonic-net/sonic-utilities#2737)) * 8414a70 [chassis][multi asic] change acl_loader to use tcp socket for db communication ([sonic-net#2525](sonic-net/sonic-utilities#2525)) * 0b629ba Revert [chassis][voq] Clear fabric counters queue/port (2789) ([sonic-net#2882](sonic-net/sonic-utilities#2882)) * 3ba8241 [db_migtrator] Add migration of FLEX_COUNTER_DELAY_STATUS during 1911->master upgrade + fast-reboot. Add UT. ([sonic-net#2839](sonic-net/sonic-utilities#2839)) * fceef2e [chassis][voq] Clear fabric counters queue/port ([sonic-net#2789](sonic-net/sonic-utilities#2789)) Signed-off-by: dgsudharsan <sudharsand@nvidia.com>
What I did
Microsoft ADO: 18217044
This PR is follow up to an old PR: #2515
This PR addresses two issues:
RESTAPI,TELEMETRY,DEVICE_METADATAentries if they are not supported in target image's minigraph.py.How I did it
This change removes hardcoding config in migrator code, and migrating the config for
RESTAPI,TELEMETRY,DEVICE_METADATAfrom minigraph generator.How to verify it
Tested on a physical device.
This change works w/ another change to fix config-setup, database dependency sonic-net/sonic-buildimage#14933
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)