dellemc.enterprise_sonic.sonic_network_policy module – Manage network policy 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_network_policy.
New in dellemc.enterprise_sonic 3.1.0
Synopsis
This module provides configuration management of network policy for devices running SONiC
Parameters
Parameter |
Comments |
|---|---|
List of network policy configurations |
|
List of network policy application configurations dot1p and vlan_id are mutually exclusive dot1p cannot be configured when untagged=True |
|
Media type of the application Choices:
|
|
Enable dot1p priority tagging Choices:
|
|
DSCP value of VLAN, range 0-63 |
|
Priority of VLAN, range 0-7 |
|
Indicates that the application is using an untagged VLAN Choices:
|
|
VLAN identifier, range 1-4094 |
|
Network policy number, range 1-128 |
|
The state of the configuration after module completion Choices:
|
Notes
Note
Tested against Enterprise SONiC Distribution by Dell Technologies.
Supports
check_mode.
Examples
# Using "merged" state
#
# Before state:
# -------------
#
# sonic# show running-configuration
# (No network policy configuration present)
- name: Merge network policy configuration
dellemc.enterprise_sonic.sonic_network_policy:
config:
- number: 1
applications:
- app_type: voice
vlan_id: 2
priority: 1
dscp: 1
- app_type: voice-signaling
dot1p: enabled
dscp: 50
state: merged
# After state:
# ------------
#
# sonic# show running-configuration
# !
# network-policy profile 1
# voice vlan 2 cos 1 dscp 1
# voice-signaling vlan dot1p dscp 50
# !
# Using "replaced" state
#
# Before state:
# -------------
#
# sonic# show running-configuration
# !
# network-policy profile 1
# voice vlan 2 cos 1 dscp 1
# voice-signaling vlan 3 untagged dscp 50
# !
# network-policy profile 2
# voice vlan 100 cos 7 dscp 12
# voice-signaling vlan 400 cos 7 dscp 45
# !
- name: Replace network policy configuration
dellemc.enterprise_sonic.sonic_network_policy:
config:
- number: 1
applications:
- app_type: voice
vlan_id: 1
untagged: false
priority: 0
dscp: 0
state: replaced
# After state:
# ------------
#
# sonic# show running-configuration
# !
# network-policy profile 1
# voice vlan 1 cos 0 dscp 0
# !
# network-policy profile 2
# voice vlan 100 cos 7 dscp 12
# voice-signaling vlan 400 cos 7 dscp 45
# !
# Using "overridden" state
#
# Before state:
# -------------
#
# sonic# show running-configuration
# !
# network-policy profile 1
# voice vlan 2 cos 1 dscp 1
# voice-signaling vlan 3 untagged dscp 50
# !
# network-policy profile 2
# voice vlan 100 cos 7 dscp 12
# voice-signaling vlan 400 cos 7 dscp 45
# !
- name: Override network policy configuration
dellemc.enterprise_sonic.sonic_network_policy:
config:
- number: 1
applications:
- app_type: voice
vlan_id: 1
untagged: false
priority: 0
dscp: 0
state: overridden
# After state:
# ------------
#
# sonic# show running-configuration
# !
# network-policy profile 1
# voice vlan 1 cos 0 dscp 0
# !
# Using "deleted" state
#
# Before state:
# -------------
#
# sonic# show running-configuration
# !
# network-policy profile 1
# voice vlan 2 cos 1 dscp 1
# voice-signaling vlan 3 untagged dscp 50
# !
# network-policy profile 2
# voice vlan 100 cos 7 dscp 12
# voice-signaling vlan 400 cos 7 dscp 45
# !
# network-policy profile 3
# voice-signaling vlan 80 cos 6 dscp 32
# !
- name: Delete network policy configuration
dellemc.enterprise_sonic.sonic_network_policy:
config:
- number: 1
applications:
- app_type: voice
dscp: 1
- number: 2
applications:
- app_type: voice
- number: 3
state: deleted
# After state:
# ------------
#
# sonic# show running-configuration
# !
# network-policy profile 1
# voice vlan 2 cos 1
# voice-signaling vlan 3 untagged dscp 50
# !
# network-policy profile 2
# voice-signaling vlan 400 cos 7 dscp 45
# !
# Using "deleted" state
#
# Before state:
# -------------
#
# sonic# show running-configuration
# !
# network-policy profile 1
# voice vlan 2 cos 1 dscp 1
# voice-signaling vlan 3 untagged dscp 50
# !
# network-policy profile 2
# voice vlan 100 cos 7 dscp 12
# voice-signaling vlan 400 cos 7 dscp 45
# !
# network-policy profile 3
# voice-signaling vlan 80 cos 6 dscp 32
# !
- name: Delete all network policy configuration
dellemc.enterprise_sonic.sonic_network_policy:
config:
state: deleted
# After state:
# ------------
#
# sonic# show running-configuration
# (No network policy configuration present)
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The configuration resulting from module invocation. Returned: when changed |
|
The generated configuration from module invocation. Returned: when |
|
The configuration prior to the module invocation. Returned: always |
|
The set of commands pushed to the remote device. Returned: always Sample: |