use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.pcreq.message.Requests in project netvirt by opendaylight.
the class SubnetRoutePacketInHandler method handleBgpVpnSubnetRoute.
private void handleBgpVpnSubnetRoute(IPv4 ipv4, byte[] srcMac, byte[] dstIp, String dstIpStr, String srcIpStr, long elanTag) throws UnknownHostException {
LOG.info("{} handleBgpVpnSubnetRoute: Processing IPv4 Packet received with Source IP {} and Target IP {}" + " and elan Tag {}", LOGGING_PREFIX, srcIpStr, dstIpStr, elanTag);
SubnetOpDataEntry targetSubnetForPacketOut = getTargetSubnetForPacketOut(dataBroker, elanTag, ipv4.getDestinationAddress());
if (targetSubnetForPacketOut != null) {
// Handle subnet routes ip requests
transmitArpPacket(targetSubnetForPacketOut.getNhDpnId(), srcIpStr, NWUtil.toStringMacAddress(srcMac), dstIp, elanTag);
} else {
VpnManagerCounters.subnet_route_packet_failed.inc();
LOG.debug("{} handleBgpVpnSubnetRoute: Could not find target subnet for packet out {}", LOGGING_PREFIX, dstIpStr);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.pcreq.message.Requests in project netvirt by opendaylight.
the class ArpNotificationHandler method processArpLearning.
private void processArpLearning(String srcInterface, IpAddress srcIP, PhysAddress srcMac, BigInteger metadata, IpAddress dstIP) {
if (metadata != null && !Objects.equals(metadata, BigInteger.ZERO)) {
Optional<List<String>> vpnList = VpnUtil.getVpnHandlingIpv4AssociatedWithInterface(dataBroker, srcInterface);
if (vpnList.isPresent()) {
for (String vpnName : vpnList.get()) {
LOG.info("Received ARP for sender MAC {} and sender IP {} via interface {}", srcMac.getValue(), srcIP.getIpv4Address().getValue(), srcInterface);
String ipToQuery = srcIP.getIpv4Address().getValue();
LOG.info("ARP being processed for Source IP {}", ipToQuery);
VpnPortipToPort vpnPortipToPort = VpnUtil.getNeutronPortFromVpnPortFixedIp(dataBroker, vpnName, ipToQuery);
if (vpnPortipToPort != null) {
/* This is a well known neutron port and so should be ignored
* from being discovered
*/
continue;
}
LearntVpnVipToPort learntVpnVipToPort = VpnUtil.getLearntVpnVipToPort(dataBroker, vpnName, ipToQuery);
if (learntVpnVipToPort != null) {
String oldPortName = learntVpnVipToPort.getPortName();
String oldMac = learntVpnVipToPort.getMacAddress();
if (!oldMac.equalsIgnoreCase(srcMac.getValue())) {
// MAC has changed for requested IP
LOG.info("ARP Source IP/MAC data modified for IP {} with MAC {} and Port {}", ipToQuery, srcMac, srcInterface);
synchronized ((vpnName + ipToQuery).intern()) {
removeMipAdjacency(vpnName, oldPortName, srcIP);
VpnUtil.removeLearntVpnVipToPort(dataBroker, vpnName, ipToQuery);
putVpnIpToMigrateArpCache(vpnName, ipToQuery, srcMac);
}
}
} else if (!isIpInArpMigrateCache(vpnName, ipToQuery)) {
learnMacFromArpPackets(vpnName, srcInterface, srcIP, srcMac, dstIP);
}
}
} else {
LOG.info("ARP NO_RESOLVE: VPN not configured. Ignoring responding to ARP requests from this" + " Interface {}.", srcInterface);
return;
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.pcreq.message.Requests in project netvirt by opendaylight.
the class NeutronSubnetGwMacResolver method sendArpRequestsToExtGatewayTask.
private void sendArpRequestsToExtGatewayTask(Router router) {
LOG.trace("Send ARP requests to external GW for router {}", router);
Port extPort = getRouterExtGatewayPort(router);
if (extPort == null) {
LOG.trace("External GW port for router {} is missing", router.getUuid().getValue());
return;
}
String extInterface = getExternalInterface(router);
if (extInterface == null) {
LOG.trace("No external interface defined for router {}", router.getUuid().getValue());
return;
}
Map<FixedIpsKey, FixedIps> keyFixedIpsMap = extPort.getFixedIps();
if (keyFixedIpsMap == null || keyFixedIpsMap.isEmpty()) {
LOG.trace("External GW port {} for router {} has no fixed IPs", extPort.getUuid().getValue(), router.getUuid().getValue());
return;
}
MacAddress macAddress = extPort.getMacAddress();
if (macAddress == null) {
LOG.trace("External GW port {} for router {} has no mac address", extPort.getUuid().getValue(), router.getUuid().getValue());
return;
}
for (FixedIps fixIp : keyFixedIpsMap.values()) {
Uuid subnetId = fixIp.getSubnetId();
IpAddress srcIpAddress = fixIp.getIpAddress();
IpAddress dstIpAddress = getExternalGwIpAddress(subnetId);
String srcIpAddressString = srcIpAddress.stringValue();
String dstIpAddressString = dstIpAddress.stringValue();
if (NWUtil.isIpv4Address(srcIpAddressString)) {
sendArpRequest(srcIpAddress, dstIpAddress, macAddress, extInterface);
} else {
sendNeighborSolication(new Ipv6Address(srcIpAddressString), macAddress, new Ipv6Address(dstIpAddressString), extInterface);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.pcreq.message.Requests in project bgpcep by opendaylight.
the class PCEPTopologySessionListenerTest method testDuplicatedSession.
/**
* When a session is somehow duplicated in controller, the controller should drop existing session.
*/
@Test
public void testDuplicatedSession() throws ExecutionException, InterruptedException {
listener.onSessionUp(session);
// create node
topologyRpcs.addLsp(createAddLspInput());
final Pcinitiate pcinitiate = (Pcinitiate) receivedMsgs.get(0);
final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
final Uint32 srpId = req.getSrp().getOperationId().getValue();
final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true, testAddress, testAddress, testAddress, Optional.empty());
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setSync(TRUE).setRemove(FALSE).setOperational(OperationalStatus.Active).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)), MsgBuilderUtil.createPath(req.getEro().getSubobject()));
listener.onMessage(session, pcRpt);
readDataOperational(getDataBroker(), TOPO_IID, topology -> {
assertEquals(1, topology.nonnullNode().size());
return topology;
});
// now we do session up again
listener.onSessionUp(session);
assertTrue(session.isClosed());
// node should be removed after termination
checkNotPresentOperational(getDataBroker(), pathComputationClientIId);
assertFalse(receivedMsgs.isEmpty());
// the last message should be a Close message
assertTrue(receivedMsgs.get(receivedMsgs.size() - 1) instanceof Close);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.pcreq.message.Requests in project bgpcep by opendaylight.
the class PCEPTopologySessionListenerTest method testOnSessionTermination.
@Test
public void testOnSessionTermination() throws Exception {
listener.onSessionUp(session);
// create node
topologyRpcs.addLsp(createAddLspInput());
final Pcinitiate pcinitiate = (Pcinitiate) receivedMsgs.get(0);
final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
final Uint32 srpId = req.getSrp().getOperationId().getValue();
final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true, testAddress, testAddress, testAddress, Optional.empty());
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setSync(TRUE).setRemove(FALSE).setOperational(OperationalStatus.Active).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)), MsgBuilderUtil.createPath(req.getEro().getSubobject()));
listener.onMessage(session, pcRpt);
readDataOperational(getDataBroker(), TOPO_IID, topology -> {
assertEquals(1, topology.nonnullNode().size());
return topology;
});
assertFalse(session.isClosed());
// node should be removed after termination
listener.onSessionTerminated(session, new PCEPCloseTermination(TerminationReason.UNKNOWN));
assertTrue(session.isClosed());
checkNotPresentOperational(getDataBroker(), pathComputationClientIId);
}
Aggregations