ansible-collections / dellemc.os9

GNU General Public License v3.0
8 stars 12 forks source link

Add `range` key #21

Closed Shourai closed 2 years ago

Shourai commented 3 years ago

Use the range key under tagged or untagged members to expedite tagging or untagging of multiple ports.

SUMMARY

It is often the case that a range of ports need to be tagged or untagged in certain vlan. With this commit we can specify a range of ports which removes the need to create a list item for every port. It is still possible to add additional ports to the list.

ISSUE TYPE
COMPONENT NAME

os9_vlan

ADDITIONAL INFORMATION

For example

os9_vlan:
      default_vlan: true
      VLAN 1:
        name: "vlan2"
        description: "int-vlan"
        tagged_members:
          - port: fortyGigE 0/32
            state: present
          - port: fortyGigE 0/40
            state: absent
        untagged_members:
          - port: fortyGigE 0/41
            state: absent
          - port: fortyGigE 0/44
            state: present
          - range: GigabitEthernet 1/9-1/15,1/17,1/20-1/28
            state: present
          - port: fortyGigE 0/45
            state: present
        state: present

would generate

default-vlan disable

interface Vlan 1
 name vlan2
 description int-vlan 
 no untagged fortyGigE 0/41
 untagged fortyGigE 0/44
 untagged GigabitEthernet 1/9-1/15,1/17,1/20-1/28
 untagged fortyGigE 0/45

 tagged fortyGigE 0/32
 no tagged fortyGigE 0/40