Updating version to 1.5.0-SNAPSHOT
API change in version 1.4.0 necessitated moving VPLS app to use new
IntentSynchronizationService.
Change-Id: I3ca5fde8b2d36a4f157b93dbdbc7ca80c0f90e06
diff --git a/calendar/pom.xml b/calendar/pom.xml
index 9c9a5d5..732c926 100644
--- a/calendar/pom.xml
+++ b/calendar/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-samples</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/database-perf/pom.xml b/database-perf/pom.xml
index 0455227..0d8c4a0 100644
--- a/database-perf/pom.xml
+++ b/database-perf/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-samples</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/ecord/co/pom.xml b/ecord/co/pom.xml
index 733b7a8..d804cd3 100644
--- a/ecord/co/pom.xml
+++ b/ecord/co/pom.xml
@@ -19,20 +19,20 @@
<parent>
<artifactId>onos-app-samples</artifactId>
<groupId>org.onosproject</groupId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-ecord-co</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>Enterprise CORD for Central Office</description>
<url>http://onosproject.org</url>
<properties>
- <onos.version>1.4.0-SNAPSHOT</onos.version>
+ <onos.version>1.5.0-SNAPSHOT</onos.version>
<onos.app.name>org.onosproject.ecord.co</onos.app.name>
<onos.app.origin>Open Networking Lab</onos.app.origin>
</properties>
diff --git a/flowtest/pom.xml b/flowtest/pom.xml
index eea75e8..d570783 100644
--- a/flowtest/pom.xml
+++ b/flowtest/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-samples</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/ifwd/pom.xml b/ifwd/pom.xml
index 7f82a7a..d32086d 100644
--- a/ifwd/pom.xml
+++ b/ifwd/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-samples</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/ipfix/pom.xml b/ipfix/pom.xml
index 1af3e2b..6933325 100644
--- a/ipfix/pom.xml
+++ b/ipfix/pom.xml
@@ -20,10 +20,10 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-samples</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
-
+
<artifactId>onos-app-ipfix</artifactId>
<packaging>bundle</packaging>
diff --git a/oneping/pom.xml b/oneping/pom.xml
index 48243aa..814d543 100644
--- a/oneping/pom.xml
+++ b/oneping/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-samples</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/pom.xml b/pom.xml
index a2cc2ea..db081c0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,11 +19,11 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
</parent>
<artifactId>onos-app-samples</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<packaging>pom</packaging>
<description>ONOS sample applications</description>
diff --git a/tvue/pom.xml b/tvue/pom.xml
index a1046ab..9f037bb 100644
--- a/tvue/pom.xml
+++ b/tvue/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-samples</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/uiref/pom.xml b/uiref/pom.xml
index 5d2ee7f..847e105 100644
--- a/uiref/pom.xml
+++ b/uiref/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-samples</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/vpls/pom.xml b/vpls/pom.xml
index b237aa0..45c0529 100644
--- a/vpls/pom.xml
+++ b/vpls/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-samples</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -56,7 +56,7 @@
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-sdnip</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
diff --git a/vpls/src/main/java/org/onos/vpls/IntentInstaller.java b/vpls/src/main/java/org/onos/vpls/IntentInstaller.java
index fa8d6ce..a1b65d9 100644
--- a/vpls/src/main/java/org/onos/vpls/IntentInstaller.java
+++ b/vpls/src/main/java/org/onos/vpls/IntentInstaller.java
@@ -15,7 +15,7 @@
import org.onosproject.net.intent.Key;
import org.onosproject.net.intent.MultiPointToSinglePointIntent;
import org.onosproject.net.intent.SinglePointToMultiPointIntent;
-import org.onosproject.sdnip.IntentSynchronizer;
+import org.onosproject.routing.IntentSynchronizationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,7 +40,7 @@
private static final String PREFIX_UNICAST = "uni";
private final ApplicationId appId;
- private final IntentSynchronizer intentSynchronizer;
+ private final IntentSynchronizationService intentSynchronizer;
private final IntentService intentService;
/**
@@ -51,7 +51,7 @@
* @param intentSynchronizer the intent synchronizer service
*/
public IntentInstaller(ApplicationId appId, IntentService intentService,
- IntentSynchronizer intentSynchronizer) {
+ IntentSynchronizationService intentSynchronizer) {
this.appId = appId;
this.intentService = intentService;
this.intentSynchronizer = intentSynchronizer;
diff --git a/vpls/src/main/java/org/onos/vpls/Vpls.java b/vpls/src/main/java/org/onos/vpls/Vpls.java
index b8cfebe..7fdb970 100644
--- a/vpls/src/main/java/org/onos/vpls/Vpls.java
+++ b/vpls/src/main/java/org/onos/vpls/Vpls.java
@@ -26,11 +26,6 @@
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onosproject.app.ApplicationService;
-import org.onosproject.cluster.ClusterService;
-import org.onosproject.cluster.ControllerNode;
-import org.onosproject.cluster.LeadershipEvent;
-import org.onosproject.cluster.LeadershipEventListener;
-import org.onosproject.cluster.LeadershipService;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.incubator.net.intf.InterfaceService;
@@ -40,16 +35,13 @@
import org.onosproject.net.host.HostListener;
import org.onosproject.net.host.HostService;
import org.onosproject.net.intent.IntentService;
-import org.onosproject.sdnip.IntentSynchronizer;
+import org.onosproject.routing.IntentSynchronizationAdminService;
+import org.onosproject.routing.IntentSynchronizationService;
import org.slf4j.Logger;
import java.util.Map;
-import java.util.Objects;
import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import static org.onlab.util.BoundedThreadPool.newSingleThreadExecutor;
-import static org.onlab.util.Tools.groupedThreads;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -64,9 +56,6 @@
protected ApplicationService applicationService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected ClusterService clusterService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected CoreService coreService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
@@ -79,40 +68,27 @@
protected InterfaceService interfaceService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected LeadershipService leadershipService;
+ protected IntentSynchronizationService intentSynchronizer;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected IntentSynchronizationAdminService intentSynchronizerAdmin;
private final HostListener hostListener = new InternalHostListener();
private IntentInstaller intentInstaller;
- protected ExecutorService synchronizerExecutor =
- newSingleThreadExecutor(groupedThreads("onos/vpls", "sync"));
- private IntentSynchronizer intentSynchronizer;
-
private ApplicationId appId;
- private LeadershipEventListener leadershipEventListener =
- new InnerLeadershipEventListener();
- private ControllerNode localControllerNode;
-
@Activate
public void activate() {
appId = coreService.registerApplication(VPLS_APP);
- localControllerNode = clusterService.getLocalNode();
-
- intentSynchronizer = new IntentSynchronizer(appId, intentService, synchronizerExecutor);
- intentSynchronizer.start();
-
intentInstaller = new IntentInstaller(appId,
intentService,
intentSynchronizer);
- leadershipService.addListener(leadershipEventListener);
- leadershipService.runForLeadership(appId.name());
-
applicationService.registerDeactivateHook(appId,
- intentSynchronizer::removeIntents);
+ intentSynchronizerAdmin::removeIntents);
hostService.addListener(hostListener);
@@ -123,9 +99,6 @@
@Deactivate
public void deactivate() {
- leadershipService.withdraw(appId.name());
- leadershipService.removeListener(leadershipEventListener);
-
log.info("Stopped");
}
@@ -208,41 +181,6 @@
}
/**
- * A listener for Leadership Events.
- */
- private class InnerLeadershipEventListener
- implements LeadershipEventListener {
-
- @Override
- public void event(LeadershipEvent event) {
- log.debug("Leadership Event: time = {} type = {} event = {}",
- event.time(), event.type(), event);
-
- if (!event.subject().topic().equals(appId.name())) {
- return; // Not our topic: ignore
- }
- if (!Objects.equals(event.subject().leader(), localControllerNode.id())) {
- return; // The event is not about this instance: ignore
- }
-
- switch (event.type()) {
- case LEADER_ELECTED:
- log.info("Leader Elected");
- intentSynchronizer.leaderChanged(true);
- break;
- case LEADER_BOOTED:
- log.info("Leader Lost Election");
- intentSynchronizer.leaderChanged(false);
- break;
- case LEADER_REELECTED:
- break;
- default:
- break;
- }
- }
- }
-
- /**
* Listener for host events.
*/
class InternalHostListener implements HostListener {
diff --git a/vpls/src/test/java/org/onos/vpls/VplsTest.java b/vpls/src/test/java/org/onos/vpls/VplsTest.java
index 18338de..a420eea 100644
--- a/vpls/src/test/java/org/onos/vpls/VplsTest.java
+++ b/vpls/src/test/java/org/onos/vpls/VplsTest.java
@@ -16,26 +16,14 @@
package org.onos.vpls;
import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.MoreExecutors;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
-import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onosproject.TestApplicationId;
import org.onosproject.app.ApplicationService;
-import org.onosproject.cluster.ClusterService;
-import org.onosproject.cluster.ClusterServiceAdapter;
-import org.onosproject.cluster.ControllerNode;
-import org.onosproject.cluster.DefaultControllerNode;
-import org.onosproject.cluster.Leadership;
-import org.onosproject.cluster.LeadershipEvent;
-import org.onosproject.cluster.LeadershipEventListener;
-import org.onosproject.cluster.LeadershipService;
-import org.onosproject.cluster.LeadershipServiceAdapter;
-import org.onosproject.cluster.NodeId;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.core.IdGenerator;
@@ -64,6 +52,8 @@
import org.onosproject.net.intent.MultiPointToSinglePointIntent;
import org.onosproject.net.intent.SinglePointToMultiPointIntent;
import org.onosproject.net.provider.ProviderId;
+import org.onosproject.routing.IntentSynchronizationAdminService;
+import org.onosproject.routing.IntentSynchronizationService;
import java.util.ArrayList;
import java.util.Collections;
@@ -130,25 +120,17 @@
private static final HostId HID7 = HostId.hostId(MAC7, VlanId.NONE);
private ApplicationService applicationService;
- private ClusterService clusterService;
private CoreService coreService;
private HostListener hostListener;
private Set<Host> hostsAvailable;
private HostService hostService;
private IntentService intentService;
private InterfaceService interfaceService;
- private LeadershipService leadershipService;
private Vpls vpls;
private static final String APP_NAME = "org.onosproject.vpls";
private static final ApplicationId APPID = TestApplicationId.create(APP_NAME);
- private static final NodeId NID_LOCAL = new NodeId("local");
- private static final IpAddress LOCALHOST = IpAddress.valueOf("127.0.0.1");
- private final LeadershipEvent leadershipEvent
- = new LeadershipEvent(LeadershipEvent.Type.LEADER_ELECTED,
- new Leadership(APP_NAME, NID_LOCAL, 0, 0));
-
private static final ProviderId PID = new ProviderId("of", "foo");
@BeforeClass
@@ -159,8 +141,6 @@
@Before
public void setUp() throws Exception {
- clusterService = new TestClusterService();
-
applicationService = createMock(ApplicationService.class);
coreService = createMock(CoreService.class);
@@ -173,20 +153,20 @@
intentService = new TestIntentService();
+ TestIntentSynchronizer intentSynchronizer =
+ new TestIntentSynchronizer(intentService);
+
interfaceService = createMock(InterfaceService.class);
addIntfConfig();
- leadershipService = new TestLeadershipService();
-
vpls = new Vpls();
vpls.applicationService = applicationService;
- vpls.clusterService = clusterService;
vpls.coreService = coreService;
vpls.hostService = hostService;
vpls.intentService = intentService;
vpls.interfaceService = interfaceService;
- vpls.leadershipService = leadershipService;
- vpls.synchronizerExecutor = MoreExecutors.newDirectExecutorService();
+ vpls.intentSynchronizer = intentSynchronizer;
+ vpls.intentSynchronizerAdmin = intentSynchronizer;
}
/**
@@ -312,9 +292,8 @@
Collections.EMPTY_SET);
hostsAvailable.addAll(Sets.newHashSet(h1, h2, h3, h7));
- hostsAvailable.forEach(host -> {
- hostListener.event(new HostEvent(HostEvent.Type.HOST_ADDED, host));
- });
+ hostsAvailable.forEach(host ->
+ hostListener.event(new HostEvent(HostEvent.Type.HOST_ADDED, host)));
List<Intent> expectedIntents = new ArrayList<>();
expectedIntents.addAll(generateVlanOneBrc());
@@ -375,7 +354,7 @@
if (intentOne.key().equals(intentTwo.key())) {
found = true;
assertTrue(format("Comparing %s and %s", intentOne, intentTwo),
- IntentUtils.equals(intentOne, intentTwo));
+ IntentUtils.intentsAreEqual(intentOne, intentTwo));
break;
}
}
@@ -577,36 +556,6 @@
return new HostLocation(new ConnectPoint(getDeviceId(i), P1), 123L);
}
- private final class TestClusterService extends ClusterServiceAdapter {
-
- ControllerNode local = new DefaultControllerNode(NID_LOCAL, LOCALHOST);
-
- @Override
- public ControllerNode getLocalNode() {
- return local;
- }
-
- @Override
- public Set<ControllerNode> getNodes() {
- return Sets.newHashSet();
- }
-
- }
-
- /**
- * LeadershipService that allows us to grab a reference to
- * PartitionManager's LeadershipEventListener.
- */
- public class TestLeadershipService extends LeadershipServiceAdapter {
-
- // Assume by default that the listener is the leader.
- @Override
- public void addListener(LeadershipEventListener listener) {
- listener.event(leadershipEvent);
- }
-
- }
-
/**
* Represents a fake IntentService class that easily allows to store and
* retrieve intents without implementing the IntentService logic.
@@ -683,4 +632,43 @@
}
+ /**
+ * Test IntentSynchronizer that passes all intents straight through to the
+ * intent service.
+ */
+ private class TestIntentSynchronizer implements IntentSynchronizationService,
+ IntentSynchronizationAdminService {
+
+ private final IntentService intentService;
+
+ /**
+ * Creates a new test intent synchronizer.
+ *
+ * @param intentService intent service
+ */
+ public TestIntentSynchronizer(IntentService intentService) {
+ this.intentService = intentService;
+ }
+
+ @Override
+ public void submit(Intent intent) {
+ intentService.submit(intent);
+ }
+
+ @Override
+ public void withdraw(Intent intent) {
+ intentService.withdraw(intent);
+ }
+
+ @Override
+ public void modifyPrimary(boolean isPrimary) {
+
+ }
+
+ @Override
+ public void removeIntents() {
+
+ }
+ }
+
}