dellemc.enterprise_sonic.sonic_fbs_policies module – Manage flow based services (FBS) policies 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_fbs_policies.

New in dellemc.enterprise_sonic 3.1.0

Synopsis

  • This module provides configuration management of FBS policies for devices running SONiC

Parameters

Parameter

Comments

config

list / elements=dictionary

FBS policies configuration

policy_description

string

Description of policy

policy_name

string / required

Name of policy

policy_type

string

Type of policy

Choices:

  • "acl-copp"

  • "copp"

  • "forwarding"

  • "monitoring"

  • "qos"

sections

list / elements=dictionary

Policy sections configuration

acl_copp

dictionary

ACL CoPP configuration

policy_type must be configured to acl-copp for user-assigned policy names

or copp for policy_name = copp-system-policy

cpu_queue_index

integer

CPU queue index, range 0-31

policer

dictionary

Traffic policing configuration

cbs

integer

Committed burst size measured Bps, range 1-4294967295

cir

integer

Committed information rate measured in bps, range 1-4294967295

pbs

integer

Peak burst size measured in Bps, range 1-4294967295

pir

integer

Peak information rate measured in bps, range 1-4294967295

class

string / required

Name of classifier

forwarding

dictionary

Forwarding actions configuration

policy_type must be configured to forwarding

ars_disable

boolean

Enable/disable adaptive routing and switching forwarding

Functional default is false

Choices:

  • false

  • true

egress_interfaces

list / elements=dictionary

Egress interfaces configuration

intf_name

string / required

Name of interface

priority

integer

Priority of the egress interfaces to be selected for forwarding, range 1-65535

next_hop_groups

list / elements=dictionary

Next hop groups configuration for L3 forwarding

group_name

string / required

Name of next hop group

group_type

string

Type of next hop group

Choices:

  • "ipv4"

  • "ipv6"

priority

integer

Priority of the next hop group to be selected for forwarding, range 1-65535

next_hops

list / elements=dictionary

Next hops configuration for L3 forwarding

address

string / required

Forwarding IP/IPv6 address

priority

integer

Priority of the next hop to be selected for forwarding, range 1-65535

vrf

string

Forwarding network instance

replication_groups

list / elements=dictionary

Replication groups configuration for L3 forwarding

group_name

string / required

Name of replication group

group_type

string

Type of replication group

Choices:

  • "ipv4"

  • "ipv6"

priority

integer

Priority of the replication group to be selected for forwarding, range 1-65535

mirror_sessions

list / elements=dictionary

Mirroring sessions configuration

policy_type must be configured to monitoring

session_name

string / required

Name of the mirror session

priority

integer

Flow priority in the policy, range 0-4095

qos

dictionary

QoS action configuration

policy_type must be configured to qos

output_queue_index

integer

Output queue index, range 0-7

policer

dictionary

Traffic policing configuration

cbs

integer

Committed burst size measured Bps, range 1-4294967295

cir

integer

Committed information rate measured in bps, range 1-4294967295

pbs

integer

Peak burst size measured in Bps, range 1-4294967295

pir

integer

Peak information rate measured in bps, range 1-4294967295

remark

dictionary

Remark configuration

set_dot1p

integer

Set Dot1p remarking value, range 0-7

set_dscp

integer

Set DSCP remarking value, range 0-63

section_description

string

Description of section

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 policy-map
# (No policy-map configuration present)

- name: Merge FBS policies configuration
  dellemc.enterprise_sonic.sonic_fbs_policies:
    config:
      - policy_name: policy1
        policy_description: abc
        policy_type: forwarding
        sections:
          - class: class1
            forwarding:
              ars_disable: true
              egress_interfaces:
                - intf_name: Ethernet96
                  priority: 1
            priority: 0
            section_description: xyz
      - policy_name: policy2
        policy_description: qwerty
        policy_type: acl-copp
        sections:
          - class: class1
            acl_copp:
              cpu_queue_index: 0
              policer:
                cbs: 80
                cir: 75
                pbs: 95
                pir: 96
            priority: 0
      - policy_name: policy3
        policy_description: 'this is policy 3'
        policy_type: qos
        sections:
          - class: class1
            qos:
              output_queue_index: 0
              policer:
                cbs: 15
                cir: 20
                pbs: 21
                pir: 24
              remark:
                set_dot1p: 0
                set_dscp: 0
            priority: 0
      - policy_name: policy4
        policy_description: 'this is policy 4'
        policy_type: monitoring
        sections:
          - class: class1
            mirror_sessions:
              - session_name: session1
            priority: 0
      - policy_name: policy5
        policy_description: abc
        policy_type: forwarding
        sections:
          - class: class1
            forwarding:
              next_hops:
                - address: 1.1.1.1
                  vrf: default
                  priority: 1
              next_hop_groups:
                - group_name: hop1
                  group_type: ipv4
                  priority: 1
              replication_groups:
                - group_name: rep1
                  group_type: ipv4
                  priority: 1
            priority: 0
            section_description: 'section for class1'
    state: merged

