Skip to content

Commit

Permalink
ensure description is optional and consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
anubisg1 committed Aug 8, 2023
1 parent 74955ee commit f1f1d24
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 22 deletions.
4 changes: 3 additions & 1 deletion cat9k-playbooks/templates/overlay_interfaces.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ This module configures overlay interfaces
{% if action == 'delete' -%}
no vrf forwarding {{ overlay_interfaces[intf].vrf }}
{% elif action == 'add' %}
description {{ overlay_interfaces[intf].description }}
{% 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 %}
Expand Down
4 changes: 2 additions & 2 deletions cat9k-playbooks/templates/underlay_interfaces.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ This module configures ip addresses for underlay underlay_interfaces
interface {{ interface }}
{# prevents err-disabled caused by STP #}
shutdown
{% if underlay_interfaces[interface].name is defined %}
description {{ underlay_interfaces[interface].name }}
{% if underlay_interfaces[interface].description is defined %}
description {{ underlay_interfaces[interface].description }}
{% endif %}
{% set type = underlay_interfaces[interface].type | default ('physical') %}
{% if type == 'loopback'%}
Expand Down
14 changes: 7 additions & 7 deletions docs/input.rst
Original file line number Diff line number Diff line change
Expand Up @@ -602,29 +602,29 @@ In this section, the configurations of the underlay interfaces are defined.

underlay_interfaces:
Loopback0:
name: 'ROUTER-ID'
description: 'ROUTER-ID'
type: 'loopback'
ip_address: '192.168.210.11'
subnet_mask: '255.255.255.255'

Loopback1:
name: 'VTEP'
description: 'VTEP'
type: 'loopback'
ip_address: '192.168.211.11'
subnet_mask: '255.255.255.255'

GigabitEthernet1/0/23:
name: 'UNDERLAY-FABRIC'
description: 'UNDERLAY-FABRIC'
type: 'slave'
etherchannel_number: '1'

GigabitEthernet1/0/24:
name: 'UNDERLAY-FABRIC'
description: 'UNDERLAY-FABRIC'
type: 'slave'
etherchannel_number: '1'

Port-channel1:
name: 'UNDERLAY-FABRIC'
description: 'UNDERLAY-FABRIC'
type: 'master'

<...snip...>
Expand All @@ -641,7 +641,7 @@ In this section, the configurations of the underlay interfaces are defined.
**<interface_name>** / :red:`mandatory` This option defines the interface name. For example: ``Loopback0`` or
``GigabitEthernet1/0/1``

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

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

Expand Down Expand Up @@ -699,7 +699,7 @@ In this section, the configurations of the overlay interfaces are defined.
**<interface_name>** / :red:`mandatory` This option defines the interface name. For example: ``Loopback0`` or
``GigabitEthernet1/0/1``

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

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

Expand Down
6 changes: 3 additions & 3 deletions host_vars/node_vars/Leaf-01.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ hostname: 'LEAF-1'

underlay_interfaces:
Loopback0:
name: 'ROUTER-ID'
description: 'ROUTER-ID'
ip_address: '192.168.210.11'
subnet_mask: '255.255.255.255'
type: 'loopback'

Loopback1:
name: 'VTEP'
description: 'VTEP'
ip_address: '192.168.211.11'
subnet_mask: '255.255.255.255'
type: 'loopback'

GigabitEthernet1/0/24:
name: 'UNDERLAY-FABRIC'
description: 'UNDERLAY-FABRIC'

#layer 3 interface
overlay_interfaces:
Expand Down
6 changes: 3 additions & 3 deletions host_vars/node_vars/Leaf-02.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ hostname: 'LEAF-2'

underlay_interfaces:
Loopback0:
name: 'ROUTER-ID'
description: 'ROUTER-ID'
ip_address: '192.168.210.12'
subnet_mask: '255.255.255.255'
type: 'loopback'

Loopback1:
name: 'VTEP'
description: 'VTEP'
ip_address: '192.168.211.12'
subnet_mask: '255.255.255.255'
type: 'loopback'

GigabitEthernet1/0/24:
name: 'UNDERLAY-FABRIC'
description: 'UNDERLAY-FABRIC'

#layer 3 interface
overlay_interfaces:
Expand Down
12 changes: 6 additions & 6 deletions host_vars/node_vars/Spine-01.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ hostname: 'SPINE-1'

underlay_interfaces:
Loopback0:
name: 'ROUTER-ID'
description: 'ROUTER-ID'
ip_address: '192.168.210.1'
subnet_mask: '255.255.255.255'
type: 'loopback'

GigabitEthernet1/0/1:
name: 'UNDERLAY-FABRIC'
description: 'UNDERLAY-FABRIC'

GigabitEthernet1/0/2:
name: 'UNDERLAY-FABRIC'
description: 'UNDERLAY-FABRIC'

GigabitEthernet1/0/3:
name: 'UNDERLAY-FABRIC'
description: 'UNDERLAY-FABRIC'
type: 'slave'
etherchannel_number: '1'

GigabitEthernet1/0/4:
name: 'UNDERLAY-FABRIC'
description: 'UNDERLAY-FABRIC'
type: 'slave'
etherchannel_number: '1'

Port-channel1:
name: 'UNDERLAY-FABRIC'
description: 'UNDERLAY-FABRIC'
type: 'master'

0 comments on commit f1f1d24

Please sign in to comment.