[VOL-3054] Added -igmp flag and changed sadis response
Change-Id: I621cd516bd3c5aa20f1095d5200e8f3d4af43da7
diff --git a/VERSION b/VERSION
index a0d4970..ee1372d 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.2.2-dev
\ No newline at end of file
+0.2.2
diff --git a/cmd/bbsim/bbsim.go b/cmd/bbsim/bbsim.go
index 4dade03..1ca93e6 100644
--- a/cmd/bbsim/bbsim.go
+++ b/cmd/bbsim/bbsim.go
@@ -154,6 +154,7 @@
"TotalOnus": options.Olt.PonPorts * options.Olt.OnusPonPort,
"EnableAuth": options.BBSim.EnableAuth,
"Dhcp": options.BBSim.EnableDhcp,
+ "Igmp": options.BBSim.EnableIgmp,
"Delay": options.BBSim.Delay,
"Events": options.BBSim.Events,
"KafkaEventTopic": options.BBSim.KafkaEventTopic,
diff --git a/configs/bbsim.yaml b/configs/bbsim.yaml
index 8cb5e91..c4ade64 100644
--- a/configs/bbsim.yaml
+++ b/configs/bbsim.yaml
@@ -4,6 +4,7 @@
# BBSim specific settings
bbsim:
+ enable_igmp: false
enable_dhcp: false
enable_auth: false
openolt_address: ":50060"
@@ -35,7 +36,6 @@
pon_ports: 1
nni_ports: 1
onus_per_port: 1
- onus_per_port: 1
technology: "XGS-PON"
id: 0 # OLT-ID of the device
reboot_delay: 10 # reboot delay in seconds
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 4cd9d46..5c2ebf2 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -147,6 +147,8 @@
Setting this flag will cause BBSim to not store data like traffic schedulers, flows of ONUs etc
-kafkaEventTopic string
Set the topic on which BBSim publishes events on kafka
+ -igmp
+ Set this flag to start IGMP automatically
``BBSim`` also looks for a configuration file in ``configs/bbsim.yaml`` from
which it reads a number of default settings. The command line options listed
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