[VOL-4176] Expose uniPortMask as a parameter
Change-Id: I0c1c20d16f777121a163cc71e2a38d9618d65061
diff --git a/VERSION b/VERSION
index a562d0e..3a3cd8c 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.3.1-dev207
+1.3.1
diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go
index c4ab249..b61a909 100644
--- a/internal/pkg/config/config.go
+++ b/internal/pkg/config/config.go
@@ -69,6 +69,10 @@
defaultOmciTimeout = 3 * time.Second
defaultDlToAdapterTimeout = 10 * time.Second
defaultDlToOnuTimeoutPer4MB = 60 * time.Minute //assumed for 4 MB of the image
+ //Mask to indicate which possibly active ONU UNI state is really reported to the core
+ // compare python code - at the moment restrict active state to the first ONU UNI port
+ // check is limited to max 16 uni ports - cmp above UNI limit!!!
+ defaultUniPortMask = 0x0001
)
// AdapterFlags represents the set of configurations used by the read-write adaptercore service
@@ -109,6 +113,7 @@
AlarmAuditInterval time.Duration
DownloadToAdapterTimeout time.Duration
DownloadToOnuTimeout4MB time.Duration
+ UniPortMask int
}
// NewAdapterFlags returns a new RWCore config
@@ -149,6 +154,7 @@
OmciTimeout: defaultOmciTimeout,
DownloadToAdapterTimeout: defaultDlToAdapterTimeout,
DownloadToOnuTimeout4MB: defaultDlToOnuTimeoutPer4MB,
+ UniPortMask: defaultUniPortMask,
}
return &adapterFlags
}
@@ -260,6 +266,9 @@
help = "File download to ONU timeout in minutes for a block of 4MB"
flag.DurationVar(&(so.DownloadToOnuTimeout4MB), "download_to_onu_timeout_4MB", defaultDlToOnuTimeoutPer4MB, help)
+ help = "The bitmask to identify UNI ports that need to be enabled"
+ flag.IntVar(&(so.UniPortMask), "uni_port_mask", defaultUniPortMask, help)
+
flag.Parse()
containerName := getContainerInfo()
if len(containerName) > 0 {
diff --git a/internal/pkg/onuadaptercore/device_handler.go b/internal/pkg/onuadaptercore/device_handler.go
index 929964c..1a541c7 100644
--- a/internal/pkg/onuadaptercore/device_handler.go
+++ b/internal/pkg/onuadaptercore/device_handler.go
@@ -2438,7 +2438,7 @@
for uniNo, uniPort := range dh.uniEntityMap {
// only if this port is validated for operState transfer
- if (1<<uniPort.uniID)&activeUniPortStateUpdateMask == (1 << uniPort.uniID) {
+ if (1<<uniPort.uniID)&dh.pOpenOnuAc.config.UniPortMask == (1 << uniPort.uniID) {
logger.Infow(ctx, "onuUniPort-forced-OperState-ACTIVE", log.Fields{"for PortNo": uniNo, "device-id": dh.deviceID})
uniPort.setOperState(vc.OperStatus_ACTIVE)
if !dh.isReconciling() {
@@ -2457,7 +2457,8 @@
// -> use current restriction to operate only on first UNI port as inherited from actual Py code
for uniNo, uniPort := range dh.uniEntityMap {
// only if this port is validated for operState transfer
- if (1<<uniPort.uniID)&activeUniPortStateUpdateMask == (1 << uniPort.uniID) {
+
+ if (1<<uniPort.uniID)&dh.pOpenOnuAc.config.UniPortMask == (1 << uniPort.uniID) {
logger.Infow(ctx, "onuUniPort-forced-OperState-UNKNOWN", log.Fields{"for PortNo": uniNo, "device-id": dh.deviceID})
uniPort.setOperState(vc.OperStatus_UNKNOWN)
if !dh.isReconciling() {
diff --git a/internal/pkg/onuadaptercore/platform.go b/internal/pkg/onuadaptercore/platform.go
index 1f9898f..6ad3e7b 100644
--- a/internal/pkg/onuadaptercore/platform.go
+++ b/internal/pkg/onuadaptercore/platform.go
@@ -115,11 +115,6 @@
*/
)
-//Mask to indicate which possibly active ONU UNI state is really reported to the core
-// compare python code - at the moment restrict active state to the first ONU UNI port
-// check is limited to max 16 uni ports - cmp above UNI limit!!!
-var activeUniPortStateUpdateMask = 0x0001
-
/*
//MinUpstreamPortID value
var minUpstreamPortID = 0xfffd
diff --git a/internal/pkg/onuadaptercore/uniportadmin.go b/internal/pkg/onuadaptercore/uniportadmin.go
index 57a1b58..fea1838 100644
--- a/internal/pkg/onuadaptercore/uniportadmin.go
+++ b/internal/pkg/onuadaptercore/uniportadmin.go
@@ -416,7 +416,8 @@
for uniNo, uniPort := range oFsm.pOmciCC.pBaseDeviceHandler.uniEntityMap {
// only unlock the UniPort in case it is defined for usage (R2.6 limit only one port),
// compare also limitation for logical voltha port in dh.enableUniPortStateUpdate()
- if (omciAdminState == 1) || (1<<uniPort.uniID)&activeUniPortStateUpdateMask == (1<<uniPort.uniID) {
+
+ if (omciAdminState == 1) || (1<<uniPort.uniID)&oFsm.pDeviceHandler.pOpenOnuAc.config.UniPortMask == (1<<uniPort.uniID) {
var meInstance *me.ManagedEntity
if uniPort.portType == uniPPTP {
logger.Debugw(ctx, "Setting PPTP admin state", log.Fields{