dellemc.enterprise_sonic.sonic_ip_neighbor_interfaces module – Manage interface-specific IP neighbor configurations 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_ip_neighbor_interfaces.

New in dellemc.enterprise_sonic 3.1.0

Synopsis

  • This module provides configuration management of interface-specific IP neighbor parameters for devices running SONiC.

Parameters

Parameter

Comments

config

list / elements=dictionary

Specifies interface-specific IP neighbor configurations.

ipv4_neighbors

list / elements=dictionary

Specifies the static IPv4 neighbors.

ip & mac are required for adding a new neighbor.

ip

string / required

IPv4 address of the neighbor.

mac

string

MAC address of the neighbor.

ipv6_neighbors

list / elements=dictionary

Specifies the static IPv6 neighbors.

ip & mac are required for adding a new neighbor.

ip

string / required

IPv6 address of the neighbor.

mac

string

MAC address of the neighbor.

name

string / required

Full name of the interface.

state

string

The state of the configuration after module completion.

merged - Merges provided interface-specific IP neighbor configuration with on-device configuration.

replaced - Replaces on-device IP neighbor configuration of the specified interfaces with provided configuration.

overridden - Overrides all on-device interface-specific IP neighbor configurations with the provided configuration.

deleted - Deletes on-device interface-specific IP neighbor configuration.

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 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#


# Using "deleted" state
#
# 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#


# Using "deleted" state
#
# 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#


# Using "deleted" state
#
# 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#


# Using "replaced" state
#
# 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#


# Using "overridden" state
#
# 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#

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

after

list / elements=string

The configuration resulting from 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

Authors

  • Arun Saravanan Balachandran (@ArunSaravananBalachandran)