colinmacgiolla / vlan-render

Simple python module to assist in managing the renders of VLANs on ports

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VlanRender

A simple python3 module to assist in working with and rendering the sets of VLANs typically allowed/added to switchports on network devices.

VlanRender Objects

class VlanRender()

valid

def valid(vlan: int)

valid - Checks if a VLAN ID (int) is valid or not

Arguments:

  • vlan - int

Returns:

Bool True if VLAN ID is in the correct range, False if not

expand

def expand(vlan: str)

expand - Expand the string rendering of a VLAN list to be a list of ints

Arguments:

  • vlan - string A string with the switch rendering of the VLANs for trunk ports e.g. "2-5,11,23,55-98"

Returns:

list(int) A list of integers, being all the VLAN IDs

compress

def compress(vlans: list)

compress - take a list of ints, and convert it to a compressed (hypenated) string

Arguments:

  • vlan - list(int) A list of integers, representing the VLANs to be converted to string

Returns:

string: A string representing the VLANS, comma separated single elemends, with hyphenated ranges e.g. "1,2,3-5,20-55,57"

About

Simple python module to assist in managing the renders of VLANs on ports


Languages

Language:Python 100.0%