VOL-1305 Separation of DHCP/AAA emulation part from OLT/ONUs emulation part
Change-Id: Idd2c6fb9bee7b7dca967b9bd49f6189343d1357f
diff --git a/device/device_olt.go b/device/device_olt.go
index b87bc53..41df918 100644
--- a/device/device_olt.go
+++ b/device/device_olt.go
@@ -45,7 +45,7 @@
ONU_DISCOVERED
)
-func CreateOlt(oltid uint32, npon uint32, nnni uint32) *Olt {
+func NewOlt(oltid uint32, npon uint32, nnni uint32) *Olt {
olt := Olt{}
olt.ID = oltid
olt.NumPonIntf = npon
@@ -69,7 +69,7 @@
return &olt
}
-func (olt *Olt)InitializeStatus(){
+func (olt *Olt) InitializeStatus() {
*olt.InternalState = PRE_ENABLE
olt.OperState = "up"
for i := uint32(0); i < olt.NumNniIntf; i++ {
diff --git a/device/device_onu.go b/device/device_onu.go
index 92f96b5..de99eb3 100644
--- a/device/device_onu.go
+++ b/device/device_onu.go
@@ -17,10 +17,10 @@
package device
import (
+ "gerrit.opencord.org/voltha-bbsim/common"
+ "gerrit.opencord.org/voltha-bbsim/protos"
"reflect"
"sync"
- "gerrit.opencord.org/voltha-bbsim/protos"
- "gerrit.opencord.org/voltha-bbsim/common"
)
type onuState int
@@ -39,12 +39,12 @@
mu *sync.Mutex
}
-func CreateSN(oltid uint32, intfid uint32, onuid uint32) []byte {
+func NewSN(oltid uint32, intfid uint32, onuid uint32) []byte {
sn := []byte{0, byte(oltid % 256), byte(intfid), byte(onuid)}
return sn
}
-func CreateOnus(oltid uint32, intfid uint32, nonus uint32, nnni uint32) []*Onu {
+func NewOnus(oltid uint32, intfid uint32, nonus uint32, nnni uint32) []*Onu {
onus := []*Onu{}
for i := 0; i < int(nonus); i++ {
onu := Onu{}
@@ -55,7 +55,7 @@
onu.OperState = "up"
onu.SerialNumber = new(openolt.SerialNumber)
onu.SerialNumber.VendorId = []byte("BBSM")
- onu.SerialNumber.VendorSpecific = CreateSN(oltid, intfid, uint32(i))
+ onu.SerialNumber.VendorSpecific = NewSN(oltid, intfid, uint32(i))
onus = append(onus, &onu)
}
return onus
@@ -88,13 +88,13 @@
}
}
-func (onu *Onu) UpdateIntStatus(intstatus onuState){
+func (onu *Onu) UpdateIntStatus(intstatus onuState) {
onu.mu.Lock()
defer onu.mu.Unlock()
*onu.InternalState = intstatus
}
-func (onu *Onu) GetIntStatus() onuState{
+func (onu *Onu) GetIntStatus() onuState {
onu.mu.Lock()
defer onu.mu.Unlock()
return *onu.InternalState