DHCP-Relay : fix logs when one or more DHCP servers are not reachable.
Change-Id: Ideb0b1a959bd352b0c535b6010bd9326aca184f8
diff --git a/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java b/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
index d8a3b16..afe05f0 100644
--- a/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
+++ b/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
@@ -1086,6 +1086,7 @@
DHCP6 clientDhcp6 = (DHCP6) clientUdp.getPayload();
boolean directConnFlag = Dhcp6HandlerUtil.directlyConnected(clientDhcp6);
+ boolean serverFound = false;
List<InternalPacket> internalPackets = new ArrayList<>();
List<DhcpServerInfo> serverInfoList = findValidServerInfo(directConnFlag);
List<DhcpServerInfo> copyServerInfoList = new ArrayList<DhcpServerInfo>(serverInfoList);
@@ -1097,14 +1098,19 @@
}
DhcpServerInfo newServerInfo = getHostInfoForServerInfo(serverInfo, serverInfoList);
if (newServerInfo == null) {
- log.warn("Can't get server interface with host info resolved, ignore");
+ log.debug("Can't get server interface with host info resolved, ignore serverInfo {} serverInfoList {}",
+ serverInfo, serverInfoList);
continue;
}
Interface serverInterface = getServerInterface(newServerInfo);
if (serverInterface == null) {
- log.warn("Can't get server interface, ignore");
+ log.debug("Can't get server interface, ignore for serverInfo {}, serverInfoList {}",
+ serverInfo, serverInfoList);
continue;
}
+
+ serverFound = true;
+ log.debug("Server Info Found {}", serverInfo.getDhcpConnectMac());
Ethernet etherRouted = (Ethernet) clientPacket.clone();
MacAddress macFacingServer = serverInterface.mac();
if (macFacingServer == null) {
@@ -1119,6 +1125,9 @@
internalPackets.add(internalPacket);
log.debug("Sending LQ to DHCP server {}", newServerInfo.getDhcpServerIp6());
}
+ if (!serverFound) {
+ log.warn("ProcessDhcp6PacketFromClient No Server Found");
+ }
log.debug("num of client packets to send is{}", internalPackets.size());
return internalPackets;
@@ -1247,6 +1256,9 @@
String clientConnectionPointStr = new String(interfaceIdOption.getInPort());
ConnectPoint clientConnectionPoint = ConnectPoint.deviceConnectPoint(clientConnectionPointStr);
VlanId vlanIdInUse = VlanId.vlanId(interfaceIdOption.getVlanId());
+
+ log.debug("processDhcp6PacketFromServer Interface Id Mac {}, port{}, vlan {}",
+ peerMac, clientConnectionPointStr, vlanIdInUse);
Interface clientInterface = interfaceService.getInterfacesByPort(clientConnectionPoint)
.stream().filter(iface -> Dhcp6HandlerUtil.interfaceContainsVlan(iface, vlanIdInUse))
.findFirst().orElse(null);
@@ -1558,7 +1570,7 @@
log.debug("DHCP server {} host info found. ConnectPt{} Mac {} vlan {}", serverInfo.getDhcpServerIp6(),
dhcpServerConnectPoint, dhcpServerConnectMac, dhcpConnectVlan);
} else {
- log.warn("DHCP server {} not resolve yet connectPt {} mac {} vlan {}", serverInfo.getDhcpServerIp6(),
+ log.debug("DHCP server {} not resolve yet connectPt {} mac {} vlan {}", serverInfo.getDhcpServerIp6(),
dhcpServerConnectPoint, dhcpServerConnectMac, dhcpConnectVlan);
Ip6Address ipToProbe;
@@ -1570,7 +1582,7 @@
String hostToProbe = serverInfo.getDhcpGatewayIp6()
.map(ip -> "gateway").orElse("server");
- log.info("Dynamically probing to resolve {} IP {}", hostToProbe, ipToProbe);
+ log.debug("Dynamically probing to resolve {} IP {}", hostToProbe, ipToProbe);
hostService.startMonitoringIp(ipToProbe);
Set<Host> hosts = hostService.getHostsByIp(ipToProbe);
@@ -1584,7 +1596,7 @@
newServerInfo = serverInfo;
log.warn("Dynamically host found host {}", host);
} else {
- log.warn("No host found host ip {} dynamically", ipToProbe);
+ log.debug("No host found host ip {} dynamically", ipToProbe);
}
}
return newServerInfo;