pyhpecw7.features.vlan module

Manage VLANS on HPCOM7 devices.

class pyhpecw7.features.vlan.Vlan(device, vlanid=None)[source]

Bases: object

This class is used to get data and configure a specific VLAN.

Parameters:
  • device (HPCOM7) – connected instance of a pyhpecw7.comware.HPCOM7 object.
  • vlanid (str) – VLAN ID
device

connected instance of a pyhpecw7.comware.HPCOM7 object.

Type:HPCOM7
vlanid

VLAN ID

Type:str
build(stage=False, **vlan)[source]

Stage or execute XML object for VLAN configuration and send to staging

Parameters:
  • stage (bool) – whether to stage the command or execute immediately
  • vlan – see Keyword Args
Keyword Arguments:
 
  • name (str) – OPTIONAL - VLAN name
  • descr (str) – OPTOINAL - VLAN description
Returns:

True if stage=True and successfully staged etree.Element XML response if immediate execution

gen_top()[source]
get_config()[source]

Gets current configuration for a given VLAN ID

Parameters:vlanid (str) – REQUIRED - VLAN ID
Returns:
This returns a dictionary with the following
k/v pairs:
vlanid (str):VLAN ID of the vlan requested
name (str):configured name of the vlan
descr (str):configured descr of the vlan

It returns an empty dictionary if the vlan does not exist

get_vlan_list()[source]

Get a list of VLAN IDs that exist on the switch.

Returns:It returns a list of VLAN IDs as strings.
param_check(**vlan)[source]

Basic param validation for vlan

Parameters:
  • state (str) – REQUIRED must be “present” or “absent”
  • vlan – see Keyword Args
  • Args (Keyword) – vlanid (str): OPTIONAL - VLAN ID name (str): OPTIONAL - VLAN name descr (str): OPTIONAL - VLAN description
remove(stage=False)[source]

Stage or execute XML object for VLAN removal and send to staging

Parameters:stage (bool) – whether to stage the command or execute immediately
Returns:True if stage=True and successfully staged etree.Element XML response if immediate execution