The large deviation principle for a general class of queueing systems. I