Merge "Match DHCP flow on sTag for FTTB service"
diff --git a/internal/bbsim/devices/services.go b/internal/bbsim/devices/services.go
index c540e60..20abef6 100644
--- a/internal/bbsim/devices/services.go
+++ b/internal/bbsim/devices/services.go
@@ -48,12 +48,14 @@
ServiceTxInitialize = "initialize"
ServiceTxDisable = "disable"
+
+ fttbDpuMgmtServiceName = "DPU_MGMT_TRAFFIC"
)
type ServiceIf interface {
- HandlePackets() // start listening on the PacketCh
- HandleAuth() // Sends the EapoStart packet
- HandleDhcp(pbit uint8, cTag int) // Sends the DHCPDiscover packet
+ HandlePackets() // start listening on the PacketCh
+ HandleAuth() // Sends the EapoStart packet
+ HandleDhcp(oPbit uint8, oVid int) // Sends the DHCPDiscover packet
Initialize(stream bbsimTypes.Stream)
UpdateStream(stream bbsimTypes.Stream)
@@ -358,20 +360,30 @@
}
// HandleDhcp is used to start DHCP for a particular Service when the corresponding flow is received
-func (s *Service) HandleDhcp(pbit uint8, cTag int) {
+func (s *Service) HandleDhcp(oPbit uint8, oVid int) {
+ var compareTag int
+ var comparePbits uint8
- if s.CTag != cTag || (s.UsPonCTagPriority != pbit && pbit != 255) {
+ if s.Name == fttbDpuMgmtServiceName {
+ compareTag = s.STag
+ comparePbits = s.UsPonSTagPriority
+ } else {
+ compareTag = s.CTag
+ comparePbits = s.UsPonCTagPriority
+ }
+
+ if compareTag != oVid || (comparePbits != oPbit && oPbit != 255) {
serviceLogger.WithFields(log.Fields{
- "OnuId": s.UniPort.Onu.ID,
- "IntfId": s.UniPort.Onu.PonPortID,
- "OnuSn": s.UniPort.Onu.Sn(),
- "PortNo": s.UniPort.PortNo,
- "UniId": s.UniPort.ID,
- "Name": s.Name,
- "Service.CTag": s.CTag,
- "Service.UsPonCTagPriority": s.UsPonCTagPriority,
- "cTag": cTag,
- "pbit": pbit,
+ "OnuId": s.UniPort.Onu.ID,
+ "IntfId": s.UniPort.Onu.PonPortID,
+ "OnuSn": s.UniPort.Onu.Sn(),
+ "PortNo": s.UniPort.PortNo,
+ "UniId": s.UniPort.ID,
+ "Name": s.Name,
+ "compareTag": compareTag,
+ "comparePbits": comparePbits,
+ "oVid": oVid,
+ "oPbit": oPbit,
}).Debug("DHCP flow is not for this service, ignoring")
return
}
diff --git a/internal/bbsim/devices/uni_port.go b/internal/bbsim/devices/uni_port.go
index 8934efb..55d07cc 100644
--- a/internal/bbsim/devices/uni_port.go
+++ b/internal/bbsim/devices/uni_port.go
@@ -18,6 +18,8 @@
import (
"fmt"
+ "net"
+
"github.com/google/gopacket/layers"
"github.com/looplab/fsm"
"github.com/opencord/bbsim/internal/bbsim/packetHandlers"
@@ -25,7 +27,6 @@
"github.com/opencord/bbsim/internal/common"
omcilib "github.com/opencord/bbsim/internal/common/omci"
log "github.com/sirupsen/logrus"
- "net"
)
var uniLogger = log.WithFields(log.Fields{
@@ -255,9 +256,9 @@
}
}
-func (u *UniPort) HandleDhcp(pbit uint8, cTag int) {
+func (u *UniPort) HandleDhcp(oPbit uint8, oVid int) {
for _, s := range u.Services {
- s.HandleDhcp(pbit, cTag)
+ s.HandleDhcp(oPbit, oVid)
}
}