Beispiel #1
0
def remove_running_config(device, remove_config):
    """ Remove running configuration starting with passed keyword from device

        Args:
            device ('obj')        : Device object to modify configuration
            remove_config ('str') : Configuration to be removed from device

        Returns:
            None
    """

    config_list = get_running_config(device=device, keyword=remove_config)

    config_list = list(map(lambda conf: "no " + conf, config_list))

    try:
        device.configure(config_list)
    except SubCommandFailure as e:
        raise SubCommandFailure(
            "Failed to remove {config} configuration on device "
            "{device}".format(device=device.name, config=config_list)) from e
Beispiel #2
0
def is_eem_applet_configured(device, applet_name):
    """ Verify if EEM applet is configured in running config

        Args:
            device ('obj') : Device object
            applet_name ('str') : Applet name
        Returns:
            True
            False
        Raises:
            None
    """

    keyword = "event manager applet {name}".format(name=applet_name)

    try:

        running_config = get_running_config(device=device, keyword=keyword)
    except Exception:
        return False

    return True