# After state:
# ------------
#
# sonic# show running-configuration policy-map
# !
# policy-map policy1 type forwarding
#  description abc
#  class class1 priority 0
#  description xyz
#   set interface Ethernet96 priority 1
#   set ars disable
#  !
# !
# policy-map policy2 type acl-copp
#  description qwerty
#  class class1 priority 0
#   set trap-queue 0
#   police cir 75 cbs 80 pir 96 pbs 95
#  !
# !
# policy-map policy3 type qos
#  description "this is policy 3"
#  class class1 priority 0
#   set pcp 0
#   set dscp 0
#   set traffic-class 0
#   police cir 20 cbs 15 pir 24 pbs 21
#  !
# !
# policy-map policy4 type monitoring
#  description "this is policy 4"
#  class class1 priority 0
#   set mirror-session session1
#  !
# !
# policy-map policy5 type forwarding
#  description abc
#  class class1 priority 0
#  description "section for class1"
#   set ip next-hop 1.1.1.1 vrf default priority 1
#   set ip next-hop-group hop1 priority 1
#   set ip replication-group rep1 priority 1
#  !


# Using "replaced" state
#
# Before state:
# -------------
#
# sonic# show running-configuration policy-map
# !
# policy-map policy1 type forwarding
#  description abc
#  class class1 priority 0
#  description xyz
#   set interface Ethernet20 priority 1
#   set ars disable
#  !
# !
# policy-map policy2 type acl-copp
#  description qwerty
#  class class1 priority 0
#   set trap-queue 0
#   police cir 75 cbs 80 pir 96 pbs 95
#  !

- name: Replace FBS policies configuration
  dellemc.enterprise_sonic.sonic_fbs_policies:
    config:
      - policy_name: policy1
        policy_description: 'abc123'
        policy_type: monitoring
        sections:
          - class: class1
            mirror_sessions:
              - session_name: mirror1
            priority: 0
    state: replaced

# After state:
# ------------
#
# sonic# show running-configuration policy-map
# !
# policy-map policy1 type monitoring
#  description "abc123"
#  class class1 priority 0
#   set mirror-session mirror1
#  !
# !
# policy-map policy2 type acl-copp
#  description qwerty
#  class class1 priority 0
#   set trap-queue 0
#   police cir 75 cbs 80 pir 96 pbs 95
#  !


# Using "overridden" state
#
# Before state:
# -------------
#
# sonic# show running-configuration policy-map
# !
# policy-map policy1 type forwarding
#  description abc
#  class class1 priority 0
#  description xyz
#   set interface Ethernet20 priority 1
#   set ars disable
#  !

- name: Override FBS policies configuration
  dellemc.enterprise_sonic.sonic_fbs_policies:
    config:
      - policy_name: policy2
        policy_description: qwerty
        policy_type: copp
        sections:
          - class: class1
            acl_copp:
              cpu_queue_index: 0
              policer:
                cbs: 80
                cir: 75
                pbs: 95
                pir: 96
            priority: 0
    state: overridden

# After state:
# ------------
#
# sonic# show running-configuration policy-map
# !
# policy-map policy2 type acl-copp
#  description qwerty
#  class class1 priority 0
#   set trap-queue 0
#   police cir 75 cbs 80 pir 96 pbs 95
#  !


# Using "deleted" state
#
# Before state:
# -------------
#
# sonic# show running-configuration policy-map
# !
# policy-map policy1 type forwarding
#  description abc
#  class class1 priority 0
#  description xyz
#   set interface Ethernet20 priority 1
#   set ars disable
#  !
# !
# policy-map policy2 type acl-copp
#  description qwerty
#  class class1 priority 0
#   set trap-queue 0
#   police cir 75 cbs 80 pir 96 pbs 95
#  !
# !
# policy-map policy3 type monitoring
#  description "this is policy 3"
#  class class1 priority 0
#   set mirror-session mirror1
#  !

- name: Delete FBS policies configuration
  dellemc.enterprise_sonic.sonic_fbs_policies:
    config:
      - policy_name: policy1
      - policy_name: policy2
        sections:
          - class: class1
            acl_copp:
              policer:
                cbs: 80
                cir: 75
                pbs: 95
                pir: 96
      - policy_name: policy3
        sections:
          - class: class1
    state: deleted

# After state:
# ------------
#
# sonic# show running-configuration policy-map
# !
# policy-map policy2 type acl-copp
#  description qwerty
#  class class1 priority 0
#   set trap-queue 0
#  !
# !
# policy-map policy3 type monitoring
#  description "this is policy 3"
#  !


# Using "deleted" state
#
# Before state:
# -------------
#
# sonic# show running-configuration policy-map
# !
# policy-map policy2 type acl-copp
#  description qwerty
#  class class1 priority 0
#   set trap-queue 0
#  !
# !
# policy-map policy3 type monitoring
#  description "this is policy 3"
#  !

- name: Delete all FBS policies configuration
  dellemc.enterprise_sonic.sonic_fbs_policies:
    config:
    state: deleted

# After state:
# -------------
#
# sonic# show running-configuration policy-map
# (No policy-map 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)