VOL-3894 Support for alarm audit interval configuration through helm charts
Change-Id: Ibc0761a074ab8283acfdf31d88cb0fb1d1610c95
diff --git a/VERSION b/VERSION
index e5ec1cc..3c43790 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.2.6-dev176
+1.2.6
diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go
index 9f210de..fad08fa 100644
--- a/internal/pkg/config/config.go
+++ b/internal/pkg/config/config.go
@@ -62,8 +62,9 @@
defaultTraceAgentAddress = "127.0.0.1:6831"
defaultLogCorrelationEnabled = true
- defaultMetricsEnabled = false
- defaultMibAuditInterval = 0
+ defaultMetricsEnabled = false
+ defaultMibAuditInterval = 0
+ defaultAlarmAuditInterval = 300 * time.Second
defaultOmciTimeout = 3 * time.Second
)
@@ -103,6 +104,7 @@
MetricsEnabled bool
MibAuditInterval time.Duration
OmciTimeout time.Duration
+ AlarmAuditInterval time.Duration
}
// NewAdapterFlags returns a new RWCore config
@@ -139,6 +141,7 @@
OnuVendorIds: defaultOnuVendorIds,
MetricsEnabled: defaultMetricsEnabled,
MibAuditInterval: defaultMibAuditInterval,
+ AlarmAuditInterval: defaultAlarmAuditInterval,
OmciTimeout: defaultOmciTimeout,
}
return &adapterFlags
@@ -242,6 +245,9 @@
help = fmt.Sprintf("OMCI timeout duration - this timeout value is used on the OMCI channel for waiting on response from ONU")
flag.DurationVar(&(so.OmciTimeout), "omci_timeout", defaultOmciTimeout, help)
+ help = fmt.Sprintf("Alarm Audit Interval in seconds - the value zero will disable alarm audit")
+ flag.DurationVar(&(so.AlarmAuditInterval), "alarm_audit_interval", defaultAlarmAuditInterval, help)
+
flag.Parse()
containerName := getContainerInfo()
if len(containerName) > 0 {
diff --git a/internal/pkg/onuadaptercore/alarm_manager.go b/internal/pkg/onuadaptercore/alarm_manager.go
index 6665bd4..cb0c223 100644
--- a/internal/pkg/onuadaptercore/alarm_manager.go
+++ b/internal/pkg/onuadaptercore/alarm_manager.go
@@ -37,7 +37,6 @@
physicalPathTerminationPointEthernetUniClassID = me.PhysicalPathTerminationPointEthernetUniClassID
onuGClassID = me.OnuGClassID
aniGClassID = me.AniGClassID
- auditInterval = 300
defaultTimeoutDelay = 10
alarmBitMapSizeBytes = 28
)
@@ -185,7 +184,7 @@
logger.Debugw(ctx, "alarm-sync-fsm-start-processing-msgs-in-state", log.Fields{"state": e.FSM.Current(), "device-id": am.pDeviceHandler.deviceID})
go am.processAlarmSyncMessages(ctx)
// Start the first audit, if audit interval configured, else reach the sync state
- if auditInterval > 0 {
+ if am.pDeviceHandler.pOnuOmciDevice.alarmAuditInterval > 0 {
select {
//Transition into auditing state, using a very shorter timeout delay here, hence it is the first audit
case <-time.After(defaultTimeoutDelay * time.Second):
@@ -318,9 +317,9 @@
func (am *onuAlarmManager) asFsmInSync(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "alarm-sync-fsm", log.Fields{"state": e.FSM.Current(), "device-id": am.pDeviceHandler.deviceID})
- if auditInterval > 0 {
+ if am.pDeviceHandler.pOnuOmciDevice.alarmAuditInterval > 0 {
select {
- case <-time.After(auditInterval * time.Second):
+ case <-time.After(am.pDeviceHandler.pOnuOmciDevice.alarmAuditInterval):
go func() {
if err := am.alarmSyncFsm.pFsm.Event(asEvAudit); err != nil {
logger.Debugw(ctx, "alarm-sync-fsm-cannot-go-to-state-auditing", log.Fields{"device-id": am.pDeviceHandler.deviceID, "err": err})
@@ -578,7 +577,7 @@
return nil
}
am.incrementAlarmSequence()
- if sequenceNo != am.lastAlarmSequence && auditInterval > 0 {
+ if sequenceNo != am.lastAlarmSequence && am.pDeviceHandler.pOnuOmciDevice.alarmAuditInterval > 0 {
// signal early audit, if no match(if we are reaching here it means that audit is not going on currently)
go func() {
if err := am.alarmSyncFsm.pFsm.Event(asEvAudit); err != nil {
diff --git a/internal/pkg/onuadaptercore/onu_device_entry.go b/internal/pkg/onuadaptercore/onu_device_entry.go
index db33270..c52f96a 100644
--- a/internal/pkg/onuadaptercore/onu_device_entry.go
+++ b/internal/pkg/onuadaptercore/onu_device_entry.go
@@ -241,21 +241,22 @@
}
type onuPersistentData struct {
- PersOnuID uint32 `json:"onu_id"`
- PersIntfID uint32 `json:"intf_id"`
- PersSerialNumber string `json:"serial_number"`
- PersMacAddress string `json:"mac_address"`
- PersVendorID string `json:"vendor_id"`
- PersEquipmentID string `json:"equipment_id"`
- PersActiveSwVersion string `json:"active_sw_version"`
- PersAdminState string `json:"admin_state"`
- PersOperState string `json:"oper_state"`
- PersUniUnlockDone bool `json:"uni_unlock_done"`
- PersUniDisableDone bool `json:"uni_disable_done"`
- PersMibAuditInterval time.Duration `json:"mib_audit_interval"`
- PersMibLastDbSync uint32 `json:"mib_last_db_sync"`
- PersMibDataSyncAdpt uint8 `json:"mib_data_sync_adpt"`
- PersUniConfig []uniPersConfig `json:"uni_config"`
+ PersOnuID uint32 `json:"onu_id"`
+ PersIntfID uint32 `json:"intf_id"`
+ PersSerialNumber string `json:"serial_number"`
+ PersMacAddress string `json:"mac_address"`
+ PersVendorID string `json:"vendor_id"`
+ PersEquipmentID string `json:"equipment_id"`
+ PersActiveSwVersion string `json:"active_sw_version"`
+ PersAdminState string `json:"admin_state"`
+ PersOperState string `json:"oper_state"`
+ PersUniUnlockDone bool `json:"uni_unlock_done"`
+ PersUniDisableDone bool `json:"uni_disable_done"`
+ PersMibAuditInterval time.Duration `json:"mib_audit_interval"`
+ PersMibLastDbSync uint32 `json:"mib_last_db_sync"`
+ PersMibDataSyncAdpt uint8 `json:"mib_data_sync_adpt"`
+ PersUniConfig []uniPersConfig `json:"uni_config"`
+ PersAlarmAuditInterval time.Duration `json:"alarm_audit_interval"`
}
// OnuDeviceEntry - ONU device info and FSM events.
@@ -282,7 +283,8 @@
supportedFsms OmciDeviceFsms
devState OnuDeviceEvent
// Audit and MDS
- mibAuditInterval time.Duration
+ mibAuditInterval time.Duration
+ alarmAuditInterval time.Duration
// TODO: periodical mib resync will be implemented with story VOL-3792
//mibNextDbResync uint32
@@ -344,13 +346,17 @@
if !dh.isReconciling() {
onuDeviceEntry.mibAuditInterval = onuDeviceEntry.supportedFsms["mib-synchronizer"].auditInterval
onuDeviceEntry.sOnuPersistentData.PersMibAuditInterval = onuDeviceEntry.mibAuditInterval
+ onuDeviceEntry.alarmAuditInterval = dh.pOpenOnuAc.alarmAuditInterval
+ onuDeviceEntry.sOnuPersistentData.PersAlarmAuditInterval = onuDeviceEntry.alarmAuditInterval
} else {
logger.Debugw(ctx, "reconciling - take audit interval from persistent data", log.Fields{"device-id": dh.deviceID})
// TODO: This is a preparation for VOL-VOL-3811 to preserve config history in case of
// vendor- or deviceID-specific configurations via voltctl-commands
onuDeviceEntry.mibAuditInterval = onuDeviceEntry.sOnuPersistentData.PersMibAuditInterval
+ onuDeviceEntry.alarmAuditInterval = onuDeviceEntry.sOnuPersistentData.PersAlarmAuditInterval
}
- logger.Debugw(ctx, "MibAudit is set to", log.Fields{"Interval": onuDeviceEntry.mibAuditInterval})
+ logger.Debugw(ctx, "MibAuditInterval and AlarmAuditInterval is set to", log.Fields{"mib-audit-interval": onuDeviceEntry.mibAuditInterval,
+ "alarm-audit-interval": onuDeviceEntry.alarmAuditInterval})
// TODO: periodical mib resync will be implemented with story VOL-3792
//onuDeviceEntry.mibNextDbResync = 0
@@ -597,7 +603,7 @@
oo.persUniConfigMutex.Lock()
defer oo.persUniConfigMutex.Unlock()
oo.sOnuPersistentData =
- onuPersistentData{0, 0, "", "", "", "", "", "", "", false, false, oo.mibAuditInterval, 0, 0, make([]uniPersConfig, 0)}
+ onuPersistentData{0, 0, "", "", "", "", "", "", "", false, false, oo.mibAuditInterval, 0, 0, make([]uniPersConfig, 0), oo.alarmAuditInterval}
oo.onuKVStoreMutex.RLock()
Value, err := oo.onuKVStore.Get(ctx, oo.onuKVStorePath)
oo.onuKVStoreMutex.RUnlock()
@@ -651,7 +657,7 @@
oo.sOnuPersistentData.PersUniConfig = nil //releasing all UniConfig entries to garbage collector default entry
oo.sOnuPersistentData =
- onuPersistentData{0, 0, "", "", "", "", "", "", "", false, false, oo.mibAuditInterval, 0, 0, make([]uniPersConfig, 0)}
+ onuPersistentData{0, 0, "", "", "", "", "", "", "", false, false, oo.mibAuditInterval, 0, 0, make([]uniPersConfig, 0), oo.alarmAuditInterval}
logger.Debugw(ctx, "delete ONU-data from KVStore", log.Fields{"device-id": oo.deviceID})
oo.onuKVStoreMutex.Lock()
err := oo.onuKVStore.Delete(ctx, oo.onuKVStorePath)
diff --git a/internal/pkg/onuadaptercore/openonu.go b/internal/pkg/onuadaptercore/openonu.go
index 10281cf..cb74d5a 100644
--- a/internal/pkg/onuadaptercore/openonu.go
+++ b/internal/pkg/onuadaptercore/openonu.go
@@ -71,6 +71,7 @@
metricsEnabled bool
mibAuditInterval time.Duration
omciTimeout int // in seconds
+ alarmAuditInterval time.Duration
}
//NewOpenONUAC returns a new instance of OpenONU_AC
@@ -105,6 +106,7 @@
openOnuAc.mibAuditInterval = cfg.MibAuditInterval
// since consumers of OMCI timeout value everywhere in code is in "int seconds", do this useful conversion
openOnuAc.omciTimeout = int(cfg.OmciTimeout.Seconds())
+ openOnuAc.alarmAuditInterval = cfg.AlarmAuditInterval
openOnuAc.pSupportedFsms = &OmciDeviceFsms{
"mib-synchronizer": {