def is_intf_up(intf):
intf_path = '<STR_LIT:/>'.join(('<STR_LIT>', intf))<EOL>intf_exist = os.path.exists(intf_path)<EOL>if not intf_exist:<EOL><INDENT>LOG.error("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>{'<STR_LIT>': intf, '<STR_LIT>': intf_path})<EOL>return False<EOL><DEDENT>try:<EOL><INDENT>oper_file = '<STR_LIT:/>'.join((intf_path, '<STR_LIT>'))<EOL>with open(oper_file, '<STR_LIT:r>') as fd:<EOL><INDENT>oper_state = fd.read().strip('<STR_LIT:\n>')<EOL>if oper_state == '<STR_LIT>':<EOL><INDENT>return True<EOL><DEDENT><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>LOG.error("<STR_LIT>", str(e))<EOL><DEDENT>return False<EOL>
Function to check if a interface is up.