Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IP ECMP loadshare mode resource model #272

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions models/enterprise_sonic/loadshare_mode/deleted_example_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Using deleted
#
# Before state:
# -------------
#
#sonic# show running-configuration | grep load-share
#ip load-share hash seed 8888
#ip load-share hash ipv4 ipv4-dst-ip
#ip load-share hash ipv4 ipv4-src-ip
#ip load-share hash ipv4 ipv4-ip-proto
#ip load-share hash ipv4 ipv4-l4-src-port
#ip load-share hash ipv4 ipv4-l4-dst-port
#ip load-share hash algorithm CRC
#ip load-share hash ingress-port
#
- name: Merge some configuration
sonic_loadshare_mode:
config:
hash_algorithm: CRC
hash_offset:
offset: 12
flow_based: True
hash_roce_qpn: True
hash_seed: 8888
ipv4:
ipv4_l4_dst_port: True
ipv4_l4_src_port: True
state: deleted
#
# After state:
# ------------
#
#sonic# show running-configuration | grep load-share
#ip load-share hash ipv4 ipv4-dst-ip
#ip load-share hash ipv4 ipv4-src-ip
#ip load-share hash ipv4 ipv4-ip-proto
#ip load-share hash ingress-port
#
42 changes: 42 additions & 0 deletions models/enterprise_sonic/loadshare_mode/merged_example_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# Using merged
#
# Before state:
# -------------
#
#sonic# show running-configuration | grep load-share
#ip load-share hash seed 8888
#ip load-share hash ipv4 ipv4-dst-ip
#ip load-share hash ipv4 ipv4-src-ip
#ip load-share hash algorithm CRC
#
- name: Merge some configuration
sonic_loadshare_mode:
config:
hash_algorithm: CRC_32LO
hash_ingress_port: True
hash_offset:
offset: 12
flow_based: True
hash_roce_qpn: True
hash_seed: 9999
ipv4:
ipv4_src_ip: True
ipv4_ip_proto: True
ipv4_l4_dst_port: True
ipv4_l4_src_port: True
state: merged
#
# After state:
# ------------
#
#sonic# show running-configuration | grep load-share
#ip load-share hash seed 9999
#ip load-share hash ipv4 ipv4-dst-ip
#ip load-share hash ipv4 ipv4-src-ip
#ip load-share hash ipv4 ipv4-ip-proto
#ip load-share hash ipv4 ipv4-l4-src-port
#ip load-share hash ipv4 ipv4-l4-dst-port
#ip load-share hash algorithm CRC_32LO
#ip load-share hash ingress-port
#
40 changes: 40 additions & 0 deletions models/enterprise_sonic/loadshare_mode/overridden_example_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# Using overridden
#
# Before state:
# -------------
#
#sonic# show running-configuration | grep load-share
#ip load-share hash seed 8888
#ip load-share hash ipv4 ipv4-dst-ip
#ip load-share hash ipv4 ipv4-src-ip
#ip load-share hash algorithm CRC
#
- name: Merge some configuration
sonic_loadshare_mode:
config:
hash_algorithm: CRC_32LO
hash_ingress_port: True
hash_offset:
flow_based: True
hash_seed: 9999
ipv4:
ipv4_src_ip: True
ipv4_ip_proto: True
ipv4_l4_dst_port: True
ipv4_l4_src_port: True
state: overridden
#
# After state:
# ------------
#
#sonic# show running-configuration | grep load-share
#ip load-share hash offset flow-based
#ip load-share hash seed 9999
#ip load-share hash ipv4 ipv4-src-ip
#ip load-share hash ipv4 ipv4-ip-proto
#ip load-share hash ipv4 ipv4-l4-src-port
#ip load-share hash ipv4 ipv4-l4-dst-port
#ip load-share hash algorithm CRC_32LO
#ip load-share hash ingress-port
#
42 changes: 42 additions & 0 deletions models/enterprise_sonic/loadshare_mode/replaced_example_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# Using replaced
#
# Before state:
# -------------
#
#sonic# show running-configuration | grep load-share
#ip load-share hash offset flow-based
#ip load-share hash seed 8888
#ip load-share hash ipv4 ipv4-dst-ip
#ip load-share hash ipv4 ipv4-src-ip
#ip load-share hash algorithm CRC
#ip load-share hash ingress-port
#
- name: Merge some configuration
sonic_loadshare_mode:
config:
hash_algorithm: CRC
hash_ingress_port: True
hash_offset:
flow_based: True
hash_seed: 8888
ipv4:
ipv4_src_ip: True
ipv4_ip_proto: True
ipv4_l4_dst_port: True
ipv4_l4_src_port: True
state: replaced
#
# After state:
# ------------
#
#sonic# show running-configuration | grep load-share
#ip load-share hash offset flow-based
#ip load-share hash seed 8888
#ip load-share hash ipv4 ipv4-src-ip
#ip load-share hash ipv4 ipv4-ip-proto
#ip load-share hash ipv4 ipv4-l4-src-port
#ip load-share hash ipv4 ipv4-l4-dst-port
#ip load-share hash algorithm CRC
#ip load-share hash ingress-port
#
147 changes: 147 additions & 0 deletions models/enterprise_sonic/loadshare_mode/sonic_loadshare_mode.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
GENERATOR_VERSION: '1.0'
ANSIBLE_METADATA: |
{
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community',
'license': 'Apache 2.0'
}
NETWORK_OS: sonic
RESOURCE: loadshare_mode
COPYRIGHT: "© Copyright 2024 Dell Inc. or its subsidiaries. All Rights Reserved"
LICENSE: gpl-3.0.txt
DOCUMENTATION: |
module: sonic_loadshare_mode
version_added: "3.0.0"
author: "M. Zhang (@mingjunzhang2019)"
short_description: IP ECMP load share mode configuration handling for SONiC.
description:
- This module provides configuration management for IP ECMP load share mode on
- devices running SONiC.
options:
config:
description:
- Specifies IP ECMP load share mode configuration.
type: dict
suboptions:
hash_algorithm:
description:
- Load share hash algorithm.
type: str
choices:
- CRC
- XOR
- CRC_32LO
- CRC_32HI
- CRC_CCITT
- CRC_XOR
- JENKINS_HASH_LO
- JENKINS_HASH_HI
hash_ingress_port:
description:
- Load share hash ingress port.
type: bool
hash_offset:
description:
- Load share hash offset.
type: dict
suboptions:
offset:
description:
- IP ECMP hash offset value.
- The range of values is from 0 to 15.
type: int
flow_based:
description:
- Enable flow-based IP ECMP hashing.
type: bool
hash_roce_qpn:
description:
- Load share ROCE Queue-Pair Number.
type: bool
hash_seed:
description:
- IP ECMP hash seed value.
- The range of values is from 0 to 16777215.
type: int
ipv4:
description:
- IPv4 ECMP Load share hash parameters.
type: dict
suboptions:
ipv4_dst_ip:
description:
- IPv4 destination IP address.
type: bool
ipv4_src_ip:
description:
- IPv4 source IP address.
type: bool
ipv4_ip_proto:
description:
- IPv4 protocol.
type: bool
ipv4_l4_dst_port:
description:
- IPv4 L4 destination port.
type: bool
ipv4_l4_src_port:
description:
- IPv4 L4 source port.
type: bool
ipv4_symmetric:
description:
- IPv4 symmetric hash mode.
type: bool
ipv6:
description:
- IPv6 ECMP Load share hash parameters.
type: dict
suboptions:
ipv6_dst_ip:
description:
- IPv6 destination IP address.
type: bool
ipv6_src_ip:
description:
- IPv6 source IP address.
type: bool
ipv6_next_hdr:
description:
- IPv6 protocol.
type: bool
ipv6_l4_dst_port:
description:
- IPv6 L4 destination port.
type: bool
ipv6_l4_src_port:
description:
- IPv6 L4 source port.
type: bool
ipv6_symmetric:
description:
- IPv6 symmetric hash mode.
type: bool
state:
description:
- Specifies the operation to be performed on the load share mode configured on the device.
- In case of merged, the input configuration will be merged with the existing load share mode on the device.
- In case of deleted, the existing load share mode configuration will be removed from the device.
- In case of overridden, all existing load share mode will be deleted and
- the specified input configuration will be add.
- In case of replaced, the existing load share mode on the device will be replaced
- by the specified input configuration.
type: str
choices:
- merged
- deleted
- replaced
- overridden
default: merged

EXAMPLES:
- deleted_example_01.txt
- merged_example_01.txt
- replaced_example_01.txt
- overridden_example_01.txt