dellemc.enterprise_sonic.sonic_copp (2.4.0) — module

Manage CoPP configuration on SONiC

| "added in version" 2.1.0 of dellemc.enterprise_sonic"

Authors: Shade Talabi (@stalabi1)

preview | supported by community

Install collection

Install with ansible-galaxy collection install dellemc.enterprise_sonic:==2.4.0


Add to requirements.yml

  collections:
    - name: dellemc.enterprise_sonic
      version: 2.4.0

Description

This module provides configuration management of CoPP for devices running SONiC

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Using merged
#
# Before state:
# -------------
#
# sonic# show copp actions
# (No "copp actions" configuration present)

  - name: Merge CoPP groups configuration
    dellemc.enterprise_sonic.sonic_copp:
    config:
      copp_groups:
        - copp_name: 'copp-1'
          trap_priority: 1
          trap_action: 'DROP'
          queue: 1
          cir: '45'
          cbs: '45'
        - copp_name: 'copp-2'
          trap_priority: 2
          trap_action: 'FORWARD'
          queue: 2
          cir: '90'
          cbs: '90'
    state: merged
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# After state:
# ------------
#
# sonic# show copp actions
# CoPP action group copp-1
#    trap-action drop
#    trap-priority 1
#    trap-queue 1
#    police cir 45 cbs 45
# CoPP action group copp-2
#    trap-action forward
#    trap-priority 2
#    trap-queue 2
#    police cir 90 cbs 90
#
#
# Using replaced
#
# Before state:
# -------------
#
# sonic# show copp actions
# CoPP action group copp-1
#    trap-action drop
#    trap-priority 1
#    trap-queue 1
#    police cir 45 cbs 45

  - name: Replace CoPP groups configuration
    dellemc.enterprise_sonic.sonic_copp:
    config:
      copp_groups:
        - copp_name: 'copp-1'
          trap_priority: 2
          trap_action: 'FORWARD'
          queue: 2
        - copp_name: 'copp-3'
          trap_priority: 3
          trap_action: 'DROP'
          queue: 3
          cir: '1000'
          cbs: '1000'
    state: replaced
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# After state:
# ------------
#
# sonic# show copp actions
# CoPP action group copp-1
#    trap-action forward
#    trap-priority 2
#    trap-queue 2
# CoPP action group copp-3
#    trap-action drop
#    trap-priority 3
#    trap-queue 3
#    police cir 1000 cbs 1000
#
#
# Using overridden
#
# Before state:
# -------------
#
# sonic# show copp actions
# CoPP action group copp-1
#    trap-action forward
#    trap-priority 2
#    trap-queue 2
# CoPP action group copp-3
#    trap-action drop
#    trap-priority 3
#    trap-queue 3
#    police cir 1000 cbs 1000

  - name: Override CoPP groups configuration
    dellemc.enterprise_sonic.sonic_copp:
    config:
      copp_groups:
        - copp_name: 'copp-4'
          trap_priority: 4
          trap_action: 'FORWARD'
          queue: 4
          cir: 200
          cbs: 200
    state: overridden
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# After state:
# ------------
#
# sonic# show copp actions
# CoPP action group copp-4
#    trap-action forward
#    trap-priority 4
#    trap-queue 4
#    police cir 200 cbs 200
#
#
# Using deleted
#
# Before state:
# -------------
#
# sonic# show copp actions
# CoPP action group copp-1
#    trap-action drop
#    trap-priority 1
#    trap-queue 1
#    police cir 45 cbs 45
# CoPP action group copp-2
#    trap-action forward
#    trap-priority 2
#    trap-queue 2
#    police cir 90 cbs 90

  - name: Delete CoPP groups configuration
    dellemc.enterprise_sonic.sonic_copp:
    config:
      copp_groups:
        - copp_name: 'copp-1'
          trap_action: 'DROP'
          cir: '45'
          cbs: '45'
        - copp_name: 'copp-2'
    state: deleted

Inputs

    
state:
    choices:
    - merged
    - deleted
    - replaced
    - overridden
    default: merged
    description:
    - The state of the configuration after module completion
    type: str

config:
    description:
    - Specifies CoPP configurations
    suboptions:
      copp_groups:
        description:
        - List of CoPP entries that comprise a CoPP group
        elements: dict
        suboptions:
          cbs:
            description:
            - Committed bucket size in packets or bytes
            type: str
          cir:
            description:
            - Committed information rate in bps or pps (packets per second)
            type: str
          copp_name:
            description:
            - Name of CoPP classifier
            required: true
            type: str
          queue:
            description:
            - CoPP queue ID
            type: int
          trap_action:
            description:
            - CoPP trap action
            type: str
          trap_priority:
            description:
            - CoPP trap priority
            type: int
        type: list
    type: dict

Outputs

after:
  description: The resulting configuration model invocation.
  returned: when changed
  sample: 'The configuration returned will always be in the same format of the parameters
    above.

    '
  type: list
before:
  description: The configuration prior to the model invocation.
  returned: always
  sample: 'The configuration returned will always be in the same format of the parameters
    above.

    '
  type: list
commands:
  description: The set of commands pushed to the remote device.
  returned: always
  sample:
  - command 1
  - command 2
  - command 3
  type: list