.. _cisco.nxos.nxos_l3_interfaces_module: ***************************** cisco.nxos.nxos_l3_interfaces ***************************** **L3 interfaces resource module** Version added: 1.0.0 .. contents:: :local: :depth: 1 Synopsis -------- - This module manages Layer-3 interfaces attributes of NX-OS Interfaces. Parameters ---------- .. raw:: html
Parameter Choices/Defaults Comments
config
list / elements=dictionary
A dictionary of Layer-3 interface options
bandwidth
dictionary
Manually set the bandwidth
inherit
boolean
    Choices:
  • no
  • yes
Specify that bandwidth is inherited
kilobits
integer
Bandwidth in kilobits
dhcp
dictionary
Configure DHCP snooping or relay
ipv4
dictionary
DHCP snooping for ipv4
option82
dictionary
DHCP option82.
suboption
dictionary
DHCP option82.
circuit_id
string
DHCP option82 suboption circuit-id string configuration.
relay
dictionary
Configure relay agent.
address
list / elements=dictionary
List of ipv4 relay addresses
relay_ip
string
IP address
vrf_name
string
Helper address VRF membership
information
dictionary
Relay agent information option.
trusted
boolean
    Choices:
  • no
  • yes
Enable relay trust on this interface.
source_interface
dictionary
Configure gateway address for DHCP relay
interface_id
string
Interface ID
interface_type
string
Type of interface
subnet_selection
dictionary
Configure gateway address for DHCP relay
subnet_ip
string
IP address
smart_relay
boolean
    Choices:
  • no
  • yes
Configure DHCP smart relay on interface.
ipv6
dictionary
DHCP snooping for ipv6
relay
dictionary
Configure relay agent.
address
list / elements=dictionary
Configure DHCPv6 server relay address
interface_id
string
Interface ID
interface_type
string
Type of interface
relay_ip
string
IP address
vrf_name
string
Helper address VRF membership
source_interface
dictionary
Configure source interface for DHCPv6 relay.
interface_id
string
Interface ID
interface_type
string
Type of interface
smart_relay
boolean
    Choices:
  • no
  • yes
Configure DHCP smart relay on interface.
dot1q
integer
Configures IEEE 802.1Q VLAN encapsulation on a subinterface.
evpn_multisite_tracking
string
added in 1.1.0
    Choices:
  • fabric-tracking
  • dci-tracking
VxLAN evpn multisite Interface tracking. Supported only on selected model.
ipv4
list / elements=dictionary
IPv4 address and attributes of the L3 interface.
address
string
IPV4 address of the L3 interface.
ip_network_mask
string
IP prefix and network mask length in format x.x.x.x/m or IP network mask in format m.m.m.m
route_preference
integer
URIB route preference for local/direct routes
secondary
boolean
    Choices:
  • no
  • yes
A boolean attribute to manage addition of secondary IP address.
tag
integer
URIB route tag value for local/direct routes.
ipv6
list / elements=dictionary
IPv6 address and attributes of the L3 interface.
address
string
IPV6 address of the L3 interface.
aggregate_prefix_length
integer
Prefix-Length for AM Route Aggregation
anycast
boolean
    Choices:
  • no
  • yes
Configure IPv6 anycast address on interface
eui64
boolean
    Choices:
  • no
  • yes
Configure Extended Unique Identifier for the low-order 64 bits
route_preference
integer
URIB route preference for local/direct routes
tag
integer
URIB route tag value for local/direct routes.
use_bia
boolean
    Choices:
  • no
  • yes
Use BIA
ipv6_redirects
boolean
    Choices:
  • no
  • yes
Enables/disables ipv6 redirects.
ipv6_unreachables
boolean
    Choices:
  • no
  • yes
Enables/disables ip redirects.
ipv6_verify
dictionary
Unicast Reverse Path Forwarding.
unicast
dictionary
Unicast Reverse Path Forwarding.
source
dictionary
Validation of source address.
reachable_via
dictionary
Specify reachability check to apply to the source address.
allow_default
boolean
    Choices:
  • no
  • yes
Loose Default Route Unicast Reverse Path Forwarding.
mode
string
Source is reachable via any/rx interface.
mac_address
string
Manually set interface MAC address or extract the MAC address (3) from the IPv6 address configured on the interface.
name
string / required
Full name of L3 interface, i.e. Ethernet1/1.
port_unreachable
boolean
    Choices:
  • no
  • yes
Enable sending ICMP port-unreachable.
proxy_arp
boolean
    Choices:
  • no
  • yes
Configure proxy ARP.
redirects
boolean
    Choices:
  • no
  • yes
Enables/disables ipv4 redirects.
unreachables
boolean
    Choices:
  • no
  • yes
