Merge "More logs"
diff --git a/core/core_server.go b/core/core_server.go
index c38419d..69d6d69 100644
--- a/core/core_server.go
+++ b/core/core_server.go
@@ -372,20 +372,20 @@
continue
}
case unipkt := <-unichannel:
- logger.Debug("Received packet from UNI in grpc Server")
+ onuid := unipkt.Info.onuid
+ onu, _ := s.GetOnuByID(onuid)
+ utils.LoggerWithOnu(onu).Debug("Received packet from UNI in grpc Server")
if unipkt.Info == nil || unipkt.Info.iotype != "uni" {
logger.Debug("WARNING: This packet does not come from UNI ")
continue
}
intfid := unipkt.Info.intfid
- onuid := unipkt.Info.onuid
gemid, _ := getGemPortID(intfid, onuid)
pkt := unipkt.Pkt
layerEth := pkt.Layer(layers.LayerTypeEthernet)
le, _ := layerEth.(*layers.Ethernet)
ethtype := le.EthernetType
- onu, _ := s.GetOnuByID(onuid)
if ethtype == 0x888e {
utils.LoggerWithOnu(onu).WithFields(log.Fields{
@@ -399,7 +399,7 @@
//C-TAG
sn := convB2S(onu.SerialNumber.VendorSpecific)
if ctag, ok := s.CtagMap[sn]; ok == true {
- tagpkt, err := PushVLAN(pkt, uint16(ctag))
+ tagpkt, err := PushVLAN(pkt, uint16(ctag), onu)
if err != nil {
utils.LoggerWithOnu(onu).WithFields(log.Fields{
"gemId": gemid,
@@ -467,10 +467,14 @@
if ethtype == 0x888e {
utils.LoggerWithOnu(onu).Info("Received downstream packet is EAPOL.")
} else if layerDHCP := rawpkt.Layer(layers.LayerTypeDHCPv4); layerDHCP != nil {
- utils.LoggerWithOnu(onu).Info("Received downstream packet is DHCP.")
+ utils.LoggerWithOnu(onu).WithFields(log.Fields{
+ "payload": layerDHCP.LayerPayload(),
+ "type": layerDHCP.LayerType().String(),
+ }).Info("Received downstream packet is DHCP.")
rawpkt, _, _ = PopVLAN(rawpkt)
rawpkt, _, _ = PopVLAN(rawpkt)
} else {
+ utils.LoggerWithOnu(onu).Info("WARNING: Received packet is not EAPOL or DHCP")
return nil
}
ioinfo, err := s.identifyUniIoinfo("inside", intfid, onuid)
@@ -478,10 +482,10 @@
return err
}
handle := ioinfo.handler
- SendUni(handle, rawpkt)
+ SendUni(handle, rawpkt, onu)
return nil
}
- logger.Info("WARNING: Received packet is not supported")
+ utils.LoggerWithOnu(onu).Info("WARNING: Received packet does not have layerEth")
return nil
}
diff --git a/core/grpc_service.go b/core/grpc_service.go
index cd8a108..2175a75 100644
--- a/core/grpc_service.go
+++ b/core/grpc_service.go
@@ -112,6 +112,7 @@
intfid := packet.IntfId
rawpkt := gopacket.NewPacket(packet.Pkt, layers.LayerTypeEthernet, gopacket.Default)
if err := s.onuPacketOut(intfid, onuid, rawpkt); err != nil {
+ utils.LoggerWithOnu(onu).WithField("error", err).Errorf("OnuPacketOut Error ")
return new(openolt.Empty), err
}
return new(openolt.Empty), nil
diff --git a/core/io_worker.go b/core/io_worker.go
index 8524866..2533a19 100644
--- a/core/io_worker.go
+++ b/core/io_worker.go
@@ -22,7 +22,10 @@
"strconv"
"time"
+ "gerrit.opencord.org/voltha-bbsim/device"
+
"gerrit.opencord.org/voltha-bbsim/common/logger"
+ "gerrit.opencord.org/voltha-bbsim/common/utils"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/google/gopacket/pcap"
@@ -41,12 +44,12 @@
}
}
-func SendUni(handle *pcap.Handle, packet gopacket.Packet) {
+func SendUni(handle *pcap.Handle, packet gopacket.Packet, onu *device.Onu) {
err := handle.WritePacketData(packet.Data())
if err != nil {
- logger.Error("Error in send packet to UNI-IF: %v e:%s", *handle, err)
+ utils.LoggerWithOnu(onu).Error("Error in send packet to UNI-IF: %v e:%s", *handle, err)
}
- logger.Debug("Successfully send packet to UNI-IF: %v ", *handle)
+ utils.LoggerWithOnu(onu).Debug("Successfully send packet to UNI-IF: %v ", *handle)
//logger.Println(packet.Dump())
}
@@ -86,7 +89,7 @@
//return nil, 0, errors.New("failed to pop vlan")
}
-func PushVLAN(pkt gopacket.Packet, vid uint16) (gopacket.Packet, error) {
+func PushVLAN(pkt gopacket.Packet, vid uint16, onu *device.Onu) (gopacket.Packet, error) {
if eth := getEthernetLayer(pkt); eth != nil {
ethernetLayer := &layers.Ethernet{
SrcMAC: eth.SrcMAC,
@@ -113,7 +116,7 @@
layers.LayerTypeEthernet,
gopacket.Default,
)
- logger.Debug("Push the 802.1Q header (VID: %d)", vid)
+ utils.LoggerWithOnu(onu).Debugf("Push the 802.1Q header (VID: %d)", vid)
return ret, nil
}
return nil, errors.New("failed to push vlan")