[VOL-4678] BBSIM: OMCI extended message set - make OMCC version configurable
Change-Id: I6a6bdde944612621dd8e5696075fe09b3c341709
diff --git a/internal/common/omci/get.go b/internal/common/omci/get.go
index 71d7d87..b450b87 100644
--- a/internal/common/omci/get.go
+++ b/internal/common/omci/get.go
@@ -24,6 +24,7 @@
"strconv"
"github.com/google/gopacket"
+ "github.com/opencord/bbsim/internal/common"
"github.com/opencord/omci-lib-go/v2"
me "github.com/opencord/omci-lib-go/v2/generated"
"github.com/opencord/voltha-protos/v5/go/openolt"
@@ -143,7 +144,7 @@
Attributes: me.AttributeValueMap{
me.ManagedEntityID: entityID,
me.Onu2G_EquipmentId: ToOctets("12345123451234512345", 20),
- me.Onu2G_OpticalNetworkUnitManagementAndControlChannelOmccVersion: 180,
+ me.Onu2G_OpticalNetworkUnitManagementAndControlChannelOmccVersion: common.Config.BBSim.OmccVersion,
me.Onu2G_VendorProductCode: 0,
me.Onu2G_SecurityCapability: 1,
me.Onu2G_SecurityMode: 1,
diff --git a/internal/common/omci/get_test.go b/internal/common/omci/get_test.go
index 82bbe7a..94422c1 100644
--- a/internal/common/omci/get_test.go
+++ b/internal/common/omci/get_test.go
@@ -23,6 +23,7 @@
"testing"
"github.com/google/gopacket"
+ "github.com/opencord/bbsim/internal/common"
"github.com/opencord/omci-lib-go/v2"
me "github.com/opencord/omci-lib-go/v2/generated"
"github.com/opencord/voltha-protos/v5/go/openolt"
@@ -69,6 +70,8 @@
func TestGetResponse(t *testing.T) {
+ common.Config = common.GetDefaultOps()
+
// NOTE that we're not testing the SerialNumber attribute part of the ONU-G
// response here as it is a special case and it requires transformation.
// we specifically test that in TestCreateOnugResponse
@@ -83,7 +86,7 @@
}{
{"getOnu2gResponse",
getArgs{createOnu2gResponse(false, 57344, 10), 1},
- getWant{1, map[string]interface{}{"OpticalNetworkUnitManagementAndControlChannelOmccVersion": uint8(180)}},
+ getWant{1, map[string]interface{}{"OpticalNetworkUnitManagementAndControlChannelOmccVersion": uint8(163)}},
},
{"getOnugResponse",
getArgs{createOnugResponse(false, 40960, 10, sn), 1},
diff --git a/internal/common/option_test.go b/internal/common/option_test.go
index bf8d139..01a97f5 100644
--- a/internal/common/option_test.go
+++ b/internal/common/option_test.go
@@ -41,7 +41,7 @@
}
func TestLoadPonsConfigDefaults(t *testing.T) {
- Config = getDefaultOps()
+ Config = GetDefaultOps()
// The default options define 1 PON per OLT
// and 1 ONU per PON
@@ -72,7 +72,7 @@
func TestLoadPonsConfigFile(t *testing.T) {
- Config = getDefaultOps()
+ Config = GetDefaultOps()
Services = []ServiceYaml{
{
diff --git a/internal/common/options.go b/internal/common/options.go
index 318e29f..3f16058 100644
--- a/internal/common/options.go
+++ b/internal/common/options.go
@@ -190,6 +190,7 @@
BandwidthProfileFormat string `yaml:"bp_format"`
InjectOmciUnknownMe bool `yaml:"inject_omci_unknown_me"`
InjectOmciUnknownAttributes bool `yaml:"inject_omci_unknown_attributes"`
+ OmccVersion int `yaml:"omcc_version"`
}
type BBRConfig struct {
@@ -254,7 +255,7 @@
// - we merge the configuration (CLI has priority over yaml files)
func LoadConfig() {
- Config = getDefaultOps()
+ Config = GetDefaultOps()
cliConf := readCliParams()
@@ -321,7 +322,7 @@
func readCliParams() *GlobalConfig {
- conf := getDefaultOps()
+ conf := GetDefaultOps()
configFile := flag.String("config", conf.BBSim.ConfigFile, "Configuration file path")
servicesFile := flag.String("services", conf.BBSim.ServiceConfigFile, "Service Configuration file path")
@@ -361,6 +362,7 @@
authRetry := flag.Bool("authRetry", conf.BBSim.AuthRetry, "Set this flag if BBSim should retry EAPOL (Authentication) upon failure until success")
injectOmciUnknownMe := flag.Bool("injectOmciUnknownMe", conf.BBSim.InjectOmciUnknownMe, "Generate an extra MibDB packet with ClassID 37 (Intentionally left blank)")
injectOmciUnknownAttributes := flag.Bool("injectOmciUnknownAttributes", conf.BBSim.InjectOmciUnknownAttributes, "Modifies the ONU2-G MibDB packet to add Unknown Attributes")
+ omccVersion := flag.Int("omccVersion", conf.BBSim.OmccVersion, "Set OMCC version to be returned in OMCI response of ME Onu2G")
flag.Parse()
@@ -394,6 +396,7 @@
conf.BBSim.DmiServerAddress = *dmi_server_address
conf.BBSim.InjectOmciUnknownMe = *injectOmciUnknownMe
conf.BBSim.InjectOmciUnknownAttributes = *injectOmciUnknownAttributes
+ conf.BBSim.OmccVersion = *omccVersion
// update device id if not set
if conf.Olt.DeviceId == "" {
@@ -409,7 +412,7 @@
return conf
}
-func getDefaultOps() *GlobalConfig {
+func GetDefaultOps() *GlobalConfig {
c := &GlobalConfig{
BBSimConfig{
@@ -440,6 +443,7 @@
BandwidthProfileFormat: BP_FORMAT_MEF,
InjectOmciUnknownMe: false,
InjectOmciUnknownAttributes: false,
+ OmccVersion: 0xA3,
},
OltConfig{
Vendor: "BBSim",
@@ -498,7 +502,7 @@
// LoadBBSimConf loads the BBSim configuration from a YAML file
func loadBBSimConf(filename string) (*GlobalConfig, error) {
- yamlConfig := getDefaultOps()
+ yamlConfig := GetDefaultOps()
yamlFile, err := ioutil.ReadFile(filename)
if err != nil {