Enables/disables ip redirects.
verify
dictionary
Configure Unicast Reverse Path Forwarding or IP Source Guard.
unicast
dictionary
Unicast Reverse Path Forwarding.
source
dictionary
Validation of source address.
reachable_via
dictionary
Specify reachability check to apply to the source address.
allow_default
boolean
    Choices:
  • no
  • yes
Loose Default Route Unicast Reverse Path Forwarding.
mode
string
Source is reachable via any/rx interface.
running_config
string
This option is used only with state parsed.
The value of this option should be the output received from the IOS device by executing the command show running-config | section ^interface.
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
state
string
    Choices:
  • merged ←
  • replaced
  • overridden
  • deleted
  • rendered
  • gathered
  • parsed
The state the configuration should be left in
The states rendered, gathered and parsed does not perform any change on the device.
The state rendered will transform the configuration in config option to platform specific CLI commands which will be returned in the rendered key within the result. For state rendered active connection to remote host is not required.
The state gathered will fetch the running configuration from device and transform it into structured data in the format as per the resource module argspec and the value is returned in the gathered key within the result.
The state parsed reads the configuration from running_config option and transforms it into JSON format as per the resource module parameters and the value is returned in the parsed key within the result. The value of running_config option should be the same format as the output of command show running-config | section ^interface executed on device. For state parsed active connection to remote host is not required.

