iosxr_l2_interfaces – Manage Layer-2 interface on Cisco IOS-XR devices¶
New in version 2.9.
Parameters¶
Notes¶
Note
Tested against Cisco IOS-XRv Version 6.1.3 on VIRL.
This module works with connection
network_cli
. See the IOS-XR Platform Options.
Examples¶
---
# Using merged
#
# Before state:
# -------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/3
# description Ansible Network
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex half
# shutdown
# !
# interface GigabitEthernet0/0/0/4
# description Test description
# !
- name: Merge provided configuration with device configuration
iosxr_l2_interfaces:
config:
- name: GigabitEthernet0/0/0/3
native_vlan: 20
- name: GigabitEthernet0/0/0/4
native_vlan: 40
l2transport: True
l2protocol:
- stp: tunnel
- name: GigabitEthernet0/0/0/3.900
l2transport: True
q_vlan:
- 20
- 40
state: merged
# After state:
# ------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/3
# description Ansible Network
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex half
# shutdown
# dot1q native vlan 20
# !
# interface GigabitEthernet0/0/0/4
# description Test description
# dot1q native vlan 10
# l2transport
# l2protocol stp tunnel
# !
# !
# interface GigabitEthernet0/0/0/3.900 l2transport
# dot1q vlan 20 40
# !
# Using replaced
#
# Before state:
# -------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/3
# description Ansible Network
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex half
# shutdown
# dot1q native vlan 20
# !
# interface GigabitEthernet0/0/0/4
# description Test description
# dot1q native vlan 10
# l2transport
# l2protocol stp tunnel
# !
# !
# interface GigabitEthernet0/0/0/3.900 l2transport
# dot1q vlan 20 40
# !
- name: Replaces device configuration of listed interfaces with provided configuration
iosxr_l2_interfaces:
config:
- name: GigabitEthernet0/0/0/4
native_vlan: 40
l2transport: True
l2protocol:
- stp: forward
- name: GigabitEthernet0/0/0/3.900
q_vlan:
- 20
- any
state: replaced
# After state:
# -------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/3
# description Ansible Network
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex half
# shutdown
# dot1q native vlan 20
# !
# interface GigabitEthernet0/0/0/4
# description Test description
# dot1q native vlan 40
# l2transport
# l2protocol stp forward
# !
# !
# interface GigabitEthernet0/0/0/3.900 l2transport
# dot1q vlan 20 any
# !
# Using overridden
#
# Before state:
# -------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/3
# description Ansible Network
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex half
# shutdown
# dot1q native vlan 20
# !
# interface GigabitEthernet0/0/0/4
# description Test description
# dot1q native vlan 10
# l2transport
# l2protocol stp tunnel
# !
# !
# interface GigabitEthernet0/0/0/3.900 l2transport
# dot1q vlan 20 40
# !
- name: Override device configuration of all interfaces with provided configuration
iosxr_l2_interfaces:
config:
- name: GigabitEthernet0/0/0/4
native_vlan: 40
l2transport: True
l2protocol:
- stp: forward
- name: GigabitEthernet0/0/0/3.900
q_vlan:
- 20
- any
state: overridden
# After state:
# -------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/3
# description Ansible Network
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex half
# shutdown
# !
# interface GigabitEthernet0/0/0/4
# description Test description
# dot1q native vlan 40
# l2transport
# l2protocol stp forward
# !
# !
# interface GigabitEthernet0/0/0/3.900
# dot1q vlan 20 any
# !
# Using deleted
#
# Before state:
# -------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/3
# description Ansible Network
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex half
# shutdown
# dot1q native vlan 20
# !
# interface GigabitEthernet0/0/0/4
# description Test description
# dot1q native vlan 10
# l2transport
# l2protocol stp tunnel
# !
# !
#
- name: "Delete L2 attributes of given interfaces (Note: This won't delete the interface itself)"
iosxr_l2_interfaces:
config:
- name: GigabitEthernet0/0/0/4
state: deleted
# After state:
# ------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/3
# description Ansible Network
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex half
# shutdown
# dot1q native vlan 20
# !
# interface GigabitEthernet0/0/0/4
# description Test description
# !
# Using Deleted without any config passed
# "(NOTE: This will delete all of configured resource module attributes from each configured interface)"
#
# Before state:
# -------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/3
# description Ansible Network
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex half
# shutdown
# dot1q native vlan 20
# !
# interface GigabitEthernet0/0/0/4
# description Test description
# dot1q native vlan 10
# l2transport
# l2protocol stp tunnel
# !
# !
- name: "Delete L2 attributes of all interfaces (Note: This won't delete the interface itself)"
iosxr_l2_interfaces:
state: deleted
# After state:
# ------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/3
# description Ansible Network
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex half
# shutdown
# !
# interface GigabitEthernet0/0/0/4
# description Test description
# !
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Network Team. [network]
Red Hat Support¶
More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.
Authors¶
Sumit Jaiswal (@justjais)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.