[GEANT] Adaptation to BgpSpeakerVlan feature.
Change-Id: I997bf31778ff41037eab457b338760dc6fdd1582
diff --git a/sdx-l3/app.xml b/sdx-l3/app.xml
index 8460219..54b83d4 100644
--- a/sdx-l3/app.xml
+++ b/sdx-l3/app.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright 2014-2015 Open Networking Laboratory
+ ~ Copyright 2016-present Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
diff --git a/sdx-l3/features.xml b/sdx-l3/features.xml
index dbe3f0a..838fd7b 100644
--- a/sdx-l3/features.xml
+++ b/sdx-l3/features.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
- ~ Copyright 2014-2015 Open Networking Laboratory
+ ~ Copyright 2016-present Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
diff --git a/sdx-l3/pom.xml b/sdx-l3/pom.xml
index 7fac0da..694c128 100644
--- a/sdx-l3/pom.xml
+++ b/sdx-l3/pom.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright 2016 Open Networking Laboratory
+ ~ Copyright 2016-present Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3.java
index 8211b68..c28e894 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,23 +21,14 @@
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.onlab.packet.Ethernet;
import org.onosproject.app.ApplicationService;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.incubator.component.ComponentService;
import org.onosproject.incubator.net.intf.InterfaceService;
-import org.onosproject.net.config.NetworkConfigService;
-import org.onosproject.net.edge.EdgePortService;
-import org.onosproject.net.host.HostService;
-import org.onosproject.net.packet.InboundPacket;
-import org.onosproject.net.packet.PacketContext;
-import org.onosproject.net.packet.PacketProcessor;
import org.onosproject.net.packet.PacketService;
import org.onosproject.routing.IntentSynchronizationAdminService;
import org.onosproject.routing.IntentSynchronizationService;
-import org.onosproject.routing.RoutingService;
-import org.onosproject.routing.config.BgpConfig;
import org.slf4j.Logger;
import java.util.ArrayList;
@@ -49,7 +40,7 @@
* Component for the SDX-L3 application.
*/
@Component(immediate = true)
-public class SdxL3 {
+public class SdxL3 {
public static final String SDX_L3_APP = "org.onosproject.sdxl3";
@@ -62,9 +53,6 @@
protected ApplicationService applicationService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected NetworkConfigService networkConfigService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected InterfaceService interfaceService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
@@ -79,16 +67,6 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected PacketService packetService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected EdgePortService edgeService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected HostService hostService;
-
- protected SdxL3ArpHandler arpHandler = null;
-
- private InternalPacketProcessor processor = null;
-
private ApplicationId appId;
private static List<String> components = new ArrayList<>();
@@ -96,57 +74,23 @@
components.add("org.onosproject.routing.bgp.BgpSessionManager");
components.add("org.onosproject.routing.impl.Router");
components.add(org.onosproject.sdxl3.impl.SdxL3PeerManager.class.getName());
- components.add(org.onosproject.sdxl3.SdxL3Fib.class.getName());
+ components.add(SdxL3Fib.class.getName());
+ components.add(SdxL3ArpHandler.class.getName());
}
@Activate
protected void activate() {
components.forEach(name -> componentService.activate(appId, name));
-
appId = coreService.registerApplication(SDX_L3_APP);
-
- ApplicationId routerAppId = coreService.getAppId(RoutingService.ROUTER_APP_ID);
- BgpConfig bgpConfig =
- networkConfigService.getConfig(routerAppId, RoutingService.CONFIG_CLASS);
-
- arpHandler = new SdxL3ArpHandler(bgpConfig,
- edgeService,
- hostService,
- packetService,
- interfaceService);
- processor = new InternalPacketProcessor();
- packetService.addProcessor(processor, PacketProcessor.director(2));
-
// TODO fix removing intents
applicationService.registerDeactivateHook(appId,
intentSynchronizerAdmin::removeIntents);
-
log.info("SDX-L3 started");
}
@Deactivate
protected void deactivate() {
components.forEach(name -> componentService.deactivate(appId, name));
-
- packetService.removeProcessor(processor);
-
log.info("SDX-L3 stopped");
}
-
- private class InternalPacketProcessor implements PacketProcessor {
- @Override
- public void process(PacketContext context) {
-
- if (context.isHandled()) {
- return;
- }
-
- InboundPacket pkt = context.inPacket();
- Ethernet ethernet = pkt.parsed();
- if (ethernet.getEtherType() == Ethernet.TYPE_ARP) {
- arpHandler.processPacketIn(pkt);
- }
- }
- }
-
}
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3ArpHandler.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3ArpHandler.java
index a1643c3..64693ea 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3ArpHandler.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3ArpHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,11 @@
*/
package org.onosproject.sdxl3;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.packet.ARP;
import org.onlab.packet.Ethernet;
import org.onlab.packet.ICMP6;
@@ -27,39 +32,68 @@
import org.onlab.packet.ndp.NeighborAdvertisement;
import org.onlab.packet.ndp.NeighborDiscoveryOptions;
import org.onlab.packet.ndp.NeighborSolicitation;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
import org.onosproject.incubator.net.intf.Interface;
import org.onosproject.incubator.net.intf.InterfaceService;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.Host;
+import org.onosproject.net.config.NetworkConfigService;
import org.onosproject.net.edge.EdgePortService;
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.host.HostService;
import org.onosproject.net.packet.DefaultOutboundPacket;
import org.onosproject.net.packet.InboundPacket;
+import org.onosproject.net.packet.PacketContext;
+import org.onosproject.net.packet.PacketProcessor;
import org.onosproject.net.packet.PacketService;
+import org.onosproject.routing.RoutingService;
import org.onosproject.routing.config.BgpConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer;
import java.util.Set;
import java.util.stream.Collectors;
-import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.net.HostId.hostId;
import static org.onosproject.security.AppGuard.checkPermission;
import static org.onosproject.security.AppPermission.Type.PACKET_WRITE;
+/**
+ * Proxy-ARP functionality adapted to SDX-L3.
+ */
+@Component(immediate = true, enabled = false)
public class SdxL3ArpHandler {
-
private static final String REQUEST_NULL = "ARP or NDP request cannot be null.";
- private static final String MSG_NOT_REQUEST = "Message is not an ARP or NDP request";
+
+ private Logger log = LoggerFactory.getLogger(getClass());
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected CoreService coreService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected InterfaceService interfaceService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected EdgePortService edgeService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected HostService hostService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected PacketService packetService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected NetworkConfigService networkConfigService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected SdxL3PeerService sdxL3PeerService;
private BgpConfig bgpConfig;
- private EdgePortService edgeService;
- private HostService hostService;
- private PacketService packetService;
- private InterfaceService interfaceService;
+ private InternalPacketProcessor processor = null;
private enum Protocol {
ARP, NDP
@@ -69,20 +103,19 @@
REQUEST, REPLY
}
- /**
- * Creates an ArpHandler object.
- *
- */
- public SdxL3ArpHandler(BgpConfig bgpConfig,
- EdgePortService edgeService,
- HostService hostService,
- PacketService packetService,
- InterfaceService interfaceService) {
- this.bgpConfig = bgpConfig;
- this.edgeService = edgeService;
- this.hostService = hostService;
- this.packetService = packetService;
- this.interfaceService = interfaceService;
+ @Activate
+ public void activate() {
+ ApplicationId routerAppId = coreService.getAppId(RoutingService.ROUTER_APP_ID);
+ bgpConfig = networkConfigService.getConfig(routerAppId, RoutingService.CONFIG_CLASS);
+ processor = new InternalPacketProcessor();
+ packetService.addProcessor(processor, PacketProcessor.director(2));
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ packetService.removeProcessor(processor);
+ log.info("Stopped");
}
/**
@@ -90,7 +123,7 @@
*
* @param pkt incoming packet
*/
- public void processPacketIn(InboundPacket pkt) {
+ protected void processPacketIn(InboundPacket pkt) {
checkPermission(PACKET_WRITE);
Ethernet eth = pkt.parsed();
@@ -99,7 +132,63 @@
ConnectPoint inPort = pkt.receivedFrom();
MessageContext context = createContext(eth, inPort);
if (context != null) {
- replyInternal(context);
+ if (context.type() == MessageType.REQUEST) {
+ handleRequest(context);
+ } else if (context.type() == MessageType.REPLY) {
+ handleReply(context);
+ }
+ }
+ }
+
+ /**
+ * Handles a reply message only in the case it concerns a reply from an
+ * internal speaker to external peer where VLAN translation is necessary.
+ *
+ * @param context reply message context to process
+ */
+ private void handleReply(MessageContext context) {
+ if (fromPeerToSpeaker(context)) {
+ translateVlanAndSendToSpeaker(context);
+ } else if (fromPeerToPeer(context)) {
+ translateVlanAndSendToPeer(context);
+ }
+ }
+
+ private boolean fromPeerToSpeaker(MessageContext context) {
+ return sdxL3PeerService != null &&
+ isPeerAddress(context.sender()) &&
+ !interfaceService.getInterfacesByIp(context.target()).isEmpty();
+ }
+
+ /**
+ * Makes the VLAN translation if necessary and sends the packet at the port
+ * configured for the speaker.
+ *
+ * @param context reply message context to process
+ */
+ private void translateVlanAndSendToSpeaker(MessageContext context) {
+ BgpConfig.BgpSpeakerConfig speaker =
+ bgpConfig.getSpeakerFromPeer(context.sender());
+ if (speaker != null) {
+ Interface peeringInterface = sdxL3PeerService.getInterfaceForPeer(context.sender());
+ if (context.vlan().equals(peeringInterface.vlan())) {
+ context.setVlan(speaker.vlan());
+ sendTo(context.packet(), speaker.connectPoint());
+ }
+ }
+ }
+
+ /**
+ * Makes the VLAN translation if necessary and sends the packet at the port
+ * configured for the peer.
+ *
+ * @param context reply message context to process
+ */
+ private void translateVlanAndSendToPeer(MessageContext context) {
+ Interface interfaceForPeer = sdxL3PeerService.getInterfaceForPeer(context.target());
+ if (interfaceForPeer != null) {
+ context.setVlan(interfaceForPeer.vlan());
+ sendTo(context.packet(), interfaceForPeer.connectPoint());
}
}
@@ -112,22 +201,19 @@
*
* @param context request message context to process
*/
- private void replyInternal(MessageContext context) {
- checkNotNull(context);
- checkArgument(context.type() == MessageType.REQUEST, MSG_NOT_REQUEST);
-
+ private void handleRequest(MessageContext context) {
if (hasIpAddress(context.inPort())) {
// If the request came from outside the network, only reply if it was
// for one of our external addresses.
interfaceService.getInterfacesByPort(context.inPort())
.stream()
- .filter(intf -> intf.ipAddresses()
+ .filter(intf -> intf.ipAddressesList()
.stream()
.anyMatch(ia -> ia.ipAddress().equals(context.target())))
.forEach(intf -> buildAndSendReply(context, intf.mac()));
- if (!isPeerAddress(context.sender()) || !isPeerAddress(context.target())) {
+ if (!fromPeerToPeer(context)) {
// Only care about requests from/towards external BGP peers
return;
}
@@ -139,6 +225,14 @@
Host dst = null;
Host src = hostService.getHost(hostId(context.srcMac(), context.vlan()));
+ // If the request concerns an external BGP peer address and an internal
+ // BGP speaker or is between external BGP peers, VLAN translation may be
+ // necessary on the ARP request.
+ if (fromSpeakerToPeer(context) || fromPeerToPeer(context)) {
+ translateVlanAndSendToPeer(context);
+ return;
+ }
+
for (Host host : hosts) {
if (host.vlan().equals(context.vlan())) {
dst = host;
@@ -189,6 +283,31 @@
flood(context.packet(), context.inPort());
}
+ private boolean fromPeerToPeer(MessageContext context) {
+ return isPeerAddress(context.sender()) && isPeerAddress(context.target());
+ }
+
+ private boolean fromSpeakerToPeer(MessageContext context) {
+ return sdxL3PeerService != null &&
+ isPeerAddress(context.target()) &&
+ !interfaceService.getInterfacesByIp(context.sender()).isEmpty();
+ }
+
+ /**
+ * Makes the VLAN translation if necessary on the packet.
+ *
+ * @param context request message context to process
+ */
+ private VlanId getDestinationPeerVlan(MessageContext context) {
+ return sdxL3PeerService.getInterfaceForPeer(context.target()).vlan();
+ }
+
+ /**
+ * Controls whether an IP address is configured for an external peer.
+ *
+ * @param ip the examined IP address
+ * @return result of the control
+ */
private boolean isPeerAddress(IpAddress ip) {
return bgpConfig.bgpSpeakers()
.stream()
@@ -199,7 +318,7 @@
private Set<Interface> filterVlanInterfacesNoIp(Set<Interface> vlanInterfaces) {
return vlanInterfaces
.stream()
- .filter(intf -> intf.ipAddresses().isEmpty())
+ .filter(intf -> intf.ipAddressesList().isEmpty())
.collect(Collectors.toSet());
}
@@ -215,7 +334,8 @@
Set<Interface> vlanInterfaces = interfaceService.getInterfacesByVlan(vlanId);
return interfaceService.getInterfacesByVlan(vlanId)
.stream()
- .anyMatch(intf -> intf.connectPoint().equals(connectPoint) && intf.ipAddresses().isEmpty())
+ .anyMatch(intf -> intf.connectPoint().equals(connectPoint) &&
+ intf.ipAddressesList().isEmpty())
&& vlanInterfaces.size() > 1;
}
@@ -281,7 +401,7 @@
private boolean hasIpAddress(ConnectPoint connectPoint) {
return interfaceService.getInterfacesByPort(connectPoint)
.stream()
- .flatMap(intf -> intf.ipAddresses().stream())
+ .flatMap(intf -> intf.ipAddressesList().stream())
.findAny()
.isPresent();
}
@@ -302,7 +422,7 @@
}
/**
- * Flood the arp request at all edges on a specifc VLAN.
+ * Floods the arp request at all edges on a specifc VLAN.
*
* @param request the arp request
* @param dsts the destination interfaces
@@ -457,7 +577,7 @@
ICMP6 icmpv6 = (ICMP6) ipv6.getPayload();
IpAddress sender = Ip6Address.valueOf(ipv6.getSourceAddress());
- IpAddress target = null;
+ IpAddress target = Ip6Address.valueOf(ipv6.getDestinationAddress());
MessageType type;
if (icmpv6.getIcmpType() == ICMP6.NEIGHBOR_SOLICITATION) {
@@ -530,6 +650,26 @@
public IpAddress sender() {
return sender;
}
+
+ public void setVlan(VlanId vlanId) {
+ this.eth.setVlanID(vlanId.toShort());
+ }
+ }
+
+ private class InternalPacketProcessor implements PacketProcessor {
+ @Override
+ public void process(PacketContext context) {
+
+ if (context.isHandled()) {
+ return;
+ }
+
+ InboundPacket pkt = context.inPacket();
+ Ethernet ethernet = pkt.parsed();
+ if (ethernet.getEtherType() == Ethernet.TYPE_ARP) {
+ processPacketIn(pkt);
+ }
+ }
}
}
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3Fib.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3Fib.java
index 9cd228d..2a64240 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3Fib.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3Fib.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3PeerService.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3PeerService.java
index c0a7a77..9b8e2d2 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3PeerService.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3PeerService.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
import org.onosproject.incubator.net.intf.Interface;
import org.onosproject.net.ConnectPoint;
import org.onosproject.routing.config.BgpConfig;
-import org.onosproject.sdxl3.config.SdxProvidersConfig;
+import org.onosproject.sdxl3.config.SdxParticipantsConfig;
import java.util.List;
@@ -29,8 +29,8 @@
*/
public interface SdxL3PeerService {
- Class<SdxProvidersConfig> CONFIG_CLASS = SdxProvidersConfig.class;
- String CONFIG_KEY = "providers";
+ Class<SdxParticipantsConfig> CONFIG_CLASS = SdxParticipantsConfig.class;
+ String CONFIG_KEY = "participants";
/**
* Returns the list of IP addresses of BGP peers.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/AddPeerDetailsCommand.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/AddPeerDetailsCommand.java
index acc4579..dae6b49 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/AddPeerDetailsCommand.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/AddPeerDetailsCommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/BgpPeersListCommand.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/BgpPeersListCommand.java
index 2e22bed..b50c2e2 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/BgpPeersListCommand.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/BgpPeersListCommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
import org.onosproject.routing.config.BgpConfig;
import org.onosproject.sdxl3.SdxL3;
import org.onosproject.sdxl3.SdxL3PeerService;
-import org.onosproject.sdxl3.config.SdxProvidersConfig;
+import org.onosproject.sdxl3.config.SdxParticipantsConfig;
import java.util.Comparator;
import java.util.List;
@@ -46,7 +46,7 @@
private static final String NAME_FORMAT = "%s: " + DETAILS_FORMAT;
public static final String NO_PEERS = "No peers configured";
- private static final Comparator<SdxProvidersConfig.PeerConfig> PEER_COMPARATOR =
+ private static final Comparator<SdxParticipantsConfig.PeerConfig> PEER_COMPARATOR =
Comparator.comparing(p -> p.ip());
public static final String EMPTY = "";
@@ -60,8 +60,8 @@
BgpConfig bgpConfig = configService.getConfig(routerAppId, RoutingService.CONFIG_CLASS);
ApplicationId sdxL3AppId = coreService.getAppId(SdxL3.SDX_L3_APP);
- SdxProvidersConfig peersConfig = configService.
- getConfig(sdxL3AppId, SdxProvidersConfig.class);
+ SdxParticipantsConfig peersConfig = configService.
+ getConfig(sdxL3AppId, SdxParticipantsConfig.class);
if (bgpConfig == null && peersConfig == null) {
print(NO_PEERS);
@@ -74,7 +74,7 @@
peeringAddresses = peerService.getPeerAddresses(bgpConfig);
}
- List<SdxProvidersConfig.PeerConfig> bgpPeers =
+ List<SdxParticipantsConfig.PeerConfig> bgpPeers =
Lists.newArrayList();
if (peersConfig != null) {
// Get all peers having details specified
@@ -103,15 +103,15 @@
});
}
- private List<SdxProvidersConfig.PeerConfig> mergePeers(
+ private List<SdxParticipantsConfig.PeerConfig> mergePeers(
List<IpAddress> peeringAddresses,
- List<SdxProvidersConfig.PeerConfig> bgpPeers) {
+ List<SdxParticipantsConfig.PeerConfig> bgpPeers) {
peeringAddresses.forEach(a -> {
boolean exists = bgpPeers.stream()
.filter(p -> p.ip().equals(a))
.findAny().isPresent();
if (!exists) {
- bgpPeers.add(new SdxProvidersConfig
+ bgpPeers.add(new SdxParticipantsConfig
.PeerConfig(Optional.<String>empty(), a, null, EMPTY));
}
});
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/RemovePeerDetailsCommand.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/RemovePeerDetailsCommand.java
index 8eee2ba..a8e1bb9 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/RemovePeerDetailsCommand.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/RemovePeerDetailsCommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/package-info.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/package-info.java
index a5216de..0aa9aed 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/package-info.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/config/SdxProvidersConfig.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/config/SdxParticipantsConfig.java
similarity index 98%
rename from sdx-l3/src/main/java/org/onosproject/sdxl3/config/SdxProvidersConfig.java
rename to sdx-l3/src/main/java/org/onosproject/sdxl3/config/SdxParticipantsConfig.java
index 8206fda..6d3dfce 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/config/SdxProvidersConfig.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/config/SdxParticipantsConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@
* Configuration for the Service Providers being connected to the
* software defined internet exchange point.
*/
-public class SdxProvidersConfig extends Config<ApplicationId> {
+public class SdxParticipantsConfig extends Config<ApplicationId> {
public static final String PEERS = "bgpPeers";
public static final String NAME = "name";
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/config/package-info.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/config/package-info.java
index ebcfa19..14c6552 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/config/package-info.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/config/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3PeerManager.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3PeerManager.java
index dfa68ba..e9105a3 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3PeerManager.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3PeerManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.TpPort;
+import org.onlab.packet.VlanId;
import org.onlab.util.ItemNotFoundException;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
@@ -54,7 +55,7 @@
import org.onosproject.routing.config.BgpConfig;
import org.onosproject.sdxl3.SdxL3;
import org.onosproject.sdxl3.SdxL3PeerService;
-import org.onosproject.sdxl3.config.SdxProvidersConfig;
+import org.onosproject.sdxl3.config.SdxParticipantsConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -103,8 +104,8 @@
new ConfigFactory(SubjectFactories.APP_SUBJECT_FACTORY,
CONFIG_CLASS, CONFIG_KEY) {
@Override
- public SdxProvidersConfig createConfig() {
- return new SdxProvidersConfig();
+ public SdxParticipantsConfig createConfig() {
+ return new SdxParticipantsConfig();
}
};
@@ -146,7 +147,10 @@
* @param interfaceName Name of the interface configured on port
*/
@Override
- public void addPeerDetails(String peerName, IpAddress peerAddress, ConnectPoint port, String interfaceName) {
+ public void addPeerDetails(String peerName,
+ IpAddress peerAddress,
+ ConnectPoint port,
+ String interfaceName) {
BgpConfig bgpConfig = getBgpConfig();
if (bgpConfig == null) {
@@ -178,15 +182,15 @@
}
}
- SdxProvidersConfig peersConfig =
- configService.addConfig(sdxAppId, SdxProvidersConfig.class);
+ SdxParticipantsConfig peersConfig =
+ configService.addConfig(sdxAppId, SdxParticipantsConfig.class);
if (peerName != null && peerNameExists(peersConfig, peerName)) {
throw new IllegalArgumentException("Peer name in use");
}
addPeerToConf(peersConfig, peerName, peerAddress, port, interfaceName);
configService.
- applyConfig(sdxAppId, SdxProvidersConfig.class, peersConfig.node());
+ applyConfig(sdxAppId, SdxParticipantsConfig.class, peersConfig.node());
}
/**
@@ -201,8 +205,8 @@
throw new ItemNotFoundException("BGP configuration not found");
}
- SdxProvidersConfig peersConfig =
- configService.addConfig(sdxAppId, SdxProvidersConfig.class);
+ SdxParticipantsConfig peersConfig =
+ configService.addConfig(sdxAppId, SdxParticipantsConfig.class);
if (peersConfig.getPeerForIp(peerAddress) == null) {
throw new ItemNotFoundException("Peer details not found");
@@ -210,7 +214,7 @@
removePeerFromConf(peersConfig, peerAddress);
configService.applyConfig(sdxAppId,
- SdxProvidersConfig.class,
+ SdxParticipantsConfig.class,
peersConfig.node());
}
@@ -244,7 +248,7 @@
}
private boolean interfaceSubnetIncludesIp(Interface peerInterface, IpAddress peerAddress) {
- if (peerInterface.ipAddresses().stream()
+ if (peerInterface.ipAddressesList().stream()
.anyMatch(intfIp -> intfIp.subnetAddress().
contains(peerAddress))) {
// Interface configured subnet not including peer address
@@ -253,7 +257,7 @@
return false;
}
- private boolean peerNameExists(SdxProvidersConfig config, String peerName) {
+ private boolean peerNameExists(SdxParticipantsConfig config, String peerName) {
if (config.getPeerForName(Optional.of(peerName)) == null) {
return false;
}
@@ -265,11 +269,11 @@
*
* @param peersConfig the BGP peers configuration
*/
- private void addPeerToConf(SdxProvidersConfig peersConfig, String peerName,
+ private void addPeerToConf(SdxParticipantsConfig peersConfig, String peerName,
IpAddress peerAddress, ConnectPoint port,
String interfaceName) {
log.debug("Adding peer with IP to configuration: {}", peerAddress);
- SdxProvidersConfig.PeerConfig peer = new SdxProvidersConfig.
+ SdxParticipantsConfig.PeerConfig peer = new SdxParticipantsConfig.
PeerConfig(Optional.ofNullable(peerName), peerAddress,
port, interfaceName);
@@ -281,7 +285,7 @@
*
* @param peersConfig the BGP peeers configuration
*/
- private void removePeerFromConf(SdxProvidersConfig peersConfig,
+ private void removePeerFromConf(SdxParticipantsConfig peersConfig,
IpAddress peerAddress) {
log.debug("Removing peer details from configuration: {}",
peerAddress.toString());
@@ -311,7 +315,7 @@
return null;
}
- SdxProvidersConfig config = configService.getConfig(sdxAppId, SdxProvidersConfig.class);
+ SdxParticipantsConfig config = configService.getConfig(sdxAppId, SdxParticipantsConfig.class);
if (config == null) {
return null;
}
@@ -395,6 +399,9 @@
private Collection<PointToPointIntent> buildSpeakerIntents(BgpConfig.BgpSpeakerConfig speaker) {
List<PointToPointIntent> intents = new ArrayList<>();
+ // Get the BGP Speaker VLAN Id
+ VlanId bgpSpeakerVlanId = speaker.vlan();
+
for (IpAddress peerAddress : speaker.peers()) {
Interface peeringInterface = getInterfaceForPeer(peerAddress);
@@ -404,18 +411,23 @@
continue;
}
- IpAddress peeringAddress = null;
- for (InterfaceIpAddress address : peeringInterface.ipAddresses()) {
+ IpAddress bgpSpeakerAddress = null;
+ for (InterfaceIpAddress address : peeringInterface.ipAddressesList()) {
if (address.subnetAddress().contains(peerAddress)) {
- peeringAddress = address.ipAddress();
+ bgpSpeakerAddress = address.ipAddress();
break;
}
}
- checkNotNull(peeringAddress);
+ checkNotNull(bgpSpeakerAddress);
- intents.addAll(buildIntents(speaker.connectPoint(), peeringAddress,
- peeringInterface.connectPoint(), peerAddress));
+ VlanId peerVlanId = peeringInterface.vlan();
+
+ intents.addAll(buildIntents(speaker.connectPoint(), bgpSpeakerVlanId,
+ bgpSpeakerAddress,
+ peeringInterface.connectPoint(),
+ peerVlanId,
+ peerAddress));
}
return intents;
@@ -426,19 +438,24 @@
* IP addresses.
*
* @param portOne the first connect point
+ * @param vlanOne the ingress VLAN
* @param ipOne the first IP address
* @param portTwo the second connect point
+ * @param vlanTwo the egress VLAN
* @param ipTwo the second IP address
* @return the intents to install
*/
private Collection<PointToPointIntent> buildIntents(ConnectPoint portOne,
+ VlanId vlanOne,
IpAddress ipOne,
ConnectPoint portTwo,
+ VlanId vlanTwo,
IpAddress ipTwo) {
List<PointToPointIntent> intents = new ArrayList<>();
- TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
+ TrafficTreatment.Builder treatmentToPeer = DefaultTrafficTreatment.builder();
+ TrafficTreatment.Builder treatmentToSpeaker = DefaultTrafficTreatment.builder();
TrafficSelector selector;
Key key;
@@ -453,8 +470,14 @@
icmpProtocol = IPv6.PROTOCOL_ICMP6;
}
- // Path from BGP speaker to BGP peer matching destination TCP connectPoint 179
+ // Add treatment for VLAN for traffic going from BGP speaker to BGP peer
+ if (!vlanTwo.equals(VlanId.NONE)) {
+ treatmentToPeer.setVlanId(vlanTwo);
+ }
+
+ // Path from BGP speaker to BGP peer matching destination TCP port 179
selector = buildSelector(tcpProtocol,
+ vlanOne,
ipOne,
ipTwo,
null,
@@ -466,14 +489,15 @@
.appId(sdxAppId)
.key(key)
.selector(selector)
- .treatment(treatment)
+ .treatment(treatmentToPeer.build())
.ingressPoint(portOne)
.egressPoint(portTwo)
.priority(PRIORITY_OFFSET)
.build());
- // Path from BGP speaker to BGP peer matching source TCP connectPoint 179
+ // Path from BGP speaker to BGP peer matching source TCP port 179
selector = buildSelector(tcpProtocol,
+ vlanOne,
ipOne,
ipTwo,
BGP_PORT,
@@ -485,52 +509,15 @@
.appId(sdxAppId)
.key(key)
.selector(selector)
- .treatment(treatment)
+ .treatment(treatmentToPeer.build())
.ingressPoint(portOne)
.egressPoint(portTwo)
.priority(PRIORITY_OFFSET)
.build());
- // Path from BGP peer to BGP speaker matching destination TCP connectPoint 179
- selector = buildSelector(tcpProtocol,
- ipTwo,
- ipOne,
- null,
- BGP_PORT);
-
- key = buildKey(ipTwo, ipOne, SUFFIX_DST);
-
- intents.add(PointToPointIntent.builder()
- .appId(sdxAppId)
- .key(key)
- .selector(selector)
- .treatment(treatment)
- .ingressPoint(portTwo)
- .egressPoint(portOne)
- .priority(PRIORITY_OFFSET)
- .build());
-
- // Path from BGP peer to BGP speaker matching source TCP connectPoint 179
- selector = buildSelector(tcpProtocol,
- ipTwo,
- ipOne,
- BGP_PORT,
- null);
-
- key = buildKey(ipTwo, ipOne, SUFFIX_SRC);
-
- intents.add(PointToPointIntent.builder()
- .appId(sdxAppId)
- .key(key)
- .selector(selector)
- .treatment(treatment)
- .ingressPoint(portTwo)
- .egressPoint(portOne)
- .priority(PRIORITY_OFFSET)
- .build());
-
// ICMP path from BGP speaker to BGP peer
selector = buildSelector(icmpProtocol,
+ vlanOne,
ipOne,
ipTwo,
null,
@@ -542,14 +529,60 @@
.appId(sdxAppId)
.key(key)
.selector(selector)
- .treatment(treatment)
+ .treatment(treatmentToPeer.build())
.ingressPoint(portOne)
.egressPoint(portTwo)
.priority(PRIORITY_OFFSET)
.build());
+ // Add treatment for VLAN for traffic going from BGP peer to BGP speaker
+ if (!vlanOne.equals(VlanId.NONE)) {
+ treatmentToSpeaker.setVlanId(vlanOne);
+ }
+
+ // Path from BGP peer to BGP speaker matching destination TCP port 179
+ selector = buildSelector(tcpProtocol,
+ vlanTwo,
+ ipTwo,
+ ipOne,
+ null,
+ BGP_PORT);
+
+ key = buildKey(ipTwo, ipOne, SUFFIX_DST);
+
+ intents.add(PointToPointIntent.builder()
+ .appId(sdxAppId)
+ .key(key)
+ .selector(selector)
+ .treatment(treatmentToSpeaker.build())
+ .ingressPoint(portTwo)
+ .egressPoint(portOne)
+ .priority(PRIORITY_OFFSET)
+ .build());
+
+ // Path from BGP peer to BGP speaker matching source TCP port 179
+ selector = buildSelector(tcpProtocol,
+ vlanTwo,
+ ipTwo,
+ ipOne,
+ BGP_PORT,
+ null);
+
+ key = buildKey(ipTwo, ipOne, SUFFIX_SRC);
+
+ intents.add(PointToPointIntent.builder()
+ .appId(sdxAppId)
+ .key(key)
+ .selector(selector)
+ .treatment(treatmentToSpeaker.build())
+ .ingressPoint(portTwo)
+ .egressPoint(portOne)
+ .priority(PRIORITY_OFFSET)
+ .build());
+
// ICMP path from BGP peer to BGP speaker
selector = buildSelector(icmpProtocol,
+ vlanTwo,
ipTwo,
ipOne,
null,
@@ -561,7 +594,7 @@
.appId(sdxAppId)
.key(key)
.selector(selector)
- .treatment(treatment)
+ .treatment(treatmentToSpeaker.build())
.ingressPoint(portTwo)
.egressPoint(portOne)
.priority(PRIORITY_OFFSET)
@@ -574,16 +607,23 @@
* Builds a traffic selector based on the set of input parameters.
*
* @param ipProto IP protocol
+ * @param ingressVlanId VLAN Id configured on the ingress interface
* @param srcIp source IP address
* @param dstIp destination IP address
- * @param srcTcpPort source TCP connectPoint, or null if shouldn't be set
- * @param dstTcpPort destination TCP connectPoint, or null if shouldn't be set
+ * @param srcTcpPort source TCP port, or null if shouldn't be set
+ * @param dstTcpPort destination TCP port, or null if shouldn't be set
* @return the new traffic selector
*/
- private TrafficSelector buildSelector(byte ipProto, IpAddress srcIp,
+ private TrafficSelector buildSelector(byte ipProto,
+ VlanId ingressVlanId,
+ IpAddress srcIp,
IpAddress dstIp, Short srcTcpPort,
Short dstTcpPort) {
TrafficSelector.Builder builder = DefaultTrafficSelector.builder().matchIPProtocol(ipProto);
+ // Match on any VLAN Id if a VLAN Id configured on the ingress interface
+ if (!ingressVlanId.equals(VlanId.NONE)) {
+ builder.matchVlanId(VlanId.ANY);
+ }
if (dstIp.isIp4()) {
builder.matchEthType(Ethernet.TYPE_IPV4)
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/package-info.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/package-info.java
index d172822..81773cb 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/package-info.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/package-info.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/package-info.java
index eb7b599..6869796 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/package-info.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/sdx-l3/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/sdx-l3/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 237a9dc..6c3a84d 100644
--- a/sdx-l3/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/sdx-l3/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -1,5 +1,5 @@
<!--
- ~ Copyright 2014-2015 Open Networking Laboratory
+ ~ Copyright 2016-present Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
diff --git a/sdx-l3/src/main/resources/config-examples/network-cfg.json b/sdx-l3/src/main/resources/config-examples/network-cfg.json
index 7100e7a..31fde3f 100644
--- a/sdx-l3/src/main/resources/config-examples/network-cfg.json
+++ b/sdx-l3/src/main/resources/config-examples/network-cfg.json
@@ -50,7 +50,7 @@
},
"apps" : {
"org.onosproject.sdxl3": {
- "providers": {
+ "participants": {
"bgpPeers": [
{
"name": "AS1-Router1",
diff --git a/sdx-l3/src/main/resources/config-examples/route-server_network-cfg.json b/sdx-l3/src/main/resources/config-examples/route-server_network-cfg.json
index 1bdc232..e4df2f8 100644
--- a/sdx-l3/src/main/resources/config-examples/route-server_network-cfg.json
+++ b/sdx-l3/src/main/resources/config-examples/route-server_network-cfg.json
@@ -21,7 +21,7 @@
},
"apps" : {
"org.onosproject.sdxl3" : {
- "providers" : {
+ "participants" : {
"bgpPeers": [
{
"name": "AS65001-R1",
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3ArpHandlerTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3ArpHandlerTest.java
index e32a63d..0608ee6 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3ArpHandlerTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3ArpHandlerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
package org.onosproject.sdxl3;
+import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.junit.Before;
import org.junit.Test;
@@ -34,6 +35,10 @@
import org.onlab.packet.ndp.NeighborAdvertisement;
import org.onlab.packet.ndp.NeighborDiscoveryOptions;
import org.onlab.packet.ndp.NeighborSolicitation;
+import org.onosproject.TestApplicationId;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.core.CoreServiceAdapter;
import org.onosproject.incubator.net.intf.Interface;
import org.onosproject.incubator.net.intf.InterfaceService;
import org.onosproject.net.ConnectPoint;
@@ -46,6 +51,9 @@
import org.onosproject.net.Link;
import org.onosproject.net.Port;
import org.onosproject.net.PortNumber;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.config.NetworkConfigServiceAdapter;
import org.onosproject.net.device.DeviceListener;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.edge.EdgePortService;
@@ -60,14 +68,17 @@
import org.onosproject.net.packet.OutboundPacket;
import org.onosproject.net.packet.PacketServiceAdapter;
import org.onosproject.net.provider.ProviderId;
+import org.onosproject.routing.RoutingService;
import org.onosproject.routing.config.BgpConfig;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import java.util.Set;
@@ -90,6 +101,10 @@
* also included.
*/
public class SdxL3ArpHandlerTest {
+ private static final ApplicationId ROUTER_APPID =
+ TestApplicationId.create("foo");
+ private static final ApplicationId SDXL3_APPID =
+ TestApplicationId.create("bar");
private static final int NUM_DEVICES = 10;
private static final int NUM_PORTS_PER_DEVICE = 3;
@@ -111,6 +126,7 @@
private static final MacAddress MAC2 = MacAddress.valueOf("00:00:00:00:00:02");
private static final MacAddress MAC3 = MacAddress.valueOf("00:00:00:00:00:03");
private static final MacAddress MAC4 = MacAddress.valueOf("00:00:00:00:00:04");
+ private static final MacAddress MAC5 = MacAddress.valueOf("00:00:00:00:00:05");
private static final MacAddress MAC10 = MacAddress.valueOf("00:00:00:00:00:0A");
private static final MacAddress SOLICITED_MAC3 = MacAddress.valueOf("33:33:FF:00:00:01");
@@ -119,22 +135,44 @@
private static final HostId HID2 = HostId.hostId(MAC2, VLAN1);
private static final HostId HID3 = HostId.hostId(MAC3, VLAN1);
private static final HostId HID4 = HostId.hostId(MAC4, VLAN1);
+ private static final HostId HID5 = HostId.hostId(MAC5, VLAN1);
private static final HostId HID10 = HostId.hostId(MAC10, VLAN10);
private static final DeviceId DID1 = getDeviceId(1);
private static final DeviceId DID2 = getDeviceId(2);
+ private static final DeviceId DID3 = getDeviceId(100);
private static final PortNumber P1 = PortNumber.portNumber(1);
private static final ConnectPoint CP1 = new ConnectPoint(DID1, P1);
private static final ConnectPoint CP2 = new ConnectPoint(DID2, P1);
+ private static final ConnectPoint CP3 = new ConnectPoint(DID3, P1);
private static final HostLocation LOC1 = new HostLocation(DID1, P1, 123L);
+ private static final HostLocation LOC2 = new HostLocation(DID2, P1, 123L);
- private static final String PEER1_IP = "10.0.1.201";
- private static final String PEER2_IP = "10.0.1.101";
- private static final String PEER1_IP6 = "1000::1";
- private static final String PEER2_IP6 = "1000::100";
+ private static final String SPEAKER_IP_STRING = "10.0.2.201";
+ private static final Ip4Address SPEAKER_IP = Ip4Address.valueOf(SPEAKER_IP_STRING);
+ private static final IpPrefix INTF1_IP_PREFIX = IpPrefix.valueOf(SPEAKER_IP_STRING + "/24");
+ private static final String PEER1_IP_STRING = "10.0.1.1";
+ private static final Ip4Address PEER1_IP = Ip4Address.valueOf(PEER1_IP_STRING);
+ private static final String PEER2_IP_STRING = "10.0.1.2";
+ private static final Ip4Address PEER2_IP = Ip4Address.valueOf(PEER2_IP_STRING);
+ private static final String PEER3_IP_STRING = "10.0.2.1";
+ private static final Ip4Address PEER3_IP = Ip4Address.valueOf(PEER3_IP_STRING);
+ private static final String SPEAKER_IP6_STRING = "1001::1";
+ private static final Ip6Address SPEAKER_IP6 = Ip6Address.valueOf(SPEAKER_IP6_STRING);
+ private static final IpPrefix INTF2_IP6_PREFIX = IpPrefix.valueOf(SPEAKER_IP6_STRING + "/64");
+ private static final String PEER1_IP6_STRING = "1001::100";
+ private static final Ip6Address PEER1_IP6 = Ip6Address.valueOf(PEER1_IP6_STRING);
+ private static final String PEER2_IP6_STRING = "1001::200";
+ private static final Ip6Address PEER2_IP6 = Ip6Address.valueOf(PEER2_IP6_STRING);
+ private static final String PEER3_IP6_STRING = "1001::1000";
+ private static final Ip6Address PEER3_IP6 = Ip6Address.valueOf(PEER3_IP6_STRING);
+ private static final String INTF1_NAME = "intf1";
+ private static final String INTF2_NAME = "intf2";
+ private static final String INTF_NAME_PREFIX = "intf";
+ private static final String NO_NAME = "";
private final byte[] zeroMacAddress = MacAddress.ZERO.toBytes();
@@ -152,22 +190,28 @@
private SdxL3ArpHandler proxyArp;
- private BgpConfig bgpConfig;
- private TestPacketService packetService;
- private DeviceService deviceService;
- private EdgePortService edgePortService;
- private LinkService linkService;
- private HostService hostService;
+ private CoreService coreService;
private InterfaceService interfaceService;
+ private EdgePortService edgePortService;
+ private HostService hostService;
+ private TestPacketService packetService;
+ private NetworkConfigService networkConfigService;
+ private SdxL3PeerService sdxL3PeerService;
+ private BgpConfig bgpConfig;
+
+ private DeviceService deviceService;
+ private LinkService linkService;
@Before
public void setUp() throws Exception {
-
- bgpConfig = createMock(BgpConfig.class);
- packetService = new TestPacketService();
- hostService = createMock(HostService.class);
- edgePortService = createMock(EdgePortService.class);
interfaceService = createMock(InterfaceService.class);
+ edgePortService = createMock(EdgePortService.class);
+ hostService = createMock(HostService.class);
+ sdxL3PeerService = createMock(SdxL3PeerService.class);
+ bgpConfig = createMock(BgpConfig.class);
+ coreService = new TestCoreService();
+ packetService = new TestPacketService();
+ networkConfigService = new TestNetworkConfigService();
// Create the topology
createTopology();
@@ -176,11 +220,15 @@
setupconfigIpCPoints();
setupconfigVlanCPoints();
- proxyArp = new SdxL3ArpHandler(bgpConfig,
- edgePortService,
- hostService,
- packetService,
- interfaceService);
+ proxyArp = new SdxL3ArpHandler();
+ proxyArp.coreService = coreService;
+ proxyArp.interfaceService = interfaceService;
+ proxyArp.edgeService = edgePortService;
+ proxyArp.hostService = hostService;
+ proxyArp.packetService = packetService;
+ proxyArp.networkConfigService = networkConfigService;
+ proxyArp.sdxL3PeerService = sdxL3PeerService;
+ proxyArp.activate();
}
/**
@@ -204,7 +252,7 @@
createLinks(NUM_DEVICES);
addIntfConfig();
addEmptyBgpConfig();
- popluateEdgePortService();
+ populateEdgePortService();
}
/**
@@ -276,6 +324,7 @@
Set<Interface> interfaces = Sets.newHashSet();
Set<Interface> vlanOneSet = new HashSet<>();
+ Set<Interface> vlanTwoSet = new HashSet<>();
for (int i = 1; i <= LAST_CONF_DEVICE_INTF_VLAN_IP; i++) {
ConnectPoint cp = new ConnectPoint(getDeviceId(i), P1);
@@ -297,33 +346,42 @@
InterfaceIpAddress ia4 = new InterfaceIpAddress(addr4, prefix4);
// Setting up interfaces
- Interface intf1 = new Interface(cp, Sets.newHashSet(ia1, ia3),
+ Interface intf1 = new Interface(INTF1_NAME, cp,
+ Lists.newArrayList(ia1, ia3),
MacAddress.valueOf(2 * i - 1),
- VlanId.vlanId((short) 1));
- Interface intf2 = new Interface(cp, Sets.newHashSet(ia2, ia4),
+ VLAN1);
+ Interface intf2 = new Interface(INTF2_NAME, cp,
+ Lists.newArrayList(ia2, ia4),
MacAddress.valueOf(2 * i),
- VlanId.NONE);
+ VLAN2);
interfaces.add(intf1);
interfaces.add(intf2);
vlanOneSet.add(intf1);
+ vlanTwoSet.add(intf2);
expect(interfaceService.getInterfacesByPort(cp))
.andReturn(Sets.newHashSet(intf1, intf2)).anyTimes();
}
for (int i = LAST_CONF_DEVICE_INTF_VLAN_IP + 1; i <= LAST_CONF_DEVICE_INTF_VLAN; i++) {
ConnectPoint cp = new ConnectPoint(getDeviceId(i), P1);
- Interface intf1 = new Interface(cp, Collections.emptyList(),
- MacAddress.NONE,
- VlanId.vlanId((short) 1));
+ Interface intf = new Interface(INTF_NAME_PREFIX + i, cp,
+ Collections.emptyList(),
+ MacAddress.NONE,
+ VlanId.vlanId((short) 1));
- interfaces.add(intf1);
- vlanOneSet.add(intf1);
+ interfaces.add(intf);
+ vlanOneSet.add(intf);
expect(interfaceService.getInterfacesByPort(cp))
- .andReturn(Sets.newHashSet(intf1)).anyTimes();
+ .andReturn(Sets.newHashSet(intf)).anyTimes();
}
+ expect(interfaceService.getInterfacesByPort(CP3))
+ .andReturn(Collections.emptySet()).anyTimes();
+
+ expect(interfaceService.getInterfacesByVlan(VlanId.NONE))
+ .andReturn(vlanTwoSet).anyTimes();
expect(interfaceService.getInterfacesByVlan(VLAN1))
.andReturn(vlanOneSet).anyTimes();
expect(interfaceService.getInterfacesByVlan(VLAN10))
@@ -345,6 +403,7 @@
Set<BgpConfig.BgpSpeakerConfig> speakers = Sets.newHashSet();
expect(bgpConfig.bgpSpeakers()).andReturn(speakers).anyTimes();
+ expect(bgpConfig.getSpeakerFromPeer(anyObject())).andReturn(null).anyTimes();
replay(bgpConfig);
}
@@ -352,7 +411,7 @@
* Populates edge ports in the EdgePortService to return all port 1
* as edge ports.
*/
- private void popluateEdgePortService() {
+ private void populateEdgePortService() {
Set<ConnectPoint> edgeConnectPoints = new HashSet<>();
for (int i = 1; i <= NUM_DEVICES; i++) {
@@ -380,6 +439,8 @@
expect(edgePortService.getEdgePoints())
.andReturn(edgeConnectPoints).anyTimes();
+ expect(edgePortService.isEdgePoint(CP3)).andReturn(true).anyTimes();
+
replay(edgePortService);
}
@@ -479,7 +540,7 @@
replay(hostService);
replay(interfaceService);
- Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION, VLAN1,
MAC4, SOLICITED_MAC3,
IP4, IP3);
@@ -490,7 +551,7 @@
proxyArp.processPacketIn(pkt);
assertEquals(1, packetService.packets.size());
- Ethernet ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
+ Ethernet ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT, VLAN1,
MAC3, MAC4, IP3, IP4);
verifyPacketOut(ndpReply, getLocation(5), packetService.packets.get(0));
}
@@ -548,7 +609,7 @@
replay(hostService);
replay(interfaceService);
- Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION, VLAN1,
MAC4, SOLICITED_MAC3,
IP4, IP3);
@@ -694,7 +755,7 @@
replay(hostService);
replay(interfaceService);
- Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION, VLAN1,
MAC4, SOLICITED_MAC3,
IP4, IP3);
@@ -771,7 +832,7 @@
replay(hostService);
replay(interfaceService);
- Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION, VLAN1,
MAC2,
MacAddress.valueOf("33:33:ff:00:00:01"),
theirIp,
@@ -785,6 +846,7 @@
assertEquals(1, packetService.packets.size());
Ethernet ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
+ VLAN1,
firstMac,
MAC2,
ourFirstIp,
@@ -794,6 +856,7 @@
// Test a request for the second address on that port
packetService.packets.clear();
ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ VLAN1,
MAC2,
MacAddress.valueOf("33:33:ff:00:00:01"),
theirIp,
@@ -807,6 +870,7 @@
assertEquals(1, packetService.packets.size());
ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
+ VLAN1,
secondMac,
MAC2,
ourSecondIp,
@@ -854,6 +918,7 @@
Ip6Address theirIp = Ip6Address.valueOf("1000::ffff");
Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ VLAN1,
MAC1,
MacAddress.valueOf("33:33:ff:00:00:01"),
theirIp,
@@ -870,6 +935,7 @@
// Request for a valid internal IP address but coming in an external port
packetService.packets.clear();
ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ VLAN1,
MAC1,
MacAddress.valueOf("33:33:ff:00:00:01"),
theirIp,
@@ -894,9 +960,12 @@
expect(hostService.getHostsByIp(theirIp)).andReturn(Collections.emptySet());
expect(interfaceService.getInterfacesByIp(ourIp)).andReturn(
- Collections.singleton(new Interface(getLocation(1),
- Collections.singleton(new InterfaceIpAddress(ourIp, IpPrefix.valueOf("10.0.1.1/24"))),
- ourMac, VLAN1)));
+ Collections.singleton(new Interface(NO_NAME,
+ getLocation(1),
+ Collections.singletonList(
+ new InterfaceIpAddress(ourIp,
+ IpPrefix.valueOf("10.0.1.1/24"))),
+ ourMac, VLAN1)));
expect(hostService.getHost(HostId.hostId(ourMac, VLAN1))).andReturn(null);
replay(hostService);
replay(interfaceService);
@@ -938,8 +1007,9 @@
expect(hostService.getHostsByIp(theirIp)).andReturn(Collections.emptySet());
expect(interfaceService.getInterfacesByIp(ourIp))
- .andReturn(Collections.singleton(new Interface(getLocation(1),
- Collections.singleton(new InterfaceIpAddress(
+ .andReturn(Collections.singleton(new Interface(NO_NAME,
+ getLocation(1),
+ Collections.singletonList(new InterfaceIpAddress(
ourIp,
IpPrefix.valueOf("1000::1/64"))),
ourMac,
@@ -951,6 +1021,7 @@
// This is a request from something inside our network (like a BGP
// daemon) to an external host.
Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ VLAN1,
ourMac,
MacAddress.valueOf("33:33:ff:00:00:01"),
ourIp,
@@ -985,28 +1056,10 @@
*/
@Test
public void testReplyExternalPortForPeer() {
- Ip4Address peer1 = Ip4Address.valueOf(PEER1_IP);
- MacAddress ourMac = MacAddress.valueOf(1L);
- Ip4Address peer2 = Ip4Address.valueOf(PEER2_IP);
-
- expect(hostService.getHostsByIp(peer2)).andReturn(Collections.emptySet());
- expect(interfaceService.getInterfacesByIp(peer1)).andReturn(
- Collections.singleton(
- new Interface(getLocation(1),
- Collections.singleton(
- new InterfaceIpAddress(
- peer1,
- IpPrefix.valueOf("10.0.1.1/24"))),
- ourMac, VLAN1)));
- expect(hostService.getHost(HostId.hostId(ourMac, VLAN1))).andReturn(null);
- replay(hostService);
- replay(interfaceService);
-
- addPeersToBgpConfig();
+ setupSdx();
// Request for a valid external IP address belonging to BGP peer
- Ethernet arpRequest = buildArp(ARP.OP_REQUEST, VLAN1, MAC1, null, peer1,
- peer2);
+ Ethernet arpRequest = buildArp(ARP.OP_REQUEST, VLAN1, MAC1, null, PEER1_IP, PEER2_IP);
InboundPacket pkt =
new DefaultInboundPacket(CP1, arpRequest,
ByteBuffer.wrap(arpRequest.serialize()));
@@ -1021,29 +1074,14 @@
*/
@Test
public void testReplyExternalPortForPeerIpv6() {
- Ip6Address peer1 = Ip6Address.valueOf(PEER1_IP6);
- MacAddress peer1Mac = MacAddress.valueOf(1L);
- Ip6Address peer2 = Ip6Address.valueOf(PEER2_IP6);
-
- expect(hostService.getHostsByIp(peer2)).andReturn(Collections.emptySet());
- expect(interfaceService.getInterfacesByIp(peer1))
- .andReturn(Collections.singleton(new Interface(getLocation(1),
- Collections.singleton(new InterfaceIpAddress(
- peer1,
- IpPrefix.valueOf("1000::1/64"))),
- peer1Mac,
- VLAN1)));
- expect(hostService.getHost(HostId.hostId(peer1Mac, VLAN1))).andReturn(null);
- replay(hostService);
- replay(interfaceService);
-
- addPeersToBgpConfig();
+ setupSdx();
Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ VLAN1,
MAC1,
MacAddress.valueOf("33:33:ff:00:00:01"),
- peer1,
- peer2);
+ PEER1_IP6,
+ PEER2_IP6);
InboundPacket pkt =
new DefaultInboundPacket(CP1, ndpRequest,
@@ -1054,6 +1092,212 @@
assertEquals(1, packetService.packets.size());
}
+ /**
+ * Request for a valid IPv4 address for BGP peer, coming from a
+ * BGP speaker and VLAN translation is necessary.
+ */
+ @Test
+ public void testReplySpeakerForPeerWithVlan() {
+ setupSdx();
+
+ // Request for a valid external IP address belonging to BGP peer
+ Ethernet arpRequest = buildArp(ARP.OP_REQUEST, VLAN10, MAC1, null,
+ SPEAKER_IP, PEER3_IP);
+ InboundPacket pkt =
+ new DefaultInboundPacket(CP3, arpRequest,
+ ByteBuffer.wrap(arpRequest.serialize()));
+ proxyArp.processPacketIn(pkt);
+
+ assertEquals(1, packetService.packets.size());
+ }
+
+ /**
+ * Request for a valid IPv6 address for BGP peer, coming from a
+ * BGP speaker and VLAN translation is necessary.
+ */
+ @Test
+ public void testReplySpeakerForPeerWithVlanIpv6() {
+ setupSdx();
+
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ VLAN10,
+ MAC1,
+ MacAddress.valueOf("33:33:ff:00:00:01"),
+ SPEAKER_IP6,
+ PEER3_IP6);
+
+ InboundPacket pkt =
+ new DefaultInboundPacket(CP3, ndpRequest,
+ ByteBuffer.wrap(ndpRequest.serialize()));
+
+ proxyArp.processPacketIn(pkt);
+
+ assertEquals(1, packetService.packets.size());
+ }
+
+ /**
+ * Request for a valid IPv4 address of BGP speaker, originating from a
+ * BGP peer and VLAN translation is necessary.
+ */
+ @Test
+ public void testReplyPeerForSpeakerWithVlan() {
+ setupSdx();
+
+ // Request for a valid external IP address belonging to BGP peer
+ Ethernet arpRequest = buildArp(ARP.OP_REQUEST, VLAN1, MAC1, null,
+ PEER3_IP, SPEAKER_IP);
+ InboundPacket pkt =
+ new DefaultInboundPacket(CP3, arpRequest,
+ ByteBuffer.wrap(arpRequest.serialize()));
+ proxyArp.processPacketIn(pkt);
+
+ assertEquals(1, packetService.packets.size());
+ }
+
+ /**
+ * Request for a valid IPv6 address for BGP speaker, originating from a
+ * BGP peer and VLAN translation is necessary.
+ */
+ @Test
+ public void testReplyPeerForSpeakerWithVlanIpv6() {
+ setupSdx();
+
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ VLAN1,
+ MAC1,
+ MacAddress.valueOf("33:33:ff:00:00:01"),
+ PEER3_IP6,
+ SPEAKER_IP6);
+
+ InboundPacket pkt =
+ new DefaultInboundPacket(CP3, ndpRequest,
+ ByteBuffer.wrap(ndpRequest.serialize()));
+ proxyArp.processPacketIn(pkt);
+
+ assertEquals(1, packetService.packets.size());
+ }
+
+
+ /**
+ * Tests the VLAN translation for ARP reply originating from external peer
+ * and addressing to internal speaker.
+ */
+ @Test
+ public void testHandleArpReplyWithVlan() {
+ setupSdx();
+
+ // Reply for a valid external IP address belonging to BGP peer
+ Ethernet arpReply = buildArp(ARP.OP_REPLY, VLAN1, MAC2, MAC1,
+ PEER3_IP, SPEAKER_IP);
+ InboundPacket pkt =
+ new DefaultInboundPacket(CP3, arpReply,
+ ByteBuffer.wrap(arpReply.serialize()));
+ proxyArp.processPacketIn(pkt);
+
+ assertEquals(1, packetService.packets.size());
+ }
+
+ /**
+ * Tests the VLAN translation for NDP reply originating from external peer
+ * and addressing to internal speaker.
+ */
+ @Test
+ public void testHandleNdpReplyWithVlan() {
+ setupSdx();
+
+ Ethernet ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
+ VLAN1,
+ MAC2,
+ MAC1,
+ PEER3_IP6,
+ SPEAKER_IP6);
+
+ InboundPacket pkt =
+ new DefaultInboundPacket(CP3, ndpReply,
+ ByteBuffer.wrap(ndpReply.serialize()));
+ proxyArp.processPacketIn(pkt);
+
+ assertEquals(1, packetService.packets.size());
+ }
+
+ private void setupSdx() {
+ MacAddress dstMac = MacAddress.valueOf(1L);
+
+ Host peer1Host = new DefaultHost(PID, HID1, MAC1, VLAN1, LOC1,
+ Collections.singleton(PEER1_IP));
+
+ expect(hostService.getHost(HID1)).andReturn(peer1Host);
+ expect(hostService.getHostsByIp(PEER1_IP))
+ .andReturn(Collections.singleton(peer1Host));
+ Host peer2Host = new DefaultHost(PID, HID2, MAC2, VLAN1, LOC2,
+ Collections.singleton(PEER2_IP));
+ expect(hostService.getHost(HID2)).andReturn(peer2Host);
+ expect(hostService.getHostsByIp(PEER2_IP))
+ .andReturn(Collections.singleton(peer2Host));
+ Host peer1Ipv6Host = new DefaultHost(PID, HID3, MAC3, VLAN1, LOC1,
+ Collections.singleton(PEER1_IP6));
+ expect(hostService.getHost(HID3)).andReturn(peer1Ipv6Host);
+ expect(hostService.getHostsByIp(PEER1_IP6))
+ .andReturn(Collections.singleton(peer1Ipv6Host));
+ Host peer2Ipv6Host = new DefaultHost(PID, HID4, MAC4, VLAN1, LOC2,
+ Collections.singleton(PEER2_IP6));
+ expect(hostService.getHost(HID4)).andReturn(peer2Ipv6Host);
+ expect(hostService.getHostsByIp(PEER2_IP6))
+ .andReturn(Collections.singleton(peer2Ipv6Host));
+ expect(hostService.getHost(HostId.hostId(dstMac, VLAN1))).andReturn(null);
+ expect(hostService.getHostsByIp(PEER3_IP)).andReturn(Collections.emptySet());
+ expect(hostService.getHost(HostId.hostId(dstMac, VLAN10))).andReturn(null);
+ Host peer3Ipv6Host = new DefaultHost(PID, HID5, MAC5, VLAN1, LOC2,
+ Collections.singleton(PEER3_IP6));
+ expect(hostService.getHost(HID5)).andReturn(peer3Ipv6Host);
+ expect(hostService.getHostsByIp(PEER3_IP6))
+ .andReturn(Collections.singleton(peer3Ipv6Host));
+ expect(hostService.getHost(HostId.hostId(dstMac, VLAN10))).andReturn(null);
+ expect(hostService.getHostsByIp(SPEAKER_IP)).andReturn(Collections.emptySet());
+ expect(hostService.getHostsByIp(SPEAKER_IP6)).andReturn(Collections.emptySet());
+
+ replay(hostService);
+
+ expect(interfaceService.getInterfacesByIp(PEER1_IP))
+ .andReturn(Collections.emptySet()).anyTimes();
+ expect(interfaceService.getInterfacesByIp(PEER1_IP6))
+ .andReturn(Collections.emptySet()).anyTimes();
+
+ Interface intf1 = new Interface(NO_NAME,
+ getLocation(1),
+ Collections.singletonList(
+ new InterfaceIpAddress(
+ SPEAKER_IP,
+ INTF1_IP_PREFIX)),
+ dstMac, VLAN1);
+ expect(interfaceService.getInterfacesByIp(SPEAKER_IP)).andReturn(
+ Collections.singleton(intf1)).anyTimes();
+
+ Interface intf2 = new Interface(NO_NAME,
+ getLocation(1),
+ Collections.singletonList(
+ new InterfaceIpAddress(
+ SPEAKER_IP6,
+ INTF2_IP6_PREFIX)),
+ dstMac, VLAN1);
+ expect(interfaceService.getInterfacesByIp(SPEAKER_IP6)).andReturn(
+ Collections.singleton(intf2)).anyTimes();
+ expect(interfaceService.getInterfacesByIp(PEER3_IP)).andReturn(
+ Collections.singleton(intf1));
+ expect(interfaceService.getInterfacesByIp(PEER3_IP6)).andReturn(
+ Collections.singleton(intf2));
+
+ replay(interfaceService);
+
+ expect(sdxL3PeerService.getInterfaceForPeer(PEER2_IP)).andReturn(intf1);
+ expect(sdxL3PeerService.getInterfaceForPeer(PEER2_IP6)).andReturn(intf2);
+ expect(sdxL3PeerService.getInterfaceForPeer(PEER3_IP)).andReturn(intf1);
+ expect(sdxL3PeerService.getInterfaceForPeer(PEER3_IP6)).andReturn(intf2);
+ replay(sdxL3PeerService);
+
+ addPeersToBgpConfig();
+ }
+
private void addPeersToBgpConfig() {
reset(bgpConfig);
@@ -1062,16 +1306,36 @@
Optional<String> speakerName = Optional.empty();
ConnectPoint connectPoint = CP2;
Set<IpAddress> connectedPeers =
- new HashSet<>(Arrays.asList(IpAddress.valueOf(PEER1_IP),
- IpAddress.valueOf(PEER2_IP),
- IpAddress.valueOf(PEER1_IP6),
- IpAddress.valueOf(PEER2_IP6)));
+ new HashSet<>(Arrays.asList(PEER1_IP,
+ PEER2_IP,
+ PEER1_IP6,
+ PEER2_IP6));
+ BgpConfig.BgpSpeakerConfig speaker1 =
+ new BgpConfig.BgpSpeakerConfig(speakerName,
+ VlanId.NONE,
+ connectPoint,
+ connectedPeers);
+ speakers.add(speaker1);
- speakers.add(new BgpConfig.BgpSpeakerConfig(speakerName, VlanId.NONE,
- connectPoint,
- connectedPeers));
+ speakerName = Optional.empty();
+ connectPoint = CP3;
+ connectedPeers = new HashSet<>(Arrays.asList(PEER3_IP,
+ PEER3_IP6));
+ BgpConfig.BgpSpeakerConfig speaker2 =
+ new BgpConfig.BgpSpeakerConfig(speakerName,
+ VLAN10,
+ connectPoint,
+ connectedPeers);
+ speakers.add(speaker2);
expect(bgpConfig.bgpSpeakers()).andReturn(speakers).anyTimes();
+
+ expect(bgpConfig.getSpeakerFromPeer(PEER1_IP)).andReturn(speaker1).anyTimes();
+ expect(bgpConfig.getSpeakerFromPeer(PEER2_IP)).andReturn(speaker1).anyTimes();
+ expect(bgpConfig.getSpeakerFromPeer(PEER3_IP)).andReturn(speaker2).anyTimes();
+ expect(bgpConfig.getSpeakerFromPeer(PEER1_IP6)).andReturn(speaker1).anyTimes();
+ expect(bgpConfig.getSpeakerFromPeer(PEER2_IP6)).andReturn(speaker1).anyTimes();
+ expect(bgpConfig.getSpeakerFromPeer(PEER3_IP6)).andReturn(speaker2).anyTimes();
replay(bgpConfig);
}
@@ -1184,7 +1448,7 @@
* @param dstIp destination IP address
* @return the NDP packet
*/
- private Ethernet buildNdp(byte type, MacAddress srcMac, MacAddress dstMac,
+ private Ethernet buildNdp(byte type, VlanId vlanId, MacAddress srcMac, MacAddress dstMac,
Ip6Address srcIp, Ip6Address dstIp) {
assertThat(type, anyOf(
is(ICMP6.NEIGHBOR_SOLICITATION),
@@ -1223,7 +1487,7 @@
eth.setDestinationMACAddress(dstMac);
eth.setSourceMACAddress(srcMac);
eth.setEtherType(Ethernet.TYPE_IPV6);
- eth.setVlanID(VLAN1.toShort());
+ eth.setVlanID(vlanId.toShort());
eth.setPayload(ipv6);
return eth;
@@ -1242,5 +1506,45 @@
packets.add(packet);
}
}
+
+ /**
+ * Mocks the CoreService.
+ */
+ private class TestCoreService extends CoreServiceAdapter {
+ private final Map<String, ApplicationId> registeredApps =
+ new HashMap<>();
+
+ public TestCoreService() {
+ registeredApps.put(RoutingService.ROUTER_APP_ID, ROUTER_APPID);
+ registeredApps.put(SdxL3.SDX_L3_APP, SDXL3_APPID);
+ }
+
+ @Override
+ public ApplicationId getAppId(String name) {
+ return registeredApps.get(name);
+ }
+ }
+
+ /**
+ * Mocks the NetworkConfigService.
+ */
+ private class TestNetworkConfigService extends NetworkConfigServiceAdapter {
+ private final Map<ApplicationId, Config> registeredConfigs
+ = new HashMap<>();
+
+ public TestNetworkConfigService() {
+ registeredConfigs.put(ROUTER_APPID, bgpConfig);
+ }
+
+ @Override
+ public <S, C extends Config<S>> C getConfig(S subject, Class<C> configClass) {
+ return (C) registeredConfigs.get(subject);
+ }
+
+ @Override
+ public <S, C extends Config<S>> C addConfig(S subject, Class<C> configClass) {
+ return (C) registeredConfigs.get(subject);
+ }
+ }
}
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3FibTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3FibTest.java
index 1a09d0d..bea2fe8 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3FibTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3FibTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/config/SdxProvidersConfigTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/config/SdxParticipantsConfigTest.java
similarity index 78%
rename from sdx-l3/src/test/java/org/onosproject/sdxl3/config/SdxProvidersConfigTest.java
rename to sdx-l3/src/test/java/org/onosproject/sdxl3/config/SdxParticipantsConfigTest.java
index aea859a..8dedc82 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/config/SdxProvidersConfigTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/config/SdxParticipantsConfigTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,10 @@
import static junit.framework.TestCase.assertEquals;
import static org.junit.Assert.assertFalse;
-public class SdxProvidersConfigTest {
+/**
+ * Unit tests for SdxParticipantsConfig class.
+ */
+public class SdxParticipantsConfigTest {
private static final ApplicationId APP_ID =
new TestApplicationId(SdxL3.SDX_L3_APP);
private static final String KEY = "key";
@@ -64,22 +67,22 @@
private static final IpAddress IP3 = IpAddress.valueOf(IP_STRING3);
private static final String INTF_NAME3 = "conn_point3";
- private static final String JSON_TREE = "{\"" + SdxProvidersConfig.PEERS + "\"" +
- ": [{\"" + SdxProvidersConfig.NAME + "\" : \"" + NAME1 + "\", " +
- "\"" + SdxProvidersConfig.IP + "\" : \"" + IP_STRING1 + "\", " +
- "\"" + SdxProvidersConfig.CONN_POINT + "\" : \"" + PORT_STRING1 + "\", " +
- "\"" + SdxProvidersConfig.INTF_NAME + "\" : \"" + INTF_NAME1 + "\"}, " +
- "{ \"" + SdxProvidersConfig.IP + "\" : \"" + IP_STRING2 + "\", " +
- "\"" + SdxProvidersConfig.CONN_POINT + "\" : \"" + PORT_STRING2 + "\", " +
- "\"" + SdxProvidersConfig.INTF_NAME + "\" : \"" + INTF_NAME2 + "\"}]}";
+ private static final String JSON_TREE = "{\"" + SdxParticipantsConfig.PEERS + "\"" +
+ ": [{\"" + SdxParticipantsConfig.NAME + "\" : \"" + NAME1 + "\", " +
+ "\"" + SdxParticipantsConfig.IP + "\" : \"" + IP_STRING1 + "\", " +
+ "\"" + SdxParticipantsConfig.CONN_POINT + "\" : \"" + PORT_STRING1 + "\", " +
+ "\"" + SdxParticipantsConfig.INTF_NAME + "\" : \"" + INTF_NAME1 + "\"}, " +
+ "{ \"" + SdxParticipantsConfig.IP + "\" : \"" + IP_STRING2 + "\", " +
+ "\"" + SdxParticipantsConfig.CONN_POINT + "\" : \"" + PORT_STRING2 + "\", " +
+ "\"" + SdxParticipantsConfig.INTF_NAME + "\" : \"" + INTF_NAME2 + "\"}]}";
private static final String EMPTY_JSON_TREE = "{ }";
- private Set<SdxProvidersConfig.PeerConfig> peers = new HashSet<>();
- private SdxProvidersConfig.PeerConfig peer1;
+ private Set<SdxParticipantsConfig.PeerConfig> peers = new HashSet<>();
+ private SdxParticipantsConfig.PeerConfig peer1;
- private SdxProvidersConfig peersConfig = new SdxProvidersConfig();
- private SdxProvidersConfig emptyPeersConfig = new SdxProvidersConfig();
+ private SdxParticipantsConfig peersConfig = new SdxParticipantsConfig();
+ private SdxParticipantsConfig emptyPeersConfig = new SdxParticipantsConfig();
private final ConfigApplyDelegate delegate = new MockCfgDelegate();
private final ObjectMapper mapper = new ObjectMapper();
@@ -115,7 +118,7 @@
@Test
public void testAddPeer() throws Exception {
int initialSize = peersConfig.bgpPeers().size();
- SdxProvidersConfig.PeerConfig newPeer = createNewPeer();
+ SdxParticipantsConfig.PeerConfig newPeer = createNewPeer();
peersConfig.addPeer(newPeer);
assertEquals(initialSize + 1, peersConfig.bgpPeers().size());
peers.add(newPeer);
@@ -158,20 +161,20 @@
peers.remove(peer1);
assertEquals(peers, peersConfig.bgpPeers()); }
- private Set<SdxProvidersConfig.PeerConfig> createPeers() {
- Set<SdxProvidersConfig.PeerConfig> peers = Sets.newHashSet();
+ private Set<SdxParticipantsConfig.PeerConfig> createPeers() {
+ Set<SdxParticipantsConfig.PeerConfig> peers = Sets.newHashSet();
- peer1 = new SdxProvidersConfig.
+ peer1 = new SdxParticipantsConfig.
PeerConfig(Optional.of(NAME1), IP1, PORT1, INTF_NAME1);
peers.add(peer1);
- peers.add(new SdxProvidersConfig.
+ peers.add(new SdxParticipantsConfig.
PeerConfig(Optional.empty(), IP2, PORT2, INTF_NAME2));
return peers;
}
- private SdxProvidersConfig.PeerConfig createNewPeer() {
- return new SdxProvidersConfig.
+ private SdxParticipantsConfig.PeerConfig createNewPeer() {
+ return new SdxParticipantsConfig.
PeerConfig(Optional.of(NAME3), IP3, PORT3, INTF_NAME3);
}
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerAdministrationTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerAdministrationTest.java
index e4b5c9e..325d8fb 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerAdministrationTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerAdministrationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@
import org.onosproject.routing.RoutingService;
import org.onosproject.routing.config.BgpConfig;
import org.onosproject.sdxl3.SdxL3;
-import org.onosproject.sdxl3.config.SdxProvidersConfig;
+import org.onosproject.sdxl3.config.SdxParticipantsConfig;
import java.util.ArrayList;
import java.util.Collections;
@@ -102,12 +102,12 @@
private NetworkConfigRegistry registry;
private BgpConfig bgpConfig;
- private SdxProvidersConfig providersConfig;
+ private SdxParticipantsConfig participantsConfig;
private Set<BgpConfig.BgpSpeakerConfig> bgpSpeakers;
private Map<String, Interface> interfaces;
- SdxProvidersConfig.PeerConfig newPeer = createNewPeer();
+ SdxParticipantsConfig.PeerConfig newPeer = createNewPeer();
private List<PointToPointIntent> intentList;
@@ -153,7 +153,7 @@
private void setupEnvironment() {
// Create mocks for configurations
bgpConfig = createMock(BgpConfig.class);
- providersConfig = createMock(SdxProvidersConfig.class);
+ participantsConfig = createMock(SdxParticipantsConfig.class);
// Create mocks for services
coreService = new TestCoreService();
@@ -190,7 +190,7 @@
public TestNetworkConfigService() {
registeredConfigs.put(ROUTER_APPID, bgpConfig);
- registeredConfigs.put(SDXL3_APPID, providersConfig);
+ registeredConfigs.put(SDXL3_APPID, participantsConfig);
}
@Override
@@ -312,39 +312,39 @@
* @return configured BGP peers as a MAP from peer IP address to BgpPeer
*/
private void setUpPeers() {
- SdxProvidersConfig.PeerConfig peer1 =
- new SdxProvidersConfig.PeerConfig(Optional.of(PEER1_NAME),
- IpAddress.valueOf(PEER_IP),
- SW1_ETH1,
- INTERFACE_SW1_ETH1);
+ SdxParticipantsConfig.PeerConfig peer1 =
+ new SdxParticipantsConfig.PeerConfig(Optional.of(PEER1_NAME),
+ IpAddress.valueOf(PEER_IP),
+ SW1_ETH1,
+ INTERFACE_SW1_ETH1);
// Set up the related expectations
- expect(providersConfig.getPortForPeer(IpAddress.valueOf(PEER_IP)))
+ expect(participantsConfig.getPortForPeer(IpAddress.valueOf(PEER_IP)))
.andReturn(SW1_ETH1).anyTimes();
- expect(providersConfig.
+ expect(participantsConfig.
getInterfaceNameForPeer(IpAddress.valueOf(PEER_IP)))
.andReturn(INTERFACE_SW1_ETH1).anyTimes();
- expect(providersConfig.getPeerForName(Optional.of(PEER1_NAME)))
+ expect(participantsConfig.getPeerForName(Optional.of(PEER1_NAME)))
.andReturn(peer1).anyTimes();
- expect(providersConfig.getPeerForIp(IpAddress.valueOf(PEER_IP)))
+ expect(participantsConfig.getPeerForIp(IpAddress.valueOf(PEER_IP)))
.andReturn(peer1).anyTimes();
// Set up expectations for peers that will be added
- expect(providersConfig.
+ expect(participantsConfig.
getInterfaceNameForPeer(IpAddress.valueOf(NEW_PEER1_IP)))
.andReturn(null).anyTimes();
- expect(providersConfig.getPortForPeer(IpAddress.valueOf(NEW_PEER1_IP)))
+ expect(participantsConfig.getPortForPeer(IpAddress.valueOf(NEW_PEER1_IP)))
.andReturn(null).anyTimes();
- expect(providersConfig.getPeerForIp(IpAddress.valueOf(NEW_PEER1_IP)))
+ expect(participantsConfig.getPeerForIp(IpAddress.valueOf(NEW_PEER1_IP)))
.andReturn(null).anyTimes();
- expect(providersConfig.
+ expect(participantsConfig.
getInterfaceNameForPeer(IpAddress.valueOf(NEW_PEER2_IP)))
.andReturn(null).anyTimes();
- expect(providersConfig.getPortForPeer(IpAddress.valueOf(NEW_PEER2_IP)))
+ expect(participantsConfig.getPortForPeer(IpAddress.valueOf(NEW_PEER2_IP)))
.andReturn(null).anyTimes();
- expect(providersConfig.getPeerForName(Optional.of(NEW_PEER_NAME)))
+ expect(participantsConfig.getPeerForName(Optional.of(NEW_PEER_NAME)))
.andReturn(null).anyTimes();
- expect(providersConfig.node()).andReturn(null).anyTimes();
+ expect(participantsConfig.node()).andReturn(null).anyTimes();
}
/**
@@ -352,7 +352,7 @@
*/
@Test(expected = ItemNotFoundException.class)
public void testAddPeerWithNoBgpConfig() {
- replay(providersConfig);
+ replay(participantsConfig);
// Reset NetworkConfigService
peerManager.configService = new NetworkConfigServiceAdapter();
peerManager.activate();
@@ -368,7 +368,7 @@
*/
@Test(expected = ItemNotFoundException.class)
public void testAddPeerUknownIp() {
- replay(providersConfig);
+ replay(participantsConfig);
peerManager.activate();
@@ -383,7 +383,7 @@
*/
@Test(expected = ItemNotFoundException.class)
public void testAddPeerToUnknownInterface() {
- replay(providersConfig);
+ replay(participantsConfig);
peerManager.activate();
@@ -398,7 +398,7 @@
*/
@Test(expected = IllegalArgumentException.class)
public void testAddPeerToNonMatchingInterface() {
- replay(providersConfig);
+ replay(participantsConfig);
peerManager.activate();
@@ -413,7 +413,7 @@
*/
@Test(expected = IllegalArgumentException.class)
public void testAddAlreadyRegisteredPeer() {
- replay(providersConfig);
+ replay(participantsConfig);
peerManager.activate();
@@ -428,7 +428,7 @@
*/
@Test(expected = IllegalArgumentException.class)
public void testAddPeerWithNameInUse() {
- replay(providersConfig);
+ replay(participantsConfig);
peerManager.activate();
@@ -443,9 +443,9 @@
*/
@Test
public void testAddPeerDetailsSuccess() {
- providersConfig.addPeer(newPeer);
+ participantsConfig.addPeer(newPeer);
expectLastCall().once();
- replay(providersConfig);
+ replay(participantsConfig);
peerManager.activate();
@@ -453,14 +453,14 @@
newPeer.ip(),
newPeer.connectPoint(),
newPeer.interfaceName());
- verify(providersConfig);
+ verify(participantsConfig);
}
- private SdxProvidersConfig.PeerConfig createNewPeer() {
- return new SdxProvidersConfig.PeerConfig(Optional.of(NEW_PEER_NAME),
- IpAddress.valueOf(NEW_PEER1_IP),
- SW2_ETH1,
- INTERFACE_SW2_ETH1);
+ private SdxParticipantsConfig.PeerConfig createNewPeer() {
+ return new SdxParticipantsConfig.PeerConfig(Optional.of(NEW_PEER_NAME),
+ IpAddress.valueOf(NEW_PEER1_IP),
+ SW2_ETH1,
+ INTERFACE_SW2_ETH1);
}
/**
@@ -468,7 +468,7 @@
*/
@Test(expected = ItemNotFoundException.class)
public void testRemovePeerWithNoBgpConfig() {
- replay(providersConfig);
+ replay(participantsConfig);
// Reset NetworkConfigService
peerManager.configService = new NetworkConfigServiceAdapter();
peerManager.activate();
@@ -481,7 +481,7 @@
*/
@Test(expected = ItemNotFoundException.class)
public void testRemoveNonFoundPeer() {
- replay(providersConfig);
+ replay(participantsConfig);
peerManager.activate();
@@ -493,14 +493,14 @@
*/
@Test
public void testRemovePeerDetailsSuccess() {
- providersConfig.removePeer(IpAddress.valueOf(PEER_IP));
+ participantsConfig.removePeer(IpAddress.valueOf(PEER_IP));
expectLastCall().once();
- replay(providersConfig);
+ replay(participantsConfig);
peerManager.activate();
peerManager.removePeerDetails(IpAddress.valueOf(PEER_IP));
- verify(providersConfig);
+ verify(participantsConfig);
}
/**
@@ -508,7 +508,7 @@
*/
@Test
public void testGetPeerAddresses() {
- replay(providersConfig);
+ replay(participantsConfig);
peerManager.activate();
@@ -529,7 +529,7 @@
*/
@Test
public void testGetInterfaceForPeer() {
- replay(providersConfig);
+ replay(participantsConfig);
peerManager.activate();
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerConnectivityTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerConnectivityTest.java
index 6d775ab..1f9cbdd 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerConnectivityTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerConnectivityTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@
import org.onosproject.routing.RoutingService;
import org.onosproject.routing.config.BgpConfig;
import org.onosproject.sdxl3.SdxL3;
-import org.onosproject.sdxl3.config.SdxProvidersConfig;
+import org.onosproject.sdxl3.config.SdxParticipantsConfig;
import java.util.ArrayList;
import java.util.Collections;
@@ -85,21 +85,30 @@
private static final String DPID1 = "00:00:00:00:00:00:00:01";
private static final String DPID2 = "00:00:00:00:00:00:00:02";
private static final String DPID3 = "00:00:00:00:00:00:00:03";
+ private static final String DPID4 = "00:00:00:00:00:00:00:04";
+
+ private static final VlanId NO_VLAN = VlanId.NONE;
+ private static final VlanId VLAN10 = VlanId.vlanId(Short.valueOf("10"));
+ private static final VlanId VLAN20 = VlanId.vlanId(Short.valueOf("20"));
private static final String PEER1_IP = "192.168.10.1";
- private static final String PEER2_IP = "192.168.20.1";
- private static final String PEER3_IP = "192.168.10.2";
+ private static final String PEER2_IP = "192.168.10.2";
+ private static final String PEER3_IP = "192.168.20.1";
+ private static final String PEER4_IP = "192.168.30.1";
private static final String SPEAKER1_IP = "192.168.10.101";
private static final String SPEAKER2_IP = "192.168.20.101";
+ private static final String SPEAKER3_IP = "192.168.30.101";
private static final String PREFIX32 = "/32";
private static final String PREFIX24 = "/24";
private static final String INTERFACE_SW1_ETH1 = "s1-eth1";
private static final String INTERFACE_SW2_ETH1 = "s2-eth1";
private static final String INTERFACE_SW3_ETH1 = "s3-eth1";
+ private static final String INTERFACE_SW4_ETH1 = "s4-eth1";
private static final String MAC1 = "00:00:00:00:00:01";
private static final String MAC2 = "00:00:00:00:00:02";
+ private static final String MAC3 = "00:00:00:00:00:03";
private SdxL3PeerManager peerManager;
private CoreService coreService;
@@ -109,7 +118,7 @@
private NetworkConfigRegistry registry;
private BgpConfig bgpConfig;
- private SdxProvidersConfig providersConfig;
+ private SdxParticipantsConfig participantsConfig;
private Set<BgpConfig.BgpSpeakerConfig> bgpSpeakers;
private Map<String, Interface> interfaces;
@@ -122,12 +131,16 @@
DeviceId.deviceId(dpidToUri(DPID2));
private static final DeviceId DEVICE3_ID =
DeviceId.deviceId(dpidToUri(DPID3));
+ private static final DeviceId DEVICE4_ID =
+ DeviceId.deviceId(dpidToUri(DPID4));
// Ports where BGP speakers are connected
private static final ConnectPoint SW1_ETH100 =
new ConnectPoint(DEVICE1_ID, PortNumber.portNumber(100));
private static final ConnectPoint SW2_ETH100 =
new ConnectPoint(DEVICE2_ID, PortNumber.portNumber(100));
+ private static final ConnectPoint SW3_ETH100 =
+ new ConnectPoint(DEVICE3_ID, PortNumber.portNumber(100));
// Ports where BGP peers are connected
private static final ConnectPoint SW1_ETH1 =
@@ -136,6 +149,8 @@
new ConnectPoint(DEVICE2_ID, PortNumber.portNumber(1));
private static final ConnectPoint SW3_ETH1 =
new ConnectPoint(DEVICE3_ID, PortNumber.portNumber(1));
+ private static final ConnectPoint SW4_ETH1 =
+ new ConnectPoint(DEVICE4_ID, PortNumber.portNumber(1));
private final TrafficTreatment noTreatment =
DefaultTrafficTreatment.emptyTreatment();
@@ -162,7 +177,7 @@
private void setupEnvironment() {
// Create mocks for configurations
bgpConfig = createMock(BgpConfig.class);
- providersConfig = createMock(SdxProvidersConfig.class);
+ participantsConfig = createMock(SdxParticipantsConfig.class);
// Create mocks for services
coreService = new TestCoreService();
@@ -199,7 +214,7 @@
public TestNetworkConfigService() {
registeredConfigs.put(ROUTER_APPID, bgpConfig);
- registeredConfigs.put(SDXL3_APPID, providersConfig);
+ registeredConfigs.put(SDXL3_APPID, participantsConfig);
}
@Override
@@ -240,50 +255,66 @@
IpPrefix.valueOf(SPEAKER1_IP + PREFIX24));
Interface intfSw1Eth1 = new Interface(INTERFACE_SW1_ETH1,
SW1_ETH1,
- Collections.singleton(ia1),
+ Collections.singletonList(ia1),
MacAddress.valueOf(MAC1),
VlanId.NONE);
configuredInterfaces.put(INTERFACE_SW1_ETH1, intfSw1Eth1);
InterfaceIpAddress ia2 =
- new InterfaceIpAddress(IpAddress.valueOf(SPEAKER2_IP),
- IpPrefix.valueOf(SPEAKER2_IP + PREFIX24));
+ new InterfaceIpAddress(IpAddress.valueOf(SPEAKER1_IP),
+ IpPrefix.valueOf(SPEAKER1_IP + PREFIX24));
Interface intfSw2Eth1 = new Interface(INTERFACE_SW2_ETH1,
SW2_ETH1,
- Collections.singleton(ia2),
- MacAddress.valueOf(MAC2),
+ Collections.singletonList(ia2),
+ MacAddress.valueOf(MAC1),
VlanId.NONE);
configuredInterfaces.put(INTERFACE_SW2_ETH1, intfSw2Eth1);
InterfaceIpAddress ia3 =
- new InterfaceIpAddress(IpAddress.valueOf(SPEAKER1_IP),
- IpPrefix.valueOf(SPEAKER1_IP + PREFIX24));
+ new InterfaceIpAddress(IpAddress.valueOf(SPEAKER2_IP),
+ IpPrefix.valueOf(SPEAKER2_IP + PREFIX24));
Interface intfSw3Eth1 = new Interface(INTERFACE_SW3_ETH1,
SW3_ETH1,
- Collections.singleton(ia3),
- MacAddress.valueOf(MAC1),
+ Collections.singletonList(ia3),
+ MacAddress.valueOf(MAC2),
VlanId.NONE);
configuredInterfaces.put(INTERFACE_SW3_ETH1, intfSw3Eth1);
+ InterfaceIpAddress ia4 =
+ new InterfaceIpAddress(IpAddress.valueOf(SPEAKER3_IP),
+ IpPrefix.valueOf(SPEAKER3_IP + PREFIX24));
+ Interface intfSw4Eth1 = new Interface(INTERFACE_SW4_ETH1,
+ SW4_ETH1,
+ Collections.singletonList(ia4),
+ MacAddress.valueOf(MAC3),
+ VLAN20);
+ configuredInterfaces.put(INTERFACE_SW4_ETH1, intfSw4Eth1);
+
// Set up the related expectations
expect(interfaceService.getInterfacesByIp(IpAddress.valueOf(SPEAKER1_IP)))
.andReturn(Collections.singleton(intfSw1Eth1)).anyTimes();
// Always return the first matching even if not associated interface
expect(interfaceService.getMatchingInterface(IpAddress.valueOf(PEER1_IP)))
.andReturn(intfSw1Eth1).anyTimes();
- expect(interfaceService.getMatchingInterface(IpAddress.valueOf(PEER3_IP)))
- .andReturn(intfSw1Eth1).anyTimes();
- expect(interfaceService.getInterfacesByIp(IpAddress.valueOf(SPEAKER2_IP)))
- .andReturn(Collections.singleton(intfSw2Eth1)).anyTimes();
expect(interfaceService.getMatchingInterface(IpAddress.valueOf(PEER2_IP)))
.andReturn(intfSw2Eth1).anyTimes();
+ expect(interfaceService.getInterfacesByIp(IpAddress.valueOf(SPEAKER2_IP)))
+ .andReturn(Collections.singleton(intfSw3Eth1)).anyTimes();
+ expect(interfaceService.getMatchingInterface(IpAddress.valueOf(PEER3_IP)))
+ .andReturn(intfSw3Eth1).anyTimes();
+ expect(interfaceService.getInterfacesByIp(IpAddress.valueOf(SPEAKER3_IP)))
+ .andReturn(Collections.singleton(intfSw4Eth1)).anyTimes();
+ expect(interfaceService.getMatchingInterface(IpAddress.valueOf(PEER4_IP)))
+ .andReturn(intfSw4Eth1).anyTimes();
expect(interfaceService.getInterfacesByPort(SW1_ETH1))
.andReturn(Collections.singleton(intfSw1Eth1)).anyTimes();
expect(interfaceService.getInterfacesByPort(SW2_ETH1))
.andReturn(Collections.singleton(intfSw2Eth1)).anyTimes();
expect(interfaceService.getInterfacesByPort(SW3_ETH1))
.andReturn(Collections.singleton(intfSw3Eth1)).anyTimes();
+ expect(interfaceService.getInterfacesByPort(SW4_ETH1))
+ .andReturn(Collections.singleton(intfSw4Eth1)).anyTimes();
expect(interfaceService.getInterfacesByPort(new ConnectPoint(
DeviceId.deviceId(dpidToUri("00:00:00:00:00:00:01:00")),
PortNumber.portNumber(1))))
@@ -314,17 +345,22 @@
Set<IpAddress> connectedPeers = new HashSet<>();
connectedPeers.add(IpAddress.valueOf(PEER1_IP));
- connectedPeers.add(IpAddress.valueOf(PEER3_IP));
+ connectedPeers.add(IpAddress.valueOf(PEER2_IP));
BgpConfig.BgpSpeakerConfig speaker1 = new BgpConfig.BgpSpeakerConfig(
Optional.empty(), VlanId.NONE, SW1_ETH100, connectedPeers);
BgpConfig.BgpSpeakerConfig speaker2 = new BgpConfig.BgpSpeakerConfig(
Optional.empty(), VlanId.NONE,
- SW2_ETH100, Collections.singleton(IpAddress.valueOf(PEER2_IP)));
+ SW2_ETH100, Collections.singleton(IpAddress.valueOf(PEER3_IP)));
+
+ BgpConfig.BgpSpeakerConfig speaker3 = new BgpConfig.BgpSpeakerConfig(
+ Optional.empty(), VLAN10, SW3_ETH100,
+ Collections.singleton(IpAddress.valueOf(PEER4_IP)));
Set<BgpConfig.BgpSpeakerConfig> speakers = Sets.newHashSet();
speakers.add(speaker1);
speakers.add(speaker2);
+ speakers.add(speaker3);
// Set up the related expectations
expect(bgpConfig.bgpSpeakers()).andReturn(speakers).anyTimes();
@@ -341,22 +377,30 @@
private void setUpPeers() {
// Set up the related expectations
- expect(providersConfig.getPortForPeer(IpAddress.valueOf(PEER1_IP)))
+ expect(participantsConfig.getPortForPeer(IpAddress.valueOf(PEER1_IP)))
.andReturn(SW1_ETH1).anyTimes();
- expect(providersConfig.
- getInterfaceNameForPeer(IpAddress.valueOf(PEER1_IP)))
+ expect(participantsConfig
+ .getInterfaceNameForPeer(IpAddress.valueOf(PEER1_IP)))
.andReturn(INTERFACE_SW1_ETH1).anyTimes();
- expect(providersConfig.getPortForPeer(IpAddress.valueOf(PEER2_IP)))
- .andReturn(null).anyTimes();
- expect(providersConfig
+
+ expect(participantsConfig.getPortForPeer(IpAddress.valueOf(PEER2_IP)))
+ .andReturn(SW2_ETH1).anyTimes();
+ expect(participantsConfig
.getInterfaceNameForPeer(IpAddress.valueOf(PEER2_IP)))
+ .andReturn(INTERFACE_SW2_ETH1).anyTimes();
+
+ expect(participantsConfig.getPortForPeer(IpAddress.valueOf(PEER3_IP)))
.andReturn(null).anyTimes();
- expect(providersConfig.getPortForPeer(IpAddress.valueOf(PEER3_IP)))
- .andReturn(SW3_ETH1).anyTimes();
- expect(providersConfig
+ expect(participantsConfig
.getInterfaceNameForPeer(IpAddress.valueOf(PEER3_IP)))
- .andReturn(INTERFACE_SW3_ETH1).anyTimes();
- replay(providersConfig);
+ .andReturn(null).anyTimes();
+
+ expect(participantsConfig.getPortForPeer(IpAddress.valueOf(PEER4_IP)))
+ .andReturn(null).anyTimes();
+ expect(participantsConfig
+ .getInterfaceNameForPeer(IpAddress.valueOf(PEER4_IP)))
+ .andReturn(null).anyTimes();
+ replay(participantsConfig);
}
/**
@@ -379,6 +423,8 @@
* The purpose of this method is too simplify the setUpBgpIntents() method,
* and to make the setUpBgpIntents() easy to read.
*
+ * @param srcVlanId ingress VlanId
+ * @param dstVlanId egress VlanId
* @param srcPrefix source IP prefix to match
* @param dstPrefix destination IP prefix to match
* @param srcTcpPort source TCP port to match
@@ -386,9 +432,14 @@
* @param srcConnectPoint source connect point for PointToPointIntent
* @param dstConnectPoint destination connect point for PointToPointIntent
*/
- private void bgpPathintentConstructor(String srcPrefix, String dstPrefix,
- Short srcTcpPort, Short dstTcpPort,
- ConnectPoint srcConnectPoint, ConnectPoint dstConnectPoint) {
+ private void bgpPathIntentConstructor(VlanId srcVlanId,
+ VlanId dstVlanId,
+ String srcPrefix,
+ String dstPrefix,
+ Short srcTcpPort,
+ Short dstTcpPort,
+ ConnectPoint srcConnectPoint,
+ ConnectPoint dstConnectPoint) {
TrafficSelector.Builder builder = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
@@ -396,6 +447,16 @@
.matchIPSrc(IpPrefix.valueOf(srcPrefix))
.matchIPDst(IpPrefix.valueOf(dstPrefix));
+ if (!srcVlanId.equals(VlanId.NONE)) {
+ builder.matchVlanId(VlanId.ANY);
+ }
+
+ TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
+
+ if (!dstVlanId.equals(VlanId.NONE)) {
+ treatment.setVlanId(dstVlanId);
+ }
+
if (srcTcpPort != null) {
builder.matchTcpSrc(TpPort.tpPort(srcTcpPort));
}
@@ -404,13 +465,14 @@
}
Key key = Key.of(srcPrefix.split("/")[0] + "-" + dstPrefix.split("/")[0]
- + "-" + ((srcTcpPort == null) ? "dst" : "src"), SDXL3_APPID);
+ + "-" + ((srcTcpPort == null) ? "dst" : "src"),
+ SDXL3_APPID);
PointToPointIntent intent = PointToPointIntent.builder()
.appId(SDXL3_APPID)
.key(key)
.selector(builder.build())
- .treatment(noTreatment)
+ .treatment(treatment.build())
.ingressPoint(srcConnectPoint)
.egressPoint(dstConnectPoint)
.build();
@@ -426,46 +488,61 @@
Short bgpPort = 179;
// Start to build intents between BGP speaker1 and BGP peer1
- bgpPathintentConstructor(
+ bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
SPEAKER1_IP + PREFIX32, PEER1_IP + PREFIX32, null, bgpPort,
SW1_ETH100, SW1_ETH1);
- bgpPathintentConstructor(
+ bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
SPEAKER1_IP + PREFIX32, PEER1_IP + PREFIX32, bgpPort, null,
SW1_ETH100, SW1_ETH1);
- bgpPathintentConstructor(
+ bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
PEER1_IP + PREFIX32, SPEAKER1_IP + PREFIX32, null, bgpPort,
SW1_ETH1, SW1_ETH100);
- bgpPathintentConstructor(
+ bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
PEER1_IP + PREFIX32, SPEAKER1_IP + PREFIX32, bgpPort, null,
SW1_ETH1, SW1_ETH100);
- // Start to build intents between BGP speaker2 and BGP peer2
- bgpPathintentConstructor(
- SPEAKER2_IP + PREFIX32, PEER2_IP + PREFIX32, null, bgpPort,
- SW2_ETH100, SW2_ETH1);
- bgpPathintentConstructor(
- SPEAKER2_IP + PREFIX32, PEER2_IP + PREFIX32, bgpPort, null,
- SW2_ETH100, SW2_ETH1);
- bgpPathintentConstructor(
- PEER2_IP + PREFIX32, SPEAKER2_IP + PREFIX32, null, bgpPort,
- SW2_ETH1, SW2_ETH100);
- bgpPathintentConstructor(
- PEER2_IP + PREFIX32, SPEAKER2_IP + PREFIX32, bgpPort, null,
- SW2_ETH1, SW2_ETH100);
+ // Start to build intents between BGP speaker1 and BGP peer2
+ bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+ SPEAKER1_IP + PREFIX32, PEER2_IP + PREFIX32, null, bgpPort,
+ SW1_ETH100, SW2_ETH1);
+ bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+ SPEAKER1_IP + PREFIX32, PEER2_IP + PREFIX32, bgpPort, null,
+ SW1_ETH100, SW2_ETH1);
+ bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+ PEER2_IP + PREFIX32, SPEAKER1_IP + PREFIX32, null, bgpPort,
+ SW2_ETH1, SW1_ETH100);
+ bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+ PEER2_IP + PREFIX32, SPEAKER1_IP + PREFIX32, bgpPort, null,
+ SW2_ETH1, SW1_ETH100);
- // Start to build intents between BGP speaker1 and BGP peer3
- bgpPathintentConstructor(
- SPEAKER1_IP + PREFIX32, PEER3_IP + PREFIX32, null, bgpPort,
- SW1_ETH100, SW3_ETH1);
- bgpPathintentConstructor(
- SPEAKER1_IP + PREFIX32, PEER3_IP + PREFIX32, bgpPort, null,
- SW1_ETH100, SW3_ETH1);
- bgpPathintentConstructor(
- PEER3_IP + PREFIX32, SPEAKER1_IP + PREFIX32, null, bgpPort,
- SW3_ETH1, SW1_ETH100);
- bgpPathintentConstructor(
- PEER3_IP + PREFIX32, SPEAKER1_IP + PREFIX32, bgpPort, null,
- SW3_ETH1, SW1_ETH100);
+ // Start to build intents between BGP speaker2 and BGP peer3
+ bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+ SPEAKER2_IP + PREFIX32, PEER3_IP + PREFIX32, null, bgpPort,
+ SW2_ETH100, SW3_ETH1);
+ bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+ SPEAKER2_IP + PREFIX32, PEER3_IP + PREFIX32, bgpPort, null,
+ SW2_ETH100, SW3_ETH1);
+ bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+ PEER3_IP + PREFIX32, SPEAKER2_IP + PREFIX32, null, bgpPort,
+ SW3_ETH1, SW2_ETH100);
+ bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+ PEER3_IP + PREFIX32, SPEAKER2_IP + PREFIX32, bgpPort, null,
+ SW3_ETH1, SW2_ETH100);
+
+ // Start to build intents between BGP speaker3 and BGP peer4
+ bgpPathIntentConstructor(VLAN10, VLAN20,
+ SPEAKER3_IP + PREFIX32, PEER4_IP + PREFIX32, null, bgpPort,
+ SW3_ETH100, SW4_ETH1);
+ bgpPathIntentConstructor(VLAN10, VLAN20,
+ SPEAKER3_IP + PREFIX32, PEER4_IP + PREFIX32, bgpPort, null,
+ SW3_ETH100, SW4_ETH1);
+ bgpPathIntentConstructor(VLAN20, VLAN10,
+ PEER4_IP + PREFIX32, SPEAKER3_IP + PREFIX32, null, bgpPort,
+ SW4_ETH1, SW3_ETH100);
+ bgpPathIntentConstructor(VLAN20, VLAN10,
+ PEER4_IP + PREFIX32, SPEAKER3_IP + PREFIX32, bgpPort, null,
+ SW4_ETH1, SW3_ETH100);
+
}
/**
@@ -474,20 +551,35 @@
* The purpose of this method is too simplify the setUpBgpIntents() method,
* and to make the setUpBgpIntents() easy to read.
*
+ * @param srcVlanId ingress VlanId
+ * @param dstVlanId egress VlanId
* @param srcPrefix source IP prefix to match
* @param dstPrefix destination IP prefix to match
* @param srcConnectPoint source connect point for PointToPointIntent
* @param dstConnectPoint destination connect point for PointToPointIntent
*/
- private void icmpPathintentConstructor(String srcPrefix, String dstPrefix,
- ConnectPoint srcConnectPoint, ConnectPoint dstConnectPoint) {
+ private void icmpPathIntentConstructor(VlanId srcVlanId,
+ VlanId dstVlanId,
+ String srcPrefix,
+ String dstPrefix,
+ ConnectPoint srcConnectPoint,
+ ConnectPoint dstConnectPoint) {
- TrafficSelector selector = DefaultTrafficSelector.builder()
+ TrafficSelector.Builder builder = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
.matchIPProtocol(IPv4.PROTOCOL_ICMP)
.matchIPSrc(IpPrefix.valueOf(srcPrefix))
- .matchIPDst(IpPrefix.valueOf(dstPrefix))
- .build();
+ .matchIPDst(IpPrefix.valueOf(dstPrefix));
+
+ if (!srcVlanId.equals(VlanId.NONE)) {
+ builder.matchVlanId(VlanId.ANY);
+ }
+
+ TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
+
+ if (!dstVlanId.equals(VlanId.NONE)) {
+ treatment.setVlanId(dstVlanId);
+ }
Key key = Key.of(srcPrefix.split("/")[0] + "-" + dstPrefix.split("/")[0]
+ "-" + "icmp", SDXL3_APPID);
@@ -495,8 +587,8 @@
PointToPointIntent intent = PointToPointIntent.builder()
.appId(SDXL3_APPID)
.key(key)
- .selector(selector)
- .treatment(noTreatment)
+ .selector(builder.build())
+ .treatment(treatment.build())
.ingressPoint(srcConnectPoint)
.egressPoint(dstConnectPoint)
.build();
@@ -509,21 +601,60 @@
*/
private void setUpIcmpIntents() {
// Start to build intents between BGP speaker1 and BGP peer1
- icmpPathintentConstructor(
- SPEAKER1_IP + PREFIX32, PEER1_IP + PREFIX32, SW1_ETH100, SW1_ETH1);
- icmpPathintentConstructor(
- PEER1_IP + PREFIX32, SPEAKER1_IP + PREFIX32, SW1_ETH1, SW1_ETH100);
+ icmpPathIntentConstructor(NO_VLAN,
+ NO_VLAN,
+ SPEAKER1_IP + PREFIX32,
+ PEER1_IP + PREFIX32,
+ SW1_ETH100,
+ SW1_ETH1);
+ icmpPathIntentConstructor(NO_VLAN,
+ NO_VLAN,
+ PEER1_IP + PREFIX32,
+ SPEAKER1_IP + PREFIX32,
+ SW1_ETH1,
+ SW1_ETH100);
// Start to build intents between BGP speaker1 and BGP peer2
- icmpPathintentConstructor(
- SPEAKER2_IP + PREFIX32, PEER2_IP + PREFIX32, SW2_ETH100, SW2_ETH1);
- icmpPathintentConstructor(
- PEER2_IP + PREFIX32, SPEAKER2_IP + PREFIX32, SW2_ETH1, SW2_ETH100);
+ icmpPathIntentConstructor(NO_VLAN,
+ NO_VLAN,
+ SPEAKER1_IP + PREFIX32,
+ PEER2_IP + PREFIX32,
+ SW1_ETH100,
+ SW2_ETH1);
+ icmpPathIntentConstructor(NO_VLAN,
+ NO_VLAN,
+ PEER2_IP + PREFIX32,
+ SPEAKER1_IP + PREFIX32,
+ SW2_ETH1,
+ SW1_ETH100);
- icmpPathintentConstructor(
- SPEAKER1_IP + PREFIX32, PEER3_IP + PREFIX32, SW1_ETH100, SW3_ETH1);
- icmpPathintentConstructor(
- PEER3_IP + PREFIX32, SPEAKER1_IP + PREFIX32, SW3_ETH1, SW1_ETH100);
+ // Start to build intents between BGP speaker2 and BGP peer3
+ icmpPathIntentConstructor(NO_VLAN,
+ NO_VLAN,
+ SPEAKER2_IP + PREFIX32,
+ PEER3_IP + PREFIX32,
+ SW2_ETH100,
+ SW3_ETH1);
+ icmpPathIntentConstructor(NO_VLAN,
+ NO_VLAN,
+ PEER3_IP + PREFIX32,
+ SPEAKER2_IP + PREFIX32,
+ SW3_ETH1,
+ SW2_ETH100);
+
+ // Start to build intents between BGP speaker3 and BGP peer4
+ icmpPathIntentConstructor(VLAN10,
+ VLAN20,
+ SPEAKER3_IP + PREFIX32,
+ PEER4_IP + PREFIX32,
+ SW3_ETH100,
+ SW4_ETH1);
+ icmpPathIntentConstructor(VLAN20,
+ VLAN10,
+ PEER4_IP + PREFIX32,
+ SPEAKER3_IP + PREFIX32,
+ SW4_ETH1,
+ SW3_ETH100);
}
/**
@@ -600,10 +731,10 @@
interfaceService.addListener(anyObject(InterfaceListener.class));
expect(interfaceService.getMatchingInterface(ip)).andReturn(null).anyTimes();
replay(interfaceService);
- reset(providersConfig);
- expect(providersConfig.getPortForPeer(ip)).andReturn(null);
- expect(providersConfig.getInterfaceNameForPeer(ip)).andReturn(null);
- replay(providersConfig);
+ reset(participantsConfig);
+ expect(participantsConfig.getPortForPeer(ip)).andReturn(null);
+ expect(participantsConfig.getInterfaceNameForPeer(ip)).andReturn(null);
+ replay(participantsConfig);
// We don't expect any intents in this case
reset(intentSynchronizer);