SnmpInterface and IpInterface cannot be deleted when using the according DAO

Description

When you delete a snmpIfInterface using the snmpIfInterfaceDAO it is not working properly.

The problem here is, that the SnmpIfInterface has a relationship to IpInterface, therefore you have not only to delete the SnmpIfInterface, but also disconnect the connection between them.

In addition to that one has to remove the connection on the associated node.
Because each node has a list of all snmpIfInterfaces and ipInterfaces.

If this is not done, hibernate complains, because the object model is in an invalid state.

Either the according DAO must take care of this, or the persistence model (e.g. OnmsSnmpInterface object) has to be annotated correctly.

I manually implemented a disconnection in the DatabasePopulator:

To verify if this works, please add a test to SnmpInterfaceDaoIT which deletes a SnmpInterface by invoking "snmpInterfaceDao.delete(interface)"
The same goes for OnmsIpInterface and IpInterfaceDao

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

PagerDuty

Created October 22, 2015 at 5:06 AM
Updated September 21, 2021 at 6:21 PM