Adding useful logs for igmp operations
Change-Id: If55ba0a7da86ade3c05b4f6bcbe36f7324abf83a
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 e32bc4a..f70dde2 100644
--- a/app/src/main/java/org/opencord/igmpproxy/impl/IgmpManager.java
+++ b/app/src/main/java/org/opencord/igmpproxy/impl/IgmpManager.java
@@ -352,6 +352,9 @@
DeviceId deviceId = cp.deviceId();
PortNumber portNumber = cp.port();
+ log.debug("Processing IGMP report on membership {} for vlan {} on port {} with type {}",
+ igmpGroup, vlan, cp, igmpType);
+
Ip4Address groupIp = igmpGroup.getGaddr().getIp4Address();
if (!groupIp.isMulticast()) {
log.info(groupIp.toString() + " is not a valid group address");
@@ -405,7 +408,9 @@
GroupMember groupMember = groupMemberStore.getGroupMember(groupMemberKey);
if (join) {
+ log.debug("Received join on {} for vlan {}", cp, vlan);
igmpStatisticsManager.increaseStat(IgmpStatisticType.IGMP_JOIN_REQ);
+
if (groupMember == null) {
Optional<ConnectPoint> sourceConfigured = getSource();
if (!sourceConfigured.isPresent()) {
@@ -460,6 +465,7 @@
//put updated member to the store
groupMemberStore.putGroupMember(groupMember);
} else {
+ log.debug("Received leave on {} for vlan {}", cp, vlan);
igmpStatisticsManager.increaseStat(IgmpStatisticType.IGMP_LEAVE_REQ);
if (groupMember == null) {
log.info("receive leave but no instance, group {} device: {} port:{}",
@@ -775,7 +781,7 @@
return (connectPointMode && connectPoint.deviceId().equals(device)
&& connectPoint.port().equals(port));
} else {
- log.info("connectPoint not configured for device {}", device);
+ log.debug("connectPoint not configured for device {}", device);
return false;
}
}
diff --git a/app/src/main/java/org/opencord/igmpproxy/impl/IgmpSender.java b/app/src/main/java/org/opencord/igmpproxy/impl/IgmpSender.java
index 9bda1c9..c71c70a 100644
--- a/app/src/main/java/org/opencord/igmpproxy/impl/IgmpSender.java
+++ b/app/src/main/java/org/opencord/igmpproxy/impl/IgmpSender.java
@@ -271,9 +271,15 @@
public void sendIgmpPacket(Ethernet ethPkt, DeviceId deviceId, PortNumber portNumber) {
if (!igmpLeadershipService.isLocalLeader(deviceId)) {
+ log.trace("Instance is not leader for device {}, " +
+ "not emitting IMGP packet on port {}", deviceId, portNumber);
return;
}
+ if (log.isTraceEnabled()) {
+ log.trace("Emitting on {}/{} outbound IGMP packet {}", deviceId, portNumber, ethPkt);
+ }
+
IPv4 ipv4Pkt = (IPv4) ethPkt.getPayload();
IGMP igmp = (IGMP) ipv4Pkt.getPayload();
// We are checking the length of packets. Right now the counter value will be 0 because of internal translation
@@ -292,6 +298,9 @@
treatment, ByteBuffer.wrap(ethPkt.serialize()));
igmpStatisticsService.increaseStat(IgmpStatisticType.VALID_IGMP_PACKET_COUNTER);
packetService.emit(packet);
+ if (log.isTraceEnabled()) {
+ log.trace("Emitted on {}/{} outbound IGMP packet {}", deviceId, portNumber, packet);
+ }
}
}
diff --git a/app/src/main/java/org/opencord/igmpproxy/impl/SingleStateMachine.java b/app/src/main/java/org/opencord/igmpproxy/impl/SingleStateMachine.java
index 83f2ef2..e0ae994 100644
--- a/app/src/main/java/org/opencord/igmpproxy/impl/SingleStateMachine.java
+++ b/app/src/main/java/org/opencord/igmpproxy/impl/SingleStateMachine.java
@@ -24,6 +24,8 @@
import org.opencord.igmpproxy.statemachine.StateMachine;
import org.opencord.igmpproxy.statemachine.State;
import org.opencord.igmpproxy.statemachine.StateMachineId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.concurrent.atomic.AtomicInteger;
@@ -34,6 +36,8 @@
public final class SingleStateMachine implements StateMachine {
public static final int DEFAULT_MAX_RESP = 0xfffffff;
+ private Logger log = LoggerFactory.getLogger(getClass());
+
private StateMachineId stateMachineId;
private int currentState;
@@ -211,6 +215,7 @@
}
private void next(int msg) {
+ log.debug("Transitioning to State {}", msg);
this.currentState = transition[currentState][msg];
}