Minor fixes & tweaks to improve error handing in preparation for BBSim REST API pull request.
Added comments to reduce golint warnings.
Main contributors: Pragya Arya, Vishesh Prasidh
Change-Id: I6f0b67a39dd0b8da0288306ac4f66098df53b18d
diff --git a/core/mediator.go b/core/mediator.go
index 5565715..4e8833a 100644
--- a/core/mediator.go
+++ b/core/mediator.go
@@ -46,6 +46,7 @@
Debuglvl string
}
+// GetOptions receives command line options and stores them in option structure
func GetOptions() *option {
o := new(option)
addressport := flag.String("H", ":50060", "IP address:port")
@@ -87,6 +88,7 @@
testmanager *TestManager
}
+// NewMediator returns a new mediator object
func NewMediator(o *option) *mediator {
m := new(mediator)
m.opt = o
@@ -100,6 +102,7 @@
return m
}
+// Start mediator
func (m *mediator) Start() {
var wg sync.WaitGroup
opt := m.opt
@@ -140,6 +143,7 @@
logger.Debug("Reach to the end line")
}
+// Mediate method is invoked on OLT and ONU state change
func (m *mediator) Mediate() {
defer logger.Debug("Mediate Done")
for sr := range m.server.stateRepCh {
@@ -180,8 +184,7 @@
if err := tm.StartTester(key, t); err != nil {
logger.Error("Cannot Start Executer error:%v", err)
}
- } else if (current == device.ONU_OMCIACTIVE || current == device.ONU_ACTIVE) &&
- next == device.ONU_INACTIVE {
+ } else if current == device.ONU_OMCIACTIVE && next == device.ONU_INACTIVE {
if err := tm.StopTester(key); err != nil {
logger.Error("Cannot Start Executer error:%v", err)
}