dellemc.enterprise_sonic.sonic_fbs_classifiers module – Manage flow based services (FBS) classifiers 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_classifiers.

New in dellemc.enterprise_sonic 3.1.0

Synopsis

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

Parameters

Parameter

Comments

config

list / elements=dictionary

FBS classifiers configuration

match_acl and match_hdr_fields are mutually exclusive.

class_description

string

Description of classifier

class_name

string / required

Name of classifier

match_acl

dictionary

Match ACL configuration

acl_name

string / required

Name of ACL to be used as match criteria

acl_type

string / required

Type of ACL to be used as match criteria

Choices:

  • "ip"

  • "ipv6"

  • "mac"

match_hdr_fields

dictionary

Match header fields configuration

ipv4 and ipv6 are mutually exclusive.

ip

dictionary

IP field configuration

dscp

integer

Value of diffserv code point, range 0-63

protocol

string

IP protocol

Choices:

  • "auth"

  • "gre"

  • "icmp"

  • "icmpv6"

  • "igmp"

  • "l2tp"

  • "pim"

  • "rsvp"

  • "tcp"

  • "udp"

ipv4

dictionary

IPv4 field configuration

destination_address

string

Destination IPv4 address prefix

source_address

string

Source IPv4 address prefix

ipv6

dictionary

IPv6 field configuration

destination_address

string

Destination IPv6 address prefix

source_address

string

Source IPv6 address prefix

l2

dictionary

Ethernet field configuration

dei

integer

Drop eligible indicator, range 0-1

destination_mac

string

Destination MAC address

destination_mac_mask

string

Destination MAC address mask

ethertype

string

Ethertype field to match in ethernet packets

Choices:

  • "arp"

  • "ipv4"

  • "ipv6"

  • "lldp"

  • "mpls"

  • "roce"

  • "vlan"

pcp

integer

Priority code point, range 0-7

source_mac

string

Source MAC address

source_mac_mask

string

Source MAC address mask

vlanid

integer

VLAN ID, range 1-4094

transport

dictionary

Transport field configuration

destination_port

string

Destination port or range

For specifying a range use ‘..’ as a delimeter, e.g. ‘1..3’.

icmp_code

integer

ICMP or ICMPv6 code, range 0-255

icmp_type

integer

ICMP or ICMPv6 type, range 0-255

source_port

string

Source port or range

For specifying a range use ‘..’ as a delimeter, e.g. ‘1..3’.

tcp_flags

list / elements=string

List of TCP flags to match

Choices:

  • "ack"

  • "fin"

  • "psh"

  • "rst"

  • "syn"

  • "urg"

match_type

string

Classifier match type

The classifier match type is required for classifier creation and corresponds to either ‘match_acl’ or ‘match_hdr_fields’ configuration.

Choices:

  • "acl"

  • "fields"

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

- name: Merge FBS classifiers configuration
  dellemc.enterprise_sonic.sonic_fbs_classifiers:
    config:
      - class_name: class1
        class_description: xyz
        match_type: fields
        match_hdr_fields:
          ip:
            dscp: 0
            protocol: tcp
          ipv4:
            source_address: 1.1.1.1/1
            destination_address: 2.2.2.2/2
          l2:
            source_mac: 1a:2b:3c:4d:5e:6f
            source_mac_mask: 6a:5b:4c:3d:2e:1f
            destination_mac: 2a:4b:6c:8d:10:20
            destination_mac_mask: 20:10:8d:6c:4b:2a
            dei: 0
            ethertype: ipv4
            pcp: 0
            vlanid: 1
          transport:
            source_port: 1..3
            destination_port: 4..6
            tcp_flags:
              - ack
              - fin
              - psh
    state: merged

# After state:
# ------------
#
# sonic# show class-map
# Class-map class1 match-type fields
#   Description: xyz
#   Match:
#     ethertype ip
#     src-mac 1a:2b:3c:4d:5e:6f/6a:5b:4c:3d:2e:1f
#     dst-mac 2a:4b:6c:8d:10:20/20:10:8d:6c:4b:2a
#     vlan 1
#     pcp be
#     dei 0
#     ip protocol tcp
#     src-ip 1.1.1.1/1
#     dst-ip 2.2.2.2/2
#     dscp default
#     src-port 1-3
#     dst-port 4-6
#     tcp-flags fin psh ack
#   Referenced in flows:


