COPP_TRAP テーブル¶
概要¶
CoPP の trap エントリを定義し、SAI hostif trap ID 群を COPP_GROUP に束ねる。各 trap は trap_ids フィールドにカンマ区切り識別子 (bgp、lldp、arp_req など) を列挙し、trap_group で COPP_GROUP に紐付ける1。coppmgr が両テーブルを結合し APPL_DB の COPP_TABLE に書く。
データフロー (自動生成)¶
flowchart LR
CDB[("CONFIG_DB<br/>COPP_TRAP")]
DM["coppmgrd"]
CDB --> DM
APPDB[("APP_DB<br/>APP_COPP_TABLE")]
DM --> APPDB
SYNCD["syncd"]
APPDB --> SYNCD
SAI["SAI<br/>sai_hostif_api"]
SYNCD --> SAI
凡例
CONFIG_DB から SAI までの典型経路を docs/reference/config-db-orch-map.md から機械生成したミニ図。詳細・例外は本ページ本文と対応表を参照。
key 構造¶
主要フィールド¶
| フィールド | 型 | 必須 | 既定 | 説明 |
|---|---|---|---|---|
trap_ids |
string | yes | - | カンマ区切り trap 識別子。例: bgp,bgpv6 |
trap_group |
leafref COPP_GROUP.name |
no | - | 適用する CoPP group |
always_enabled |
boolean | no | - | true なら feature の有効/無効に関わらず常時インストール |
動作上の注意¶
always_enabled = trueのエントリ (例: BGP / LLDP のシステム必須 trap) はユーザのconfig feature state操作と独立にインストールされる- 既定の
COPP_TRAP群はdockers/docker-orchagent/copp_cfg.j2およびfiles/image_config/copp/copp_cfg.j2由来でビルド時に生成される
例外条件・特殊挙動¶
- NAT trap_id → NAT 非対応時 ignore: スイッチが NAT 非対応 (
gIsNatSupported == false) の場合、SNAT_MISS/DNAT_MISSの trap_id はSWSS_LOG_NOTICE("Ignoring the trap_id: %s, as NAT is not supported")を出力してスキップされる。 - SAI 非対応 trap_id → ignore:
isTrapIdSupported()が false の場合SWSS_LOG_NOTICE("Ignoring the trap_id: %s, since not supported by vendor SAI")を出力してスキップ。ベンダー SAI が実装していない trap は適用されない。 - COPP_GROUP 未到着時の trap_group 参照 → 書き込み保留:
trap_groupに指定したグループが pending の場合、coppmgrは APPL_DB への書き込みを保留し COPP_GROUP 到着後に再処理する。 - feature 無効な trap_id → COPP_TABLE から除外: feature が off の trap_id は
isTrapIdDisabled()で除外される。trap_group の trap_ids が空になった場合は APPL_DB エントリを削除。 - task_failed → プロセス終了:
CoppOrchはtask_failedが返った場合プロセスを終了する。
値依存挙動マトリクス¶
| フィールド | 値 | 挙動 |
|---|---|---|
always_enabled |
true |
coppmgr が feature の有効/無効に関わらず trap を APPL_DB に書き込む(coppmgr.cpp:90)。config feature state <feature> disabled を実行しても trap はアクティブのまま。BGP / LLDP など必須プロトコルに使用。 |
always_enabled |
false / 未設定 |
feature が enabled のときのみ trap をインストール。feature が disabled になると trap が削除される。 |
trap_ids |
有効な trap_id(例: bgp) |
CoppOrch が trap_id_map で SAI hostif trap type に変換してインストール。 |
trap_ids |
未知の trap_id | CoppOrch の trap_id_map.at() が例外を投げ、当該エントリ全体が適用されない(サイレント失敗)。 |
trap_ids |
プラットフォーム SAI 非対応の trap_id | isTrapIdSupported()=false で個別 trap がスキップ(NOTICE ログのみ)(copporch.cpp:408-413)。他の trap_id は継続適用。 |
trap_ids |
snat_miss / dnat_miss |
NAT 非対応スイッチ(gIsNatSupported=false)ではスキップ(NOTICE ログ)(copporch.cpp:400-406)。 |
購読者¶
関連 CONFIG_DB / YANG / CLI¶
関連リファレンス¶
- YANG:
sonic-copp - CLI:
config copp
引用元¶
関連 Topics¶
運用ヒント¶
典型値¶
- key 形式:
COPP_TRAP|<trap-name>(bgp,lldp,arp等)。 trap_ids:bgp,bgpv6等のカンマ区切り。trap_group: 紐付けるCOPP_GROUP名。
よくある誤設定¶
- 存在しない
trap_groupを参照すると copporch が trap を install しない。 trap_idsのスペル違いは silently 無視され該当トラフィックが CPU に上がらない。