def _validate_duplicates(self):
<EOL>if not self.id:<EOL><INDENT>duplicates = []<EOL>self.netengine_dict = self.netengine.to_dict()<EOL>for interface in self.netengine_dict['<STR_LIT>']:<EOL><INDENT>if interface['<STR_LIT>'] in duplicates:<EOL><INDENT>continue<EOL><DEDENT>if Interface.objects.filter(mac__iexact=interface['<STR_LIT>']).count() > <NUM_LIT:0>:<EOL><INDENT>duplicates.append(interface['<STR_LIT>'])<EOL><DEDENT><DEDENT>if len(duplicates) > <NUM_LIT:0>:<EOL><INDENT>mac_address_string = '<STR_LIT:U+002CU+0020>'.join(duplicates)<EOL>raise ValidationError(_('<STR_LIT>') % mac_address_string)<EOL><DEDENT><DEDENT>
Ensure we're not creating a device that already exists
Runs only when the DeviceConnector object is created, not when is updated