the literary device used on this occasion is the metaphor
Explanation:
Rhetorical figure of thought through which a reality or concept is expressed through a different reality or concept with which what is represented has a certain relationship of similarity.