pyhpecw7.features.ipinterface module¶
Manage layer 3 interfaces on HPCOM7 devices.
-
class
pyhpecw7.features.ipinterface.
IpInterface
(device, interface_name, version='v4')[source]¶ Bases:
object
This class is used to get and build layer 3 interface configurations on
HPCOM7
devices.Parameters: - device (HPCOM7) – connected instance of
a
pyhpecw7.comware.HPCOM7
object. - interface_name (str) – The name of the interface.
- version (str) – V4 for IPv4, V6 for IPv6
-
interface_name
¶ The name of the interface.
Type: str
-
version
¶ V4 for IPv4, V6 for IPv6
Type: str
-
interface
¶ The associated
Interface
configuration object.Type: pyhpecw7.features.Interface
-
is_routed
¶ True
if the interface is in layer 3 mode,False
otherwise.Type: bool
-
build
(stage=False, **params)[source]¶ Stage or execute a configuration to configure an IP address on an interface.
Parameters: - stage (bool) – whether to stage the commands or execute immediately
- **params – see Keyword Args
Keyword Arguments: - addr (str) – The IP address to add.
- mask (str) – The network mask for the IP address, in dotted decimal or prefix length notation.
Returns: True if stage=True and staging is successful etree.Element XML response if immediate execution
-
get_config
()[source]¶ Return a list of currently configured IP addresses on the interface.
Note
Either only IPv4 or only IPv6 addresses will be returned depending on the version stored in
self.version
.Returns: A list of currently configured IP addresses on the interface.
-
remove
(stage=False, **params)[source]¶ Stage or execute a configuration to remove an IP address on an interface.
Parameters: - stage (bool) – whether to stage the commands or execute immediately
- **params – see Keyword Args
Keyword Arguments: - addr (str) – The IP address to remove.
- mask (str) – The network mask for the IP address, in dotted decimal or prefix length notation.
Returns: True if stage=True and staging is successful etree.Element XML response if immediate execution
- device (HPCOM7) – connected instance of
a