dellemc.enterprise_sonic.sonic_drop_counter module – Manage drop counter configuration on SONiC

Note

This module is part of the dellemc.enterprise_sonic collection (version 3.2.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install dellemc.enterprise_sonic.

To use it in a playbook, specify: dellemc.enterprise_sonic.sonic_drop_counter.

New in dellemc.enterprise_sonic 3.1.0

Synopsis

  • This module provides configuration management of drop counter for devices running SONiC

Parameters

Parameter

Comments

config

list / elements=dictionary

List of drop counter configurations

alias

string

Alias of drop counter

counter_description

string

Description of drop counter

counter_type

string

Type of drop counter

Choices:

  • "PORT_INGRESS_DROPS"

enable

boolean

Enable drop counter

Choices:

  • false

  • true

group

string

Group of drop counter

mirror

string

Mirror session to mirror the drop counter

name

string / required

Name of drop counter

reasons

list / elements=string

List of drop counter reasons

Choices:

  • "ACL_ANY"

  • "ANY"

  • "DIP_LINK_LOCAL"

  • "EXCEEDS_L3_MTU"

  • "FDB_AND_BLACKHOLE_DISCARDS"

  • "IP_HEADER_ERROR"

  • "L3_EGRESS_LINK_DOWN"

  • "MPLS_MISS"

  • "SIP_LINK_LOCAL"

  • "SMAC_EQUALS_DMAC"

state

string

The state of the configuration after module completion

Choices:

  • "merged" ← (default)

  • "deleted"

  • "replaced"

  • "overridden"

Notes

Note

  • Tested against Enterprise SONiC Distribution by Dell Technologies

  • Supports check_mode

Examples

# Using "merged" state
#
# Before state:
# -------------
#
# sonic# show running-configuration dropcounters
# (No 'dropcounters' configuration present)

- name: Merge drop counter configuration
  dellemc.enterprise_sonic.sonic_drop_counter:
    config:
      - name: counter1
        alias: c1
        counter_description: abc
        counter_type: PORT_INGRESS_DROPS
        enable: true
        group: group1
        mirror: session1
        reasons:
          - ANY
    state: merged

# After state:
# ------------
#
# sonic# show running-configuration dropcounters
# !
# dropcounters counter1
#  enable
#  type PORT_INGRESS_DROPS
#  alias c1
#  group group1
#  description "abc"
#  mirror session1
#  add-reason ANY


# Using "replaced" state
#
# Before state:
# -------------
#
# sonic# show running-configuration dropcounters
# !
# dropcounters counter1
#  enable
#  type PORT_INGRESS_DROPS
#  alias c1
#  group group1
#  description "abc"
#  mirror session1
#  add-reason ANY
# !
# dropcounters counter2
#  no enable
#  type PORT_INGRESS_DROPS
#  alias drop2
#  group group2
#  description "xyz789"
#  add-reason IP_HEADER_ERROR,L3_EGRESS_LINK_DOWN,SMAC_EQUALS_DMAC

- name: Replace drop counter configuration
  dellemc.enterprise_sonic.sonic_drop_counter:
    config:
      - name: counter1
        counter_description: abc123
    state: replaced

# After state:
# ------------
#
# sonic# show running-configuration dropcounters
# !
# dropcounters counter1
#  description "abc123"
# !
# dropcounters counter2
#  no enable
#  type PORT_INGRESS_DROPS
#  alias drop2
#  group group2
#  description "xyz789"
#  add-reason IP_HEADER_ERROR,L3_EGRESS_LINK_DOWN,SMAC_EQUALS_DMAC


# Using "overridden" state
#
# Before state:
# -------------
#
# sonic# show running-configuration dropcounters
# !
# dropcounters counter1
#  enable
#  type PORT_INGRESS_DROPS
#  alias c1
#  group group1
#  description "abc"
#  mirror session1
#  add-reason ANY
# !
# dropcounters counter2
#  no enable
#  type PORT_INGRESS_DROPS
#  alias drop2
#  group group2
#  description "xyz789"
#  add-reason IP_HEADER_ERROR,L3_EGRESS_LINK_DOWN,SMAC_EQUALS_DMAC

- name: Override drop counter configuration
  dellemc.enterprise_sonic.sonic_drop_counter:
    config:
      - name: counter3
        alias: c3
        counter_description: qwerty
        counter_type: PORT_INGRESS_DROPS
        enable: true
        group: group3
        mirror: session2
        reasons:
          - ACL_ANY
          - FDB_AND_BLACKHOLE_DISCARDS
    state: overridden

# After state:
# ------------
#
# sonic# show running-configuration dropcounters
# !
# dropcounters counter3
#  enable
#  type PORT_INGRESS_DROPS
#  alias c3
#  group group3
#  description "qwerty"
#  mirror session2
#  add-reason ACL_ANY,FDB_AND_BLACKHOLE_DISCARDS


# Using "deleted" state
#
# Before state:
# -------------
#
# sonic# show running-configuration dropcounters
# !
# dropcounters counter1
#  enable
#  type PORT_INGRESS_DROPS
#  alias c1
#  group group1
#  description "abc"
#  mirror session1
#  add-reason ANY
# !
# dropcounters counter2
#  no enable
#  type PORT_INGRESS_DROPS
#  alias drop2
#  group group2
#  description "xyz789"
#  add-reason IP_HEADER_ERROR,L3_EGRESS_LINK_DOWN,SMAC_EQUALS_DMAC

- name: Delete drop counter configuration
  dellemc.enterprise_sonic.sonic_drop_counter:
    config:
      - name: counter1
        alias: c1
        counter_description: abc
      - name: counter2
    state: deleted

# After state:
# ------------
#
# sonic# show running-configuration dropcounters
# !
# dropcounters counter1
#  enable
#  type PORT_INGRESS_DROPS
#  group group1
#  mirror session1
#  add-reason ANY


# Using "deleted" state
#
# Before state:
# -------------
#
# sonic# show running-configuration dropcounters
# !
# dropcounters counter1
#  enable
#  type PORT_INGRESS_DROPS
#  group group1
#  mirror session1
#  add-reason ANY

- name: Delete all drop counter configuration
  dellemc.enterprise_sonic.sonic_drop_counter:
    config:
    state: deleted

# After state:
# ------------
#
# (No 'dropcounters' configuration present)

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

after

list / elements=string

The configuration resulting from module invocation.

Returned: when changed

after(generated)

list / elements=string

The generated configuration from module invocation.

Returned: when check_mode

before

list / elements=string

The configuration prior to the module invocation.

Returned: always

commands

list / elements=string

The set of commands pushed to the remote device.

Returned: always

Sample: ["command 1", "command 2", "command 3"]

Authors

    1. Talabi (@stalabi1)