Skip to content

Define 'ip_neighbor_interfaces' model for Dell Enterprise SONiC collection #292

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

Open
wants to merge 1 commit 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Using deleted
#
# Before State:
# -------------
#
# sonic# show running-configuration interface Vlan 10 | grep "arp|neighbor"
# ip arp 10.1.1.3 00:01:02:03:33:55
# ip arp 10.1.1.4 00:01:02:03:44:55
# ipv6 neighbor 10::2 00:01:02:03:04:22
# ipv6 neighbor 10::3 00:01:02:03:04:33
# sonic# show running-configuration interface Vlan 20 | grep "arp|neighbor"
# ip arp 20.1.1.4 00:01:02:03:22:44
# ip arp 20.1.1.5 00:01:02:03:22:55
# ipv6 neighbor 20::2 00:01:02:03:22:22
# ipv6 neighbor 20::3 00:01:02:03:22:33
# sonic#

- name: Delete interface IP neighbor configurations
dellemc.enterprise_sonic.sonic_ip_neighbor_interfaces:
config:
- name: 'Vlan10'
ipv4_neighbors:
- ip: '10.1.1.4'
ipv6_neighbors:
- ip: '10::2'
- name: 'Vlan20'
ipv4_neighbors:
- ip: '20.1.1.4'
state: deleted

# After State:
# ------------
#
# sonic# show running-configuration interface Vlan 10 | grep "arp|neighbor"
# ip arp 10.1.1.3 00:01:02:03:33:55
# ipv6 neighbor 10::3 00:01:02:03:04:33
# sonic# show running-configuration interface Vlan 20 | grep "arp|neighbor"
# ip arp 20.1.1.5 00:01:02:03:22:55
# ipv6 neighbor 20::2 00:01:02:03:22:22
# ipv6 neighbor 20::3 00:01:02:03:22:33
# sonic#
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Using deleted
#
# Before State:
# -------------
#
# sonic# show running-configuration interface Vlan 10 | grep "arp|neighbor"
# ip arp 10.1.1.3 00:01:02:03:33:55
# ip arp 10.1.1.4 00:01:02:03:44:55
# ipv6 neighbor 10::2 00:01:02:03:04:22
# ipv6 neighbor 10::3 00:01:02:03:04:33
# sonic# show running-configuration interface Vlan 20 | grep "arp|neighbor"
# ip arp 20.1.1.4 00:01:02:03:22:44
# ip arp 20.1.1.5 00:01:02:03:22:55
# ipv6 neighbor 20::2 00:01:02:03:22:22
# ipv6 neighbor 20::3 00:01:02:03:22:33
# sonic#

- name: Delete all interface IP neighbor configurations for interface Vlan 10
dellemc.enterprise_sonic.sonic_ip_neighbor_interfaces:
config:
- name: 'Vlan10'
state: deleted

# After State:
# ------------
#
# sonic# show running-configuration interface Vlan 10 | grep "arp|neighbor"
# sonic# show running-configuration interface Vlan 20 | grep "arp|neighbor"
# ip arp 20.1.1.4 00:01:02:03:22:44
# ip arp 20.1.1.5 00:01:02:03:22:55
# ipv6 neighbor 20::2 00:01:02:03:22:22
# ipv6 neighbor 20::3 00:01:02:03:22:33
# sonic#
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Using deleted
#
# Before State:
# -------------
#
# sonic# show running-configuration interface Vlan 10 | grep "arp|neighbor"
# ip arp 10.1.1.3 00:01:02:03:33:55
# ip arp 10.1.1.4 00:01:02:03:44:55
# ipv6 neighbor 10::2 00:01:02:03:04:22
# ipv6 neighbor 10::3 00:01:02:03:04:33
# sonic# show running-configuration interface Vlan 20 | grep "arp|neighbor"
# ip arp 20.1.1.4 00:01:02:03:22:44
# ip arp 20.1.1.5 00:01:02:03:22:55
# ipv6 neighbor 20::2 00:01:02:03:22:22
# sonic#

- name: Delete all interface IP neighbor configurations
dellemc.enterprise_sonic.sonic_ip_neighbor_interfaces:
config:
state: deleted

# After State:
# ------------
#
# sonic# show running-configuration interface Vlan 10 | grep "arp|neighbor"
# sonic# show running-configuration interface Vlan 20 | grep "arp|neighbor"
# sonic#
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Using merged
#
# Before State:
# -------------
#
# sonic# show running-configuration interface Vlan 10 | grep "arp|neighbor"
# ip arp 10.1.1.4 00:01:02:03:44:55
# sonic# show running-configuration interface Vlan 20 | grep "arp|neighbor"
# sonic#

- name: Merge provided interface IP neighbor configurations
dellemc.enterprise_sonic.sonic_ip_neighbor_interfaces:
config:
- name: 'Vlan10'
ipv6_neighbors:
- ip: '10::2'
mac: '00:01:02:03:04:22'
- name: 'Vlan20'
ipv4_neighbors:
- ip: '20.1.1.4'
mac: '00:01:02:03:22:44'
- ip: '20.1.1.5'
mac: '00:01:02:03:22:55'
state: merged

