VOL-2776 unit test for StartOmciTestAction
Change-Id: Ib0b560b2ae37fab428b3fc058f282b941c5e237f
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/grpc/common.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/grpc/common.go
new file mode 100644
index 0000000..17eeeaf
--- /dev/null
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/grpc/common.go
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2020-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package grpc
+
+import (
+ "github.com/opencord/voltha-lib-go/v3/pkg/log"
+)
+
+var logger log.Logger
+
+func init() {
+ // Setup this package so that it's log level can be modified at run time
+ var err error
+ logger, err = log.AddPackage(log.JSON, log.ErrorLevel, log.Fields{"pkg": "grpc"})
+ if err != nil {
+ panic(err)
+ }
+}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/grpc/server.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/grpc/server.go
index 33c9b76..43f2912 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/grpc/server.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/grpc/server.go
@@ -18,7 +18,6 @@
import (
"context"
"fmt"
- "github.com/opencord/voltha-lib-go/v3/pkg/log"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
@@ -100,19 +99,19 @@
lis, err := net.Listen("tcp", host)
if err != nil {
- log.Fatalf("failed to listen: %v", err)
+ logger.Fatalf("failed to listen: %v", err)
}
if s.secure && s.GrpcSecurity != nil {
creds, err := credentials.NewServerTLSFromFile(s.CertFile, s.KeyFile)
if err != nil {
- log.Fatalf("could not load TLS keys: %s", err)
+ logger.Fatalf("could not load TLS keys: %s", err)
}
s.gs = grpc.NewServer(grpc.Creds(creds),
withServerUnaryInterceptor(s))
} else {
- log.Info("starting-insecure-grpc-server")
+ logger.Info("starting-insecure-grpc-server")
s.gs = grpc.NewServer(withServerUnaryInterceptor(s))
}
@@ -122,7 +121,7 @@
}
if err := s.gs.Serve(lis); err != nil {
- log.Fatalf("failed to serve: %v\n", err)
+ logger.Fatalf("failed to serve: %v\n", err)
}
}
@@ -145,7 +144,7 @@
handler grpc.UnaryHandler) (interface{}, error) {
if (s.probe != nil) && (!s.probe.IsReady()) {
- log.Warnf("Grpc request received while not ready %v", req)
+ logger.Warnf("Grpc request received while not ready %v", req)
return nil, status.Error(codes.Unavailable, "system is not ready")
}