Does the sentence use a simile or a metaphor?
My dog, Bandit, is the security guard for our front yard mailbox.

 - metaphor
 - simile
My dog, Bandit, is the security guard for our front yard mailbox.
The words Bandit and security guard are compared without the word like or as. So, the sentence uses a metaphor.