# After State:
# ------------
#
# sonic# show running-configuration interface Vlan 10 | grep "arp|neighbor"
# ip arp 10.1.1.4 00:01:02:03:44:55
# ipv6 neighbor 10::2 00:01:02:03:04:22
# sonic# show running-configuration interface Vlan 20 | grep "arp|neighbor"
# ip arp 20.1.1.4 00:01:02:03:22:44
# ip arp 20.1.1.5 00:01:02:03:22:55
# sonic#
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Using overridden
#
# Before State:
# -------------
#
# sonic# show running-configuration interface Vlan 10 | grep "arp|neighbor"
# ip arp 10.1.1.3 00:01:02:03:33:55
# ip arp 10.1.1.4 00:01:02:03:44:55
# ipv6 neighbor 10::2 00:01:02:03:04:22
# ipv6 neighbor 10::3 00:01:02:03:04:33
# sonic# show running-configuration interface Vlan 20 | grep "arp|neighbor"
# ip arp 20.1.1.4 00:01:02:03:22:44
# ip arp 20.1.1.5 00:01:02:03:22:55
# ipv6 neighbor 20::2 00:01:02:03:22:22
# ipv6 neighbor 20::3 00:01:02:03:22:33
# sonic# show running-configuration interface Vlan 30 | grep "arp|neighbor"
# sonic#

- name: Override all interface IP neighbor configurations
dellemc.enterprise_sonic.sonic_ip_neighbor_interfaces:
config:
- name: 'Vlan10'
ipv4_neighbors:
- ip: '10.1.1.11'
mac: '00:01:02:03:04:11'
ipv6_neighbors:
- ip: '10::11'
mac: '00:01:02:03:10:11'
- name: 'Vlan30'
ipv4_neighbors:
- ip: '30.1.1.6'
mac: '00:01:02:03:30:66'
- ip: '30.1.1.7'
mac: '00:01:02:03:30:77'
state: overridden

# After State:
# ------------
#
# sonic# show running-configuration interface Vlan 10 | grep "arp|neighbor"
# ip arp 10.1.1.11 00:01:02:03:04:11
# ipv6 neighbor 10::11 00:01:02:03:10:11
# sonic# show running-configuration interface Vlan 20 | grep "arp|neighbor"
# sonic# show running-configuration interface Vlan 30 | grep "arp|neighbor"
# ip arp 30.1.1.6 00:01:02:03:30:66
# ip arp 30.1.1.7 00:01:02:03:30:77
# sonic#
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Using replaced
#
# Before State:
# -------------
#
# sonic# show running-configuration interface Vlan 10 | grep "arp|neighbor"
# ip arp 10.1.1.3 00:01:02:03:33:55
# ip arp 10.1.1.4 00:01:02:03:44:55
# ipv6 neighbor 10::2 00:01:02:03:04:22
# ipv6 neighbor 10::3 00:01:02:03:04:33
# sonic# show running-configuration interface Vlan 20 | grep "arp|neighbor"
# ip arp 20.1.1.4 00:01:02:03:22:44
# ip arp 20.1.1.5 00:01:02:03:22:55
# ipv6 neighbor 20::2 00:01:02:03:22:22
# ipv6 neighbor 20::3 00:01:02:03:22:33
# sonic#

- name: Replace interface IP neighbor configurations for interface Vlan 10
dellemc.enterprise_sonic.sonic_ip_neighbor_interfaces:
config:
- name: 'Vlan10'
ipv4_neighbors:
- ip: '10.1.1.11'
mac: '00:01:02:03:04:11'
- ip: '10.1.1.12'
mac: '00:01:02:03:04:12'
state: replaced

# After State:
# ------------
#
# sonic# show running-configuration interface Vlan 10 | grep "arp|neighbor"
# ip arp 10.1.1.11 00:01:02:03:04:11
# ip arp 10.1.1.12 00:01:02:03:04:12
# sonic# show running-configuration interface Vlan 20 | grep "arp|neighbor"
# ip arp 20.1.1.4 00:01:02:03:22:44
# ip arp 20.1.1.5 00:01:02:03:22:55
# ipv6 neighbor 20::2 00:01:02:03:22:22
# ipv6 neighbor 20::3 00:01:02:03:22:33
# sonic#
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
GENERATOR_VERSION: '1.0'
ANSIBLE_METADATA: |
{
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community',
'license': 'Apache 2.0'
}
NETWORK_OS: sonic
RESOURCE: ip_neighbor_interfaces
COPYRIGHT: Copyright 2025 Dell Inc. or its subsidiaries. All Rights Reserved
DOCUMENTATION: |
module: sonic_ip_neighbor_interfaces
version_added: '3.1.0'
short_description: Manage interface-specific IP neighbor configurations on SONiC
description:
- This module provides configuration management of interface-specific
IP neighbor parameters for devices running SONiC.
author: 'Arun Saravanan Balachandran (@ArunSaravananBalachandran)'
options:
config:
description:
- Specifies interface-specific IP neighbor configurations.
type: list
elements: dict
suboptions:
name:
description:
- Full name of the interface.
type: str
required: true
ipv4_neighbors:
description:
- Specifies the static IPv4 neighbors.
type: list
elements: dict
suboptions:
ip:
description:
- IPv4 address of the neighbor.
type: str
required: true
mac:
description:
- MAC address of the neighbor.
type: str
ipv6_neighbors:
description:
- Specifies the static IPv6 neighbors.
type: list
elements: dict
suboptions:
ip:
description:
- IPv6 address of the neighbor.
type: str
required: true
mac:
description:
- MAC address of the neighbor.
type: str
state:
description:
- The state of the configuration after module completion.
- C(merged) - Merges provided interface-specific IP neighbor configuration with on-device configuration.
- C(replaced) - Replaces on-device IP neighbor configuration of the specified interfaces with provided configuration.
- C(overridden) - Overrides all on-device interface-specific IP neighbor configurations with the provided configuration.
- C(deleted) - Deletes on-device interface-specific IP neighbor configuration.
type: str
choices:
- merged
- deleted
- replaced
- overridden
default: merged
EXAMPLES:
- merged_example_01.txt
- deleted_example_01.txt
- deleted_example_02.txt
- deleted_example_03.txt
- replaced_example_01.txt
- overridden_example_01.txt