diff --git a/models/enterprise_sonic/network_policy/deleted_example_01.txt b/models/enterprise_sonic/network_policy/deleted_example_01.txt new file mode 100644 index 00000000..2efc99b2 --- /dev/null +++ b/models/enterprise_sonic/network_policy/deleted_example_01.txt @@ -0,0 +1,44 @@ +# 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 +# ! diff --git a/models/enterprise_sonic/network_policy/deleted_example_02.txt b/models/enterprise_sonic/network_policy/deleted_example_02.txt new file mode 100644 index 00000000..daa58a2a --- /dev/null +++ b/models/enterprise_sonic/network_policy/deleted_example_02.txt @@ -0,0 +1,29 @@ +# 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) diff --git a/models/enterprise_sonic/network_policy/merged_example_01.txt b/models/enterprise_sonic/network_policy/merged_example_01.txt new file mode 100644 index 00000000..a255a942 --- /dev/null +++ b/models/enterprise_sonic/network_policy/merged_example_01.txt @@ -0,0 +1,32 @@ +# 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 + vlan_id: 3 + tagged: false + dscp: 50 + state: merged + +# After state: +# ------------ +# +# sonic# show running-configuration +# ! +# network-policy profile 1 +# voice vlan 2 cos 1 dscp 1 +# voice-signaling vlan 3 untagged dscp 50 +# ! diff --git a/models/enterprise_sonic/network_policy/overridden_example_01.txt b/models/enterprise_sonic/network_policy/overridden_example_01.txt new file mode 100644 index 00000000..a74eb320 --- /dev/null +++ b/models/enterprise_sonic/network_policy/overridden_example_01.txt @@ -0,0 +1,36 @@ +# 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 + tagged: true + priority: 0 + dscp: 0 + state: overridden + +# After state: +# ------------ +# +# sonic# show running-configuration +# ! +# network-policy profile 1 +# voice vlan 1 cos 0 dscp 0 +# ! diff --git a/models/enterprise_sonic/network_policy/replaced_example_01.txt b/models/enterprise_sonic/network_policy/replaced_example_01.txt new file mode 100644 index 00000000..20ff7a37 --- /dev/null +++ b/models/enterprise_sonic/network_policy/replaced_example_01.txt @@ -0,0 +1,40 @@ +# 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 + tagged: true + 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 +# ! diff --git a/models/enterprise_sonic/network_policy/sonic_network_policy.yaml b/models/enterprise_sonic/network_policy/sonic_network_policy.yaml new file mode 100644 index 00000000..8b5122af --- /dev/null +++ b/models/enterprise_sonic/network_policy/sonic_network_policy.yaml @@ -0,0 +1,67 @@ +--- +GENERATOR_VERSION: '1.0' +NETWORK_OS: sonic +RESOURCE: network_policy +COPYRIGHT: Copyright 2025 Dell Inc. or its subsidiaries. All Rights Reserved. +DOCUMENTATION: | + module: sonic_network_policy + version_added: 3.1.0 + notes: + - Tested against Enterprise SONiC Distribution by Dell Technologies. + - Supports C(check_mode). + short_description: Manage network policy configuration on SONiC + description: + - This module provides configuration management of network policy for devices running SONiC + author: S. Talabi (@stalabi1) + options: + config: + description: + - List of network policy configurations + type: list + elements: dict + suboptions: + number: + description: + - Network policy number, range 1-128 + type: int + required: true + applications: + description: + - List of network policy application configurations + type: list + elements: dict + suboptions: + app_type: + description: + - Media type of the application + type: str + choices: ['voice', 'voice_signaling'] + required: true + vlan_id: + description: + - VLAN identifier, range 1-4094 + type: int + tagged: + description: + - Indicates that the application is using a tagged VLAN + type: bool + priority: + description: + - Priority of VLAN, range 0-7 + type: int + dscp: + description: + - DSCP value of VLAN, range 0-63 + type: int + state: + description: + - The state of the configuration after module completion + type: str + choices: ['merged', 'deleted', 'replaced', 'overridden'] + default: merged +EXAMPLES: + - deleted_example_01.txt + - deleted_example_02.txt + - merged_example_01.txt + - overridden_example_01.txt + - replaced_example_01.txt