def no_apply_interface(
        sw, app_type, interface_num, acl_addr_type, acl_name, direction
        ):

    assert sw is not None
    assert app_type in ('port', 'vlan')
    assert isinstance(interface_num, str)
    assert acl_addr_type in ('ip', 'ipv6', 'mac')
    assert isinstance(acl_name, str)
    assert direction in ('in', 'out')

    print(">>>>>>>>>>>>>>>> unapplying the {acl_name} from interface "
          "{interface_num} for the "
          "direction {direction}".format(**locals()))

    if app_type == 'port':
        if acl_addr_type == 'ip':
            with sw.libs.vtysh.ConfigInterface(interface_num) as ctx:
                if direction == 'in':
                    ctx.no_apply_access_list_ip_in(acl_name)
                    pass
                else:
                    ctx.no_apply_access_list_ip_out(acl_name)
                    pass
        else:
            print(
                "<%s> address type is not supported in no_apply_interface()"
                % (acl_addr_type)
                )
            assert False
    else:
        print(
            "<%s> ACL application type is not supported in"
            " no_apply_interface()" % (app_type)
            )
        assert False

    if app_type == 'port':
        app_type = 'interface'

    wait_on_warnings(sw=sw, retries=3, polling_frequency=2)
    test_result = sw(
            'show access-list {app_type} {interface_num} {acl_addr_type} '
            'commands'.format(**locals())
            )
    print(">>>>>>>>.after\n" + test_result)
    print(">>>> The search is search(r'(apply\s+access-list\s+{acl_addr_type}"
          "\s+{acl_name}\s+{direction})'".format(**locals()))
    assert search(
       r'(apply\s+access-list\s+{acl_addr_type}\s+{acl_name}\s+{direction})'
       .format(**locals()), test_result
       ) is None
def unconfigure_ace(sw, acl_addr_type, acl_name, seq_num):

    assert sw is not None
    assert acl_addr_type in ('ip', 'ipv6', 'mac')
    assert isinstance(acl_name, str)
    assert isinstance(seq_num, str)

    if acl_addr_type == 'ip':
        with sw.libs.vtysh.ConfigAccessListIpTestname(acl_name) as ctx:
            ctx.no(seq_num)
    else:
        print(
            "<%s> ACL address type is not supported in"
            " unconfigure_ace()" % (acl_addr_type)
            )

    wait_on_warnings(sw=sw, retries=3, polling_frequency=2)

    test_result = sw(
            'show access-list {acl_addr_type} {acl_name} commands'
            .format(**locals())
            )
    print(test_result)
    assert search(r'\n\s+{seq_num}'.format(**locals()), test_result) is None