[VOL-3054] Added -igmp flag and changed sadis response
Change-Id: I621cd516bd3c5aa20f1095d5200e8f3d4af43da7
diff --git a/internal/bbsim/responders/sadis/sadis.go b/internal/bbsim/responders/sadis/sadis.go
index fc2b451..ac084a5 100644
--- a/internal/bbsim/responders/sadis/sadis.go
+++ b/internal/bbsim/responders/sadis/sadis.go
@@ -212,8 +212,8 @@
// if so use bandwidthProfiles[rand.Intn(len(bandwidthProfiles))].ID
UpstreamBandwidthProfile: "Default",
DownstreamBandwidthProfile: "User_Bandwidth1",
- IsDhcpRequired: true,
- IsIgmpRequired: true,
+ IsDhcpRequired: common.Options.BBSim.EnableDhcp,
+ IsIgmpRequired: common.Options.BBSim.EnableIgmp,
}
case common.SadisFormatDt:
sonuUniTag = SadisUniTagDt{
diff --git a/internal/bbsim/responders/sadis/sadis_test.go b/internal/bbsim/responders/sadis/sadis_test.go
index 7c8bc1b..59c3874 100644
--- a/internal/bbsim/responders/sadis/sadis_test.go
+++ b/internal/bbsim/responders/sadis/sadis_test.go
@@ -18,11 +18,12 @@
import (
"fmt"
+ "net"
+ "testing"
+
"github.com/opencord/bbsim/internal/bbsim/devices"
"github.com/opencord/bbsim/internal/common"
"gotest.tools/assert"
- "net"
- "testing"
)
func createMockDevices() (devices.OltDevice, devices.Onu) {
@@ -54,7 +55,7 @@
t.Fatal(err)
}
- assert.Equal(t, res.ID, fmt.Sprintf("%s-%s",onu.Sn(), uni))
+ assert.Equal(t, res.ID, fmt.Sprintf("%s-%s", onu.Sn(), uni))
assert.Equal(t, res.CTag, 923)
assert.Equal(t, res.STag, 900)
assert.Equal(t, res.RemoteID, string(olt.SerialNumber))
@@ -74,8 +75,8 @@
t.Fatal(err)
}
- assert.Equal(t, res.ID, fmt.Sprintf("%s-%s",onu.Sn(), uni))
- assert.Equal(t, res.RemoteID, fmt.Sprintf("%s-%s",onu.Sn(), uni))
+ assert.Equal(t, res.ID, fmt.Sprintf("%s-%s", onu.Sn(), uni))
+ assert.Equal(t, res.RemoteID, fmt.Sprintf("%s-%s", onu.Sn(), uni))
// assert the correct type
uniTagList, ok := res.UniTagList[0].(SadisUniTagAtt)
@@ -88,8 +89,8 @@
assert.Equal(t, uniTagList.DownstreamBandwidthProfile, "User_Bandwidth1")
assert.Equal(t, uniTagList.UpstreamBandwidthProfile, "Default")
assert.Equal(t, uniTagList.TechnologyProfileID, 64)
- assert.Equal(t, uniTagList.IsDhcpRequired, true)
- assert.Equal(t, uniTagList.IsIgmpRequired, true)
+ assert.Equal(t, uniTagList.IsDhcpRequired, false)
+ assert.Equal(t, uniTagList.IsIgmpRequired, false)
}
func TestSadisServer_GetOnuEntryV2_Dt(t *testing.T) {
@@ -103,8 +104,8 @@
t.Fatal(err)
}
- assert.Equal(t, res.ID, fmt.Sprintf("%s-%s",onu.Sn(), uni))
- assert.Equal(t, res.RemoteID, fmt.Sprintf("%s-%s",onu.Sn(), uni))
+ assert.Equal(t, res.ID, fmt.Sprintf("%s-%s", onu.Sn(), uni))
+ assert.Equal(t, res.RemoteID, fmt.Sprintf("%s-%s", onu.Sn(), uni))
// assert the correct type
uniTagList, ok := res.UniTagList[0].(SadisUniTagDt)
@@ -118,4 +119,4 @@
assert.Equal(t, uniTagList.UpstreamBandwidthProfile, "Default")
assert.Equal(t, uniTagList.TechnologyProfileID, 64)
assert.Equal(t, uniTagList.UniTagMatch, 4096)
-}
\ No newline at end of file
+}
diff --git a/internal/common/options.go b/internal/common/options.go
index 0ecb0c8..b7f8bf6 100644
--- a/internal/common/options.go
+++ b/internal/common/options.go
@@ -121,6 +121,7 @@
}
type BBSimConfig struct {
+ EnableIgmp bool `yaml:"enable_igmp"`
EnableDhcp bool `yaml:"enable_dhcp"`
EnableAuth bool `yaml:"enable_auth"`
LogLevel string `yaml:"log_level"`
@@ -167,6 +168,7 @@
STag: 900,
CTagAllocation: TagAllocationUnique,
CTag: 900,
+ EnableIgmp: false,
EnableDhcp: false,
EnableAuth: false,
LogLevel: "debug",
@@ -251,7 +253,7 @@
auth := flag.Bool("auth", conf.BBSim.EnableAuth, "Set this flag if you want authentication to start automatically")
dhcp := flag.Bool("dhcp", conf.BBSim.EnableDhcp, "Set this flag if you want DHCP to start automatically")
-
+ igmp := flag.Bool("igmp", conf.BBSim.EnableIgmp, "Set this flag if you want IGMP to start automatically")
profileCpu := flag.String("cpuprofile", "", "write cpu profile to file")
logLevel := flag.String("logLevel", conf.BBSim.LogLevel, "Set the log level (trace, debug, info, warn, error)")
@@ -298,6 +300,7 @@
conf.BBSim.LogCaller = *logCaller
conf.BBSim.EnableAuth = *auth
conf.BBSim.EnableDhcp = *dhcp
+ conf.BBSim.EnableIgmp = *igmp
conf.BBSim.Delay = *delay
conf.BBSim.ControlledActivation = *controlledActivation
conf.BBSim.EnablePerf = *enablePerf