use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.NeutronvpnService in project netvirt by opendaylight.
the class ArpMonitoringHandler method add.
@Override
protected void add(InstanceIdentifier<LearntVpnVipToPort> identifier, LearntVpnVipToPort value) {
runOnlyInOwnerNode("ArpMonitoringHandler: add event", () -> {
try {
InetAddress srcInetAddr = InetAddress.getByName(value.getPortFixedip());
if (value.getMacAddress() == null) {
LOG.warn("The mac address received is null for VpnPortipToPort {}, ignoring the DTCN", value);
return;
}
MacAddress srcMacAddress = MacAddress.getDefaultInstance(value.getMacAddress());
String vpnName = value.getVpnName();
MacEntry macEntry = new MacEntry(vpnName, srcMacAddress, srcInetAddr, value.getPortName(), value.getCreationTime());
jobCoordinator.enqueueJob(buildJobKey(srcInetAddr.toString(), vpnName), new ArpMonitorStartTask(macEntry, arpMonitorProfileId, dataBroker, alivenessManager, neutronVpnService, interfaceManager));
} catch (UnknownHostException e) {
LOG.error("Error in deserializing packet {} with exception", value, e);
}
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.NeutronvpnService in project netvirt by opendaylight.
the class NatRouterInterfaceListener method remove.
@Override
public void remove(InstanceIdentifier<Interfaces> identifier, Interfaces interfaceInfo) {
LOG.trace("remove : Remove event - key: {}, value: {}", interfaceInfo.key(), interfaceInfo);
final String routerId = identifier.firstKeyOf(RouterInterfaces.class).getRouterId().getValue();
final String interfaceName = interfaceInfo.getInterfaceId();
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface interfaceState = NatUtil.getInterfaceStateFromOperDS(dataBroker, interfaceName);
if (interfaceState != null) {
Uint64 dpId = NatUtil.getDpIdFromInterface(interfaceState);
if (dpId.equals(Uint64.ZERO)) {
LOG.warn("REMOVE : Could not retrieve DPN ID for interface {} to handle router {} dissociation model", interfaceName, routerId);
return;
}
final ReentrantLock lock = NatUtil.lockForNat(dpId);
lock.lock();
try {
if (NatUtil.isSnatEnabledForRouterId(dataBroker, routerId)) {
NatUtil.removeSnatEntriesForPort(dataBroker, naptManager, mdsalManager, neutronVpnService, interfaceName, routerId);
}
LoggingFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, operTx -> {
// Delete the NeutronRouterDpnMap from the ODL:L3VPN operational model
NatUtil.removeFromNeutronRouterDpnsMap(routerId, interfaceName, dpId, operTx);
// Delete the DpnRouterMap from the ODL:L3VPN operational model
NatUtil.removeFromDpnRoutersMap(dataBroker, routerId, interfaceName, dpId, interfaceManager, operTx);
}), LOG, "Error handling NAT router interface removal");
// Delete the RouterInterfaces maintained in the ODL:L3VPN configuration model
LoggingFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, confTx -> confTx.delete(NatUtil.getRouterInterfaceId(interfaceName))), LOG, "Error handling NAT router interface removal");
} finally {
lock.unlock();
}
}
}
Aggregations