コンテンツにスキップ

COPP_TRAP テーブル

概要

CoPP の trap エントリを定義し、SAI hostif trap ID 群を COPP_GROUP に束ねる。各 trap は trap_ids フィールドにカンマ区切り識別子 (bgplldparp_req など) を列挙し、trap_groupCOPP_GROUP に紐付ける1coppmgr が両テーブルを結合し APPL_DBCOPP_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 構造

COPP_TRAP|<name>

主要フィールド

フィールド 必須 既定 説明
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 → プロセス終了: CoppOrchtask_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 CoppOrchtrap_id_map で SAI hostif trap type に変換してインストール。
trap_ids 未知の trap_id CoppOrchtrap_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)。

購読者

  • coppmgr: CONFIG_DBAPPL_DB COPP_TABLE
  • orchagent CoppOrch: SAI HOSTIF_TRAP オブジェクト生成

関連 CONFIG_DB / YANG / CLI

  • 関連 CONFIG_DB: COPP_GROUPFEATURE
  • 関連 CLI: config coppshow copp
  • 関連 YANG: sonic-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 に上がらない。

確認コマンド

sonic-db-cli CONFIG_DB keys 'COPP_TRAP|*'
show copp config