VOL-473 Non-OLT connect point flow provisioning
Change-Id: I4cc4ddbbfa78181ab050dcf815e4ecf0b2e04d65
diff --git a/src/main/java/org/opencord/igmpproxy/IgmpManager.java b/src/main/java/org/opencord/igmpproxy/IgmpManager.java
index cc3ab98..99a4773 100644
--- a/src/main/java/org/opencord/igmpproxy/IgmpManager.java
+++ b/src/main/java/org/opencord/igmpproxy/IgmpManager.java
@@ -453,7 +453,7 @@
DeviceId deviceId = pkt.receivedFrom().deviceId();
if (oltData.get(deviceId) == null &&
- !(connectPointMode && deviceId.equals(connectPoint.deviceId()))) {
+ !isConnectPoint(deviceId, pkt.receivedFrom().port())) {
log.error("Device not registered in netcfg :" + deviceId.toString());
return;
}
@@ -486,8 +486,9 @@
case IGMP.TYPE_IGMPV2_MEMBERSHIP_REPORT:
case IGMP.TYPE_IGMPV2_LEAVE_GROUP:
//Discard join/leave from OLT’s uplink port’s
- if (pkt.receivedFrom().port().equals(getDeviceUplink(deviceId))) {
- log.info("IGMP Picked up join/leave from the olt uplink port");
+ if (pkt.receivedFrom().port().equals(getDeviceUplink(deviceId)) ||
+ isConnectPoint(deviceId, pkt.receivedFrom().port())) {
+ log.info("IGMP Picked up join/leave from uplink/connectPoint port");
return;
}
@@ -631,10 +632,13 @@
@Override
public void event(DeviceEvent event) {
DeviceId devId = event.subject().id();
- PortNumber port;
- if (oltData.get(devId) == null) {
+ Port p = event.port();
+ if (oltData.get(devId) == null &&
+ !(p != null && isConnectPoint(devId, p.number()))) {
return;
}
+ PortNumber port;
+
switch (event.type()) {
case DEVICE_ADDED:
@@ -645,7 +649,7 @@
case PORT_STATS_UPDATED:
break;
case PORT_ADDED:
- port = event.port().number();
+ port = p.number();
if (oltData.containsKey(devId) && !isUplink(devId, port) && !isConnectPoint(devId, port)) {
processFilterObjective(devId, port, false);
} else if (isUplink(devId, port)) {
@@ -655,7 +659,7 @@
}
break;
case PORT_UPDATED:
- port = event.port().number();
+ port = p.number();
if (oltData.containsKey(devId) && !isUplink(devId, port) && !isConnectPoint(devId, port)) {
if (event.port().isEnabled()) {
processFilterObjective(devId, port, false);
@@ -677,7 +681,7 @@
}
break;
case PORT_REMOVED:
- port = event.port().number();
+ port = p.number();
processFilterObjective(devId, port, true);
break;
default:
@@ -714,9 +718,11 @@
periodicQuery = newCfg.periodicQuery();
fastLeave = newCfg.fastLeave();
pimSSmInterworking = newCfg.pimSsmInterworking();
- connectPoint = newCfg.connectPoint();
- if (connectPointMode != newCfg.connectPointMode()) {
+
+ if (connectPointMode != newCfg.connectPointMode() ||
+ connectPoint != newCfg.connectPoint()) {
connectPointMode = newCfg.connectPointMode();
+ connectPoint = newCfg.connectPoint();
if (connectPointMode) {
unprovisionUplinkFlows();
provisionConnectPointFlows();
diff --git a/src/main/java/org/opencord/igmpproxy/IgmpSender.java b/src/main/java/org/opencord/igmpproxy/IgmpSender.java
index 75e1d7b..f880646 100644
--- a/src/main/java/org/opencord/igmpproxy/IgmpSender.java
+++ b/src/main/java/org/opencord/igmpproxy/IgmpSender.java
@@ -30,6 +30,8 @@
import org.onosproject.net.packet.DefaultOutboundPacket;
import org.onosproject.net.packet.OutboundPacket;
import org.onosproject.net.packet.PacketService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer;
@@ -52,6 +54,7 @@
private short mvlan = DEFAULT_MVLAN;
private byte igmpCos = DEFAULT_COS;
private int maxResp = DEFAULT_MEX_RESP;
+ private Logger log = LoggerFactory.getLogger(getClass());
private IgmpSender(PacketService packetService, MastershipService mastershipService) {
this.packetService = packetService;
@@ -199,6 +202,10 @@
if (IgmpManager.connectPointMode) {
+ if (IgmpManager.connectPoint == null) {
+ log.warn("cannot find a connectPoint to send the packet uplink");
+ return;
+ }
sendIgmpPacket(ethPkt, IgmpManager.connectPoint.deviceId(), IgmpManager.connectPoint.port());
} else {
PortNumber upLink = IgmpManager.getDeviceUplink(deviceId);