Skip to content

Latest commit

 

History

History
634 lines (574 loc) · 20.8 KB

cisco.iosxr.iosxr_vrf_interfaces_module.rst

File metadata and controls

634 lines (574 loc) · 20.8 KB

cisco.iosxr.iosxr_vrf_interfaces

Resource module to configure VRF interfaces.

Version added: 10.3.0

  • This module configures and manages the VRF configuration in interface on IOS XR platforms.
Parameter Choices/Defaults Comments
config
list / elements=dictionary
A list of VRF interfaces options.
name
string / required
Full name of the interface excluding any logical unit number, i.e. GigabitEthernet0/0/0/1.
vrf_name
string
Vrf that is to be added to the 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 sh running-config 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
  • gathered
  • rendered
  • 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 | include ip route|ipv6 route executed on device. For state parsed active connection to remote host is not required.

Note

  • Tested against Cisco IOS-XR 7.2.2.
  • This module works with connection network_cli.
# Using merged

# Before state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
#  ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
#  description this is interface0
#  cdp
# !
# interface GigabitEthernet0/0/0/1
#  shutdown
# !
# interface GigabitEthernet0/0/0/2
#  shutdown
# !

- name: Simple merge selective
  cisco.iosxr.iosxr_vrf_interfaces:
    state: merged
    config:
      - name: MgmtEth0/RP0/CPU0/0
      - name: GigabitEthernet0/0/0/0
      - name: GigabitEthernet0/0/0/1
        vrf_name: vrf_C
      - name: GigabitEthernet0/0/0/2
        vrf_name: vrf_D

# Task Output
# -----------
#
# before:
#   - name: MgmtEth0/RP0/CPU0/0
#   - name: GigabitEthernet0/0/0/0
#   - name: GigabitEthernet0/0/0/1
#   - name: GigabitEthernet0/0/0/2
# commands:
#   - interface GigabitEthernet0/0/0/1
#   - vrf vrf_C
#   - interface GigabitEthernet0/0/0/2
#   - vrf vrf_D
# after:
#   - name: MgmtEth0/RP0/CPU0/0
#   - name: GigabitEthernet0/0/0/0
#   - name: GigabitEthernet0/0/0/1
#     vrf_name: vrf_C
#   - name: GigabitEthernet0/0/0/2
#     vrf_name: vrf_D

# After state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
#  ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
#  description this is interface0
#  cdp
# !
# interface GigabitEthernet0/0/0/1
#  vrf vrf_C
#  shutdown
# !
# interface GigabitEthernet0/0/0/2
#  vrf vrf_D
#  shutdown
# !

# Using replaced

# Before state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
#  ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
#  description this is interface0
#  cdp
# !
# interface GigabitEthernet0/0/0/1
#  vrf vrf_C
#  shutdown
# !
# interface GigabitEthernet0/0/0/2
#  vrf vrf_D
#  shutdown
# !

- name: Simple replaced selective
  cisco.iosxr.iosxr_vrf_interfaces:
    state: replaced
    config:
      - name: MgmtEth0/RP0/CPU0/0
      - name: GigabitEthernet0/0/0/0
      - name: GigabitEthernet0/0/0/1
        vrf_name: vrf_E
      - name: GigabitEthernet0/0/0/2
        vrf_name: vrf_D

# Task Output
# -----------
#
# before:
#   - name: MgmtEth0/RP0/CPU0/0
#   - name: GigabitEthernet0/0/0/0
#   - name: GigabitEthernet0/0/0/1
#     vrf_name: vrf_C
#   - name: GigabitEthernet0/0/0/2
#     vrf_name: vrf_D
# commands:
#   - interface GigabitEthernet0/0/0/1
#   - vrf vrf_E
# after:
#   - name: MgmtEth0/RP0/CPU0/0
#   - name: GigabitEthernet0/0/0/0
#   - name: GigabitEthernet0/0/0/1
#     vrf_name: vrf_E
#   - name: GigabitEthernet0/0/0/2
#     vrf_name: vrf_D

# After state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
#  ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
#  description this is interface0
#  cdp
# !
# interface GigabitEthernet0/0/0/1
#  vrf vrf_E
#  shutdown
# !
# interface GigabitEthernet0/0/0/2
#  vrf vrf_D
#  shutdown
# !

# Using overridden

# Before state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
#  ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
#  description this is interface0
#  cdp
# !
# interface GigabitEthernet0/0/0/1
#  vrf vrf_C
#  shutdown
# !
# interface GigabitEthernet0/0/0/2
#  vrf vrf_D
#  shutdown
# !

