-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
SONiC Yang model support for Mirror #7877
Conversation
pick-up upstream fixes. important ones - bgpd: Removing "neighbor <peer-group> allowas-in" complete lists * 6b2b5cce3 2021-01-29 | Merge pull request sonic-net#7977 from ton31337/fix/allowas_in_reset_value_7.5 (HEAD -> frr/7.5, tag: frr-7.5-s2, upstream/stable/7.5, origin/frr/7.5, stable/7.5) [Donald Sharp] |\ | * f403534df 2021-01-28 | bgpd: Removing "neighbor <peer-group> allowas-in" [Kishore Kunal] * | 86e2f106c 2021-01-28 | Merge pull request sonic-net#7962 from ton31337/fix/bgpd_validate_community_7.5 [Donald Sharp] |\ \ | |/ |/| | * e182af45c 2021-01-05 | bgpd: separate lcommunity validation from tokenizer [Wesley Coakley] | * 2cf37d594 2020-12-30 | bgpd: Validate community list if they are not malformed [Donatas Abraitis] |/ * a4af08a19 2021-01-22 | Merge pull request sonic-net#7912 from idryzhov/7.5-backports-2021-01 [Donald Sharp] |\ | * 160021013 2021-01-12 | bgpd : multiple memory leak fixes in show commands [Sarita Patra] | * 46a2b560f 2021-01-19 | tools: fix frr-reload BFD profile support [Rafael Zalamena] | * 7f6c81fca 2020-12-02 | ospfd: fix area removal at interface level [ckishimo] | * f7db4dfb1 2021-01-08 | bfdd: update vrf of received packet [Philippe Guibert] | * 4d470f3ef 2021-01-08 | bfdd: enable bfd session if vrf interface available [Philippe Guibert] | * c656985fb 2021-01-08 | bfdd: socket should be bound to vrf interface by default [Philippe Guibert] | * f30c002b8 2021-01-15 | bgpd: Allow peer-groups to have `ttl-security hops` configured [Donald Sharp] | * 85ff76513 2021-01-15 | configure.ac: Correct library name for sysrepo [Bo Zhang] | * d00c543f1 2020-12-04 | bgpd: Handle IPv6 prefixes with IPv4 nexthops for zebra [Donatas Abraitis] | * 87b9b2973 2021-01-06 | zebra: zebra route-map delay-timer is global not per vrf [Donald Sharp] | * 91e1adec9 2021-01-05 | bgpd: Fix default-originate clearing from peer-groups. [zyxwvu Shi] | * 0f2f32fa1 2021-01-05 | isisd: When last area address is removed, resign if we were DR [Karen Schoener] | * 842e99d49 2021-01-02 | vrrpd.yang bug fix: modify augment path to comply with rfc 7950 [Bo Zhang] | * 9616ef937 2020-12-24 | ospfd: fix no show database output when selecting vrf [Louis Scalbert] | * 4c4764e36 2020-11-30 | ospf6d: ospfv3 disable on the interface, but interface prefix still shown in the output [Yash Ranjan] | * 1870dbd86 2020-12-14 | ospf6d: Link LSA is not updated when router priority is modified [Mobashshera Rasool] | * 4883a06c3 2020-12-10 | bgpd: fix evpn route-map vni filter at origin [Chirag Shah] |/ * 9c087052a 2021-01-15 | Merge pull request sonic-net#7877 from vishaldhingra/static_7_5 [Mark Stapp] |\ | * a687b6b27 2021-01-15 | staticd: Backend cofiguration code to fix table-id problem [vdhingra] | * 52370b494 2021-01-15 | staticd: autogenerated code modifications due to yang changes [vdhingra] | * f9d6511f2 2021-01-15 | staticd: make table-id as the key for path-list [vdhingra] |/ Signed-off-by: Guohan Lu <lguohan@gmail.com>
/azp run |
Commenter does not have sufficient privileges for PR 7877 in repo Azure/sonic-buildimage |
|
||
import sonic-port { | ||
prefix port; | ||
revision-date 2019-07-01; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this revision date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
|
||
leaf type { | ||
type string { | ||
pattern "ERSPAN|SPAN"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
leaf dst_port { | ||
type leafref { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add "when" condition to configure this field only when type set to SPAN? the similar condition needs to be done ERSPAN fields as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. added ERSPAN and SPAN conditions. Some fields are valid for both SPAN and ERSPAN.
} | ||
|
||
leaf queue { | ||
type uint8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any valid queue range?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ASIC specific and we cant have the validation in yang model.
Please see for more details. #8189
leaf name { | ||
type string { | ||
pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; | ||
length 1..32 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it max len 32, any backend restriction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No Backend limitation. But as discussed in meeting, keeping this check same.
|
||
leaf direction { | ||
type string { | ||
pattern "RX|TX|BOTH"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be enum as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
leaf dst_port { | ||
type leafref { | ||
path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CPU dst_port is not supported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add dst_port as discussed in the meeting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added CPU to dst_port
leaf dst_port { | ||
type leafref { | ||
path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add dst_port as discussed in the meeting
"Mirror session type."; | ||
} | ||
|
||
leaf src_ip { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the must check for src_ip and dst_ip ERSPAN as discussed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to ip-address and enforce it is only ipv4 so that in future when supported we can remove the check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added ERSPAN checks. Changed to ip-address and added must condition to have only IPv4 Address for now.
Hi @abdosi - could you please take a look, thanks |
@rupesh-k please help to address the build failure and conflict. |
BRCM is still working on this and ETA is end of next week. |
BRCM team is working on addressing the comments, ETA is 9/30. |
Taken care of all comments in review meeting and in this PR. |
branch conflict need be resolved before merge. @rupesh-k can you please fix those conflicts? Thanks. |
5b19b1b
Will merge once the build succeed |
@rupesh-k would you please check and fix the build failure? Thanks. |
Last time I saw the build failures are in not related to my changes. But Now the build is deleted. So Pushed after rebasing to latest master. Will follow up on current builds. |
All checks are successful. Please help with merging Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
#### Why I did it Created SONiC Yang model for Mirror. Tables: MIRROR_SESSION #### How I did it Defined Yang models for COPP based on Guideline doc: https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md and https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md #### How to verify it ''' ============================= test session starts ============================== platform linux -- Python 3.7.3, pytest-3.10.1, py-1.7.0, pluggy-0.8.0 rootdir: /sonic/src/sonic-yang-models, inifile: plugins: cov-2.6.0 collected 3 items tests/test_sonic_yang_models.py .. [ 66%] tests/yang_model_tests/test_yang_model.py . [100%] =============================== warnings summary =============================== module: sonic-mirror-session +--rw sonic-mirror-session +--rw MIRROR_SESSION +--rw MIRROR_SESSION_LIST* [name] +--rw name string +--rw type? string +--rw src_ip? inet:ipv4-address +--rw dst_ip? inet:ipv4-address +--rw gre_type? string +--rw dscp? uint8 +--rw ttl? uint8 +--rw queue? uint8 +--rw dst_port? -> /port:sonic-port/PORT/PORT_LIST/name +--rw src_port? union +--rw direction? string '''
Created SONiC Yang model for Mirror. Tables: MIRROR_SESSION Defined Yang models for COPP based on Guideline doc: https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md and https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md ''' ============================= test session starts ============================== platform linux -- Python 3.7.3, pytest-3.10.1, py-1.7.0, pluggy-0.8.0 rootdir: /sonic/src/sonic-yang-models, inifile: plugins: cov-2.6.0 collected 3 items tests/test_sonic_yang_models.py .. [ 66%] tests/yang_model_tests/test_yang_model.py . [100%] =============================== warnings summary =============================== module: sonic-mirror-session +--rw sonic-mirror-session +--rw MIRROR_SESSION +--rw MIRROR_SESSION_LIST* [name] +--rw name string +--rw type? string +--rw src_ip? inet:ipv4-address +--rw dst_ip? inet:ipv4-address +--rw gre_type? string +--rw dscp? uint8 +--rw ttl? uint8 +--rw queue? uint8 +--rw dst_port? -> /port:sonic-port/PORT/PORT_LIST/name +--rw src_port? union +--rw direction? string ''' Conflicts: src/sonic-yang-models/setup.py src/sonic-yang-models/tests/files/sample_config_db.json
Why I did it
Created SONiC Yang model for Mirror.
Tables: MIRROR_SESSION
How I did it
Defined Yang models for COPP based on Guideline doc:
https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md
and
https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md
How to verify it
'''
============================= test session starts ==============================
platform linux -- Python 3.7.3, pytest-3.10.1, py-1.7.0, pluggy-0.8.0
rootdir: /sonic/src/sonic-yang-models, inifile:
plugins: cov-2.6.0
collected 3 items
tests/test_sonic_yang_models.py .. [ 66%]
tests/yang_model_tests/test_yang_model.py . [100%]
=============================== warnings summary ===============================
module: sonic-mirror-session
+--rw sonic-mirror-session
+--rw MIRROR_SESSION
+--rw MIRROR_SESSION_LIST* [name]
+--rw name string
+--rw type? string
+--rw src_ip? inet:ipv4-address
+--rw dst_ip? inet:ipv4-address
+--rw gre_type? string
+--rw dscp? uint8
+--rw ttl? uint8
+--rw queue? uint8
+--rw dst_port? -> /port:sonic-port/PORT/PORT_LIST/name
+--rw src_port? union
+--rw direction? string
'''
Which release branch to backport (provide reason below if selected)
Description for the changelog
A picture of a cute animal (not mandatory but encouraged)