pyhpecw7.features.switchport module¶
Manage switchports on HPCOM7 devices.
-
class
pyhpecw7.features.switchport.
Switchport
(device, interface_name)[source]¶ Bases:
object
This class is used to get and build layer 2 interface configurations on
HPCOM7
devices.Parameters: - device (HPCOM7) – connected instance of a
pyhpecw7.comware.HPCOM7
object. - interface_name (str) – The name of the interface.
-
interface_name
¶ The name of the interface.
Type: str
-
interface
¶ The associated
Interface
configuration object.Type: pyhpecw7.features.Interface
-
build
(stage=False, **params)[source]¶ Stage a layer 2 configuration with given parameters on switchport.
Parameters: stage (bool) – whether to stage the command or execute immediately
Keyword Arguments: - link_type (str) – ‘access’ or ‘trunk’.
- pvid (str) – The access VLAN if link_type is ‘access’, the native VLAN if link_type is ‘trunk’.
- permitted_vlans (str) – A comma and/or hyphen delimited list of VLAN numbers. Used when link_type is ‘trunk’. For example: 1,3-5,7
Returns: True if stage=True and successfully staged etree.Element XML response if immediate execution
-
convert_interface
(link_type, stage=False)[source]¶ Stage or execute the commands to toggle an interface between trunk/access.
Parameters: - link_type (str) – ‘access’ or ‘trunk’.
- stage (bool) – whether to stage the command or execute immediately
Note
If link_type does not equal ‘access’ or ‘trunk’, no commands are staged.
Returns: True if stage=True and successfully staged etree.Element XML responses if immediate execution
-
default
(stage=False)[source]¶ Stage or execute a layer 2 default configuration.
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
- device (HPCOM7) – connected instance of a