use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.
the class MergeCommandsAggregator method mergeUpdate.
public void mergeUpdate(InstanceIdentifier<Node> dstPath, DataObjectModification mod, LogicalDatastoreType datastoreType, ReadWriteTransaction tx) {
if (mod == null) {
return;
}
Collection<DataObjectModification> modifications = mod.getModifiedChildren();
modifications.stream().filter(modification -> skipCopy.negate().test(datastoreType, modification.getDataType())).filter(modification -> commands.get(modification.getDataType()) != null).peek(modification -> LOG.debug("Received {} modification {} copy/delete to {}", datastoreType, modification, dstPath)).forEach(modification -> {
MergeCommand mergeCommand = commands.get(modification.getDataType());
boolean create = modification.getDataAfter() != null;
DataObject data = create ? modification.getDataAfter() : modification.getDataBefore();
InstanceIdentifier<DataObject> transformedId = mergeCommand.generateId(dstPath, data);
DataObject transformedItem = mergeCommand.transform(dstPath, data);
Optional<DataObject> existingDataOptional = null;
try {
existingDataOptional = tx.read(datastoreType, transformedId).checkedGet();
} catch (ReadFailedException ex) {
LOG.error("Failed to read data {} from {}", transformedId, datastoreType);
return;
}
String destination = datastoreType == CONFIGURATION ? "child" : "parent";
if (create) {
if (isDataUpdated(existingDataOptional, transformedItem)) {
LOG.debug("Copy to {} {} {}", destination, datastoreType, transformedId);
tx.put(datastoreType, transformedId, transformedItem, true);
} else {
LOG.debug("Data not updated skip copy to {}", transformedId);
}
} else {
if (existingDataOptional.isPresent()) {
LOG.debug("Delete from {} {} {}", destination, datastoreType, transformedId);
tx.delete(datastoreType, transformedId);
} else {
LOG.debug("Delete skipped for {}", transformedId);
}
}
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.
the class ArpMonitoringHandler method remove.
@Override
protected void remove(InstanceIdentifier<LearntVpnVipToPort> key, LearntVpnVipToPort value) {
runOnlyInOwnerNode("ArpMonitoringHandler: remove event", () -> {
try {
InetAddress srcInetAddr = InetAddress.getByName(value.getPortFixedip());
if (value.getMacAddress() == null) {
LOG.warn("The mac address received is null for LearntVpnVipToPort {}, ignoring the DTCN", value);
return;
}
String vpnName = value.getVpnName();
String learntIp = srcInetAddr.getHostAddress();
LearntVpnVipToPort vpnVipToPort = VpnUtil.getLearntVpnVipToPort(dataBroker, vpnName, learntIp);
if (vpnVipToPort != null && !vpnVipToPort.getCreationTime().equals(value.getCreationTime())) {
LOG.warn("The MIP {} over vpn {} has been learnt again and processed. " + "Ignoring this remove event.", learntIp, vpnName);
return;
}
MacAddress srcMacAddress = MacAddress.getDefaultInstance(value.getMacAddress());
String interfaceName = value.getPortName();
MacEntry macEntry = new MacEntry(vpnName, srcMacAddress, srcInetAddr, interfaceName, value.getCreationTime());
jobCoordinator.enqueueJob(buildJobKey(srcInetAddr.toString(), vpnName), new ArpMonitorStopTask(macEntry, dataBroker, alivenessManager));
} catch (UnknownHostException e) {
LOG.error("Error in deserializing packet {} with exception", value, e);
}
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.
the class NeutronPortPairListener method remove.
/**
* Method removes PortPair which is identified by InstanceIdentifier.
*
* @param deletedPortPair - PortPair for removing
*/
@Override
public void remove(PortPair deletedPortPair) {
LOG.info("Received remove port pair event {}", deletedPortPair);
ServiceFunctionKey sfKey = PortPairTranslator.getSFKey(deletedPortPair);
LOG.info("Removing service function {}", sfKey);
sfcMdsalHelper.removeServiceFunction(sfKey);
ServiceFunctionForwarder sff;
ServiceFunctionForwarder updatedSff;
SffName sffName = new SffName(SfcMdsalHelper.NETVIRT_LOGICAL_SFF_NAME);
sff = sfcMdsalHelper.readServiceFunctionForwarder(new ServiceFunctionForwarderKey(sffName));
updatedSff = PortPairGroupTranslator.removePortPairFromServiceFunctionForwarder(sff, deletedPortPair);
LOG.info("Updating service function forwarder as {}", updatedSff);
sfcMdsalHelper.addServiceFunctionForwarder(updatedSff);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.
the class NatTunnelInterfaceStateListener method handleTepDelForAllRtrs.
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private boolean handleTepDelForAllRtrs(BigInteger srcDpnId, String tunnelType, String tunnelName, String srcTepIp, String destTepIp, WriteTransaction writeFlowInvTx) {
LOG.trace("handleTepDelForAllRtrs : TEP DEL ----- for EXTERNAL/HWVTEP ITM Tunnel,TYPE {},State is UP b/w SRC IP" + " : {} and DEST IP: {}", fibManager.getTransportTypeStr(tunnelType), srcTepIp, destTepIp);
// When tunnel EP is deleted on a DPN , VPN gets two deletion event.
// One for a DPN on which tunnel EP was deleted and another for other-end DPN.
// Handle only the DPN on which it was deleted , ignore other event.
// DPN on which TEP is deleted , endpoint IP will be null.
String endpointIpForDPN = null;
try {
endpointIpForDPN = NatUtil.getEndpointIpAddressForDPN(dataBroker, srcDpnId);
} catch (Exception e) {
/* this dpn does not have the VTEP */
LOG.error("handleTepDelForAllRtrs : DPN {} does not have the VTEP", srcDpnId);
endpointIpForDPN = null;
}
if (endpointIpForDPN != null) {
LOG.trace("handleTepDelForAllRtrs : Ignore TEP DELETE event received for DPN {} VTEP IP {} since its " + "the other end DPN w.r.t the delted TEP", srcDpnId, srcTepIp);
return false;
}
List<RoutersList> routersList = null;
InstanceIdentifier<DpnRoutersList> dpnRoutersListId = NatUtil.getDpnRoutersId(srcDpnId);
Optional<DpnRoutersList> optionalRouterDpnList = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, dpnRoutersListId);
if (optionalRouterDpnList.isPresent()) {
routersList = optionalRouterDpnList.get().getRoutersList();
} else {
LOG.warn("handleTepDelForAllRtrs : RouterDpnList is empty for DPN {}.Hence ignoring TEP DEL event " + "for the ITM TUNNEL TYPE {} b/w SRC IP {} and DST IP {} and TUNNEL NAME {} ", srcDpnId, tunnelType, srcTepIp, destTepIp, tunnelName);
return false;
}
if (routersList == null) {
LOG.error("handleTepDelForAllRtrs : DPN {} does not have the Routers presence", srcDpnId);
return false;
}
for (RoutersList router : routersList) {
String routerName = router.getRouter();
LOG.debug("handleTepDelForAllRtrs : TEP DEL : DNAT -> Withdrawing routes for router {} ", routerName);
long routerId = NatUtil.getVpnId(dataBroker, routerName);
if (routerId == NatConstants.INVALID_ID) {
LOG.error("handleTepDelForAllRtrs :Invalid ROUTER-ID {} returned for routerName {}", routerId, routerName);
return false;
}
Uuid externalNetworkId = NatUtil.getNetworkIdFromRouterName(dataBroker, routerName);
ProviderTypes extNwProvType = NatEvpnUtil.getExtNwProvTypeFromRouterName(dataBroker, routerName, externalNetworkId);
if (extNwProvType == null) {
return false;
}
hndlTepDelForDnatInEachRtr(router, routerId, srcDpnId, extNwProvType);
LOG.debug("handleTepDelForAllRtrs : TEP DEL : SNAT -> Withdrawing and Advertising routes for router {} ", router.getRouter());
hndlTepDelForSnatInEachRtr(router, routerId, srcDpnId, tunnelType, srcTepIp, destTepIp, tunnelName, extNwProvType, writeFlowInvTx);
}
return true;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.
the class ElanItmUtils method getExternalTunnelItmEgressAction.
/**
* Builds the list of actions to be taken when sending the packet over an
* external VxLan tunnel interface, such as stamping the VNI on the VxLAN
* header, setting the vlanId if it proceeds and output the packet over the
* right port.
*
* @param srcDpnId
* Dpn where the tunnelInterface is located
* @param torNode
* NodeId of the ExternalDevice where the packet must be sent to.
* @param vni
* Vni to be stamped on the VxLAN Header.
* @return the external itm egress action
*/
public List<Action> getExternalTunnelItmEgressAction(BigInteger srcDpnId, NodeId torNode, long vni) {
List<Action> result = Collections.emptyList();
GetExternalTunnelInterfaceNameInput input = new GetExternalTunnelInterfaceNameInputBuilder().setDestinationNode(torNode.getValue()).setSourceNode(srcDpnId.toString()).setTunnelType(TunnelTypeVxlan.class).build();
Future<RpcResult<GetExternalTunnelInterfaceNameOutput>> output = itmRpcService.getExternalTunnelInterfaceName(input);
try {
if (output.get().isSuccessful()) {
GetExternalTunnelInterfaceNameOutput tunnelInterfaceNameOutput = output.get().getResult();
String tunnelIfaceName = tunnelInterfaceNameOutput.getInterfaceName();
LOG.debug("Received tunnelInterfaceName from getTunnelInterfaceName RPC {}", tunnelIfaceName);
result = buildTunnelItmEgressActions(tunnelIfaceName, vni);
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error in RPC call getTunnelInterfaceName {}", e);
}
return result;
}
Aggregations