@Test public void onDataChangedTestAdd() { doReturn(DataObjectModification.ModificationType.WRITE).when(mockModification).getModificationType(); doReturn(dataObject).when(mockModification).getDataAfter(); manager.onDataTreeChanged(changeEvent); verify(executor).execute(any(Runnable.class)); }
@Override public void onDataTreeChanged(Collection<DataTreeModification<ActionInstance>> changes) { for (DataTreeModification<ActionInstance> change: changes) { DataObjectModification<ActionInstance> rootNode = change.getRootNode(); final ActionInstance dataBefore = rootNode.getDataBefore(); final ActionInstance dataAfter = rootNode.getDataAfter(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: if (dataBefore == null) { LOG.debug("New ActionInstance created"); executor.execute(new MatchActionDefTask(dataAfter, null, ActionState.ADD)); } else { LOG.debug("ActionInstance updated"); executor.execute(new MatchActionDefTask(dataAfter, dataBefore, ActionState.CHANGE)); } break; case DELETE: LOG.debug("ActionInstance deleted"); executor.execute(new MatchActionDefTask(null, dataBefore, ActionState.DELETE)); break; default: break; } } }
SfcManager implements AutoCloseable, DataTreeChangeListener<ActionInstance> { @Override public void onDataTreeChanged(Collection<DataTreeModification<ActionInstance>> changes) { for (DataTreeModification<ActionInstance> change: changes) { DataObjectModification<ActionInstance> rootNode = change.getRootNode(); final ActionInstance dataBefore = rootNode.getDataBefore(); final ActionInstance dataAfter = rootNode.getDataAfter(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: if (dataBefore == null) { LOG.debug("New ActionInstance created"); executor.execute(new MatchActionDefTask(dataAfter, null, ActionState.ADD)); } else { LOG.debug("ActionInstance updated"); executor.execute(new MatchActionDefTask(dataAfter, dataBefore, ActionState.CHANGE)); } break; case DELETE: LOG.debug("ActionInstance deleted"); executor.execute(new MatchActionDefTask(null, dataBefore, ActionState.DELETE)); break; default: break; } } } }
SfcManager implements AutoCloseable, DataTreeChangeListener<ActionInstance> { @Override public void onDataTreeChanged(Collection<DataTreeModification<ActionInstance>> changes) { for (DataTreeModification<ActionInstance> change: changes) { DataObjectModification<ActionInstance> rootNode = change.getRootNode(); final ActionInstance dataBefore = rootNode.getDataBefore(); final ActionInstance dataAfter = rootNode.getDataAfter(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: if (dataBefore == null) { LOG.debug("New ActionInstance created"); executor.execute(new MatchActionDefTask(dataAfter, null, ActionState.ADD)); } else { LOG.debug("ActionInstance updated"); executor.execute(new MatchActionDefTask(dataAfter, dataBefore, ActionState.CHANGE)); } break; case DELETE: LOG.debug("ActionInstance deleted"); executor.execute(new MatchActionDefTask(null, dataBefore, ActionState.DELETE)); break; default: break; } } } SfcManager(DataBroker dataBroker,
                      RpcProviderRegistry rpcRegistry,
                      ExecutorService executor); }
SfcManager implements AutoCloseable, DataTreeChangeListener<ActionInstance> { @Override public void onDataTreeChanged(Collection<DataTreeModification<ActionInstance>> changes) { for (DataTreeModification<ActionInstance> change: changes) { DataObjectModification<ActionInstance> rootNode = change.getRootNode(); final ActionInstance dataBefore = rootNode.getDataBefore(); final ActionInstance dataAfter = rootNode.getDataAfter(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: if (dataBefore == null) { LOG.debug("New ActionInstance created"); executor.execute(new MatchActionDefTask(dataAfter, null, ActionState.ADD)); } else { LOG.debug("ActionInstance updated"); executor.execute(new MatchActionDefTask(dataAfter, dataBefore, ActionState.CHANGE)); } break; case DELETE: LOG.debug("ActionInstance deleted"); executor.execute(new MatchActionDefTask(null, dataBefore, ActionState.DELETE)); break; default: break; } } } SfcManager(DataBroker dataBroker,
                      RpcProviderRegistry rpcRegistry,
                      ExecutorService executor); Set<IpAddress> getSfcSourceIps(); @Override void onDataTreeChanged(Collection<DataTreeModification<ActionInstance>> changes); RenderedServicePathFirstHop getRspFirstHop(String rspName); @Override void close(); }
SfcManager implements AutoCloseable, DataTreeChangeListener<ActionInstance> { @Override public void onDataTreeChanged(Collection<DataTreeModification<ActionInstance>> changes) { for (DataTreeModification<ActionInstance> change: changes) { DataObjectModification<ActionInstance> rootNode = change.getRootNode(); final ActionInstance dataBefore = rootNode.getDataBefore(); final ActionInstance dataAfter = rootNode.getDataAfter(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: if (dataBefore == null) { LOG.debug("New ActionInstance created"); executor.execute(new MatchActionDefTask(dataAfter, null, ActionState.ADD)); } else { LOG.debug("ActionInstance updated"); executor.execute(new MatchActionDefTask(dataAfter, dataBefore, ActionState.CHANGE)); } break; case DELETE: LOG.debug("ActionInstance deleted"); executor.execute(new MatchActionDefTask(null, dataBefore, ActionState.DELETE)); break; default: break; } } } SfcManager(DataBroker dataBroker,
                      RpcProviderRegistry rpcRegistry,
                      ExecutorService executor); Set<IpAddress> getSfcSourceIps(); @Override void onDataTreeChanged(Collection<DataTreeModification<ActionInstance>> changes); RenderedServicePathFirstHop getRspFirstHop(String rspName); @Override void close(); static final String SFC_CHAIN_ACTION; static final String SFC_CHAIN_NAME; }