- jobCoordinator.enqueueJob("PORT- " + portName,
- () -> Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(confTx -> {
- Optional<Interface> optionalInf =
- confTx.read(LogicalDatastoreType.CONFIGURATION, interfaceIdentifier).checkedGet();
- if (optionalInf.isPresent()) {
- InterfaceBuilder interfaceBuilder = new InterfaceBuilder(optionalInf.get());
- InterfaceAcl infAcl = handlePortSecurityUpdated(original, update,
- origSecurityEnabled, updatedSecurityEnabled, interfaceBuilder).build();
- interfaceBuilder.addAugmentation(InterfaceAcl.class, infAcl);
- LOG.info("update: Of-port-interface updation for port {}", portName);
- // Update OFPort interface for this neutron port
- confTx.put(LogicalDatastoreType.CONFIGURATION, interfaceIdentifier,
- interfaceBuilder.build());
- } else {
- LOG.warn("update: Interface {} is not present", portName);
- }
- })));
+ jobCoordinator.enqueueJob("PORT- " + portName, () -> {
+ ListenableFuture<Void> future = txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION,
+ confTx -> {
+ Optional<Interface> optionalInf = confTx.read(interfaceIdentifier).get();
+ if (optionalInf.isPresent()) {
+ InterfaceBuilder interfaceBuilder = new InterfaceBuilder(optionalInf.get());
+ if (origSecurityEnabled || updatedSecurityEnabled) {
+ InterfaceAcl infAcl = handlePortSecurityUpdated(original, update, origSecurityEnabled,
+ updatedSecurityEnabled, interfaceBuilder).build();
+ interfaceBuilder.addAugmentation(InterfaceAcl.class, infAcl);
+ } else if (isDhcpServerPort) {
+ Set<FixedIps> oldIPs = getFixedIpSet(original.getFixedIps());
+ Set<FixedIps> newIPs = getFixedIpSet(update.getFixedIps());
+ if (!oldIPs.equals(newIPs)) {
+ InterfaceAcl infAcl = neutronvpnUtils.getDhcpInterfaceAcl(update);
+ interfaceBuilder.addAugmentation(InterfaceAcl.class, infAcl);
+ }
+ }
+ LOG.info("update: Of-port-interface updation for port {}", portName);
+ // Update OFPort interface for this neutron port
+ confTx.put(interfaceIdentifier, interfaceBuilder.build());
+ } else {
+ LOG.warn("update: Interface {} is not present", portName);
+ }
+ });
+ ListenableFutures.addErrorLogging(future, LOG,
+ "update: Failed to update interface {} with networkId {}", portName, network);
+ return Collections.singletonList(future);
+ });