Notes ----- .. note:: - Tested against NXOS 7.3.(0)D1(1) on VIRL - Unsupported for Cisco MDS Examples -------- .. code-block:: yaml # Using merged # Before state: # ------------- # # router# show running-config | section interface # interface Ethernet1/1 # interface Ethernet1/2 - name: Merge provided configuration with device configuration. cisco.nxos.nxos_l3_interfaces: config: - name: Ethernet1/1 mac_address: 0011.2233.4455 ipv4: verify: unicast: source: reachable_via: mode: any allow_default: true dhcp: relay: address: - relay_ip: 11.0.0.1 vrf_name: abc - name: Ethernet1/2 ipv6: addresses: - ipv6_address: 2001:db8::1/32 route_preference: 70 tag: 97 dhcp: relay: address: - relay_ip: 2001:db8::1:abcd state: merged # Task Output # ----------- # # before: # - name: Ethernet1/1 # - name: Ethernet1/2 # commands: # - interface Ethernet1/1 # - mac-address 0011.2233.4455 # - ip verify unicast source reachable-via any allow-default # - ip dhcp relay address 11.0.0.1 use-vrf abc # - interface Ethernet1/2 # - ipv6 address 2001:db8::1/32 route-preference 70 tag 97 # - ipv6 dhcp relay address 2001:db8::1:abcd # after: # - name: Ethernet1/1 # mac_address: 0011.2233.4455 # ipv4: # verify: # unicast: # source: # reachable_via: # mode: any # allow_default: true # dhcp: # relay: # address: # - relay_ip: 11.0.0.1 # vrf_name: abc # - name: Ethernet1/2 # ipv6: # addresses: # - ipv6_address: 2001:db8::1/32 # route_preference: 70 # tag: 97 # dhcp: # relay: # address: # - relay_ip: 2001:db8::1:abcd # After state: # ------------ # # router# show running-config | section interface # interface Ethernet1/1 # mac-address 0011.2233.4455 # ip verify unicast source reachable-via any allow-default # ip dhcp relay address 11.0.0.1 use-vrf abc # interface Ethernet1/2 # ipv6 address 2001:db8::1/32 route-preference 70 tag 97 # ipv6 dhcp relay address 2001:db8::1:abcd # Using replaced # Before state: # ------------- # # router# show running-config | section interface # interface Ethernet 1/1 # mac-address 00:11:22:33:44:55 # ip verify unicast source reachable-via any allow-default # ip dhcp relay address 11.0.0.1 use-vrf abc # interface Ethernet 1/2 # ipv6 dhcp relay address 2001:0db8::1:abcd # ipv6 address 2001:db8::1/32 route-preference 70 tag 97 - name: Replace device configuration of specified L3 interfaces with provided configuration. cisco.nxos.nxos_l3_interfaces: config: - name: Ethernet1/2 mac_address: 0011.2233.4456 ipv6: addresses: - ipv6_address: 2001:db8::1/32 route_preference: 200 tag: 22 dhcp: relay: address: - relay_ip: 2001:db8::1:abcd state: replaced # Task Output # ----------- # # before: # - name: Ethernet1/1 # mac_address: 0011.2233.4455 # ipv4: # verify: # unicast: # source: # reachable_via: # mode: any # allow_default: true # dhcp: # relay: # address: # - relay_ip: 11.0.0.1 # vrf_name: abc # - name: Ethernet1/2 # ipv6: # addresses: # - ipv6_address: 2001:db8::1/32 # route_preference: 70 # tag: 97 # dhcp: # relay: # address: # - relay_ip: 2001:db8::1:abcd # commands: # - interface Ethernet1/2 # - no ipv6 address 2001:db8::1/32 route-preference 70 tag 97 # - ipv6 address 2001:db8::1/32 route-preference 200 tag 22 # - mac-address 0011.2233.4456 # after: # - name: Ethernet1/1 # mac_address: 0011.2233.4455 # ipv4: # verify: # unicast: # source: # reachable_via: # mode: any # allow_default: true # dhcp: # relay: # address: # - relay_ip: 11.0.0.1 # vrf_name: abc # - name: Ethernet1/2 # mac_address: 0011.2233.4456 # ipv6: # addresses: # - ipv6_address: 2001:db8::1/32 # route_preference: 200 # tag: 22 # dhcp: # relay: # address: # - relay_ip: 2001:db8::1:abcd # After state: # ------------ # # router# show running-config | section interface # interface Ethernet1/1 # mac-address 0011.2233.4455 # ip verify unicast source reachable-via any allow-default # ip dhcp relay address 11.0.0.1 use-vrf abc # interface Ethernet1/2 # mac-address 0011.2233.4456 # ipv6 address 2001:db8::1/32 route-preference 200 tag 22 # ipv6 dhcp relay address 2001:db8::1:abcd # Using overridden # Before state: # ------------- # # router# show running-config | section interface # interface Ethernet 1/1 # mac-address 00:11:22:33:44:55 # ip verify unicast source reachable-via any allow-default # ip dhcp relay address 11.0.0.1 use-vrf abc # interface Ethernet 1/2 # ipv6 dhcp relay address 2001:0db8::1:abcd # ipv6 address 2001:db8::1/32 route-preference 70 tag 97 - name: Override device configuration with provided configuration. cisco.nxos.nxos_l3_interfaces: config: - name: Ethernet1/1 mac_address: 0011.2233.4455 ipv4: verify: unicast: source: reachable_via: mode: any allow_default: true state: overridden # Task Output # ----------- # # before: # before: # - name: Ethernet1/1 # mac_address: 0011.2233.4455 # ipv4: # verify: # unicast: # source: # reachable_via: # mode: any # allow_default: true # dhcp: # relay: # address: # - relay_ip: 11.0.0.1 # vrf_name: abc # - name: Ethernet1/2 # ipv6: # addresses: # - ipv6_address: 2001:db8::1/32 # route_preference: 70 # tag: 97 # dhcp: # relay: # address: # - relay_ip: 2001:db8::1:abcd # commands: # - interface Ethernet1/1 # - no ip dhcp relay address 11.0.0.1 use-vrf abc # - interface Ethernet1/2 # - no ipv6 address 2001:db8::1/32 route-preference 70 tag 97 # - no ipv6 dhcp relay address 2001:db8::1:abcd # after: # - name: Ethernet1/1 # mac_address: 0011.2233.4455 # ipv4: # verify: # unicast: # source: # reachable_via: # mode: any # allow_default: true # - name: Ethernet1/2 # After state: # ------------ # # router# show running-config | section interface # interface Ethernet1/1 # mac-address 0011.2233.4455 # ip verify unicast source reachable-via any allow-default # Using deleted # Before state: # ------------- # # router# show running-config | section interface # interface Ethernet 1/1 # mac-address 00:11:22:33:44:55 # ip verify unicast source reachable-via any allow-default # ip dhcp relay address 11.0.0.1 use-vrf abc # interface Ethernet 1/2 # ipv6 dhcp relay address 2001:0db8::1:abcd # ipv6 address 2001:db8::1/32 route-preference 70 tag 97 - name: Delete L3 attributes of given interfaces (This won't delete the interface itself). cisco.nxos.nxos_l3_interfaces: config: - name: Ethernet1/1 - name: Ethernet1/2 state: deleted # Task Output # ----------- # # before: # - name: Ethernet1/1 # mac_address: 0011.2233.4455 # ipv4: # verify: # unicast: # source: # reachable_via: # mode: any # allow_default: true # dhcp: # relay: # address: # - relay_ip: 11.0.0.1 # vrf_name: abc # - name: Ethernet1/2 # ipv6: # addresses: # - ipv6_address: 2001:db8::1/32 # route_preference: 70 # tag: 97 # dhcp: # relay: # address: # - relay_ip: 2001:db8::1:abcd # commands: # - interface Ethernet1/1 # - no mac-address 0011.2233.4455 # - no ip verify unicast source reachable-via any allow-default # - no ip dhcp relay address 11.0.0.1 use-vrf abc # - interface Ethernet1/2 # - no ipv6 address 2001:db8::1/32 route-preference 70 tag 97 # - no ipv6 dhcp relay address 2001:db8::1:abcd # after: # - name: Ethernet1/1 # - name: Ethernet1/2 # After state: # ------------ # # router# show running-config | section interface # interface Ethernet1/1 # interface Ethernet1/2 # Using rendered - name: Use rendered state to convert task input to device specific commands cisco.nxos.nxos_l3_interfaces: config: - name: Ethernet1/1 mac_address: 0011.2233.4455 ipv4: verify: unicast: source: reachable_via: mode: any allow_default: true dhcp: relay: address: - relay_ip: 11.0.0.1 vrf_name: abc - name: Ethernet1/2 ipv6: addresses: - ipv6_address: 2001:db8::1/32 route_preference: 70 tag: 97 dhcp: relay: address: - relay_ip: 2001:db8::1:abcd state: rendered # Task Output # ----------- # # rendered: # - interface Ethernet1/1 # - mac-address 0011.2233.4455 # - ip verify unicast source reachable-via any allow-default # - ip dhcp relay address 11.0.0.1 use-vrf abc # - interface Ethernet1/2 # - ipv6 address 2001:db8::1/32 route-preference 70 tag 97 # - ipv6 dhcp relay address 2001:db8::1:abcd # Using parsed # parsed.cfg # ---------- # # interface Ethernet1/1 # mac-address 0011.2233.4455 # ip verify unicast source reachable-via any allow-default # ip dhcp relay address 11.0.0.1 use-vrf abc # interface Ethernet1/2 # ipv6 address 2001:db8::1/32 route-preference 70 tag 97 # ipv6 dhcp relay address 2001:db8::1:abcd - name: Use parsed state to convert externally supplied config to structured format cisco.nxos.nxos_l3_interfaces: running_config: "{{ lookup('file', 'parsed.cfg') }}" state: parsed # Task output # ----------- # # parsed: # - name: Ethernet1/1 # mac_address: 0011.2233.4455 # ipv4: # verify: # unicast: # source: # reachable_via: # mode: any # allow_default: true # dhcp: # relay: # address: # - relay_ip: 11.0.0.1 # vrf_name: abc # - name: Ethernet1/2 # ipv6: # addresses: # - ipv6_address: 2001:db8::1/32 # route_preference: 70 # tag: 97 # dhcp: # relay: # address: # - relay_ip: 2001:db8::1:abcd # Using gathered # Before state: # ------------- # # interface Ethernet 1/1 # mac-address 00:11:22:33:44:55 # ip verify unicast source reachable-via any allow-default # ip dhcp relay address 11.0.0.1 use-vrf abc # interface Ethernet 1/2 # ipv6 dhcp relay address 2001:0db8::1:abcd # ipv6 address 2001:db8::1/32 route-preference 70 tag 97 - name: Gather l3_interfaces facts from the device using nxos_l3_interfaces cisco.nxos.nxos_l3_interfaces: state: gathered # Task output # ----------- # # gathered: # - name: Ethernet1/1 # mac_address: 0011.2233.4455 # ipv4: # verify: # unicast: # source: # reachable_via: # mode: any # allow_default: true # dhcp: # relay: # address: # - relay_ip: 11.0.0.1 # vrf_name: abc # - name: Ethernet1/2 # ipv6: # addresses: # - ipv6_address: 2001:db8::1/32 # route_preference: 70 # tag: 97 # dhcp: # relay: # address: # - relay_ip: 2001:db8::1:abcd Return Values ------------- Common return values are documented `here `_, the following are the fields unique to this module: .. raw:: html
Key Returned Description
after
dictionary
when changed
The resulting configuration after module execution.

