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

QOS fieldvalue reference ABNF format to string #1626

Merged
merged 1 commit into from
Sep 2, 2021

Conversation

AshokDaparthi
Copy link
Contributor

@AshokDaparthi AshokDaparthi commented May 20, 2021

Depends on sonic-net/sonic-swss#1754

Qos tables in config db and app db used ABNF format i.e "[TABLE_NAME|name] to refer fieldvalue other qos tables.

Example:
Config DB:
"Ethernet92|3": {
"scheduler": "[SCHEDULER|scheduler.1]",
"wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]"
},
"Ethernet0|0": {
"profile": "[BUFFER_PROFILE|ingress_lossy_profile]"
},
"Ethernet0": {
"dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]",
"pfc_enable": "3,4",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
"tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
"tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]"
},

AppDB:
"BUFFER_QUEUE_TABLE:Ethernet88:3-4": {
"profile": "[BUFFER_PROFILE_TABLE:egress_lossless_profile]"
},

1#This format is not consistent with other DB schema followed in sonic.
2# Added db_migrator.py case to change from old format in config_db and appl_db to new format.
3#Modified the test case

Dependent pull requests:
sonic-net/sonic-buildimage#7752 - To modify platfrom files
sonic-net/sonic-buildimage#7281 - Yang model
sonic-net/sonic-swss#1754 - swss change to remove ABNF format

Copy link
Collaborator

@stephenxs stephenxs left a comment

Choose a reason for hiding this comment

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

Hi @AshokDaparthi
Some other parts need to be updated as well:

  • The buffer configuration is stored in APPL_DB. The warm reboot will fail if the switch is upgrading from an image before this change to one after. So db migrator needs to handle APPL_DB as well.
  • Suggest adding unit test cases for db migrator.
  • The version defined at the beginning of db_migrator.py needs to be updated as well.
  • Existing unit test cases need to be updated accordingly, like mock_tables, and mock tables for qos, filter fdb, counter poll, SKU create tool, etc... You might want to go over all the test cases.
    I believe the unit test is failing without these changes

Thanks

@AshokDaparthi
Copy link
Contributor Author

@stephenxs - Hi Stephan, I have query regarding "The buffer configuration is stored in APPL_DB. The warm reboot will fail if the switch is upgrading from an image before this change to one after. So db migrator needs to handle APPL_DB as well." I have not seen complete warm reboot design. Can you help me to understand, While warm/cold reboot db_migratory.py will trigger config_db update for qos right, which internally trigger swss to update APP_DB with new QOS field values right or during warmreboot swss will not process config_db updates?

@stephenxs
Copy link
Collaborator

stephenxs commented May 25, 2021

@stephenxs - Hi Stephan, I have query regarding "The buffer configuration is stored in APPL_DB. The warm reboot will fail if the switch is upgrading from an image before this change to one after. So db migrator needs to handle APPL_DB as well." I have not seen complete warm reboot design. Can you help me to understand, While warm/cold reboot db_migratory.py will trigger config_db update for qos right, which internally trigger swss to update APP_DB with new QOS field values right or during warmreboot swss will not process config_db updates?

The buffer tables are consumed from APPL_DB instead of CONFIG_DB.
In a normal starting flow,

  • the buffer manager generates table entries and pushes them into APPL_DB.
  • the orchagent consumes the entries in APPL_DB and pushes entries into ASIC_DB.

This is for both dynamic and traditional buffer models.
In a warm reboot flow,

  • the APPL_DB is saved before warm reboot and restored after it, which means the entries consumed by the orchagent are restored instead of pushed by the manager daemons.
  • the buffer manager generates table entries as well, but that's too late for warm reboot to meet its converging time.
  • given the data format has been updated before and after warm reboot, we need to update the entries in APPL_DB as well

We have a similar flow which the entries in APPL_DB is prepared for warm reboot. prepare_dynamic_buffer_for_warm_reboot. It works for both buffer model.
Hope this helps.

@AshokDaparthi
Copy link
Contributor Author

/azpw run

config/main.py Outdated
@@ -3703,7 +3703,7 @@ def update_pg(ctx, interface_name, pg_map, override_profile, add = True):
ctx.fail("Profile {} doesn't exist".format(override_profile))
if not 'xoff' in profile_dict.keys() and 'size' in profile_dict.keys():
ctx.fail("Profile {} doesn't exist or isn't a lossless profile".format(override_profile))
profile_full_name = "[BUFFER_PROFILE|{}]".format(override_profile)
profile_full_name = "{}".format(override_profile)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think profile_full_name is no longer necessary. Just using override_profile should be fine.
Originally, profile_full_name was introduced because the profile reference differed from the profile name. Now they are the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

config/main.py Outdated Show resolved Hide resolved
scripts/db_migrator.py Outdated Show resolved Hide resolved
db_key = table_name + db_delimeter + key

for field in fields_list:
if field in value:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please fix the indent in this block as well. The indent should be 4.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

