@SuppressWarnings("unchecked") @Test public void testOnDataChanged_Creation() { doReturn(DataObjectModification.ModificationType.WRITE).when(mockModification).getModificationType(); doReturn(ovsdbTp).when(mockModification).getDataAfter(); when(readTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class))).thenReturn( ovsdbBridgeFuture) .thenReturn(endpointFuture) .thenReturn(nodeFuture); when(readWriteTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class))).thenReturn( endpointByPortFuture).thenReturn(ofOverlayNodeConfigFuture); listener.onDataTreeChanged(changeEvent); verify(readWriteTransaction).submit(); }
@Override public void onDataTreeChanged(Collection<DataTreeModification<OvsdbTerminationPointAugmentation>> changes) { for (DataTreeModification<OvsdbTerminationPointAugmentation> change: changes) { DataObjectModification<OvsdbTerminationPointAugmentation> rootNode = change.getRootNode(); InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid = change.getRootPath().getRootIdentifier(); OvsdbTerminationPointAugmentation origOvsdbTp = rootNode.getDataBefore(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: OvsdbTerminationPointAugmentation updatedOvsdbTp = rootNode.getDataAfter(); OvsdbBridgeAugmentation ovsdbBridge = getOvsdbBridgeFromTerminationPoint(ovsdbTpIid, dataBroker); if (origOvsdbTp == null) { NODE_ID_BY_TERMIN_POINT.put(ovsdbTpIid, new NodeId(getInventoryNodeIdString(ovsdbBridge, ovsdbTpIid, dataBroker))); } processOvsdbBridge(ovsdbBridge, updatedOvsdbTp, ovsdbTpIid); break; case DELETE: processRemovedTp(NODE_ID_BY_TERMIN_POINT.get(ovsdbTpIid), origOvsdbTp, ovsdbTpIid); break; default: break; } } }
TerminationPointDataChangeListener implements DataTreeChangeListener<OvsdbTerminationPointAugmentation>,
        AutoCloseable { @Override public void onDataTreeChanged(Collection<DataTreeModification<OvsdbTerminationPointAugmentation>> changes) { for (DataTreeModification<OvsdbTerminationPointAugmentation> change: changes) { DataObjectModification<OvsdbTerminationPointAugmentation> rootNode = change.getRootNode(); InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid = change.getRootPath().getRootIdentifier(); OvsdbTerminationPointAugmentation origOvsdbTp = rootNode.getDataBefore(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: OvsdbTerminationPointAugmentation updatedOvsdbTp = rootNode.getDataAfter(); OvsdbBridgeAugmentation ovsdbBridge = getOvsdbBridgeFromTerminationPoint(ovsdbTpIid, dataBroker); if (origOvsdbTp == null) { NODE_ID_BY_TERMIN_POINT.put(ovsdbTpIid, new NodeId(getInventoryNodeIdString(ovsdbBridge, ovsdbTpIid, dataBroker))); } processOvsdbBridge(ovsdbBridge, updatedOvsdbTp, ovsdbTpIid); break; case DELETE: processRemovedTp(NODE_ID_BY_TERMIN_POINT.get(ovsdbTpIid), origOvsdbTp, ovsdbTpIid); break; default: break; } } } }
