@Test public void testProcessUpdated() throws Exception { WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); putVppEp(port, bebp, tx); putBaseEpByPort(port, bebp, tx); DataStoreHelper.submitToDs(tx); portHandler.processUpdated(port, port); ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction(); Optional<VppEndpoint> optVppEp = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION, TestUtils.createVppEpIid(TestUtils.createVppEndpointKey(bebp)), rTx); assertTrue(optVppEp.isPresent()); }
void processUpdated(Port original, Port delta) { if (!isUpdateNeeded(original, delta)) { LOG.trace("Port update skipped, port didn`t change. before {}, after: {}", original, delta); return; } LOG.trace("Updating port before: {}, after: {}", original, delta); if (isValidVhostUser(original)) { Optional<BaseEndpointByPort> optBebp = syncedChain.readFromDs(LogicalDatastoreType.OPERATIONAL, createBaseEpByPortIid(original.getUuid())); if (!optBebp.isPresent()) { return; } LOG.trace("Updating port - deleting old port {}", optBebp.get().getPortId()); processDeleted(optBebp.get()); } LOG.trace("Updating port - creating new port {}", delta.getUuid()); processCreated(delta); }
PortHandler implements TransactionChainListener { void processUpdated(Port original, Port delta) { if (!isUpdateNeeded(original, delta)) { LOG.trace("Port update skipped, port didn`t change. before {}, after: {}", original, delta); return; } LOG.trace("Updating port before: {}, after: {}", original, delta); if (isValidVhostUser(original)) { Optional<BaseEndpointByPort> optBebp = syncedChain.readFromDs(LogicalDatastoreType.OPERATIONAL, createBaseEpByPortIid(original.getUuid())); if (!optBebp.isPresent()) { return; } LOG.trace("Updating port - deleting old port {}", optBebp.get().getPortId()); processDeleted(optBebp.get()); } LOG.trace("Updating port - creating new port {}", delta.getUuid()); processCreated(delta); } }
PortHandler implements TransactionChainListener { void processUpdated(Port original, Port delta) { if (!isUpdateNeeded(original, delta)) { LOG.trace("Port update skipped, port didn`t change. before {}, after: {}", original, delta); return; } LOG.trace("Updating port before: {}, after: {}", original, delta); if (isValidVhostUser(original)) { Optional<BaseEndpointByPort> optBebp = syncedChain.readFromDs(LogicalDatastoreType.OPERATIONAL, createBaseEpByPortIid(original.getUuid())); if (!optBebp.isPresent()) { return; } LOG.trace("Updating port - deleting old port {}", optBebp.get().getPortId()); processDeleted(optBebp.get()); } LOG.trace("Updating port - creating new port {}", delta.getUuid()); processCreated(delta); } PortHandler(DataBroker dataBroker, NodeId routingNodeId); }
PortHandler implements TransactionChainListener { void processUpdated(Port original, Port delta) { if (!isUpdateNeeded(original, delta)) { LOG.trace("Port update skipped, port didn`t change. before {}, after: {}", original, delta); return; } LOG.trace("Updating port before: {}, after: {}", original, delta); if (isValidVhostUser(original)) { Optional<BaseEndpointByPort> optBebp = syncedChain.readFromDs(LogicalDatastoreType.OPERATIONAL, createBaseEpByPortIid(original.getUuid())); if (!optBebp.isPresent()) { return; } LOG.trace("Updating port - deleting old port {}", optBebp.get().getPortId()); processDeleted(optBebp.get()); } LOG.trace("Updating port - creating new port {}", delta.getUuid()); processCreated(delta); } PortHandler(DataBroker dataBroker, NodeId routingNodeId); static Optional<FixedIps> resolveFirstFixedIps(Port port); @Override void onTransactionChainFailed(TransactionChain<?, ?> chain, AsyncTransaction<?, ?> transaction,
            Throwable cause); @Override void onTransactionChainSuccessful(TransactionChain<?, ?> chain); }
PortHandler implements TransactionChainListener { void processUpdated(Port original, Port delta) { if (!isUpdateNeeded(original, delta)) { LOG.trace("Port update skipped, port didn`t change. before {}, after: {}", original, delta); return; } LOG.trace("Updating port before: {}, after: {}", original, delta); if (isValidVhostUser(original)) { Optional<BaseEndpointByPort> optBebp = syncedChain.readFromDs(LogicalDatastoreType.OPERATIONAL, createBaseEpByPortIid(original.getUuid())); if (!optBebp.isPresent()) { return; } LOG.trace("Updating port - deleting old port {}", optBebp.get().getPortId()); processDeleted(optBebp.get()); } LOG.trace("Updating port - creating new port {}", delta.getUuid()); processCreated(delta); } PortHandler(DataBroker dataBroker, NodeId routingNodeId); static Optional<FixedIps> resolveFirstFixedIps(Port port); @Override void onTransactionChainFailed(TransactionChain<?, ?> chain, AsyncTransaction<?, ?> transaction,
            Throwable cause); @Override void onTransactionChainSuccessful(TransactionChain<?, ?> chain);  }