Remove unnecessary warning from DHCP6 relay handler
Change-Id: Id596dd86d405245100e37e5127728d79a57856fc
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
index 087a5c9..9a8b3e0 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
@@ -276,7 +276,7 @@
if (!configured()) {
log.warn("Missing DHCP6 relay server config. Abort packet processing");
- log.warn("dhcp6 payload {}", dhcp6Payload);
+ log.trace("dhcp6 payload {}", dhcp6Payload);
return;
}
@@ -294,7 +294,6 @@
if (MSG_TYPE_FROM_CLIENT.contains(msgType)) {
-
InternalPacket ethernetClientPacket =
processDhcp6PacketFromClient(context, receivedPacket, receivingInterfaces);
if (ethernetClientPacket != null) {
@@ -302,14 +301,14 @@
}
} else if (MSG_TYPE_FROM_SERVER.contains(msgType)) {
- log.warn("calling processDhcp6PacketFromServer with RELAY_REPL", msgType);
+ log.debug("calling processDhcp6PacketFromServer with RELAY_REPL", msgType);
InternalPacket ethernetPacketReply =
processDhcp6PacketFromServer(context, receivedPacket, receivingInterfaces);
if (ethernetPacketReply != null) {
forwardPacket(ethernetPacketReply);
}
} else {
- log.warn("Not so fast, packet type {} not supported yet", msgType);
+ log.warn("DHCP type {} not supported yet", msgType);
}
}
@@ -396,7 +395,7 @@
}
}
} else {
- log.warn("directlyConnected true.");
+ log.debug("directlyConnected true.");
return true;
}
}
@@ -454,7 +453,7 @@
dhcp6Parent = dhcp6Child;
}
} else {
- log.warn("malformed pkt! Expected dhcp6 within relay pkt, but no dhcp6 leaf found.");
+ log.warn("Expected dhcp6 within relay pkt, but no dhcp6 leaf found.");
break;
}
}
@@ -573,7 +572,7 @@
* @return IpPrefix Prefix Delegation prefix, or null if not exists.
*/
private IpPrefix extractPrefix(DHCP6 dhcp6) {
- log.warn("extractPrefix enters {}", dhcp6);
+ log.trace("extractPrefix enters {}", dhcp6);
// extract prefix
IpPrefix prefixPrefix = null;
@@ -589,27 +588,26 @@
Optional<Dhcp6IaPrefixOption> iaPrefixOption;
if (iaPdOption.isPresent()) {
- log.warn("IA_PD option found {}", iaPdOption);
+ log.trace("IA_PD option found {}", iaPdOption);
iaPrefixOption = iaPdOption.get().getOptions().stream()
.filter(opt -> opt instanceof Dhcp6IaPrefixOption)
.map(opt -> (Dhcp6IaPrefixOption) opt)
.findFirst();
} else {
- log.warn("IA_PD option NOT found");
+ log.trace("IA_PD option NOT found");
iaPrefixOption = Optional.empty();
}
if (iaPrefixOption.isPresent()) {
- log.warn("IAPrefix Option within IA_PD option found {}", iaPrefixOption);
+ log.trace("IAPrefix Option within IA_PD option found {}", iaPrefixOption);
prefixAddress = iaPrefixOption.get().getIp6Prefix();
int prefixLen = (int) iaPrefixOption.get().getPrefixLength();
- log.warn("Prefix length is {} bits", prefixLen);
+ log.trace("Prefix length is {} bits", prefixLen);
prefixPrefix = IpPrefix.valueOf(prefixAddress, prefixLen);
-
} else {
- log.warn("Can't find IPv6 prefix from DHCPv6 {}", dhcp6);
+ log.trace("Can't find IPv6 prefix from DHCPv6 {}", dhcp6);
}
return prefixPrefix;
@@ -734,7 +732,7 @@
// Replace the ip when dhcp server give the host new ip address
providerService.hostDetected(hostId, desc, false);
} else {
- log.warn("ipAddress not found. Do not add Host for directly connected.");
+ log.debug("ipAddress not found. Do not add Host for directly connected.");
}
} else {
// Add to route store if it does not connect to network directly
@@ -749,19 +747,19 @@
DHCP6 leafDhcp = getDhcp6Leaf(embeddedDhcp6);
ip = extractIpAddress(leafDhcp);
if (ip == null) {
- log.warn("ip is null");
+ log.debug("ip is null");
} else {
Route routeForIP = new Route(Route.Source.STATIC, ip.toIpPrefix(), nextHopIp);
- log.warn("adding Route of 128 address for indirectly connected.");
+ log.debug("adding Route of 128 address for indirectly connected.");
routeStore.updateRoute(routeForIP);
}
IpPrefix ipPrefix = extractPrefix(leafDhcp);
if (ipPrefix == null) {
- log.warn("ipPrefix is null ");
+ log.debug("ipPrefix is null ");
} else {
Route routeForPrefix = new Route(Route.Source.STATIC, ipPrefix, nextHopIp);
- log.warn("adding Route of PD for indirectly connected.");
+ log.debug("adding Route of PD for indirectly connected.");
routeStore.updateRoute(routeForPrefix);
if (this.dhcpFpmEnabled) {
FpmRecord record = new FpmRecord(ipPrefix, nextHopIp, FpmRecord.Type.DHCP_RELAY);
@@ -846,12 +844,12 @@
log.warn("No IP v6 address for server Interface {}", serverInterface);
return null;
}
- Ethernet etherReply = (Ethernet) clientPacket.duplicate();
+ Ethernet etherReply = clientPacket.duplicate();
etherReply.setSourceMACAddress(macFacingServer);
if ((directConnFlag && dhcpConnectMac == null) ||
!directConnFlag && indirectDhcpConnectMac == null && dhcpConnectMac == null) {
- log.warn("Packet received from {} connected client.", directConnFlag ? "directly" : "indirectly");
- log.warn("DHCP6 {} not yet resolved .. Aborting DHCP packet processing from client on port: {}",
+ log.trace("Packet received from {} connected client.", directConnFlag ? "directly" : "indirectly");
+ log.debug("DHCP6 {} not yet resolved .. Aborting DHCP packet processing from client on port: {}",
(dhcpGatewayIp == null) ? "server IP " + dhcpServerIp
: "gateway IP " + dhcpGatewayIp,
clientInterfaces.iterator().next().connectPoint());
@@ -891,7 +889,7 @@
} else {
if (indirectDhcpServerIp == null) {
- log.warn("indirect DhcpServerIp not available, use default DhcpServerIp {}",
+ log.debug("indirect DhcpServerIp not available, use default DhcpServerIp {}",
HexString.toHexString(dhcpServerIp.toOctets()));
} else {
// Indirect case, replace destination to indirect dhcp server if exist
@@ -910,11 +908,11 @@
}
if (indirectRelayAgentIpFromCfg == null) {
dhcp6Relay.setLinkAddress(relayAgentIp.toOctets());
- log.warn("indirect connection: relayAgentIp NOT availale from config file! Use dynamic. {}",
+ log.trace("indirect connection: relayAgentIp NOT availale from config file! Use dynamic. {}",
HexString.toHexString(relayAgentIp.toOctets(), ":"));
} else {
dhcp6Relay.setLinkAddress(indirectRelayAgentIpFromCfg.toOctets());
- log.debug("indirect connection: relayAgentIp from config file is available! {}",
+ log.trace("indirect connection: relayAgentIp from config file is available! {}",
HexString.toHexString(indirectRelayAgentIpFromCfg.toOctets(), ":"));
}
}
@@ -945,7 +943,7 @@
vlanIdBytes[1] = (byte) ((clientPacket.getVlanID() >> 8) & 0xff);
byte[] interfaceIdBytes = new byte[clientSoureMacBytes.length +
inPortStringBytes.length + vlanIdBytes.length];
- log.debug("Length: interfaceIdBytes {} clientSoureMacBytes {} inPortStringBytes {} vlan {}",
+ log.trace("Length: interfaceIdBytes {} clientSoureMacBytes {} inPortStringBytes {} vlan {}",
interfaceIdBytes.length, clientSoureMacBytes.length, inPortStringBytes.length,
vlanIdBytes.length);
System.arraycopy(clientSoureMacBytes, 0, interfaceIdBytes, 0, clientSoureMacBytes.length);
@@ -1068,19 +1066,19 @@
}
MacAddress relayAgentMac = clientInterface.mac();
if (relayAgentMac == null) {
- log.warn("Can not get interface mac, abort packet..");
+ log.warn("Can not get client interface mac, abort packet..");
return null;
}
etherReply.setSourceMACAddress(relayAgentMac);
// find destMac
- MacAddress clientMac = null;
+ MacAddress clientMac;
Ip6Address peerAddress = Ip6Address.valueOf(dhcp6Relay.getPeerAddress());
Set<Host> clients = hostService.getHostsByIp(peerAddress);
if (clients.isEmpty()) {
- log.warn("There's no host found for this address {}",
+ log.trace("There's no host found for this address {}",
HexString.toHexString(dhcp6Relay.getPeerAddress(), ":"));
- log.warn("Let's look up interfaceId {}", HexString.toHexString(peerMac.toBytes(), ":"));
+ log.trace("Let's look up interfaceId {}", HexString.toHexString(peerMac.toBytes(), ":"));
clientMac = peerMac;
} else {
clientMac = clients.iterator().next().mac();
@@ -1088,7 +1086,7 @@
log.warn("No client mac address found, abort packet...");
return null;
}
- log.warn("Client mac address found from getHostByIp");
+ log.trace("Client mac address found from getHostByIp");
}
etherReply.setDestinationMACAddress(clientMac);
@@ -1577,7 +1575,7 @@
nextHopIp = gwHost.ipAddresses()
.stream()
.filter(IpAddress::isIp6)
- .filter(ip6 -> ip6.isLinkLocal())
+ .filter(IpAddress::isLinkLocal)
.map(IpAddress::getIp6Address)
.findFirst()
.orElse(null);