pyhpecw7.features.irf module

This module is used to configure IRF for a HPCOM7 device. The IRFMember class is used to change the IRF member numbers on the device, and can force a reboot. The IRFPort class is used to bind physical ports to IRF ports. IRFMember should be used first and the IRFPort.

class pyhpecw7.features.irf.IrfMember(device)[source]

Bases: object

This class is used to get and build IRF port configurations on a HPCOM7 device.

Parameters:device (HPCOM7) – connected instance of a pyhpecw7.comware.HPCOM7 object.
device

connected instance of a pyhpecw7.comware.HPCOM7 object.

Type:HPCOM7
build(**params)[source]

Build the IRF membership configuration.

Parameters:

**params – See Keyword Args.

Keyword Arguments:
 
  • auto_update (str) – OPTIONAL - Enables or disables the auto-upgrade of software after an IRF convergence. Should be ‘enable’ or ‘disable’.
  • mad_exclude (list) – OPTIONAL - A list of interfaces to be excluded from MAD mechanisms.
  • member_id (str) – REQUIRED - The current IRF member ID of the device.
  • new_member_id (str) – ID of the device.
  • domain_id (str) –
  • descr (str) – OPTIONAL - A textual description of the IRF member.
  • priority (str) – OPTIONAL - The desired priority of the IRF member.
Returns:

True if successful, False otherwise.

get_config(member_id)[source]

Return the entire IRF membership configuration for a given member ID.

Parameters:member_id (str) – A current IRF member ID for the device.
Returns:A dictionary with IRF membership configuration parameters. Including:
auto_update (str):
 ’enable’ or ‘disable’.
mad_exclude (list):
 A list of interfaces to be excluded from MAD mechanisms.
new_member_id (str):
 The new IRF member ID of the device to applied after reboot.
descr (str):A textual description of the IRF member.
priority (str):The priority of the IRF member.
domain_id (str):
 The domain id of the member.
Raises:IRFMemberDoesntExistError – if the IRF member doesn’t exist.
remove_mad_exclude(iface_list)[source]

Stage the configuration to remove interfaces from the mad excluded list.

class pyhpecw7.features.irf.IrfPort(device)[source]

Bases: object

This class is used to get and build IRF port configurations on a HPCOM7 device.

Parameters:device (HPCOM7) – connected instance of a pyhpecw7.comware.HPCOM7 object.
device

connected instance of a pyhpecw7.comware.HPCOM7 object.

Type:HPCOM7
build(member_id, old_p1=[], old_p2=[], irf_p1=[], irf_p2=[], filename='startup.cfg', activate=True)[source]

Stage all of the commands to configure IRF ports, including: 1. Bringing down interfaces to be removed or added 2. Binding physical ports to IRF ports 3. Bringing up interfaces to be added. 4. Saving the config. 5. (Optionally) activating the IRF port configuration.

Parameters:
  • member_id (string) – The member ID of the switch.
  • old_p1 (list) – REQUIRED - A list of current interfaces bound to IRF port 1.
  • old_p2 (list) – REQUIRED - A list of current interfaces bound to IRF port 2.
  • irf_p1 (list) – REQUIRED - A list of desired interfaces to be bound to IRF port 1.
  • irf_p2 (list) – REQUIRED - A list of desired interfaeces to be bound to IRF port 2.
  • filename (str) – OPTIONAL - The filename in which to save the current configuration. Defaults to ‘startup.cfg’.
  • activate (bool) – OPTIONAL - Whether to immediately apply the IRF port configuration. Defaults to True.

Note

The irf_p1 and irf_p2 should be the complete physical interface list for IRF port 1 and IRF port 2, respectively. Interfaces not in the list will be removed.

Note

If old_p1 and old_p2 are not accurate, behavior is undefined. These values can be obtained from get_config().

Returns:A string representation of the list of staged configurations on the device.
get_config()[source]

Get the current configuration of IRF ports on the device.

Returns:A dictionary of IRF port bindings.

It has the following format:

{
    <member_id>: {
        'irf_p1' : <iface_list>,
        'irf_p2' : <iface_list>
    }
}