TerminationPointDataChangeListener implements DataTreeChangeListener<OvsdbTerminationPointAugmentation>,
        AutoCloseable { @Override public void onDataTreeChanged(Collection<DataTreeModification<OvsdbTerminationPointAugmentation>> changes) { for (DataTreeModification<OvsdbTerminationPointAugmentation> change: changes) { DataObjectModification<OvsdbTerminationPointAugmentation> rootNode = change.getRootNode(); InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid = change.getRootPath().getRootIdentifier(); OvsdbTerminationPointAugmentation origOvsdbTp = rootNode.getDataBefore(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: OvsdbTerminationPointAugmentation updatedOvsdbTp = rootNode.getDataAfter(); OvsdbBridgeAugmentation ovsdbBridge = getOvsdbBridgeFromTerminationPoint(ovsdbTpIid, dataBroker); if (origOvsdbTp == null) { NODE_ID_BY_TERMIN_POINT.put(ovsdbTpIid, new NodeId(getInventoryNodeIdString(ovsdbBridge, ovsdbTpIid, dataBroker))); } processOvsdbBridge(ovsdbBridge, updatedOvsdbTp, ovsdbTpIid); break; case DELETE: processRemovedTp(NODE_ID_BY_TERMIN_POINT.get(ovsdbTpIid), origOvsdbTp, ovsdbTpIid); break; default: break; } } } TerminationPointDataChangeListener(DataBroker dataBroker, EndpointService epService); }
TerminationPointDataChangeListener implements DataTreeChangeListener<OvsdbTerminationPointAugmentation>,
        AutoCloseable { @Override public void onDataTreeChanged(Collection<DataTreeModification<OvsdbTerminationPointAugmentation>> changes) { for (DataTreeModification<OvsdbTerminationPointAugmentation> change: changes) { DataObjectModification<OvsdbTerminationPointAugmentation> rootNode = change.getRootNode(); InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid = change.getRootPath().getRootIdentifier(); OvsdbTerminationPointAugmentation origOvsdbTp = rootNode.getDataBefore(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: OvsdbTerminationPointAugmentation updatedOvsdbTp = rootNode.getDataAfter(); OvsdbBridgeAugmentation ovsdbBridge = getOvsdbBridgeFromTerminationPoint(ovsdbTpIid, dataBroker); if (origOvsdbTp == null) { NODE_ID_BY_TERMIN_POINT.put(ovsdbTpIid, new NodeId(getInventoryNodeIdString(ovsdbBridge, ovsdbTpIid, dataBroker))); } processOvsdbBridge(ovsdbBridge, updatedOvsdbTp, ovsdbTpIid); break; case DELETE: processRemovedTp(NODE_ID_BY_TERMIN_POINT.get(ovsdbTpIid), origOvsdbTp, ovsdbTpIid); break; default: break; } } } TerminationPointDataChangeListener(DataBroker dataBroker, EndpointService epService); @Override void close(); @Override void onDataTreeChanged(Collection<DataTreeModification<OvsdbTerminationPointAugmentation>> changes); }
TerminationPointDataChangeListener implements DataTreeChangeListener<OvsdbTerminationPointAugmentation>,
        AutoCloseable { @Override public void onDataTreeChanged(Collection<DataTreeModification<OvsdbTerminationPointAugmentation>> changes) { for (DataTreeModification<OvsdbTerminationPointAugmentation> change: changes) { DataObjectModification<OvsdbTerminationPointAugmentation> rootNode = change.getRootNode(); InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid = change.getRootPath().getRootIdentifier(); OvsdbTerminationPointAugmentation origOvsdbTp = rootNode.getDataBefore(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: OvsdbTerminationPointAugmentation updatedOvsdbTp = rootNode.getDataAfter(); OvsdbBridgeAugmentation ovsdbBridge = getOvsdbBridgeFromTerminationPoint(ovsdbTpIid, dataBroker); if (origOvsdbTp == null) { NODE_ID_BY_TERMIN_POINT.put(ovsdbTpIid, new NodeId(getInventoryNodeIdString(ovsdbBridge, ovsdbTpIid, dataBroker))); } processOvsdbBridge(ovsdbBridge, updatedOvsdbTp, ovsdbTpIid); break; case DELETE: processRemovedTp(NODE_ID_BY_TERMIN_POINT.get(ovsdbTpIid), origOvsdbTp, ovsdbTpIid); break; default: break; } } } TerminationPointDataChangeListener(DataBroker dataBroker, EndpointService epService); @Override void close(); @Override void onDataTreeChanged(Collection<DataTreeModification<OvsdbTerminationPointAugmentation>> changes);  }