when neutron router interface is deleted, contextId
should be changed back to NetworkId. this patch fixes
NetworkId for parents in L2 endpoint.
Change-Id: I799fd4fb6c9a79b68514e7c139cc09b6c2e279fa
Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
try {
RpcResult<Void> rpcResult = baseEpService.registerEndpoint(regBaseEpInput).get();
if (!rpcResult.isSuccessful()) {
try {
RpcResult<Void> rpcResult = baseEpService.registerEndpoint(regBaseEpInput).get();
if (!rpcResult.isSuccessful()) {
- LOG.warn("Illegal state - registerEndpoint was not successful. Input of RPC: {}", regBaseEpInput);
+ LOG.warn("Illegal state - register Base Endpoint was not successful. Input of RPC: {}", regBaseEpInput);
return false;
}
return true;
return false;
}
return true;
try {
RpcResult<Void> rpcResult = epService.registerEndpoint(regEndpointInput).get();
if (!rpcResult.isSuccessful()) {
try {
RpcResult<Void> rpcResult = epService.registerEndpoint(regEndpointInput).get();
if (!rpcResult.isSuccessful()) {
- LOG.warn("Illegal state - registerEndpoint was not successful. Input of RPC: {}", regEndpointInput);
+ LOG.warn("Illegal state - register Endpoint was not successful. Input of RPC: {}", regEndpointInput);
return false;
}
return true;
return false;
}
return true;
createBasicMacAddrEpInputBuilder(portInSameSubnet, networkContainment, endpointGroupIds);
AddressEndpointRegBuilder l3BaseEp = createBasicL3AddrEpInputBuilder(portInSameSubnet,
networkContainment, endpointGroupIds, neutron);
createBasicMacAddrEpInputBuilder(portInSameSubnet, networkContainment, endpointGroupIds);
AddressEndpointRegBuilder l3BaseEp = createBasicL3AddrEpInputBuilder(portInSameSubnet,
networkContainment, endpointGroupIds, neutron);
- ContextId resolvedCtxId = l3BaseEp.getContextId();
- ContextId networkCtxId = new ContextId(portInSameSubnet.getNetworkId().getValue());
setParentChildRelationshipForEndpoints(l3BaseEp, l2BaseEp);
AddressEndpointUnregBuilder addrEpUnreg =
new AddressEndpointUnregBuilder().setAddress(l3BaseEp.getAddress())
setParentChildRelationshipForEndpoints(l3BaseEp, l2BaseEp);
AddressEndpointUnregBuilder addrEpUnreg =
new AddressEndpointUnregBuilder().setAddress(l3BaseEp.getAddress())
} else {
l3BaseEp.setContextId(new ContextId(networkId.getValue()));
}
} else {
l3BaseEp.setContextId(new ContextId(networkId.getValue()));
}
+ setParentChildRelationshipForEndpoints(l3BaseEp, l2BaseEp);
RegisterEndpointInput regBaseEpInput = new RegisterEndpointInputBuilder()
.setAddressEndpointReg(ImmutableList.of(l2BaseEp.build(), l3BaseEp.build())).build();
epRegistrator.registerEndpoint(regBaseEpInput);
RegisterEndpointInput regBaseEpInput = new RegisterEndpointInputBuilder()
.setAddressEndpointReg(ImmutableList.of(l2BaseEp.build(), l3BaseEp.build())).build();
epRegistrator.registerEndpoint(regBaseEpInput);
public static <T extends DataObject> boolean netconfSyncedWrite(@Nonnull final InstanceIdentifier<Node> vppIid,
@Nonnull final InstanceIdentifier<T> iid, @Nonnull final T data, byte retryCounter) {
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().lock();
public static <T extends DataObject> boolean netconfSyncedWrite(@Nonnull final InstanceIdentifier<Node> vppIid,
@Nonnull final InstanceIdentifier<T> iid, @Nonnull final T data, byte retryCounter) {
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().lock();
- boolean result = write(VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getKey(), iid, data, retryCounter);
+ boolean result =
+ write(VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getKey(), iid, data, retryCounter);
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().unlock();
return result;
}
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().unlock();
return result;
}
* @return true if transaction is successful, false otherwise
*/
public static <T extends DataObject> boolean netconfSyncedMerge(@Nonnull final InstanceIdentifier<Node> vppIid,
* @return true if transaction is successful, false otherwise
*/
public static <T extends DataObject> boolean netconfSyncedMerge(@Nonnull final InstanceIdentifier<Node> vppIid,
- @Nonnull final InstanceIdentifier<T> iid, @Nonnull final T data, byte retryCounter) {
+ @Nonnull final InstanceIdentifier<T> iid, @Nonnull final T data, byte retryCounter) {
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().lock();
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().lock();
- boolean result = merge(VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getKey(), iid, data, retryCounter);
+ boolean result =
+ merge(VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getKey(), iid, data, retryCounter);
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().unlock();
return result;
}
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().unlock();
return result;
}
* @param retryCounter retry counter, will repeat the operation for specified amount of times if transaction fails
* @return true if transaction is successful, false otherwise
*/
* @param retryCounter retry counter, will repeat the operation for specified amount of times if transaction fails
* @return true if transaction is successful, false otherwise
*/
- public static boolean netconfSyncedWrite(@Nonnull final InstanceIdentifier<Node> vppIid, @Nonnull final ConfigCommand command,
- byte retryCounter) {
+ public static boolean netconfSyncedWrite(@Nonnull final InstanceIdentifier<Node> vppIid,
+ @Nonnull final ConfigCommand command, byte retryCounter) {
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().lock();
boolean result = write(VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getKey(), command, retryCounter);
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().unlock();
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().lock();
boolean result = write(VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getKey(), command, retryCounter);
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().unlock();
* @param retryCounter retry counter, will repeat the operation for specified amount of times if transaction fails
* @return true if transaction is successful, false otherwise
*/
* @param retryCounter retry counter, will repeat the operation for specified amount of times if transaction fails
* @return true if transaction is successful, false otherwise
*/
- public static boolean netconfSyncedWrite(@Nonnull final InstanceIdentifier<Node> vppIid, @Nonnull final RoutingCommand command,
- byte retryCounter) {
+ public static boolean netconfSyncedWrite(@Nonnull final InstanceIdentifier<Node> vppIid,
+ @Nonnull final RoutingCommand command, byte retryCounter) {
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().lock();
boolean result = write(VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getKey(), command, retryCounter);
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().unlock();
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().lock();
boolean result = write(VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getKey(), command, retryCounter);
VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getValue().unlock();
Preconditions.checkArgument(!data.isEmpty());
final ReadWriteTransaction rwTx = mountpoint.newReadWriteTransaction();
try {
Preconditions.checkArgument(!data.isEmpty());
final ReadWriteTransaction rwTx = mountpoint.newReadWriteTransaction();
try {
- data.forEach((k, v) -> {
- rwTx.put(LogicalDatastoreType.CONFIGURATION, k, v, true);
- });
+ data.forEach((k, v) -> rwTx.put(LogicalDatastoreType.CONFIGURATION, k, v, true));
final CheckedFuture<Void, TransactionCommitFailedException> futureTask = rwTx.submit();
futureTask.get();
final CheckedFuture<Void, TransactionCommitFailedException> futureTask = rwTx.submit();
futureTask.get();
- LOG.trace("Netconf WRITE transaction done for {}",
- data.keySet().stream().map(iid -> iid.getPathArguments()));
+ LOG.trace("Netconf WRITE transaction done for {}", data);
return true;
} catch (Exception e) {
// Retry
return true;
} catch (Exception e) {
// Retry
* @param retryCounter number of attempts
* @return true if transaction is successful, false otherwise
*/
* @param retryCounter number of attempts
* @return true if transaction is successful, false otherwise
*/
- private static boolean deleteIfExists(final InstanceIdentifier<Node> vppIid, final AbstractInterfaceCommand command, byte retryCounter) {
+ private static boolean deleteIfExists(final InstanceIdentifier<Node> vppIid, final AbstractInterfaceCommand command,
+ byte retryCounter) {
Preconditions.checkNotNull(vppIid);
InstanceIdentifier<Interface> iid = VppIidFactory.getInterfaceIID(command.getInterfaceBuilder().getKey());
return deleteIfExists(vppIid, iid, retryCounter);
Preconditions.checkNotNull(vppIid);
InstanceIdentifier<Interface> iid = VppIidFactory.getInterfaceIID(command.getInterfaceBuilder().getKey());
return deleteIfExists(vppIid, iid, retryCounter);
final Set<InstanceIdentifier<T>> iids, byte retryCounter) {
LOG.trace("Netconf DELETE transaction started. Data will be read at first. RetryCounter: {}", retryCounter);
Preconditions.checkNotNull(vppIid);
final Set<InstanceIdentifier<T>> iids, byte retryCounter) {
LOG.trace("Netconf DELETE transaction started. Data will be read at first. RetryCounter: {}", retryCounter);
Preconditions.checkNotNull(vppIid);
- final ReadWriteTransaction rwTx = VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getKey().newReadWriteTransaction();
+ final ReadWriteTransaction rwTx =
+ VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getKey().newReadWriteTransaction();
Set<InstanceIdentifier<T>> alreadyRemoved = new HashSet<>();
for (InstanceIdentifier<T> iid : iids) {
short microReadRetries = 3;
Set<InstanceIdentifier<T>> alreadyRemoved = new HashSet<>();
for (InstanceIdentifier<T> iid : iids) {
short microReadRetries = 3;
- alreadyRemoved.forEach(t -> {
- iids.remove(t);
- });
+ alreadyRemoved.forEach(t -> iids.remove(t));
try {
final CheckedFuture<Void, TransactionCommitFailedException> futureTask = rwTx.submit();
futureTask.get();
try {
final CheckedFuture<Void, TransactionCommitFailedException> futureTask = rwTx.submit();
futureTask.get();