cisco.ios.ios_evpn_evi module – Resource module to configure L2VPN EVPN EVI.

Note

This module is part of the cisco.ios collection (version 5.3.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 cisco.ios.

To use it in a playbook, specify: cisco.ios.ios_evpn_evi.

New in cisco.ios 5.3.0

Synopsis

  • This module provides declarative management of L2VPN EVPN EVI on Cisco IOS network devices.

Note

This module has a corresponding action plugin.

Parameters

Parameter

Comments

config

list / elements=dictionary

A dictionary of L2VPN Ethernet Virtual Private Network (EVPN) EVI configuration

default_gateway

dictionary

Default Gateway parameters

advertise

dictionary

Advertise Default Gateway MAC/IP routes

disable

boolean

Disable advertisement of Default Gateway MAC/IP routes

Choices:

  • false

  • true

enable

boolean

Enable advertisement of Default Gateway MAC/IP routes

Choices:

  • false

  • true

encapsulation

string

EVPN encapsulation type

Choices:

  • "vxlan" ← (default)

evi

integer / required

EVPN instance value

ip

dictionary

IP parameters

local_learning

dictionary

IP local learning

disable

boolean

Disable IP local learning

Choices:

  • false

  • true

enable

boolean

Enable IP local learning

Choices:

  • false

  • true

replication_type

string

Method for replicating BUM traffic

Choices:

  • "ingress"

  • "static"

route_distinguisher

string

EVPN Route Distinguisher

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 nve | section ^l2vpn evpn$.

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

The state the configuration should be left in

Choices:

  • "merged" ← (default)

  • "replaced"

  • "overridden"

  • "deleted"

  • "gathered"

  • "rendered"

  • "parsed"

Notes

Note

Examples

# Using state merged

# Before state:
# -------------
# l2vpn evpn instance 101 vlan-based
#  encapsulation vxlan
#  replication-type static
# !
# l2vpn evpn instance 102 vlan-based
#  encapsulation vxlan
#  replication-type ingress
# !
# l2vpn evpn instance 201 vlan-based
#  encapsulation vxlan
#  replication-type static
# !
# l2vpn evpn instance 202 vlan-based
#  encapsulation vxlan
#  replication-type ingress

# - name: Merge provided configuration with device configuration
#   cisco.ios.ios_evpn_evi:
#     config:
#       - evi: 101
#         replication_type: ingress
#         route_distinguisher: '1:1'
#         default_gateway:
#           advertise:
#             enable: False
#         ip:
#           local_learning:
#             enable: True
#
#       - evi: 202
#         replication_type: static
#         default_gateway:
#           advertise:
#             enable: True
#         ip:
#           local_learning:
#             disable: True
#     state: merged

# Commands Fired:
# ---------------
# "commands": [
#     "l2vpn evpn instance 101 vlan-based",
#     "ip local-learning enable",
#     "replication-type ingress",
#     "rd 1:1",
#     "l2vpn evpn instance 202 vlan-based",
#     "default-gateway advertise enable",
#     "ip local-learning disable",
#     "replication-type static"
#     ],

# After state:
# ------------
# l2vpn evpn instance 101 vlan-based
#  encapsulation vxlan
#  rd 1:1
#  replication-type ingress
#  ip local-learning enable
# !
# l2vpn evpn instance 102 vlan-based
#  encapsulation vxlan
#  replication-type ingress
# !
# l2vpn evpn instance 201 vlan-based
#  encapsulation vxlan
#  replication-type static
# !
# l2vpn evpn instance 202 vlan-based
#  encapsulation vxlan
#  replication-type static
#  ip local-learning disable
#  default-gateway advertise enable


# Using state replaced

# Before state:
# -------------
# l2vpn evpn instance 101 vlan-based
#  encapsulation vxlan
#  rd 1:1
#  replication-type ingress
#  ip local-learning enable
# !
# l2vpn evpn instance 102 vlan-based
#  encapsulation vxlan
#  replication-type ingress
# !
# l2vpn evpn instance 201 vlan-based
#  encapsulation vxlan
#  replication-type static
# !
# l2vpn evpn instance 202 vlan-based
#  encapsulation vxlan
#  replication-type static
#  ip local-learning disable
#  default-gateway advertise enable

# - name: Replaces the device configuration with the provided configuration
#   cisco.ios.ios_evpn_evi:
#     config:
#       - evi: 101
#         replication_type: ingress
#         default_gateway:
#           advertise:
#             enable: True
#       - evi: 202
#         replication_type: ingress
#     state: replaced

# Commands Fired:
# ---------------
# "commands": [
#     "l2vpn evpn instance 101 vlan-based",
#     "default-gateway advertise enable",
#     "no ip local-learning enable",
#     "no rd 1:1",
#     "l2vpn evpn instance 202 vlan-based",
#     "no default-gateway advertise enable",
#     "no ip local-learning disable",
#     "replication-type ingress"
#     ],

# After state:
# ------------
# l2vpn evpn instance 101 vlan-based
#  encapsulation vxlan
#  replication-type ingress
#  default-gateway advertise enable
# !
# l2vpn evpn instance 102 vlan-based
#  encapsulation vxlan
#  replication-type ingress
# !
# l2vpn evpn instance 201 vlan-based
#  encapsulation vxlan
#  replication-type static
# !
# l2vpn evpn instance 202 vlan-based
#  encapsulation vxlan
#  replication-type ingress

# Using state overridden

# Before state:
# -------------
# l2vpn evpn instance 101 vlan-based
#  encapsulation vxlan
#  replication-type ingress
#  default-gateway advertise enable
# !
# l2vpn evpn instance 102 vlan-based
#  encapsulation vxlan
#  replication-type ingress
# !
# l2vpn evpn instance 201 vlan-based
#  encapsulation vxlan
#  replication-type static
# !
# l2vpn evpn instance 202 vlan-based
#  encapsulation vxlan
#  replication-type ingress

# - name: Override the device configuration with provided configuration
#   cisco.ios.ios_evpn_evi:
#     config:
#       - evi: 101
#         replication_type: ingress
#         default_gateway:
#           advertise:
#             enable: True
#       - evi: 202
#         replication_type: static
#         default_gateway:
#           advertise:
#             enable: True
#     state: overridden

# Commands Fired:
# ---------------
# "commands": [
#     "no l2vpn evpn instance 102 vlan-based",
#     "no l2vpn evpn instance 201 vlan-based",
#     "l2vpn evpn instance 202 vlan-based",
#     "default-gateway advertise enable",
#     "replication-type static"
#     ],

# After state:
# ------------
# l2vpn evpn instance 101 vlan-based
#  encapsulation vxlan
#  replication-type ingress
#  default-gateway advertise enable
# !
# l2vpn evpn instance 202 vlan-based
#  encapsulation vxlan
#  replication-type static
#  default-gateway advertise enable


# Using state Deleted

# Before state:
# -------------
# l2vpn evpn instance 101 vlan-based
#  encapsulation vxlan
#  replication-type ingress
#  default-gateway advertise enable
# l2vpn evpn instance 102 vlan-based
#  encapsulation vxlan
#  replication-type ingress
# l2vpn evpn instance 202 vlan-based
#  encapsulation vxlan
#  replication-type static
#  default-gateway advertise enable

# - name: "Delete the given EVI(s)"
#   cisco.ios.ios_evpn_evi:
#     config:
#       - evi: 101
#     state: deleted

# Commands Fired:
# ---------------
# "commands": [
#       "no l2vpn evpn instance 101 vlan-based"
#       ],

# After state:
# -------------
# l2vpn evpn instance 102 vlan-based
#  encapsulation vxlan
#  replication-type ingress
# l2vpn evpn instance 202 vlan-based
#  encapsulation vxlan
#  replication-type static
#  default-gateway advertise enable

# Using state Deleted without any config passed

# Before state:
# -------------
# l2vpn evpn instance 102 vlan-based
#  encapsulation vxlan
#  replication-type ingress
# l2vpn evpn instance 202 vlan-based
#  encapsulation vxlan
#  replication-type static
#  default-gateway advertise enable

# - name: "Delete ALL EVIs"
#   cisco.ios.ios_evpn_evi:
#     state: deleted

# Commands Fired:
# ---------------
# "commands": [
#     "no l2vpn evpn instance 102 vlan-based",
#     "no l2vpn evpn instance 202 vlan-based"
#     ],

# After state:
# -------------
# !

# Using gathered

# Before state:
# -------------
#
# l2vpn evpn instance 101 vlan-based
#  encapsulation vxlan
#  replication-type static
# !
# l2vpn evpn instance 102 vlan-based
#  encapsulation vxlan
#  replication-type ingress
# !
# l2vpn evpn instance 201 vlan-based
#  encapsulation vxlan
#  replication-type static
# !
# l2vpn evpn instance 202 vlan-based
#  encapsulation vxlan
#  replication-type ingress

# - name: Gather facts for evpn_evi
#   cisco.ios.ios_evpn_evi:
#     config:
#     state: gathered

# Task Output:
# ------------
#
# gathered:
#   - evi: 101
#     encapsulation: vxlan
#     replication_type: static
#   - evi: 102
#     encapsulation: vxlan
#     replication_type: ingress
#   - evi: 201
#     encapsulation: vxlan
#     replication_type: static
#   - evi: 202
#     encapsulation: vxlan
#     replication_type: ingress

# Using Rendered

# - name: Rendered the provided configuration with the existing running configuration
#   cisco.ios.ios_evpn_evi:
#     config:
#       - evi: 101
#         replication_type: ingress
#         default_gateway:
#           advertise:
#             enable: True
#       - evi: 202
#         replication_type: ingress
#     state: rendered

# Task Output:
# ------------
#
# rendered:
# - l2vpn evpn instance 101 vlan-based
# - default-gateway advertise enable
# - replication-type ingress
# - l2vpn evpn instance 202 vlan-based
# - replication-type ingress


# Using parsed

# File: parsed.cfg
# ----------------
#
# l2vpn evpn instance 101 vlan-based
#  encapsulation vxlan
#  replication-type ingress
#  default-gateway advertise enable
# !
# l2vpn evpn instance 102 vlan-based
#  encapsulation vxlan
#  replication-type ingress
# !

# - name: Parse the commands for provided configuration
#   cisco.ios.ios_evpn_evi:
#     running_config: "{{ lookup('file', 'parsed.cfg') }}"
#     state: parsed

# Task Output:
# ------------
#
# parsed:
#   - evi: 101
#     encapsulation: vxlan
#     replication_type: ingress
#     default_gateway:
#       advertise:
#         enable: true
#   - evi: 102
#     encapsulation: vxlan
#     replication_type: ingress

Return Values

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

Key

Description

after

dictionary

The resulting configuration after module execution.

Returned: when changed

Sample: "This output will always be in the same format as the module argspec.\n"

before

dictionary

The configuration prior to the module execution.

Returned: when state is merged, replaced, overridden, deleted or purged

Sample: "This output will always be in the same format as the module argspec.\n"

commands

list / elements=string

The set of commands pushed to the remote device.

Returned: when state is merged, replaced, overridden, deleted or purged

Sample: ["l2vpn evpn instance 101 vlan-based", "encapsulation vxlan", "replication-type ingress"]

Authors

  • Padmini Priyadarshini Sivaraj (@PadminiSivaraj)