Skip to content

Commit

Permalink
Merge branch 'main' into nexus9k
Browse files Browse the repository at this point in the history
  • Loading branch information
anubisg1 committed Aug 9, 2023
2 parents 5ef0cd6 + ed86751 commit dfd77cb
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 21 deletions.
38 changes: 29 additions & 9 deletions cat9k-playbooks/templates/overlay_interfaces.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,38 @@ This module configures overlay interfaces
{% if ((ovrl_intf_cli is defined and intf in ovrl_intf_cli) or (ovrl_intf_cli is not defined)) %}
{# Checking an action for the vlan - action_vlan. #}
{% set action = overlay_interfaces[intf].action | default ('add') %}
!
interface {{ intf }}
{% if action == 'delete' -%}
no vrf forwarding {{ overlay_interfaces[intf].vrf }}
{% set type = overlay_interfaces[intf].type | default ('physical') %}
{% if action == 'delete' %}
{% if type == 'loopback' or type == 'master' or type == 'subintf' %}
!
no interface {{ intf }}
{% else %}
!
interface {{ intf }}
no vrf forwarding {{ overlay_interfaces[intf].vrf }}
{% endif %}
{% elif action == 'add' %}
!
interface {{ intf }}
{% if overlay_interfaces[intf].description is defined %}
description {{ overlay_interfaces[intf].description }}
{% endif %}
vrf forwarding {{ overlay_interfaces[intf].vrf }}
ip address {{ overlay_interfaces[intf].ip_address }} {{ overlay_interfaces[intf].subnet_mask }}
{% endif %}
no shutdown
{% endif %}
{% if type == 'physical' or type == 'slave' or type == 'master' or type == 'tagged' %}
no switchport
{% endif %}
{% if type == 'slave' %}
channel-group {{ overlay_interfaces[intf].etherchannel_number }} mode active
{% elif type == 'tagged' %}
no shutdown
{% else %}
{% if type == 'subintf' %}
encapsulation dot1q {{ overlay_interfaces[intf].dot1q }}
{% endif %}
vrf forwarding {{ overlay_interfaces[intf].vrf }}
ip address {{ overlay_interfaces[intf].ip_address }} {{ overlay_interfaces[intf].subnet_mask }}
no shutdown
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
16 changes: 8 additions & 8 deletions cat9k-playbooks/templates/underlay_interfaces.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ This module configures ip addresses for underlay underlay_interfaces

#jinja2: lstrip_blocks: "True", trim_blocks: "True"

{% for interface in underlay_interfaces %}
{% for intf in underlay_interfaces %}
!
interface {{ interface }}
interface {{ intf }}
{# prevents err-disabled caused by STP #}
shutdown
{% if underlay_interfaces[interface].description is defined %}
description {{ underlay_interfaces[interface].description }}
{% if underlay_interfaces[intf].description is defined %}
description {{ underlay_interfaces[intf].description }}
{% endif %}
{% set type = underlay_interfaces[interface].type | default ('physical') %}
{% if type == 'loopback'%}
ip address {{ underlay_interfaces[interface].ip_address }} {{ underlay_interfaces[interface].subnet_mask }}
{% set type = underlay_interfaces[intf].type | default ('physical') %}
{% if type == 'loopback' %}
ip address {{ underlay_interfaces[intf].ip_address }} {{ underlay_interfaces[intf].subnet_mask }}
{% elif type == 'slave' %}
no switchport
channel-group {{ underlay_interfaces[interface].etherchannel_number }} mode active
channel-group {{ underlay_interfaces[intf].etherchannel_number }} mode active
{% else %}
no switchport
ip unnumbered {{ underlay.router_id }}
Expand Down
63 changes: 61 additions & 2 deletions docs/input.rst
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,36 @@ In this section, the configurations of the overlay interfaces are defined.
ip_address: '10.1.10.11'
subnet_mask: '255.255.255.255'
vrf: 'test'
loopback: 'yes'
type: 'loopback'

GigabitEthernet1/0/1:
description: 'Link to Router1-1/0'
type: 'slave'
etherchannel_number: '10'

GigabitEthernet1/0/2:
description: 'Link to Router1-1/1'
type: 'slave'
etherchannel_number: '10'

Port-channel1:
description: 'Link to Router1'
type: 'master'
ip_address: '10.1.21.11'
subnet_mask: '255.255.255.255'
vrf: 'test'

GigabitEthernet1/0/3:
description: 'Link to Router3'
type: 'tagged'

GigabitEthernet1/0/3.100:
description: 'Link to Router3 vrf test'
type: 'subintf'
dot1q: '100'
ip_address: '10.1.31.12'
subnet_mask: '255.255.255.255'
vrf: 'test'

<...snip...>

Expand All @@ -701,13 +730,43 @@ In this section, the configurations of the overlay interfaces are defined.

**description** / :orange:`optional` This option defines the interface description.

**type** / :orange:`optional` | This option defines what type of interface is being configured.

| When not defined, it defaults to **physical**

**Choices:**

* physical

* tagged

* subintf

* loopback

* master

* slave

**etherchannel_number** / :red:`mandatory` This option defines what port-channel (master) the interface belongs to.

This field applies only if the type is **slave**

**dot1q** / :red:`mandatory` This option defines vlan tag should be configured

This field applies only if the type is **subintf**

**ip_address** / :red:`mandatory` This option defines the IPv4 address on the interface.

This field does **NOT** apply if type is **slave** or **tagged**

**subnet_mask** / :red:`mandatory` This option defines the subnet mask for the IPv4 address.

This field does **NOT** apply if type is **slave** or **tagged**

**vrf** / :red:`mandatory` This option defines the vrf to be associated with the interface.

**loopback** / :red:`optional` This option defines interface is a loopback. Defaults to ``no``
This field does **NOT** apply if type is **slave** or **tagged**
=============================================== ==========================================================================

access_intf/<node_name>.yml
Expand Down
17 changes: 17 additions & 0 deletions host_vars/node_vars/Leaf-01.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,20 @@ overlay_interfaces:
subnet_mask: '255.255.255.255'
loopback: 'yes'
vrf: 'test2'

GigabitEthernet1/0/1:
description: 'Link to Router1-1/0'
type: 'slave'
etherchannel_number: '10'

GigabitEthernet1/0/2:
description: 'Link to Router1-1/1'
type: 'slave'
etherchannel_number: '10'

Port-channel1:
description: 'Link to Router1'
type: 'master'
ip_address: '10.1.21.11'
subnet_mask: '255.255.255.255'
vrf: 'test2'
16 changes: 14 additions & 2 deletions host_vars/node_vars/Leaf-02.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,24 @@ overlay_interfaces:
description: 'UNIQUE-LOOPBACK-VRF-TEST'
ip_address: '10.1.10.12'
subnet_mask: '255.255.255.255'
loopback: 'yes'
type: 'loopback'
vrf: 'test'

Loopback101:
description: 'UNIQUE-LOOPBACK-VRF-TEST2'
ip_address: '10.1.11.12'
subnet_mask: '255.255.255.255'
loopback: 'yes'
type: 'loopback'
vrf: 'test2'

GigabitEthernet1/0/1:
description: 'Link to Router1-1/0'
type: 'tagged'

GigabitEthernet1/0/1.100:
description: 'test'
type: 'subintf'
dot1q: '100'
ip_address: '10.1.31.12'
subnet_mask: '255.255.255.255'
vrf: 'test'

0 comments on commit dfd77cb

Please sign in to comment.