Merge "[VOL-4382] Adding 'AlarmIndication' to MessageType String converter, adding support for ICMP packets in order to avoid false error messages"
diff --git a/internal/bbsim/devices/nni.go b/internal/bbsim/devices/nni.go
index 2159f6d..d4dfd23 100644
--- a/internal/bbsim/devices/nni.go
+++ b/internal/bbsim/devices/nni.go
@@ -55,8 +55,9 @@
func (n *NniPort) handleNniPacket(packet gopacket.Packet) error {
isDhcp := packetHandlers.IsDhcpPacket(packet)
isLldp := packetHandlers.IsLldpPacket(packet)
+ isIcmp := packetHandlers.IsIcmpPacket(packet)
- if !isDhcp && !isLldp {
+ if !isDhcp && !isLldp && !isIcmp {
nniLogger.WithFields(log.Fields{
"packet": packet,
}).Trace("Dropping NNI packet as it's not DHCP")
@@ -91,6 +92,8 @@
} else if isLldp {
// TODO rework this when BBSim supports data-plane packets
nniLogger.Trace("Received LLDP Packet, ignoring it")
+ } else if isIcmp {
+ nniLogger.Trace("Received ICMP Packet, ignoring it")
}
return nil
}
diff --git a/internal/bbsim/packetHandlers/filters.go b/internal/bbsim/packetHandlers/filters.go
index a930b1e..5a3a24f 100644
--- a/internal/bbsim/packetHandlers/filters.go
+++ b/internal/bbsim/packetHandlers/filters.go
@@ -44,6 +44,13 @@
return false
}
+func IsIcmpPacket(pkt gopacket.Packet) bool {
+ if layer := pkt.Layer(layers.LayerTypeICMPv6); layer != nil {
+ return true
+ }
+ return false
+}
+
// return true if the packet is coming in the OLT from the DHCP Server
// given that we only check DHCP packets we can use the Operation
// Request are outgoing (toward the server)
@@ -90,6 +97,8 @@
return DHCP, nil
} else if IsIgmpPacket(pkt) {
return IGMP, nil
+ } else if IsIcmpPacket(pkt) {
+ return ICMP, nil
}
return UNKNOWN, errors.New("unknown-packet-type")
}
diff --git a/internal/bbsim/packetHandlers/packetTypes.go b/internal/bbsim/packetHandlers/packetTypes.go
index c89443b..d651fab 100644
--- a/internal/bbsim/packetHandlers/packetTypes.go
+++ b/internal/bbsim/packetHandlers/packetTypes.go
@@ -23,6 +23,7 @@
EAPOL
DHCP
IGMP
+ ICMP
)
func (t PacketType) String() string {
@@ -31,6 +32,7 @@
"EAPOL",
"DHCP",
"IGMP",
+ "ICMP",
}
return names[t]
}
diff --git a/internal/bbsim/types/messageTypes.go b/internal/bbsim/types/messageTypes.go
index 361142c..893eb79 100644
--- a/internal/bbsim/types/messageTypes.go
+++ b/internal/bbsim/types/messageTypes.go
@@ -72,6 +72,7 @@
"OnuPacketIn",
"IGMPMembershipReportV2",
"IGMPLeaveGroup",
+ "AlarmIndication",
"IGMPMembershipReportV3",
"FlowRemoved",
"UniStatusAlarm",