# Using "replaced" state
#
# Before state:
# -------------
#
# sonic# show class-map
# Class-map class1 match-type fields
#   Description: xyz
#   Match:
#     ethertype ip
#     src-mac 1a:2b:3c:4d:5e:6f/6a:5b:4c:3d:2e:1f
#     dst-mac 2a:4b:6c:8d:10:20/20:10:8d:6c:4b:2a
#     vlan 1
#     pcp be
#     dei 0
#     ip protocol tcp
#     src-ip 1.1.1.1/1
#     dst-ip 2.2.2.2/2
#     dscp default
#     src-port 1-3
#     dst-port 4-6
#     tcp-flags fin psh ack
#   Referenced in flows:
#
# Class-map class2 match-type acl
#   Description: abc
#   Match:
#     ip access-group acl1
#   Referenced in flows:

- name: Replace FBS classifiers configuration
  dellemc.enterprise_sonic.sonic_fbs_classifiers:
    config:
      - class_name: class1
        match_hdr_fields:
          l2:
            source_mac: 9a:8b:7c:6d:5e:4f
            source_mac_mask: 2a:4b:1c:9b:1e:0f
            destination_mac: 1a:6c:3c:4f:40:22
            destination_mac_mask: 26:44:8c:9d:4b:6f
            ethertype: vlan
            pcp: 6
            vlanid: 2
    state: replaced

# After state:
# ------------
#
# sonic# show class-map
# Class-map class1 match-type fields
#   Description: xyz
#   Match:
#     ethertype 0x8100
#     src-mac 9a:8b:7c:6d:5e:4f/2a:4b:1c:9b:1e:0f
#     dst-mac 1a:6c:3c:4f:40:22/26:44:8c:9d:4b:6f
#     vlan 2
#     pcp ic
#   Referenced in flows:
#
# Class-map class2 match-type acl
#   Description: abc
#   Match:
#     ip access-group acl1
#   Referenced in flows:


# Using "overridden" state
#
# Before state:
# -------------
#
# sonic# show class-map
# Class-map class1 match-type fields
#   Description: xyz
#   Match:
#     ethertype 0x8100
#     src-mac 9a:8b:7c:6d:5e:4f/2a:4b:1c:9b:1e:0f
#     dst-mac 1a:6c:3c:4f:40:22/26:44:8c:9d:4b:6f
#     vlan 2
#     pcp ic
#   Referenced in flows:

- name: Override FBS classifiers configuration
  dellemc.enterprise_sonic.sonic_fbs_classifiers:
    config:
      - class_name: class2
        class_description: abc
        match_type: acl
        match_acl:
          acl_name: acl1
          acl_type: ip

# After state:
# ------------
#
# sonic# show class-map
# Class-map class2 match-type acl
#   Description: abc
#   Match:
#     ip access-group acl1
#   Referenced in flows:


# Using "deleted" state
#
# Before state:
# -------------
#
# sonic# show class-map
# Class-map class1 match-type fields
#   Description: xyz
#   Match:
#     ethertype 0x8100
#     src-mac 9a:8b:7c:6d:5e:4f/2a:4b:1c:9b:1e:0f
#     dst-mac 1a:6c:3c:4f:40:22/26:44:8c:9d:4b:6f
#     vlan 2
#     pcp ic
#   Referenced in flows:
#
# Class-map class2 match-type acl
#   Description: abc
#   Match:
#     ip access-group acl1
#   Referenced in flows:

- name: Delete FBS classifiers configuration
  dellemc.enterprise_sonic.sonic_fbs_classifiers:
    config:
      - class_name: class1
        class_description: xyz
        match_hdr_fields:
          l2:
            source_mac: 9a:8b:7c:6d:5e:4f
            source_mac_mask: 2a:4b:1c:9b:1e:0f
            destination_mac: 1a:6c:3c:4f:40:22
            destination_mac_mask: 26:44:8c:9d:4b:6f
            ethertype: vlan
            pcp: 6
            vlanid: 2
      - class_name: class2
    state: deleted

# After state:
# ------------
#
# sonic# show class-map
# Class-map class1 match-type fields
#   Description:
#   Match:
#   Referenced in flows:


# Using "deleted" state
#
# Before state:
# -------------
#
# sonic# show class-map
# Class-map class1 match-type fields
#   Description: xyz
#   Match:
#     ethertype 0x8100
#     src-mac 9a:8b:7c:6d:5e:4f/2a:4b:1c:9b:1e:0f
#     dst-mac 1a:6c:3c:4f:40:22/26:44:8c:9d:4b:6f
#     vlan 2
#     pcp ic
#   Referenced in flows:
#
# Class-map class2 match-type acl
#   Description: abc
#   Match:
#     ip access-group acl1
#   Referenced in flows:

- name: Delete all FBS classifiers configuration
  dellemc.enterprise_sonic.sonic_fbs_classifiers:
    config:
    state: deleted

# After state:
# ------------
#
# sonic# show class-map
# (No 'class-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 resulting configuration 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)