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

[copporch]: fix the error when removing the copp group table. #1039

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

wangshengjun
Copy link
Contributor

Signed-off-by: wangshengjun wangshengjun@asterfusion.com

What I did
Removing the trap ids first when removing the copp group table entry.
Why I did it
When the copporch received a DEL event from redis DB, it just recreate the trap id with defaul attribute.The creation operation fails because that it already exists.
If the copp group table was removed, the trap ids which associated with the table group should delete too, no just recreate them with default attribute.
How I verified it

  1. Test configuration as follows:
    root@48S-sdd:/etc/swss/config.d# cat 00-copp.config_add.json
    [
    {
    "COPP_TABLE:trap.group.arp": {
    "trap_ids": "arp_req,arp_resp,neigh_discovery",
    "trap_action":"copy",
    "trap_priority":"4",
    "queue": "4",
    "meter_type":"packets",
    "mode":"tr_tcm",
    "cir":"600",
    "cbs":"600",
    "pir":"600",
    "pbs":"600",
    "red_action":"drop"
    },
    "OP": "SET"
    }
    ]
    root@48S-sdd:/etc/swss/config.d# cat 00-copp.config_del.json
    [
    {
    "COPP_TABLE:trap.group.arp": {
    "trap_ids": "arp_req,arp_resp,neigh_discovery",
    "trap_action":"copy",
    "trap_priority":"4",
    "queue": "4",
    "meter_type":"packets",
    "mode":"tr_tcm",
    "cir":"600",
    "cbs":"600",
    "pir":"600",
    "pbs":"600",
    "red_action":"drop"
    },
    "OP": "DEL"
    }
    ]
    When i load the delection configuration, it throws out error as follows:
    Aug 27 19:56:43.853405 48S-sdd NOTICE swss#orchagent: :- removePolicer: Remove policer for trap group trap.group.arp
    Aug 27 19:56:43.853506 48S-sdd ERR swss#orchagent: :- meta_generic_validation_create: attribute key SAI_HOSTIF_TRAP_ATTR_TRAP_TYPE:8192; already exists, can't create
    Aug 27 19:56:43.853608 48S-sdd ERR swss#orchagent: :- applyAttributesToTrapIds: Failed to create trap 8192, rv:-5
    Aug 27 19:56:43.853699 48S-sdd ERR swss#orchagent: :- processCoppRule: Failed to reset traps to default trap group with default attributes
    Aug 27 19:56:43.853788 48S-sdd ERR swss#orchagent: :- doTask: Processing copp task item failed, exiting

Details if related

Signed-off-by: wangshengjun <wangshengjun@asterfusion.com>
@stcheng
Copy link
Contributor

stcheng commented Aug 27, 2019

Right now we don't have COPP removal logic. Could you help add the corresponding unit tests?

Signed-off-by: wangshengjun <wangshengjun@asterfusion.com>
@wangshengjun
Copy link
Contributor Author

Right now we don't have COPP removal logic. Could you help add the corresponding unit tests?

The unit tests have committed, please take a review. To test the removal logic, #1038 must be merged. Or the copporch will trap into endless loop.

Copy link
Contributor

@stcheng stcheng left a comment

Choose a reason for hiding this comment

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

please check the comments

tests/test_copp.py Outdated Show resolved Hide resolved
tests/test_copp.py Outdated Show resolved Hide resolved
tests/test_copp.py Outdated Show resolved Hide resolved
tests/test_copp.py Outdated Show resolved Hide resolved
Copy link
Contributor

@stcheng stcheng left a comment

Choose a reason for hiding this comment

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

could you check the comments?

Copy link
Collaborator

@prsunny prsunny left a comment

Choose a reason for hiding this comment

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

Minor comments

orchagent/copporch.cpp Outdated Show resolved Hide resolved
orchagent/copporch.cpp Outdated Show resolved Hide resolved
Signed-off-by: wangshengjun <wangshengjun@asterfusion.com>
@wangshengjun
Copy link
Contributor Author

@stcheng @prsunny Thanks for your comments. The latest code is already committed, please review it.

EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
…et#1039)

generate xml, html and term report

Signed-off-by: Guohan Lu <lguohan@gmail.com>
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-swss that referenced this pull request Mar 1, 2023
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.

4 participants