- name: Simple overridden selective
  cisco.iosxr.iosxr_vrf_interfaces:
    state: overridden
    config:
      - name: MgmtEth0/RP0/CPU0/0
      - name: GigabitEthernet0/0/0/0
      - name: GigabitEthernet0/0/0/1
        vrf_name: vrf_E

# Task Output
# -----------
#
# before:
#   - name: MgmtEth0/RP0/CPU0/0
#   - name: GigabitEthernet0/0/0/0
#   - name: GigabitEthernet0/0/0/1
#     vrf_name: vrf_C
#   - name: GigabitEthernet0/0/0/2
#     vrf_name: vrf_D
# commands:
#   - interface GigabitEthernet0/0/0/1
#   - vrf vrf_E
#   - interface GigabitEthernet0/0/0/2
#   - no vrf vrf_E
# after:
#   - name: MgmtEth0/RP0/CPU0/0
#   - name: GigabitEthernet0/0/0/0
#   - name: GigabitEthernet0/0/0/1
#     vrf_name: vrf_E
#   - name: GigabitEthernet0/0/0/2

# After state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
#  ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
#  description this is interface0
#  cdp
# !
# interface GigabitEthernet0/0/0/1
#  vrf vrf_E
#  shutdown
# !
# interface GigabitEthernet0/0/0/2
#  shutdown
# !

# Using deleted

# Before state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
#  ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
#  description this is interface0
#  cdp
# !
# interface GigabitEthernet0/0/0/1
#  vrf vrf_E
#  shutdown
# !
# interface GigabitEthernet0/0/0/2
#  vrf vrf_D
#  shutdown
# !

- name: Simple deleted selective
  cisco.iosxr.iosxr_vrf_interfaces:
    state: deleted
    config:
      - name: GigabitEthernet0/0/0/1
        vrf_name: vrf_E

# Task Output
# -----------
#
# before:
#   - name: MgmtEth0/RP0/CPU0/0
#   - name: GigabitEthernet0/0/0/0
#   - name: GigabitEthernet0/0/0/1
#     vrf_name: vrf_E
#   - name: GigabitEthernet0/0/0/2
#     vrf_name: vrf_D
# commands:
#   - interface GigabitEthernet0/0/0/1
#   - no vrf vrf_E
# after:
#   - name: MgmtEth0/RP0/CPU0/0
#   - name: GigabitEthernet0/0/0/0
#   - name: GigabitEthernet0/0/0/1
#   - name: GigabitEthernet0/0/0/2
#     vrf_name: vrf_D

# After state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
#  ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
#  description this is interface0
#  cdp
# !
# interface GigabitEthernet0/0/0/1
#  shutdown
# !
# interface GigabitEthernet0/0/0/2
#  vrf vrf_D
#  shutdown
# !

# Using gathered

# Before state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
#  ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
#  description this is interface0
#  cdp
# !
# interface GigabitEthernet0/0/0/1
#  vrf vrf_C
#  shutdown
# !
# interface GigabitEthernet0/0/0/2
#  vrf vrf_D
#  shutdown
# !

- name: Simple gathered selective
  cisco.iosxr.iosxr_vrf_interfaces:
    state: gathered

# Task Output
# -----------
#
# gathered:
#   - name: MgmtEth0/RP0/CPU0/0
#   - name: GigabitEthernet0/0/0/0
#   - name: GigabitEthernet0/0/0/1
#     vrf_name: vrf_C
#   - name: GigabitEthernet0/0/0/2
#     vrf_name: vrf_D

# Using rendered

# Before state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
#  ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
#  description this is interface0
#  cdp
# !
# interface GigabitEthernet0/0/0/1
#  vrf vrf_C
#  shutdown
# !
# interface GigabitEthernet0/0/0/2
#  vrf vrf_D
#  shutdown
# !

- name: Simple rendered selective
  cisco.iosxr.iosxr_vrf_interfaces:
    state: rendered

# Task Output
# -----------
#
# commands:
#   - interface GigabitEthernet0/0/0/1
#   - vrf vrf_C
#   - interface GigabitEthernet0/0/0/2
#   - vrf vrf_D

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

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:
['interface GigabitEthernet0/0/0/1', 'no vrf test_vrf1', 'vrf test_vrf2']
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:
['interface GigabitEthernet0/0/0/1', 'no vrf test_vrf1', 'vrf test_vrf2']


Authors

  • Sagar Paul (@KB-perByte)