Sample:
This output will always be in the same format as the module argspec.
before
dictionary
when state is merged, replaced, overridden, deleted or purged
The configuration prior to the module execution.

Sample:
This output will always be in the same format as the module argspec.
commands
list
when state is merged, replaced, overridden, deleted or purged
The set of commands pushed to the remote device.

Sample:
['ip dhcp relay address 11.0.0.1 use-vrf abc', 'ipv6 address 2001:db8::1/32 route-preference 70 tag 97', 'ipv6 dhcp relay address 2001:db8::1:abcd']
gathered
list
when state is gathered
Facts about the network resource gathered from the remote device as structured data.

Sample:
This output will always be in the same format as the module argspec.
parsed
list
when state is parsed
The device native config provided in running_config option parsed into structured data as per module argspec.

Sample:
This output will always be in the same format as the module argspec.
rendered
list
when state is rendered
The provided configuration in the task rendered in device-native format (offline).

Sample:
['ip dhcp relay address 11.0.0.1 use-vrf abc', 'ipv6 address 2001:db8::1/32 route-preference 70 tag 97', 'ipv6 dhcp relay address 2001:db8::1:abcd']


Status ------ Authors ~~~~~~~ - Trishna Guha (@trishnaguha) - Nikhil Bhasin (@nickbhasin)