Skip to content

Commit 31b8462

Browse files
authored
Update CoPP design with new always_enabled field info (#962)
A new "always_enabled" field was added to CoPP configurations table. This change explains the motivation for the change and what will be the new behavior.
1 parent c3f49bb commit 31b8462

1 file changed

Lines changed: 39 additions & 26 deletions

File tree

doc/copp/CoPP Config and Management.md

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ queue = number; strict queue priority. Higher number means higher priori
3232
trap_action = packet_action; trap action which will be applied to all trap_ids for this group.
3333
trap_priority = trap_priority
3434
35-
;Settings for embedded policer.
35+
;Settings for embedded policer.
3636
meter_type = "packets" | "bytes"
3737
mode = "sr_tcm" | "tr_tcm" | "storm"
3838
color = "aware" | "blind"
@@ -43,8 +43,8 @@ pir = number ;packets or bytes depending on the meter_type value
4343
green_action = packet_action
4444
yellow_action = packet_action
4545
red_action = packet_action
46-
genetlink_name = genetlink_name ;[Optional] "psample" for sFlow
47-
genetlink_mcgrp_name = multicast group name; ;[Optional] "packets" for sFlow
46+
genetlink_name = genetlink_name ;[Optional] "psample" for sFlow
47+
genetlink_mcgrp_name = multicast group name; ;[Optional] "packets" for sFlow
4848
```
4949
```
5050
key = "COPP_TRAP|name"
@@ -63,7 +63,18 @@ state = "ok"
6363
```
6464

6565
### coppmgr
66-
Introduce a *new* CoPP manager, that subscribes for the Config DB CoPP Tables and Feature Tables. Based on the feature enablement, ```coppmgr``` handles the logic to resolve whether a CoPP table shall be written to APP DB for orchagent consumption. Inorder to reduce changes to copporch and for backward compatibility during warmboot, ```coppmgr``` shall use the existing APP_DB schema and implement internal logic to convert the proposed ConfigDB entries to APP DB entries. Similar to existing swss managers, an entry with state "ok" shall be added to STATE_DB. `coppmgrd` must be started by [supervisord.conf](https://github.com/Azure/sonic-buildimage/blob/master/dockers/docker-orchagent/supervisord.conf) first, before any other process is started in swss. During init, ```coppmgr``` shall read the ```copp_cfg.json``` file and apply the default configuration. The default shall not be part of Config_DB entries. ```coppmgr``` shall also read from the config_db during init and apply the logic to merge if there are same entries within the ```copp_cfg.json``` file.
66+
Introduce a *new* CoPP manager, that subscribes for the Config DB CoPP Tables and Feature Tables. Based on the feature enablement, ```coppmgr``` handles the logic to resolve whether a CoPP table shall be written to APP DB for orchagent consumption. Inorder to reduce changes to copporch and for backward compatibility during warmboot, ```coppmgr``` shall use the existing APP_DB schema and implement internal logic to convert the proposed ConfigDB entries to APP DB entries. Similar to existing swss managers, an entry with state "ok" shall be added to STATE_DB. `coppmgrd` must be started by [supervisord.conf](https://github.com/Azure/sonic-buildimage/blob/master/dockers/docker-orchagent/supervisord.conf) first, before any other process is started in swss. During init, ```coppmgr``` shall read the ```copp_cfg.json``` file and apply the default configuration. The default shall not be part of Config_DB entries. ```coppmgr``` shall also read from the config_db during init and apply the logic to merge if there are same entries within the ```copp_cfg.json``` file.
67+
68+
Trap name added to copp_cfg.json file has to match a feature name exist in FEATURE table in Config DB.
69+
In order to handle traps which has no associated feature (such as arp, ip2me), a new field called "always_enabled" will be added to COPP_TRAP table in Config DB.
70+
71+
With the new "always_enabled" field, coppmgr will determine if a trap should be installed.
72+
73+
- If a trap has "always_enabled":"true" field, install it.
74+
75+
- If the associated feature is enabled, install the trap.
76+
77+
Now, traps which have no associated feature, will be installed only if "always_enabled" field value is "true".
6778

6879
### copporch
6980
```copporch``` shall only be a consumer of APP DB CoPP Table. It is not expected to handle feature logic and the current handling of features like sFlow, NAT shall be revisited and removed to be added as part of ```coppmgr```. However `copporch` must be able to handle any new trap_id getting added or removed from an existing CoPP table, and handle attribute value set for a trap group
@@ -75,7 +86,7 @@ Handling of CoPP config json file shall be removed from ```dockers/docker-orchag
7586
This file shall be modified to be compatible to Config DB schema, currently placed at ```swssconfig/sample/00-copp.config.json```. It shall be renamed to ```copp_cfg.j2``` and moved to ```files/image_config/copp/copp_cfg.j2```
7687

7788
### copp_cfg.json
78-
A new file ```copp_cfg.json``` shall be introduced to include default CoPP tables from copp_cfg.j2 placed under ```/etc/sonic```. This file shall be read by ```coppmgr``` during initialization.
89+
A new file ```copp_cfg.json``` shall be introduced to include default CoPP tables from copp_cfg.j2 placed under ```/etc/sonic```. This file shall be read by ```coppmgr``` during initialization.
7990

8091
### Default CoPP Tables
8192
There are two proposals for loading the default CoPP Tables.
@@ -99,22 +110,22 @@ However, this approach has the following limitations:
99110
In warmboot scenarios, as init_cfg.json is not read during warmboot and may result in ***new*** CoPP Tables in the "to" image not getting applied.
100111
In coldboot, if user saves the config and the new release happened to have new CoPP values, it will not be applied since previous default values are present in config_db
101112

102-
2. ```coppmgr``` reading directly from ```copp_cfg.json``` and apply the default CoPP Tables.
113+
2. ```coppmgr``` reading directly from ```copp_cfg.json``` and apply the default CoPP Tables.
103114

104-
For this design, considering the limitations, proposal is to go ahead with second option.
115+
For this design, considering the limitations, proposal is to go ahead with second option.
105116

106117
## Warmboot and Backward Compatibility
107118
It is desirable to have warmboot functionality from previous release versions of Sonic. Since the existing schema has COPP Group name/key with protocol names (e.g `"COPP_TABLE:trap.group.bgp.lacp"`, there is a limitation in adding any new protocol or trap to an existing CoPP group and seamlessly migrate. However, with this proposal, the following options are considered:
108119

109120
1. The implementation is to do a migration of APP DB entries to new schema.
110-
2. Let ```db_migrator``` remove all previously saved APP_DB entries and let syncd reconcile and remove the TRAP entries during warmboot. Later, ```coppmgr``` can reapply the traps afresh. Also remove COPP_TABLES from being saved in [backup_database](https://github.com/Azure/sonic-utilities/blob/master/scripts/fast-reboot#L234). This may require additional tests to confirm system behaviour during warmboot.
121+
2. Let ```db_migrator``` remove all previously saved APP_DB entries and let syncd reconcile and remove the TRAP entries during warmboot. Later, ```coppmgr``` can reapply the traps afresh. Also remove COPP_TABLES from being saved in [backup_database](https://github.com/Azure/sonic-utilities/blob/master/scripts/fast-reboot#L234). This may require additional tests to confirm system behaviour during warmboot.
111122
3. Remove '00-copp.config.json' from being included for checksum calculation in ```files/build_scripts/generate_asic_config_checksum.py```
112123

113124
In addition, the implementation must ensure that backward compatibility is maintained. If the system is boot-up with an *old* config file, the default CoPP tables are to be loaded from ```copp_cfg.json``` and expected to work seamlessly.
114125

115126
## Limitations
116127
1. In case of downgrade, the config_db entries shall be present as stale entries as there is no subscribers for the table. Functionality would be same as supported by the downgraded version
117-
2. This proposal expects the table names to be consistent across multiple releases.
128+
2. This proposal expects the table names to be consistent across multiple releases.
118129
3. User is expected to resolve any conflicts, say for a trap id or group, that arises due to default values from the Sonic binary vs same trap or group currently or previously configured by the user.
119130

120131
## CLI
@@ -124,7 +135,7 @@ CLI support to add/modify CoPP tables is not scoped as part of this design. In f
124135

125136
1. User shall be able to change policer values for a queue
126137
2. User shall be able to change the queue for a protocol/trap
127-
3. User shall be able to delete a group/trap.
138+
3. User shall be able to delete a group/trap.
128139
*In the current proposal, this would mean to keep the key in config_db with empty attributes.
129140

130141
# Flows
@@ -139,7 +150,7 @@ The following flow captures scenarios for ```boot-up``` sequence and ```config r
139150

140151
## Copp Manager flow
141152

142-
The following flow captures CoPP manager functionality.
153+
The following flow captures CoPP manager functionality.
143154

144155
![](https://github.com/Azure/SONiC/blob/master/images/copp/CoppManager_1.png)
145156

@@ -162,13 +173,13 @@ The following flow captures CoPP manager functionality.
162173
"trap_action":"trap",
163174
"trap_priority":"4",
164175
},
165-
176+
166177
"COPP_GROUP|queue4_group2": {
167178
"queue": "4",
168179
"trap_action":"trap",
169180
"trap_priority":"4",
170181
},
171-
182+
172183
"COPP_GROUP|queue4_group3": {
173184
"queue": "4",
174185
"trap_action":"copy",
@@ -189,10 +200,11 @@ The following flow captures CoPP manager functionality.
189200
"trap_ids": "lldp",
190201
"trap_group": "queue4_group2"
191202
},
192-
203+
193204
"COPP_TRAP|arp": {
194205
"trap_ids": "arp_req,arp_resp,neigh_discovery",
195-
"trap_group": "queue4_group3"
206+
"trap_group": "queue4_group3",
207+
"always_enabled": "true"
196208
},
197209
198210
"COPP_GROUP|queue1_group1": {
@@ -205,17 +217,18 @@ The following flow captures CoPP manager functionality.
205217
"cbs":"6000",
206218
"red_action":"drop"
207219
},
208-
220+
209221
"COPP_TRAP|ip2me": {
210222
"trap_ids": "ip2me",
211-
"trap_group": "queue1_group1"
223+
"trap_group": "queue1_group1",
224+
"always_enabled": "true"
212225
},
213-
226+
214227
"COPP_TRAP|nat": {
215228
"trap_ids": "src_nat_miss,dest_nat_miss",
216229
"trap_group": "queue1_group1"
217230
},
218-
231+
219232
"COPP_GROUP|queue2_group1": {
220233
"queue": "2",
221234
"trap_action":"trap",
@@ -236,7 +249,7 @@ The following flow captures CoPP manager functionality.
236249
}
237250
```
238251

239-
*queue4_group2 is added for backward compatibility. Refer "existing" APP_DB entries below
252+
*queue4_group2 is added for backward compatibility. Refer "existing" APP_DB entries below
240253

241254
### APP DB
242255

@@ -249,14 +262,14 @@ The following sample APP DB entries shall be created by `coppmgr` by merging the
249262
"trap_action":"trap",
250263
"trap_priority":"4",
251264
},
252-
265+
253266
"COPP_TABLE:queue4_group2": {
254267
"trap_ids": "lldp",
255268
"queue": "4",
256269
"trap_action":"trap",
257270
"trap_priority":"4",
258271
},
259-
272+
260273
"COPP_TABLE:queue4_group3": {
261274
"trap_ids": "arp_req,arp_resp,neigh_discovery",
262275
"queue": "4",
@@ -267,11 +280,11 @@ The following sample APP DB entries shall be created by `coppmgr` by merging the
267280
"cir":"600",
268281
"cbs":"600",
269282
"red_action":"drop"
270-
}
283+
}
271284
```
272-
285+
273286
### APP DB (Existing in swss, For reference purpose only)
274-
287+
275288
```
276289
[
277290
{
@@ -333,4 +346,4 @@ The following sample APP DB entries shall be created by `coppmgr` by merging the
333346
}
334347
]
335348
```
336-
349+

0 commit comments

Comments
 (0)