[VOL-3768] Adding startup parameter list of allowed ONU vendor Ids

Change-Id: I7b9824b716ea6623338d84dc8ecb5f599e493ffa
diff --git a/cmd/openonu-adapter/main.go b/cmd/openonu-adapter/main.go
index cd253b9..506321b 100644
--- a/cmd/openonu-adapter/main.go
+++ b/cmd/openonu-adapter/main.go
@@ -25,6 +25,7 @@
 	"os"
 	"os/signal"
 	"strconv"
+	"strings"
 	"syscall"
 	"time"
 
@@ -280,10 +281,12 @@
 
 func (a *adapter) registerWithCore(ctx context.Context, retries int) error {
 	adapterID := fmt.Sprintf("brcm_openomci_onu_%d", a.config.CurrentReplica)
+	vendorIdsList := strings.Split(a.config.OnuVendorIds, ",")
 	logger.Infow(ctx, "registering-with-core", log.Fields{
 		"adapterID":      adapterID,
 		"currentReplica": a.config.CurrentReplica,
 		"totalReplicas":  a.config.TotalReplicas,
+		"onuVendorIds":   vendorIdsList,
 	})
 	adapterDescription := &voltha.Adapter{
 		Id:             adapterID, // Unique name for the device type ->exact type required for OLT comm????
@@ -295,8 +298,7 @@
 		TotalReplicas:  int32(a.config.TotalReplicas),
 	}
 	types := []*voltha.DeviceType{{Id: "brcm_openomci_onu",
-		VendorIds: []string{"OPEN", "ALCL", "BRCM", "TWSH", "ALPH", "ISKT", "SFAA", "BBSM", "SCOM",
-			"ARPX", "DACM", "ERSN", "HWTC", "CIGG", "ADTN", "ARCA", "AVMG"},
+		VendorIds:                   vendorIdsList,
 		Adapter:                     "brcm_openomci_onu", // Name of the adapter that handles device type
 		AcceptsBulkFlowUpdate:       false,               // Currently openolt adapter does not support bulk flow handling
 		AcceptsAddRemoveFlowUpdates: true}}
@@ -423,7 +425,7 @@
 	if version.VersionInfo.Version == "unknown-version" {
 		content, err := ioutil.ReadFile("VERSION")
 		if err == nil {
-			return (string(content))
+			return string(content)
 		}
 		logger.Error(ctx, "'VERSION'-file not readable")
 	}
diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go
index 75ff11d..59b8da6 100644
--- a/internal/pkg/config/config.go
+++ b/internal/pkg/config/config.go
@@ -57,6 +57,7 @@
 	defaultCurrentReplica             = 1
 	defaultTotalReplicas              = 1
 	defaultMaxTimeoutInterAdapterComm = 30 * time.Second
+	defaultOnuVendorIds               = "OPEN,ALCL,BRCM,TWSH,ALPH,ISKT,SFAA,BBSM,SCOM,ARPX,DACM,ERSN,HWTC,CIGG,ADTN,ARCA,AVMG"
 
 	// For Tracing
 	defaultTraceEnabled          = false
@@ -97,6 +98,7 @@
 	TraceEnabled                bool
 	TraceAgentAddress           string
 	LogCorrelationEnabled       bool
+	OnuVendorIds                string
 }
 
 // NewAdapterFlags returns a new RWCore config
@@ -132,6 +134,7 @@
 		TraceEnabled:                defaultTraceEnabled,
 		TraceAgentAddress:           defaultTraceAgentAddress,
 		LogCorrelationEnabled:       defaultLogCorrelationEnabled,
+		OnuVendorIds:                defaultOnuVendorIds,
 	}
 	return &adapterFlags
 }
@@ -227,6 +230,9 @@
 	help = fmt.Sprintf("Whether to enrich log statements with fields denoting operation being executed for achieving correlation?")
 	flag.BoolVar(&(so.LogCorrelationEnabled), "log_correlation_enabled", defaultLogCorrelationEnabled, help)
 
+	help = fmt.Sprintf("List of Allowed ONU Vendor Ids")
+	flag.StringVar(&(so.OnuVendorIds), "allowed_onu_vendors", defaultOnuVendorIds, help)
+
 	flag.Parse()
 	containerName := getContainerInfo()
 	if len(containerName) > 0 {