VOL-1900 lint warning fixes rw_core
Change-Id: Icaa84d7ce24163da90c91ff2babcbb78ff4e9141
diff --git a/rw_core/mocks/adapter_olt.go b/rw_core/mocks/adapter_olt.go
index 89f6c20..7cf0d47 100644
--- a/rw_core/mocks/adapter_olt.go
+++ b/rw_core/mocks/adapter_olt.go
@@ -13,11 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package mocks
import (
"context"
"fmt"
+ "strings"
+
"github.com/gogo/protobuf/proto"
"github.com/opencord/voltha-lib-go/v2/pkg/adapters/adapterif"
com "github.com/opencord/voltha-lib-go/v2/pkg/adapters/common"
@@ -25,24 +28,26 @@
ic "github.com/opencord/voltha-protos/v2/go/inter_container"
of "github.com/opencord/voltha-protos/v2/go/openflow_13"
"github.com/opencord/voltha-protos/v2/go/voltha"
- "strings"
)
const (
numONUPerOLT = 4
)
+// OLTAdapter represent OLT adapter
type OLTAdapter struct {
Adapter
}
+// NewOLTAdapter - creates OLT adapter instance
func NewOLTAdapter(cp adapterif.CoreProxy) *OLTAdapter {
a := &OLTAdapter{}
a.coreProxy = cp
return a
}
-func (oltA *OLTAdapter) Adopt_device(device *voltha.Device) error {
+// Adopt_device creates new handler for added device
+func (oltA *OLTAdapter) Adopt_device(device *voltha.Device) error { // nolint
go func() {
d := proto.Clone(device).(*voltha.Device)
d.Root = true
@@ -112,7 +117,8 @@
return nil
}
-func (oltA *OLTAdapter) Get_ofp_device_info(device *voltha.Device) (*ic.SwitchCapability, error) {
+// Get_ofp_device_info returns ofp device info
+func (oltA *OLTAdapter) Get_ofp_device_info(device *voltha.Device) (*ic.SwitchCapability, error) { // nolint
if d := oltA.getDevice(device.Id); d == nil {
log.Fatalf("device-not-found-%s", device.Id)
}
@@ -133,7 +139,8 @@
}, nil
}
-func (oltA *OLTAdapter) Get_ofp_port_info(device *voltha.Device, port_no int64) (*ic.PortCapability, error) {
+// Get_ofp_port_info returns ofp port info
+func (oltA *OLTAdapter) Get_ofp_port_info(device *voltha.Device, portNo int64) (*ic.PortCapability, error) { // nolint
if d := oltA.getDevice(device.Id); d == nil {
log.Fatalf("device-not-found-%s", device.Id)
}
@@ -151,16 +158,18 @@
MaxSpeed: uint32(of.OfpPortFeatures_OFPPF_1GB_FD),
},
DeviceId: device.Id,
- DevicePortNo: uint32(port_no),
+ DevicePortNo: uint32(portNo),
},
}, nil
}
+// GetNumONUPerOLT returns number of ONUs per OLT
func (oltA *OLTAdapter) GetNumONUPerOLT() int {
return numONUPerOLT
}
-func (oltA *OLTAdapter) Disable_device(device *voltha.Device) error {
+// Disable_device disables device
+func (oltA *OLTAdapter) Disable_device(device *voltha.Device) error { // nolint
go func() {
if d := oltA.getDevice(device.Id); d == nil {
log.Fatalf("device-not-found-%s", device.Id)
@@ -192,7 +201,8 @@
return nil
}
-func (oltA *OLTAdapter) Reenable_device(device *voltha.Device) error {
+// Reenable_device reenables device
+func (oltA *OLTAdapter) Reenable_device(device *voltha.Device) error { // nolint
go func() {
if d := oltA.getDevice(device.Id); d == nil {
log.Fatalf("device-not-found-%s", device.Id)