log.log_info("Found ABNF format field value in table {} key {} field {} val {}".format(table_name, db_key, field, fieldVal))
value_list = fieldVal.split(",")
for item in value_list:
if "[" not in item or db_delimeter not in item or "]" not in item:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if "[" not in item or db_delimeter not in item or "]" not in item:
if "[" != item[0] or db_delimeter not in item or "]" != item[-1]:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

scripts/db_migrator.py Outdated Show resolved Hide resolved
stephenxs
stephenxs previously approved these changes Jul 30, 2021
@lguohan
Copy link
Contributor

lguohan commented Aug 26, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@zhangyanzhao
Copy link
Collaborator

@AshokDaparthi please help to monitor the build progress and check the result.

@rathnasabapathyv
Copy link

rathnasabapathyv commented Aug 26, 2021

As per the discussion in yang-subgroup-meeting (8/26) with @lguohan , we have decided to merge sonic-utilities PR (#1626) 1st followed by sub-module update in sonic-buildimage. Then this sonic-swss PR (sonic-net/sonic-swss#1754) should be merged.

Merge can happen in this order:
sonic-utilities PR for DB-migration logic : #1626
sonic-buildimage PR for new config-DB changes : sonic-net/sonic-buildimage#7752
sonic-swss PR : sonic-net/sonic-swss#1754

@AshokDaparthi
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@AshokDaparthi
Copy link
Contributor Author

@stephenxs , @neethajohn - Could you please re approve. Plan is to
1# Merge sonic-utilities
2# Modify SHA 3# Then re trigger sonic-swss Checks and merge it 4# Merge sonic-buildimage

@stephenxs
Copy link
Collaborator

stephenxs commented Sep 1, 2021

@stephenxs , @neethajohn - Could you please re approve. Plan is to
1# Merge sonic-utilities
2# Modify SHA 3# Then re trigger sonic-swss Checks and merge it 4# Merge sonic-buildimage

Hi @AshokDaparthi
Two questions.

  1. What's the difference between this one and the commit we approved? Is it just rebased to the latest master commit?
  2. To what branch will this feature be merged?
    I was wondering whether we will have a dedicated sonic-mgmt branch for testing sonic switch without this feature. Check this PR for details
    @neethajohn FYI.

Thanks

@AshokDaparthi
Copy link
Contributor Author

@stephenxs , @neethajohn - Could you please re approve. Plan is to
1# Merge sonic-utilities
2# Modify SHA 3# Then re trigger sonic-swss Checks and merge it 4# Merge sonic-buildimage

Hi @AshokDaparthi
Two questions.

1. What's the difference between this one and the commit we approved? Is it just rebased to the latest master commit?

2. To what branch will this feature be merged?
   I was wondering whether we will have a dedicated sonic-mgmt branch for testing sonic switch without this feature. Check [this PR](https://github.com/Azure/sonic-mgmt/pull/3824#issuecomment-906797660) for details
   @neethajohn FYI.

Thanks

@stephenxs , @neethajohn - Could you please re approve. Plan is to
1# Merge sonic-utilities
2# Modify SHA 3# Then re trigger sonic-swss Checks and merge it 4# Merge sonic-buildimage

Hi @AshokDaparthi
Two questions.

1. What's the difference between this one and the commit we approved? Is it just rebased to the latest master commit?

2. To what branch will this feature be merged?
   I was wondering whether we will have a dedicated sonic-mgmt branch for testing sonic switch without this feature. Check [this PR](https://github.com/Azure/sonic-mgmt/pull/3824#issuecomment-906797660) for details
   @neethajohn FYI.

Thanks

1# No changes, I did rebase all my pull requests to latest master
2# Yes, We required sonic-mgmt branch separation before and after merge this changes.

@AshokDaparthi
Copy link
Contributor Author

@neethajohn - Could you please review and approve.

@zhangyanzhao
Copy link
Collaborator

@neethajohn can you please help to review and approve this.

@lguohan lguohan merged commit 6483b0b into sonic-net:master Sep 2, 2021
neethajohn pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Sep 28, 2021
Depends on sonic-net/sonic-utilities#1626
Depends on sonic-net/sonic-swss#1754

QOS tables in config db used ABNF format i.e "[TABLE_NAME|name] to refer fieldvalue to other qos tables.

Example:
Config DB:
"Ethernet92|3": {
"scheduler": "[SCHEDULER|scheduler.1]",
"wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]"
},
"Ethernet0|0": {
"profile": "[BUFFER_PROFILE|ingress_lossy_profile]"
},
"Ethernet0": {
"dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]",
"pfc_enable": "3,4",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
"tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
"tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]"
},

This format is not consistent with other DB schema followed in sonic.
And also this reference in DB is not required, This is taken care by YANG "leafref".

Removed this format from all platform files to consistent with other sonic db schema.
Example:
"Ethernet92|3": {
"scheduler": "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
},

Dependent pull requests:
#7752 - To modify platfrom files
#7281 - Yang model
sonic-net/sonic-utilities#1626 - DB migration
sonic-net/sonic-swss#1754 - swss change to remove ABNF format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants