'check l2 sub interface valid'

def is_l2_sub_intf_valid(self, ifname):

    if (ifname.count('.') != 1):
        return False
    if_num = ifname.split('.')[1]
    if (not if_num.isdigit()):
        return False
    if ((int(if_num) < 1) or (int(if_num) > 4096)):
        self.module.fail_json(msg='Error:    Sub-interface    number    is    not    in    the    range    from    1    to    4096.')
        return False
    if (not get_interface_type(ifname)):
        return False
    return True
