This commit consists of the following:
1) The kafka messaging proxy in Twisted python for adapters
2) Initial implementation and containerization of ponsim OLT adapter
and ponsim ONU adapter
3) Initial submission of request and response facade in both Twisted
python and Go Language
4) Initial implementation of device management and logical device management
in the Core
5) Update to the log module to allow dynamic setting of log level per
package using the gRPC API
6) Bug fixes and minor changes
Change-Id: Ia8f033da84cfd08275335bae9542802415e7bb0f
diff --git a/db/kvstore/client.go b/db/kvstore/client.go
index 8b1c914..a7cbf2b 100644
--- a/db/kvstore/client.go
+++ b/db/kvstore/client.go
@@ -15,6 +15,10 @@
*/
package kvstore
+import (
+ "github.com/opencord/voltha-go/common/log"
+)
+
const (
// Default timeout in seconds when making a kvstore request
defaultKVGetTimeout = 5
@@ -38,6 +42,10 @@
Lease int64
}
+func init() {
+ log.AddPackage(log.JSON, log.WarnLevel, nil)
+}
+
// NewKVPair creates a new KVPair object
func NewKVPair(key string, value interface{}, session string, lease int64) *KVPair {
kv := new(KVPair)
diff --git a/db/kvstore/etcdclient.go b/db/kvstore/etcdclient.go
index a6a1433..490a477 100644
--- a/db/kvstore/etcdclient.go
+++ b/db/kvstore/etcdclient.go
@@ -20,9 +20,11 @@
"context"
"errors"
"fmt"
- v3Client "github.com/coreos/etcd/clientv3"
- v3rpcTypes "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
+ //v3Client "github.com/coreos/etcd/clientv3"
+ //v3rpcTypes "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
log "github.com/opencord/voltha-go/common/log"
+ v3Client "go.etcd.io/etcd/clientv3"
+ v3rpcTypes "go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes"
"sync"
)
diff --git a/db/model/backend.go b/db/model/backend.go
index 340dd26..cd92c0b 100644
--- a/db/model/backend.go
+++ b/db/model/backend.go
@@ -18,10 +18,10 @@
import (
"errors"
"fmt"
+ "github.com/opencord/voltha-go/common/log"
"github.com/opencord/voltha-go/db/kvstore"
"strconv"
"time"
- "github.com/opencord/voltha-go/common/log"
)
//TODO: missing cache stuff
diff --git a/db/model/non_persisted_revision.go b/db/model/non_persisted_revision.go
index 4a97941..06bb53d 100644
--- a/db/model/non_persisted_revision.go
+++ b/db/model/non_persisted_revision.go
@@ -19,9 +19,9 @@
"bytes"
"crypto/md5"
"fmt"
+ "github.com/opencord/voltha-go/common/log"
"reflect"
"sort"
- "github.com/opencord/voltha-go/common/log"
)
var (
diff --git a/db/model/persisted_revision.go b/db/model/persisted_revision.go
index 805557a..ece0bb0 100644
--- a/db/model/persisted_revision.go
+++ b/db/model/persisted_revision.go
@@ -186,7 +186,7 @@
newPR := &PersistedRevision{
Revision: newNPR,
Compress: pr.Compress,
- kvStore: pr.kvStore,
+ kvStore: pr.kvStore,
}
newPR.Finalize()
@@ -200,7 +200,7 @@
newPR := &PersistedRevision{
Revision: newNPR,
Compress: pr.Compress,
- kvStore: pr.kvStore,
+ kvStore: pr.kvStore,
}
newPR.Finalize()
@@ -214,7 +214,7 @@
newPR := &PersistedRevision{
Revision: newNPR,
Compress: pr.Compress,
- kvStore: pr.kvStore,
+ kvStore: pr.kvStore,
}
newPR.Finalize()
diff --git a/db/model/profiling.go b/db/model/profiling.go
index 9d13d5a..1f97839 100644
--- a/db/model/profiling.go
+++ b/db/model/profiling.go
@@ -16,8 +16,8 @@
package model
import (
- "sync"
"github.com/opencord/voltha-go/common/log"
+ "sync"
)
type profiling struct {
diff --git a/db/model/proxy.go b/db/model/proxy.go
index 4b7a59f..4aae7f4 100644
--- a/db/model/proxy.go
+++ b/db/model/proxy.go
@@ -16,13 +16,13 @@
package model
import (
- "fmt"
- "strings"
- "reflect"
"crypto/md5"
- "github.com/opencord/voltha-go/common/log"
"errors"
+ "fmt"
+ "github.com/opencord/voltha-go/common/log"
+ "reflect"
"runtime"
+ "strings"
)
type OperationContext struct {
diff --git a/db/model/proxy_test.go b/db/model/proxy_test.go
index 0984016..ad02eb6 100644
--- a/db/model/proxy_test.go
+++ b/db/model/proxy_test.go
@@ -16,15 +16,15 @@
package model
import (
- "github.com/opencord/voltha-go/protos/voltha"
- "testing"
- "github.com/opencord/voltha-go/common/log"
- "strconv"
- "reflect"
- "github.com/google/uuid"
"encoding/hex"
"encoding/json"
"fmt"
+ "github.com/google/uuid"
+ "github.com/opencord/voltha-go/common/log"
+ "github.com/opencord/voltha-go/protos/voltha"
+ "reflect"
+ "strconv"
+ "testing"
)
type proxyTest struct {
diff --git a/db/model/root.go b/db/model/root.go
index b4885c1..1c14f9a 100644
--- a/db/model/root.go
+++ b/db/model/root.go
@@ -20,9 +20,9 @@
"encoding/json"
"fmt"
"github.com/google/uuid"
+ "github.com/opencord/voltha-go/common/log"
"reflect"
"time"
- "github.com/opencord/voltha-go/common/log"
)
type Root struct {
@@ -222,7 +222,7 @@
}
type rootData struct {
- Latest string `json:latest`
+ Latest string `json:latest`
Tags map[string]string `json:tags`
}
diff --git a/db/model/transaction_test.go b/db/model/transaction_test.go
index 4a0cc29..064b9ef 100644
--- a/db/model/transaction_test.go
+++ b/db/model/transaction_test.go
@@ -16,24 +16,24 @@
package model
import (
- "github.com/opencord/voltha-go/protos/voltha"
- "github.com/opencord/voltha-go/common/log"
- "testing"
- "github.com/google/uuid"
"encoding/hex"
- "strconv"
+ "github.com/google/uuid"
+ "github.com/opencord/voltha-go/common/log"
+ "github.com/opencord/voltha-go/protos/voltha"
"reflect"
+ "strconv"
+ "testing"
)
type transactionTest struct {
- Root *Root
- Backend *Backend
- Proxy *Proxy
- DbPrefix string
- DbType string
- DbHost string
- DbPort int
- DbTimeout int
+ Root *Root
+ Backend *Backend
+ Proxy *Proxy
+ DbPrefix string
+ DbType string
+ DbHost string
+ DbPort int
+ DbTimeout int
}
var (
@@ -46,7 +46,7 @@
DbTimeout: 5,
}
txTargetDevId string
- txDevId string
+ txDevId string
)
func init() {
@@ -148,7 +148,7 @@
func Test_Transaction_5_RemoveDevice(t *testing.T) {
removeTx := tx.Proxy.openTransaction()
- if removed := removeTx.Remove("/devices/"+txDevId); removed == nil {
+ if removed := removeTx.Remove("/devices/" + txDevId); removed == nil {
t.Error("Failed to remove device")
} else {
t.Logf("Removed device : %+v", removed)
diff --git a/db/model/utils_test.go b/db/model/utils_test.go
index 644e6e2..c4cc60d 100644
--- a/db/model/utils_test.go
+++ b/db/model/utils_test.go
@@ -16,17 +16,17 @@
package model
import (
- "testing"
"github.com/opencord/voltha-go/protos/voltha"
"reflect"
+ "testing"
)
func Test_Utils_Clone(t *testing.T) {
a := &voltha.Device{
- Id: "abcde",
+ Id: "abcde",
FirmwareVersion: "someversion",
}
- b:= &voltha.Device{}
+ b := &voltha.Device{}
Clone(reflect.ValueOf(a).Interface(), b)
t.Logf("A: %+v, B: %+v", a, b)
b.Id = "12345"