def clean(self, *args, **kwargs):
if self.status != LINK_STATUS.get('<STR_LIT>'):<EOL><INDENT>if self.interface_a is None or self.interface_b is None:<EOL><INDENT>raise ValidationError(_('<STR_LIT>'))<EOL><DEDENT>if (self.interface_a_id == self.interface_b_id) or (self.interface_a == self.interface_b):<EOL><INDENT>msg = _('<STR_LIT>') % self.interface_a<EOL>raise ValidationError(msg)<EOL><DEDENT><DEDENT>if self.status == LINK_STATUS.get('<STR_LIT>') and (self.node_a is None or self.node_b is None):<EOL><INDENT>raise ValidationError(_('<STR_LIT>'))<EOL><DEDENT>if self.type != LINK_TYPES.get('<STR_LIT>') and (self.dbm is not None or self.noise is not None):<EOL><INDENT>raise ValidationError(_('<STR_LIT>'))<EOL><DEDENT>
Custom validation
    1. interface_a and interface_b mandatory except for planned links
    2. planned links should have at least node_a and node_b filled in
    3. dbm and noise fields can be filled only for radio links
    4. interface_a and interface_b must differ
    5. interface a and b type must match