SEBA-1005-Minor version upgrade
Change-Id: Id6dc9eb7ffb4af55d29066ce3b54ba83d67b3665
diff --git a/api/pom.xml b/api/pom.xml
index 9ce1655..b1111c4 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -26,7 +26,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>onos-app-igmpproxy-api</artifactId>
-
+ <version>${igmpproxy.api.version}</version>
<packaging>bundle</packaging>
<description>IGMPProxy application API</description>
diff --git a/app/app.xml b/app/app.xml
index 33b0ef8..18dd5db 100644
--- a/app/app.xml
+++ b/app/app.xml
@@ -17,8 +17,10 @@
<app name="org.opencord.igmpproxy" origin="Nokia" version="${project.version}"
category="Traffic Steering" url="http://onosproject.org" title="IGMPProxy application for CORD"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
- features="${project.artifactId}" apps="org.onosproject.mcast,org.opencord.sadis">
+ features="${project.artifactId}">
<description>IGMP PROXY APP</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
- <artifact>mvn:${project.groupId}/onos-app-igmpproxy-api/${project.version}</artifact>
+ <artifact>mvn:${project.groupId}/onos-app-igmpproxy-api/${igmpproxy.api.version}</artifact>
+ <artifact>mvn:${project.groupId}/sadis-api/${sadis.api.version}</artifact>
+ <artifact>mvn:org.onosproject/onos-apps-mcast-api/${onos.version}</artifact>
</app>
diff --git a/app/features.xml b/app/features.xml
index 412164e..b3e1ab2 100644
--- a/app/features.xml
+++ b/app/features.xml
@@ -18,7 +18,9 @@
<feature name="${project.artifactId}" version="${project.version}"
description="${project.description}">
<feature>onos-api</feature>
- <bundle>mvn:${project.groupId}/onos-app-igmpproxy-api/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/onos-app-igmpproxy-api/${igmpproxy.api.version}</bundle>
<bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/sadis-api/${sadis.api.version}</bundle>
+ <bundle>mvn:org.onosproject/onos-apps-mcast-api/${onos.version}</bundle>
</feature>
</features>
diff --git a/app/pom.xml b/app/pom.xml
index e56bc97..60597f6 100644
--- a/app/pom.xml
+++ b/app/pom.xml
@@ -36,14 +36,9 @@
<onos.app.title>IGMP proxy app</onos.app.title>
<onos.app.url>http://opencord.org</onos.app.url>
<onos.app.readme>IGMP implementation.</onos.app.readme>
- <onos.app.requires>
- org.onosproject.mcast
- org.opencord.sadis
- </onos.app.requires>
- <sadis.api.version>5.1.0</sadis.api.version>
+ <sadis.api.version>5.3.0-SNAPSHOT</sadis.api.version>
</properties>
-
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
@@ -104,7 +99,7 @@
<dependency>
<groupId>org.opencord</groupId>
<artifactId>onos-app-igmpproxy-api</artifactId>
- <version>${project.version}</version>
+ <version>${igmpproxy.api.version}</version>
<scope>compile</scope>
</dependency>
diff --git a/app/src/main/java/org/opencord/igmpproxy/impl/IgmpManager.java b/app/src/main/java/org/opencord/igmpproxy/impl/IgmpManager.java
index 2025e0b..fbe96c6 100644
--- a/app/src/main/java/org/opencord/igmpproxy/impl/IgmpManager.java
+++ b/app/src/main/java/org/opencord/igmpproxy/impl/IgmpManager.java
@@ -67,7 +67,6 @@
import org.opencord.igmpproxy.impl.store.groupmember.GroupMember;
import org.opencord.igmpproxy.impl.store.groupmember.GroupMemberStore;
import org.opencord.igmpproxy.statemachine.StateMachineService;
-import org.opencord.sadis.BaseInformationService;
import org.opencord.sadis.SadisService;
import org.opencord.sadis.SubscriberAndDeviceInformation;
import org.osgi.service.component.annotations.Activate;
@@ -75,6 +74,7 @@
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -110,7 +110,8 @@
*/
@Component(immediate = true)
public class IgmpManager {
-
+ private static final String MCAST_NOT_RUNNING = "Multicast is not running.";
+ private static final String SADIS_NOT_RUNNING = "Sadis is not running.";
private static final String APP_NAME = "org.opencord.igmpproxy";
private static final Class<IgmpproxyConfig> IGMPPROXY_CONFIG_CLASS =
@@ -174,11 +175,17 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected NetworkConfigRegistry networkConfig;
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected MulticastRouteService multicastService;
+ @Reference(cardinality = ReferenceCardinality.OPTIONAL,
+ bind = "bindMcastRouteService",
+ unbind = "unbindMcastRouteService",
+ policy = ReferencePolicy.DYNAMIC)
+ protected volatile MulticastRouteService multicastService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected SadisService sadisService;
+ @Reference(cardinality = ReferenceCardinality.OPTIONAL,
+ bind = "bindSadisService",
+ unbind = "unbindSadisService",
+ policy = ReferencePolicy.DYNAMIC)
+ protected volatile SadisService sadisService;
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected IgmpStatisticsService igmpStatisticsManager;
@@ -234,8 +241,6 @@
return outgoingIgmpWithV3;
}
- protected BaseInformationService<SubscriberAndDeviceInformation> subsService;
-
private List<Byte> validMembershipModes = Arrays.asList(MODE_IS_INCLUDE, MODE_IS_EXCLUDE, CHANGE_TO_INCLUDE_MODE,
CHANGE_TO_EXCLUDE_MODE, ALLOW_NEW_SOURCES, BLOCK_OLD_SOURCES);
@@ -253,7 +258,6 @@
configListener.reconfigureNetwork(networkConfig.getConfig(appId, IGMPPROXY_CONFIG_CLASS));
configListener.reconfigureSsmTable(networkConfig.getConfig(appId, IGMPPROXY_SSM_CONFIG_CLASS));
- subsService = sadisService.getSubscriberInfoService();
if (connectPointMode) {
provisionConnectPointFlows();
} else {
@@ -287,7 +291,6 @@
networkConfig.unregisterConfigFactory(igmpproxySsmConfigFactory);
deviceService.removeListener(deviceListener);
packetService.removeProcessor(processor);
- flowRuleService.removeFlowRulesById(appId);
log.info("Stopped");
}
@@ -304,12 +307,33 @@
igmpReportProcessServiceExecutorList[i] = igmpReportProcessServiceExecutor;
}
}
+
private void shutdownIgmpReportProcessServiceExecutors() {
for (ExecutorService executor : igmpReportProcessServiceExecutorList) {
executor.shutdown();
}
}
+ protected void bindSadisService(SadisService service) {
+ sadisService = service;
+ log.info("Sadis-service binds to onos.");
+ }
+
+ protected void unbindSadisService(SadisService service) {
+ sadisService = null;
+ log.info("Sadis-service unbinds from onos.");
+ }
+
+ protected void bindMcastRouteService(MulticastRouteService service) {
+ multicastService = service;
+ log.info("Multicast route service binds to onos.");
+ }
+
+ protected void unbindMcastRouteService(MulticastRouteService service) {
+ multicastService = null;
+ log.info("Multicast route service unbinds from onos.");
+ }
+
protected Ip4Address getDeviceIp(DeviceId ofDeviceId) {
try {
String[] mgmtAddress = deviceService.getDevice(ofDeviceId)
@@ -384,6 +408,11 @@
}
private void processIgmpReport(IGMPMembership igmpGroup, VlanId vlan, ConnectPoint cp, byte igmpType) {
+ if (multicastService == null) {
+ log.warn(MCAST_NOT_RUNNING);
+ return;
+ }
+
DeviceId deviceId = cp.deviceId();
PortNumber portNumber = cp.port();
@@ -522,6 +551,10 @@
}
private void leaveAction(GroupMember groupMember) {
+ if (multicastService == null) {
+ log.warn(MCAST_NOT_RUNNING);
+ return;
+ }
igmpStatisticsManager.increaseStat(IgmpStatisticType.IGMP_DISCONNECT);
ConnectPoint cp = new ConnectPoint(groupMember.getDeviceId(), groupMember.getPortNumber());
stateMachineService.leave(groupMember.getDeviceId(), groupMember.getGroupIp());
@@ -841,6 +874,10 @@
private Optional<SubscriberAndDeviceInformation> getSubscriberAndDeviceInformation(String serialNumber) {
long start = System.currentTimeMillis();
try {
+ if (sadisService == null) {
+ log.warn(SADIS_NOT_RUNNING);
+ return Optional.empty();
+ }
return Optional.ofNullable(sadisService.getSubscriberInfoService().get(serialNumber));
} finally {
if (log.isDebugEnabled()) {
@@ -848,7 +885,6 @@
// This measurement is just for monitoring these kinds of situations.
log.debug("Device fetched from SADIS. Elapsed {} msec", System.currentTimeMillis() - start);
}
-
}
}
@@ -956,6 +992,10 @@
}
private void onSourceStateChanged(DeviceId deviceId, PortNumber portNumber, boolean enabled) {
+ if (multicastService == null) {
+ log.warn(MCAST_NOT_RUNNING);
+ return;
+ }
if (!(getSource().isPresent() &&
getSource().get().deviceId().equals(deviceId) &&
getSource().get().port().equals(portNumber))) {
diff --git a/app/src/main/java/org/opencord/igmpproxy/impl/store/groupmember/DistributedGroupMemberStore.java b/app/src/main/java/org/opencord/igmpproxy/impl/store/groupmember/DistributedGroupMemberStore.java
index 01f9af9..bd441ed 100644
--- a/app/src/main/java/org/opencord/igmpproxy/impl/store/groupmember/DistributedGroupMemberStore.java
+++ b/app/src/main/java/org/opencord/igmpproxy/impl/store/groupmember/DistributedGroupMemberStore.java
@@ -64,9 +64,6 @@
@Deactivate
public void deactivate() {
- groupMemberMap.clear();
- groupMemberMap = null;
- consistentMap.destroy();
log.info("Stopped.");
}
}
diff --git a/app/src/main/java/org/opencord/igmpproxy/impl/store/machine/DistributedStateMachineStore.java b/app/src/main/java/org/opencord/igmpproxy/impl/store/machine/DistributedStateMachineStore.java
index f337b09..7823133 100644
--- a/app/src/main/java/org/opencord/igmpproxy/impl/store/machine/DistributedStateMachineStore.java
+++ b/app/src/main/java/org/opencord/igmpproxy/impl/store/machine/DistributedStateMachineStore.java
@@ -78,11 +78,6 @@
@Deactivate
public void deactivate() {
- stateMachineMap.clear();
- stateMachineMap = null;
- consistentMap.destroy();
- stateMachineCounters.clear();
- stateMachineCounters.destroy();
log.info("Stopped.");
}
diff --git a/app/src/test/java/org/opencord/igmpproxy/impl/IgmpManagerBase.java b/app/src/test/java/org/opencord/igmpproxy/impl/IgmpManagerBase.java
index 1905ec2..d93ec38 100644
--- a/app/src/test/java/org/opencord/igmpproxy/impl/IgmpManagerBase.java
+++ b/app/src/test/java/org/opencord/igmpproxy/impl/IgmpManagerBase.java
@@ -522,6 +522,11 @@
private class MockBpService implements BaseInformationService<BandwidthProfileInformation> {
@Override
+ public void clearLocalData() {
+
+ }
+
+ @Override
public void invalidateAll() {
}
@@ -562,6 +567,11 @@
}
@Override
+ public void clearLocalData() {
+
+ }
+
+ @Override
public void invalidateAll() {
}
diff --git a/pom.xml b/pom.xml
index 4fe4409..e7019cf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,6 +30,10 @@
<version>2.2.0-SNAPSHOT</version>
<packaging>pom</packaging>
+ <properties>
+ <igmpproxy.api.version>2.2.0-SNAPSHOT</igmpproxy.api.version>
+ </properties>
+
<modules>
<module>api</module>
<module>app</module>