[VOL-5105] - Add Mapping label port for dmi transceiver
[VOL-5108] - bbsim test failure debugging
Change-Id: I12b85029565c45b7fc27a02847629ffd2fb98ca5
diff --git a/VERSION b/VERSION
index 5f032e8..afe5df6 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.15.0-dev1
+1.15.5
\ No newline at end of file
diff --git a/internal/bbsim/devices/helpers.go b/internal/bbsim/devices/helpers.go
index cc31d7a..76a53ec 100644
--- a/internal/bbsim/devices/helpers.go
+++ b/internal/bbsim/devices/helpers.go
@@ -43,7 +43,7 @@
"both": Both,
}
-//Constants for openolt Flows
+// Constants for openolt Flows
const (
flowTypeUpstream = "upstream"
flowTypeDownstream = "downstream"
diff --git a/internal/bbsim/devices/nni_test.go b/internal/bbsim/devices/nni_test.go
index 904e8a6..0353fd8 100644
--- a/internal/bbsim/devices/nni_test.go
+++ b/internal/bbsim/devices/nni_test.go
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//https://quii.gitbook.io/learn-go-with-tests/go-fundamentals/mocking
+// https://quii.gitbook.io/learn-go-with-tests/go-fundamentals/mocking
package devices
import (
diff --git a/internal/bbsim/devices/onu.go b/internal/bbsim/devices/onu.go
index 977a474..a12bd26 100644
--- a/internal/bbsim/devices/onu.go
+++ b/internal/bbsim/devices/onu.go
@@ -1803,8 +1803,10 @@
}
}
-/* when ReDiscoverOnu is called during reboot, true is passed so that there is no delay in onu discoveries
- It is assumed that all onu resources are cleared and no sleep is required
+/*
+when ReDiscoverOnu is called during reboot, true is passed so that there is no delay in onu discoveries
+
+ It is assumed that all onu resources are cleared and no sleep is required
*/
func (onu *Onu) ReDiscoverOnu(isReboot bool) {
// Wait for few seconds to be sure of the cleanup
diff --git a/internal/bbsim/dmiserver/dmi_api_server.go b/internal/bbsim/dmiserver/dmi_api_server.go
index ff29225..7545e1d 100755
--- a/internal/bbsim/dmiserver/dmi_api_server.go
+++ b/internal/bbsim/dmiserver/dmi_api_server.go
@@ -35,7 +35,7 @@
"module": "DmiServer",
})
-//DmiAPIServer has the attributes for the Server handling the Device Management Interface
+// DmiAPIServer has the attributes for the Server handling the Device Management Interface
type DmiAPIServer struct {
ipAddress string
uuid *dmi.Uuid
@@ -51,7 +51,7 @@
var dmiServ DmiAPIServer
-//StartDmiAPIServer starts a new grpc server for the Device Manager Interface
+// StartDmiAPIServer starts a new grpc server for the Device Manager Interface
func StartDmiAPIServer() (*grpc.Server, error) {
dmiServ = DmiAPIServer{}
diff --git a/internal/bbsim/dmiserver/dmi_event_generator.go b/internal/bbsim/dmiserver/dmi_event_generator.go
index ac1fa17..3c7c4ee 100644
--- a/internal/bbsim/dmiserver/dmi_event_generator.go
+++ b/internal/bbsim/dmiserver/dmi_event_generator.go
@@ -28,7 +28,7 @@
"google.golang.org/protobuf/types/known/timestamppb"
)
-//DmiEventsGenerator has the attributes for generating events
+// DmiEventsGenerator has the attributes for generating events
type DmiEventsGenerator struct {
apiSrv *DmiAPIServer
configuredEvents map[dmi.EventIds]dmi.EventCfg
@@ -85,7 +85,7 @@
}
}
-//StartEventsGenerator initializes the event generator
+// StartEventsGenerator initializes the event generator
func StartEventsGenerator(apiSrv *DmiAPIServer) {
log.Debugf("StartEventsGenerator invoked")
@@ -153,7 +153,7 @@
return toRet
}
-//UpdateEventConfig Adds/Updates the passed event configuration
+// UpdateEventConfig Adds/Updates the passed event configuration
func UpdateEventConfig(newEventCfg *dmi.EventCfg) {
dmiEG.access.Lock()
dmiEG.configuredEvents[newEventCfg.GetEventId()] = *newEventCfg
diff --git a/internal/bbsim/dmiserver/dmi_events_mgmt.go b/internal/bbsim/dmiserver/dmi_events_mgmt.go
index 3c38ad9..ab7f002 100755
--- a/internal/bbsim/dmiserver/dmi_events_mgmt.go
+++ b/internal/bbsim/dmiserver/dmi_events_mgmt.go
@@ -25,7 +25,7 @@
dmi "github.com/opencord/device-management-interface/go/dmi"
)
-//ListEvents lists the supported events for the passed device
+// ListEvents lists the supported events for the passed device
func (dms *DmiAPIServer) ListEvents(ctx context.Context, req *dmi.HardwareID) (*dmi.ListEventsResponse, error) {
logger.Debugf("ListEvents called with request %+v", req)
events := getEventsList()
@@ -38,7 +38,7 @@
}, nil
}
-//UpdateEventsConfiguration updates the configuration of the list of events in the request
+// UpdateEventsConfiguration updates the configuration of the list of events in the request
func (dms *DmiAPIServer) UpdateEventsConfiguration(ctx context.Context, req *dmi.EventsConfigurationRequest) (*dmi.EventsConfigurationResponse, error) {
logger.Debugf("UpdateEventsConfiguration called with request %+v", req)
diff --git a/internal/bbsim/dmiserver/dmi_hw_mgmt.go b/internal/bbsim/dmiserver/dmi_hw_mgmt.go
index da73300..ff7286d 100755
--- a/internal/bbsim/dmiserver/dmi_hw_mgmt.go
+++ b/internal/bbsim/dmiserver/dmi_hw_mgmt.go
@@ -82,7 +82,7 @@
}
}
-//StartManagingDevice establishes connection with the device and does checks to ascertain if the device with passed identity can be managed
+// StartManagingDevice establishes connection with the device and does checks to ascertain if the device with passed identity can be managed
func (dms *DmiAPIServer) StartManagingDevice(req *dmi.ModifiableComponent, stream dmi.NativeHWManagementService_StartManagingDeviceServer) error {
//Get serial number and generate the UUID based on this serial number. Store this UUID in local cache
logger.Debugf("StartManagingDevice() invoked with request %+v", req)
@@ -239,7 +239,8 @@
Parent: trans.Name,
Specific: &dmi.Component_PortAttr{
PortAttr: &dmi.PortComponentAttributes{
- Protocol: portProto,
+ Protocol: portProto,
+ MappingLabel: fmt.Sprintf("pon-%d", pon.ID),
},
},
}
@@ -495,7 +496,7 @@
return nil
}
-//StopManagingDevice stops management of a device and cleans up any context and caches for that device
+// StopManagingDevice stops management of a device and cleans up any context and caches for that device
func (dms *DmiAPIServer) StopManagingDevice(ctx context.Context, req *dmi.StopManagingDeviceRequest) (*dmi.StopManagingDeviceResponse, error) {
logger.Debugf("StopManagingDevice API invoked")
if req == nil {
@@ -527,7 +528,7 @@
return &dmi.StopManagingDeviceResponse{Status: dmi.Status_OK_STATUS}, nil
}
-//GetPhysicalInventory gets the HW inventory details of the Device
+// GetPhysicalInventory gets the HW inventory details of the Device
func (dms *DmiAPIServer) GetPhysicalInventory(req *dmi.PhysicalInventoryRequest, stream dmi.NativeHWManagementService_GetPhysicalInventoryServer) error {
if req == nil || req.DeviceUuid == nil || req.DeviceUuid.Uuid == "" {
return status.Errorf(codes.InvalidArgument, "device-UUID missing in the request")
@@ -568,7 +569,7 @@
return sendResponseBackOnStream(stream, response)
}
-//Contains tells whether arr contains element.
+// Contains tells whether arr contains element.
func Contains(arr []string, element string) bool {
for _, item := range arr {
if element == item {
@@ -637,7 +638,7 @@
return nil
}
-//GetHWComponentInfo gets the details of a particular HW component
+// GetHWComponentInfo gets the details of a particular HW component
func (dms *DmiAPIServer) GetHWComponentInfo(req *dmi.HWComponentInfoGetRequest, stream dmi.NativeHWManagementService_GetHWComponentInfoServer) error {
logger.Debugf("GetHWComponentInfo() invoked with request %+v", req)
@@ -660,12 +661,12 @@
return sendGetHWComponentResponse(c, stream)
}
-//SetHWComponentInfo sets the permissible attributes of a HW component
+// SetHWComponentInfo sets the permissible attributes of a HW component
func (dms *DmiAPIServer) SetHWComponentInfo(context.Context, *dmi.HWComponentInfoSetRequest) (*dmi.HWComponentInfoSetResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "rpc SetHWComponentInfo not implemented")
}
-//SetLoggingEndpoint sets the location to which logs need to be shipped
+// SetLoggingEndpoint sets the location to which logs need to be shipped
func (dms *DmiAPIServer) SetLoggingEndpoint(_ context.Context, request *dmi.SetLoggingEndpointRequest) (*dmi.SetRemoteEndpointResponse, error) {
logger.Debugf("SetLoggingEndpoint called with request %+v", request)
errRetFunc := func(stat dmi.Status, reason dmi.SetRemoteEndpointResponse_Reason) (*dmi.SetRemoteEndpointResponse, error) {
@@ -697,7 +698,7 @@
}, nil
}
-//GetLoggingEndpoint gets the configured location to which the logs are being shipped
+// GetLoggingEndpoint gets the configured location to which the logs are being shipped
func (dms *DmiAPIServer) GetLoggingEndpoint(_ context.Context, request *dmi.HardwareID) (*dmi.GetLoggingEndpointResponse, error) {
logger.Debugf("GetLoggingEndpoint called with request %+v", request)
if request == nil || request.Uuid == nil || request.Uuid.Uuid == "" {
@@ -720,7 +721,7 @@
}, nil
}
-//SetMsgBusEndpoint sets the location of the Message Bus to which events and metrics are shipped
+// SetMsgBusEndpoint sets the location of the Message Bus to which events and metrics are shipped
func (dms *DmiAPIServer) SetMsgBusEndpoint(ctx context.Context, request *dmi.SetMsgBusEndpointRequest) (*dmi.SetRemoteEndpointResponse, error) {
logger.Debugf("SetMsgBusEndpoint() invoked with request: %+v and context: %v", request, ctx)
if request == nil || request.MsgbusEndpoint == "" {
@@ -752,7 +753,7 @@
return &dmi.SetRemoteEndpointResponse{Status: dmi.Status_OK_STATUS, Reason: dmi.SetRemoteEndpointResponse_UNDEFINED_REASON}, nil
}
-//GetMsgBusEndpoint gets the configured location to which the events and metrics are being shipped
+// GetMsgBusEndpoint gets the configured location to which the events and metrics are being shipped
func (dms *DmiAPIServer) GetMsgBusEndpoint(context.Context, *empty.Empty) (*dmi.GetMsgBusEndpointResponse, error) {
logger.Debugf("GetMsgBusEndpoint() invoked")
if dms.kafkaEndpoint != "" {
@@ -769,7 +770,7 @@
}, nil
}
-//GetManagedDevices returns an object containing a list of devices managed by this entity
+// GetManagedDevices returns an object containing a list of devices managed by this entity
func (dms *DmiAPIServer) GetManagedDevices(context.Context, *empty.Empty) (*dmi.ManagedDevicesResponse, error) {
retResponse := dmi.ManagedDevicesResponse{}
//If our uuid is empty, we return empty list; else we fill details and return
@@ -791,7 +792,7 @@
return &retResponse, nil
}
-//GetLogLevel Gets the configured log level for a certain entity on a certain device.
+// GetLogLevel Gets the configured log level for a certain entity on a certain device.
func (dms *DmiAPIServer) GetLogLevel(context.Context, *dmi.GetLogLevelRequest) (*dmi.GetLogLevelResponse, error) {
return &dmi.GetLogLevelResponse{
Status: dmi.Status_OK_STATUS,
diff --git a/internal/bbsim/dmiserver/dmi_metrics_generator.go b/internal/bbsim/dmiserver/dmi_metrics_generator.go
index 0fd8014..66f7c89 100755
--- a/internal/bbsim/dmiserver/dmi_metrics_generator.go
+++ b/internal/bbsim/dmiserver/dmi_metrics_generator.go
@@ -28,7 +28,7 @@
dmi "github.com/opencord/device-management-interface/go/dmi"
)
-//MetricGenerationFunc to generate the metrics to the kafka bus
+// MetricGenerationFunc to generate the metrics to the kafka bus
type MetricGenerationFunc func(*dmi.Component, *DmiAPIServer) *dmi.Metric
// MetricTriggerConfig is the configuration of a metric and the time at which it will be exported
@@ -37,7 +37,7 @@
t time.Time
}
-//DmiMetricsGenerator has the attributes for generating metrics
+// DmiMetricsGenerator has the attributes for generating metrics
type DmiMetricsGenerator struct {
apiSrv *DmiAPIServer
configuredMetrics map[dmi.MetricNames]MetricTriggerConfig
@@ -47,7 +47,7 @@
var dmiMG DmiMetricsGenerator
-//StartMetricGenerator starts the metric generator
+// StartMetricGenerator starts the metric generator
func StartMetricGenerator(apiSrv *DmiAPIServer) {
log.Debugf("StartMetricGenerator invoked")
// Seed the rand for use later on
@@ -282,7 +282,7 @@
return lValue + randVal
}
-//UpdateMetricConfig Adds/Updates the passed metric configuration
+// UpdateMetricConfig Adds/Updates the passed metric configuration
func UpdateMetricConfig(newCfg *dmi.MetricConfig) {
dmiMG.access.Lock()
dmiMG.configuredMetrics[newCfg.GetMetricId()] = MetricTriggerConfig{
diff --git a/internal/bbsim/dmiserver/dmi_metrics_mgmt.go b/internal/bbsim/dmiserver/dmi_metrics_mgmt.go
index 1cfaaac..2a5d657 100755
--- a/internal/bbsim/dmiserver/dmi_metrics_mgmt.go
+++ b/internal/bbsim/dmiserver/dmi_metrics_mgmt.go
@@ -26,7 +26,7 @@
dmi "github.com/opencord/device-management-interface/go/dmi"
)
-//ListMetrics lists the supported metrics for the passed device.
+// ListMetrics lists the supported metrics for the passed device.
func (dms *DmiAPIServer) ListMetrics(ctx context.Context, req *dmi.HardwareID) (*dmi.ListMetricsResponse, error) {
logger.Debugf("ListMetrics invoked with request %+v", req)
metrics := getMetricsList()
@@ -40,7 +40,7 @@
}, nil
}
-//UpdateMetricsConfiguration updates the configuration of the list of metrics in the request
+// UpdateMetricsConfiguration updates the configuration of the list of metrics in the request
func (dms *DmiAPIServer) UpdateMetricsConfiguration(ctx context.Context, req *dmi.MetricsConfigurationRequest) (*dmi.MetricsConfigurationResponse, error) {
logger.Debugf("UpdateMetricConfiguration invoked with request %+v", req)
@@ -73,7 +73,7 @@
}, nil
}
-//GetMetric gets the instantenous value of a metric
+// GetMetric gets the instantenous value of a metric
func (dms *DmiAPIServer) GetMetric(ctx context.Context, req *dmi.GetMetricRequest) (*dmi.GetMetricResponse, error) {
logger.Debugf("GetMetric invoked with request %+v", req)
diff --git a/internal/bbsim/dmiserver/dmi_sw_mgmt.go b/internal/bbsim/dmiserver/dmi_sw_mgmt.go
index b5c5b8f..10e124a 100755
--- a/internal/bbsim/dmiserver/dmi_sw_mgmt.go
+++ b/internal/bbsim/dmiserver/dmi_sw_mgmt.go
@@ -24,7 +24,7 @@
"google.golang.org/grpc/status"
)
-//GetSoftwareVersion gets the software version information of the Active and Standby images
+// GetSoftwareVersion gets the software version information of the Active and Standby images
func (dms *DmiAPIServer) GetSoftwareVersion(ctx context.Context, req *dmi.HardwareID) (*dmi.GetSoftwareVersionInformationResponse, error) {
// TODO: Make this more interesting by taking values from BBSim if available
logger.Debugf("GetSoftwareVersion invoked with for device %+v", req)
@@ -44,7 +44,7 @@
}, nil
}
-//DownloadImage downloads and installs the image in the standby partition, returns the status/progress of the Install
+// DownloadImage downloads and installs the image in the standby partition, returns the status/progress of the Install
func (dms *DmiAPIServer) DownloadImage(req *dmi.DownloadImageRequest, stream dmi.NativeSoftwareManagementService_DownloadImageServer) error {
logger.Debugf("DownloadImage invoked with request %+v", req)
err := stream.Send(&dmi.ImageStatus{
@@ -59,7 +59,7 @@
}
-//ActivateImage Activates and runs the OLT with the image in the standby partition
+// ActivateImage Activates and runs the OLT with the image in the standby partition
func (dms *DmiAPIServer) ActivateImage(req *dmi.HardwareID, stream dmi.NativeSoftwareManagementService_ActivateImageServer) error {
logger.Debugf("ActivateImage invoked with request %+v", req)
err := stream.Send(&dmi.ImageStatus{
@@ -75,7 +75,7 @@
}
-//RevertToStandbyImage marks the image in the Standby as Active and reboots the device, so that it boots from that image which was in the standby.
+// RevertToStandbyImage marks the image in the Standby as Active and reboots the device, so that it boots from that image which was in the standby.
func (dms *DmiAPIServer) RevertToStandbyImage(req *dmi.HardwareID, stream dmi.NativeSoftwareManagementService_RevertToStandbyImageServer) error {
logger.Debugf("RevertToStandbyImage invoked with request %+v", req)
err := stream.Send(&dmi.ImageStatus{
diff --git a/internal/bbsimctl/commands/dmi.go b/internal/bbsimctl/commands/dmi.go
index 9898a85..621fe4e 100644
--- a/internal/bbsimctl/commands/dmi.go
+++ b/internal/bbsimctl/commands/dmi.go
@@ -102,7 +102,7 @@
return nil
}
-//Print a list of the transceivers and their state
+// Print a list of the transceivers and their state
func (pon *DmiTransceiversList) Execute(args []string) error {
client, conn := dmiEventGrpcClient()
defer conn.Close()
@@ -126,7 +126,7 @@
return nil
}
-//Plug in the specified transceiver
+// Plug in the specified transceiver
func (pon *DmiTransceiverPlugIn) Execute(args []string) error {
client, conn := dmiEventGrpcClient()
defer conn.Close()
@@ -148,7 +148,7 @@
return nil
}
-//Plug out the specified transceiver
+// Plug out the specified transceiver
func (pon *DmiTransceiverPlugOut) Execute(args []string) error {
client, conn := dmiEventGrpcClient()
defer conn.Close()
diff --git a/internal/bbsimctl/commands/uni.go b/internal/bbsimctl/commands/uni.go
index 073c088..834c2e7 100644
--- a/internal/bbsimctl/commands/uni.go
+++ b/internal/bbsimctl/commands/uni.go
@@ -140,9 +140,9 @@
return nil
}
-//Get Services for specified UNI
-//First get UNIs from specified ONU SN
-//Then get Services from appropriate UNI
+// Get Services for specified UNI
+// First get UNIs from specified ONU SN
+// Then get Services from appropriate UNI
func (options *UNIServices) Execute(args []string) error {
services, err := getServices(string(options.Args.OnuSn), string(options.Args.UniId))
diff --git a/internal/common/omci/omci_base.go b/internal/common/omci/omci_base.go
index 482025a..7667269 100644
--- a/internal/common/omci/omci_base.go
+++ b/internal/common/omci/omci_base.go
@@ -91,7 +91,7 @@
return p
}
-//HexEncode convert binary to hex
+// HexEncode convert binary to hex
func HexEncode(omciPkt []byte) ([]byte, error) {
dst := make([]byte, hex.EncodedLen(len(omciPkt)))
hex.Encode(dst, omciPkt)
diff --git a/internal/common/options.go b/internal/common/options.go
index b529321..527940f 100644
--- a/internal/common/options.go
+++ b/internal/common/options.go
@@ -134,7 +134,7 @@
return -1, fmt.Errorf("%s-is-not-a-valid-pon-technology", s)
}
-//Constants for default allocation ranges
+// Constants for default allocation ranges
const (
defaultOnuIdStart = 1
defaultAllocIdStart = 1024