Skip to content

Commit 5acf234

Browse files
authored
SONiC Yang model support for COPP (#7199)
* SONiC Yang model support for COPP * Tables: COPP_GROUP, COPP_TRAP.
1 parent 9de7e68 commit 5acf234

File tree

6 files changed

+406
-1
lines changed

6 files changed

+406
-1
lines changed

src/sonic-yang-models/setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
'./yang-models/sonic-bgp-neighbor.yang',
4848
'./yang-models/sonic-bgp-peergroup.yang',
4949
'./yang-models/sonic-breakout_cfg.yang',
50+
'./yang-models/sonic-copp.yang',
5051
'./yang-models/sonic-crm.yang',
5152
'./yang-models/sonic-device_metadata.yang',
5253
'./yang-models/sonic-device_neighbor.yang',

src/sonic-yang-models/tests/files/sample_config_db.json

+18-1
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,6 @@
841841
"local_ip": "12.12.0.2"
842842
}
843843
},
844-
845844
"BGP_GLOBALS": {
846845
"default": {
847846
"router_id": "5.5.5.5",
@@ -907,6 +906,24 @@
907906
"PREFIX": {
908907
"prefix1|1|10.0.0.0/8|8..16": {
909908
}
909+
},
910+
"COPP_GROUP": {
911+
"queue1_group1": {
912+
"queue": "1",
913+
"trap_priority":"1",
914+
"trap_action":"trap",
915+
"meter_type":"packets",
916+
"mode":"sr_tcm",
917+
"cir":"6000",
918+
"cbs":"6000",
919+
"red_action":"drop"
920+
}
921+
},
922+
"COPP_TRAP": {
923+
"ip2me": {
924+
"trap_ids": "ip2me",
925+
"trap_group": "queue1_group1"
926+
}
910927
}
911928
},
912929

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"COPP_TRAP_WITH_EXIST_GROUP": {
3+
"desc": "Configure COPP_TRAP with group in COPP_GROUP table."
4+
},
5+
"COPP_TRAP_WITH_NON_EXIST_GROUP": {
6+
"desc": "Configure COPP_TRAP with group which does not exist in COPP_GROUP table.",
7+
"eStrKey" : "LeafRef"
8+
},
9+
"COPP_GROUP_MANDATORY_TRAP_ACTION": {
10+
"desc": "Configure COPP_GROUP with no trap_action.",
11+
"eStrKey" : "Mandatory"
12+
},
13+
"COPP_GROUP_MANDATORY_METER_TYPE": {
14+
"desc": "Configure COPP_GROUP with no meter_type.",
15+
"eStrKey" : "Mandatory"
16+
},
17+
"COPP_GROUP_PIR_LESS_THAN_CIR": {
18+
"desc": "Configure COPP_GROUP with PIR less than CIR.",
19+
"eStr": ["pir must be greater than or equal to cir"]
20+
},
21+
"COPP_TRAP_MANDATORY_TRAP_IDS": {
22+
"desc": "Configure COPP_TRAP with no trap_ids.",
23+
"eStrKey" : "Mandatory"
24+
},
25+
"COPP_GROUP_WHEN_SRTCM_WITH_PIR": {
26+
"desc": "Configure COPP_GROUP with srtcm and pir.",
27+
"eStrKey" : "When"
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
{
2+
"COPP_TRAP_WITH_EXIST_GROUP": {
3+
"sonic-copp:sonic-copp": {
4+
"sonic-copp:COPP_GROUP": {
5+
"COPP_GROUP_LIST": [{
6+
"name": "queue1_group1",
7+
"trap_action":"trap",
8+
"trap_priority":"1",
9+
"queue": "1",
10+
"meter_type":"packets",
11+
"mode":"sr_tcm",
12+
"cir":"6000",
13+
"cbs":"6000",
14+
"red_action":"drop"
15+
}]
16+
},
17+
"sonic-copp:COPP_TRAP": {
18+
"COPP_TRAP_LIST": [{
19+
"name": "ip2me",
20+
"trap_ids": "ip2me",
21+
"trap_group": "queue1_group1"
22+
}]
23+
}
24+
}
25+
},
26+
27+
"COPP_TRAP_WITH_NON_EXIST_GROUP": {
28+
"sonic-copp:sonic-copp": {
29+
"sonic-copp:COPP_GROUP": {
30+
"COPP_GROUP_LIST": [{
31+
"name": "queue2_group2",
32+
"trap_action":"trap",
33+
"trap_priority":"2",
34+
"queue": "2",
35+
"meter_type":"packets",
36+
"mode":"sr_tcm",
37+
"cir":"5000",
38+
"cbs":"5000",
39+
"red_action":"drop"
40+
}]
41+
},
42+
"sonic-copp:COPP_TRAP": {
43+
"COPP_TRAP_LIST": [{
44+
"name": "udld",
45+
"trap_ids": "udld",
46+
"trap_group": "queue3_group3"
47+
}]
48+
}
49+
}
50+
},
51+
52+
"COPP_GROUP_MANDATORY_TRAP_ACTION": {
53+
"sonic-copp:sonic-copp": {
54+
"sonic-copp:COPP_GROUP": {
55+
"COPP_GROUP_LIST": [{
56+
"name": "queue3_group4",
57+
"trap_priority":"3",
58+
"queue": "3",
59+
"meter_type":"packets",
60+
"mode":"sr_tcm",
61+
"cir":"5000",
62+
"cbs":"5000",
63+
"red_action":"drop"
64+
}]
65+
}
66+
}
67+
},
68+
69+
"COPP_GROUP_MANDATORY_METER_TYPE": {
70+
"sonic-copp:sonic-copp": {
71+
"sonic-copp:COPP_GROUP": {
72+
"COPP_GROUP_LIST": [{
73+
"name": "queue4_group5",
74+
"trap_action":"trap",
75+
"trap_priority":"4",
76+
"queue": "4",
77+
"mode":"sr_tcm",
78+
"cir":"5000",
79+
"cbs":"5000",
80+
"red_action":"drop"
81+
}]
82+
}
83+
}
84+
},
85+
86+
"COPP_GROUP_PIR_LESS_THAN_CIR": {
87+
"sonic-copp:sonic-copp": {
88+
"sonic-copp:COPP_GROUP": {
89+
"COPP_GROUP_LIST": [{
90+
"name": "queue5_group6",
91+
"trap_action":"trap",
92+
"trap_priority":"5",
93+
"queue": "5",
94+
"mode":"tr_tcm",
95+
"cir":"5000",
96+
"cbs":"5000",
97+
"pir":"4000",
98+
"pbs":"4000",
99+
"red_action":"drop"
100+
}]
101+
}
102+
}
103+
},
104+
105+
"COPP_TRAP_MANDATORY_TRAP_IDS": {
106+
"sonic-copp:sonic-copp": {
107+
"sonic-copp:COPP_GROUP": {
108+
"COPP_GROUP_LIST": [{
109+
"name": "queue6_group7",
110+
"trap_action":"trap",
111+
"trap_priority":"6",
112+
"queue": "6",
113+
"meter_type":"packets",
114+
"mode":"sr_tcm",
115+
"cir":"6000",
116+
"cbs":"6000",
117+
"red_action":"drop"
118+
}]
119+
},
120+
"sonic-copp:COPP_TRAP": {
121+
"COPP_TRAP_LIST": [{
122+
"name": "bgp",
123+
"trap_group": "queue6_group7"
124+
}]
125+
}
126+
}
127+
},
128+
129+
"COPP_GROUP_WHEN_SRTCM_WITH_PIR": {
130+
"sonic-copp:sonic-copp": {
131+
"sonic-copp:COPP_GROUP": {
132+
"COPP_GROUP_LIST": [{
133+
"name": "queue6_group7",
134+
"trap_action":"trap",
135+
"trap_priority":"6",
136+
"queue": "6",
137+
"meter_type":"packets",
138+
"mode":"sr_tcm",
139+
"cir":"6000",
140+
"cbs":"6000",
141+
"pir":"6000",
142+
"red_action":"drop"
143+
}]
144+
}
145+
}
146+
}
147+
}

0 commit comments

Comments
 (0)