SEBA-767 Directory restructuring in accordance with best practices

Change-Id: Id651366a3545ad0141a7854e99fa46867e543295
diff --git a/Makefile b/Makefile
index 87b2df3..f55f82b 100644
--- a/Makefile
+++ b/Makefile
@@ -50,7 +50,7 @@
 build: dependencies
 	export GOOS=$(HOST_OS) ;\
 	export GOARCH=$(HOST_ARCH) ;\
-	go build $(LDFLAGS) cmd/cordctl.go
+	go build $(LDFLAGS) cmd/cordctl/cordctl.go
 
 dependencies:
 	[ -d "vendor" ] || dep ensure
@@ -91,7 +91,7 @@
 $(RELEASE_BINS): dependencies
 	export GOOS=$(rel_os) ;\
 	export GOARCH=$(rel_arch) ;\
-	go build -v $(LDFLAGS) -o "$@" cmd/cordctl.go
+	go build -v $(LDFLAGS) -o "$@" cmd/cordctl/cordctl.go
 
 release: $(RELEASE_BINS)
 
diff --git a/cmd/cordctl.go b/cmd/cordctl/cordctl.go
similarity index 93%
rename from cmd/cordctl.go
rename to cmd/cordctl/cordctl.go
index 500971e..8106a36 100644
--- a/cmd/cordctl.go
+++ b/cmd/cordctl/cordctl.go
@@ -19,8 +19,8 @@
 import (
 	"fmt"
 	flags "github.com/jessevdk/go-flags"
-	"github.com/opencord/cordctl/commands"
-	corderrors "github.com/opencord/cordctl/error"
+	"github.com/opencord/cordctl/internal/pkg/commands"
+	corderrors "github.com/opencord/cordctl/internal/pkg/error"
 	"os"
 	"path"
 )
diff --git a/cli/version/version.go b/internal/pkg/cli/version/version.go
similarity index 100%
rename from cli/version/version.go
rename to internal/pkg/cli/version/version.go
diff --git a/commands/backup.go b/internal/pkg/commands/backup.go
similarity index 98%
rename from commands/backup.go
rename to internal/pkg/commands/backup.go
index ceda54a..84df5a9 100644
--- a/commands/backup.go
+++ b/internal/pkg/commands/backup.go
@@ -19,7 +19,7 @@
 import (
 	"context"
 	flags "github.com/jessevdk/go-flags"
-	corderrors "github.com/opencord/cordctl/error"
+	corderrors "github.com/opencord/cordctl/internal/pkg/error"
 	"time"
 )
 
diff --git a/commands/backup_test.go b/internal/pkg/commands/backup_test.go
similarity index 97%
rename from commands/backup_test.go
rename to internal/pkg/commands/backup_test.go
index 357f891..4d78a11 100644
--- a/commands/backup_test.go
+++ b/internal/pkg/commands/backup_test.go
@@ -18,7 +18,7 @@
 
 import (
 	"bytes"
-	"github.com/opencord/cordctl/testutils"
+	"github.com/opencord/cordctl/pkg/testutils"
 	"io/ioutil"
 	"testing"
 )
diff --git a/commands/command.go b/internal/pkg/commands/command.go
similarity index 98%
rename from commands/command.go
rename to internal/pkg/commands/command.go
index ef28d54..45ccd5d 100644
--- a/commands/command.go
+++ b/internal/pkg/commands/command.go
@@ -19,8 +19,8 @@
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/opencord/cordctl/format"
-	"github.com/opencord/cordctl/order"
+	"github.com/opencord/cordctl/pkg/format"
+	"github.com/opencord/cordctl/pkg/order"
 	"google.golang.org/grpc"
 	"gopkg.in/yaml.v2"
 	"io"
diff --git a/commands/common.go b/internal/pkg/commands/common.go
similarity index 98%
rename from commands/common.go
rename to internal/pkg/commands/common.go
index c79c3ca..6f795e4 100644
--- a/commands/common.go
+++ b/internal/pkg/commands/common.go
@@ -23,7 +23,7 @@
 	versionUtils "github.com/hashicorp/go-version"
 	"github.com/jhump/protoreflect/dynamic"
 	"github.com/jhump/protoreflect/grpcreflect"
-	corderrors "github.com/opencord/cordctl/error"
+	corderrors "github.com/opencord/cordctl/internal/pkg/error"
 	"golang.org/x/net/context"
 	"google.golang.org/grpc"
 	reflectpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
diff --git a/commands/completion.go b/internal/pkg/commands/completion.go
similarity index 94%
rename from commands/completion.go
rename to internal/pkg/commands/completion.go
index 65c4883..74e7cfa 100644
--- a/commands/completion.go
+++ b/internal/pkg/commands/completion.go
@@ -18,7 +18,7 @@
 import (
 	"fmt"
 	flags "github.com/jessevdk/go-flags"
-	"github.com/opencord/cordctl/completion"
+	"github.com/opencord/cordctl/internal/pkg/completion"
 )
 
 type BashOptions struct{}
diff --git a/commands/completion_test.go b/internal/pkg/commands/completion_test.go
similarity index 90%
rename from commands/completion_test.go
rename to internal/pkg/commands/completion_test.go
index 6b9c119..b7b25c8 100644
--- a/commands/completion_test.go
+++ b/internal/pkg/commands/completion_test.go
@@ -18,8 +18,8 @@
 
 import (
 	"bytes"
-	"github.com/opencord/cordctl/completion"
-	"github.com/opencord/cordctl/testutils"
+	"github.com/opencord/cordctl/internal/pkg/completion"
+	"github.com/opencord/cordctl/pkg/testutils"
 	"testing"
 )
 
diff --git a/commands/config.go b/internal/pkg/commands/config.go
similarity index 100%
rename from commands/config.go
rename to internal/pkg/commands/config.go
diff --git a/commands/funcmap.go b/internal/pkg/commands/funcmap.go
similarity index 100%
rename from commands/funcmap.go
rename to internal/pkg/commands/funcmap.go
diff --git a/commands/handler.go b/internal/pkg/commands/handler.go
similarity index 100%
rename from commands/handler.go
rename to internal/pkg/commands/handler.go
diff --git a/commands/models.go b/internal/pkg/commands/models.go
similarity index 99%
rename from commands/models.go
rename to internal/pkg/commands/models.go
index e413178..c39d1df 100644
--- a/commands/models.go
+++ b/internal/pkg/commands/models.go
@@ -22,7 +22,7 @@
 	"github.com/fullstorydev/grpcurl"
 	flags "github.com/jessevdk/go-flags"
 	"github.com/jhump/protoreflect/dynamic"
-	corderrors "github.com/opencord/cordctl/error"
+	corderrors "github.com/opencord/cordctl/internal/pkg/error"
 	"google.golang.org/grpc"
 	"sort"
 	"strings"
diff --git a/commands/models_test.go b/internal/pkg/commands/models_test.go
similarity index 98%
rename from commands/models_test.go
rename to internal/pkg/commands/models_test.go
index 1f9abed..40e25ea 100644
--- a/commands/models_test.go
+++ b/internal/pkg/commands/models_test.go
@@ -18,8 +18,8 @@
 
 import (
 	"bytes"
-	corderrors "github.com/opencord/cordctl/error"
-	"github.com/opencord/cordctl/testutils"
+	corderrors "github.com/opencord/cordctl/internal/pkg/error"
+	"github.com/opencord/cordctl/pkg/testutils"
 	"github.com/stretchr/testify/assert"
 	"testing"
 	"time"
diff --git a/commands/modeltypes.go b/internal/pkg/commands/modeltypes.go
similarity index 100%
rename from commands/modeltypes.go
rename to internal/pkg/commands/modeltypes.go
diff --git a/commands/modeltypes_test.go b/internal/pkg/commands/modeltypes_test.go
similarity index 97%
rename from commands/modeltypes_test.go
rename to internal/pkg/commands/modeltypes_test.go
index abdc305..e18c2db 100644
--- a/commands/modeltypes_test.go
+++ b/internal/pkg/commands/modeltypes_test.go
@@ -18,7 +18,7 @@
 
 import (
 	"bytes"
-	"github.com/opencord/cordctl/testutils"
+	"github.com/opencord/cordctl/pkg/testutils"
 	"testing"
 )
 
diff --git a/commands/orm.go b/internal/pkg/commands/orm.go
similarity index 99%
rename from commands/orm.go
rename to internal/pkg/commands/orm.go
index 1d700d7..0ac846a 100644
--- a/commands/orm.go
+++ b/internal/pkg/commands/orm.go
@@ -24,7 +24,7 @@
 	"github.com/golang/protobuf/protoc-gen-go/descriptor"
 	"github.com/jhump/protoreflect/desc"
 	"github.com/jhump/protoreflect/dynamic"
-	corderrors "github.com/opencord/cordctl/error"
+	corderrors "github.com/opencord/cordctl/internal/pkg/error"
 	"google.golang.org/grpc"
 	"io"
 	"strconv"
diff --git a/commands/orm_test.go b/internal/pkg/commands/orm_test.go
similarity index 98%
rename from commands/orm_test.go
rename to internal/pkg/commands/orm_test.go
index 9a0dad1..2d8db62 100644
--- a/commands/orm_test.go
+++ b/internal/pkg/commands/orm_test.go
@@ -18,7 +18,7 @@
 
 import (
 	"context"
-	corderrors "github.com/opencord/cordctl/error"
+	corderrors "github.com/opencord/cordctl/internal/pkg/error"
 	"github.com/stretchr/testify/assert"
 	"testing"
 )
diff --git a/commands/services.go b/internal/pkg/commands/services.go
similarity index 97%
rename from commands/services.go
rename to internal/pkg/commands/services.go
index 19d4fd0..d199ee9 100644
--- a/commands/services.go
+++ b/internal/pkg/commands/services.go
@@ -21,7 +21,7 @@
 	"github.com/fullstorydev/grpcurl"
 	flags "github.com/jessevdk/go-flags"
 	"github.com/jhump/protoreflect/dynamic"
-	corderrors "github.com/opencord/cordctl/error"
+	corderrors "github.com/opencord/cordctl/internal/pkg/error"
 )
 
 const (
diff --git a/commands/services_test.go b/internal/pkg/commands/services_test.go
similarity index 97%
rename from commands/services_test.go
rename to internal/pkg/commands/services_test.go
index 3b213bf..721b6dc 100644
--- a/commands/services_test.go
+++ b/internal/pkg/commands/services_test.go
@@ -18,7 +18,7 @@
 
 import (
 	"bytes"
-	"github.com/opencord/cordctl/testutils"
+	"github.com/opencord/cordctl/pkg/testutils"
 	"testing"
 )
 
diff --git a/commands/setup_test.go b/internal/pkg/commands/setup_test.go
similarity index 95%
rename from commands/setup_test.go
rename to internal/pkg/commands/setup_test.go
index 5c1ec83..3b1dc7b 100644
--- a/commands/setup_test.go
+++ b/internal/pkg/commands/setup_test.go
@@ -18,7 +18,7 @@
 
 import (
 	"fmt"
-	"github.com/opencord/cordctl/testutils"
+	"github.com/opencord/cordctl/pkg/testutils"
 	"os"
 	"testing"
 )
diff --git a/commands/status.go b/internal/pkg/commands/status.go
similarity index 97%
rename from commands/status.go
rename to internal/pkg/commands/status.go
index 6527371..802720a 100644
--- a/commands/status.go
+++ b/internal/pkg/commands/status.go
@@ -21,7 +21,7 @@
 	"github.com/fullstorydev/grpcurl"
 	flags "github.com/jessevdk/go-flags"
 	"github.com/jhump/protoreflect/dynamic"
-	corderrors "github.com/opencord/cordctl/error"
+	corderrors "github.com/opencord/cordctl/internal/pkg/error"
 	"strings"
 )
 
diff --git a/commands/status_test.go b/internal/pkg/commands/status_test.go
similarity index 96%
rename from commands/status_test.go
rename to internal/pkg/commands/status_test.go
index 46c0040..a7662fb 100644
--- a/commands/status_test.go
+++ b/internal/pkg/commands/status_test.go
@@ -18,7 +18,7 @@
 
 import (
 	"bytes"
-	"github.com/opencord/cordctl/testutils"
+	"github.com/opencord/cordctl/pkg/testutils"
 	"testing"
 )
 
diff --git a/commands/transfer.go b/internal/pkg/commands/transfer.go
similarity index 98%
rename from commands/transfer.go
rename to internal/pkg/commands/transfer.go
index e746058..c8fa89d 100644
--- a/commands/transfer.go
+++ b/internal/pkg/commands/transfer.go
@@ -18,7 +18,7 @@
 
 import (
 	flags "github.com/jessevdk/go-flags"
-	corderrors "github.com/opencord/cordctl/error"
+	corderrors "github.com/opencord/cordctl/internal/pkg/error"
 	"strings"
 )
 
diff --git a/commands/transfer_handler.go b/internal/pkg/commands/transfer_handler.go
similarity index 100%
rename from commands/transfer_handler.go
rename to internal/pkg/commands/transfer_handler.go
diff --git a/commands/transfer_test.go b/internal/pkg/commands/transfer_test.go
similarity index 97%
rename from commands/transfer_test.go
rename to internal/pkg/commands/transfer_test.go
index 71b7d8e..b6a4dd2 100644
--- a/commands/transfer_test.go
+++ b/internal/pkg/commands/transfer_test.go
@@ -18,7 +18,7 @@
 
 import (
 	"bytes"
-	"github.com/opencord/cordctl/testutils"
+	"github.com/opencord/cordctl/pkg/testutils"
 	"io/ioutil"
 	"testing"
 )
diff --git a/commands/version.go b/internal/pkg/commands/version.go
similarity index 97%
rename from commands/version.go
rename to internal/pkg/commands/version.go
index d650c59..c207d55 100644
--- a/commands/version.go
+++ b/internal/pkg/commands/version.go
@@ -18,8 +18,8 @@
 
 import (
 	flags "github.com/jessevdk/go-flags"
-	"github.com/opencord/cordctl/cli/version"
-	"github.com/opencord/cordctl/format"
+	"github.com/opencord/cordctl/internal/pkg/cli/version"
+	"github.com/opencord/cordctl/pkg/format"
 )
 
 type VersionDetails struct {
diff --git a/commands/version_test.go b/internal/pkg/commands/version_test.go
similarity index 100%
rename from commands/version_test.go
rename to internal/pkg/commands/version_test.go
diff --git a/completion/bash.go b/internal/pkg/completion/bash.go
similarity index 100%
rename from completion/bash.go
rename to internal/pkg/completion/bash.go
diff --git a/error/error.go b/internal/pkg/error/error.go
similarity index 100%
rename from error/error.go
rename to internal/pkg/error/error.go
diff --git a/error/error_test.go b/internal/pkg/error/error_test.go
similarity index 100%
rename from error/error_test.go
rename to internal/pkg/error/error_test.go
diff --git a/format/formatter.go b/pkg/format/formatter.go
similarity index 100%
rename from format/formatter.go
rename to pkg/format/formatter.go
diff --git a/format/formatter_test.go b/pkg/format/formatter_test.go
similarity index 100%
rename from format/formatter_test.go
rename to pkg/format/formatter_test.go
diff --git a/order/order.go b/pkg/order/order.go
similarity index 100%
rename from order/order.go
rename to pkg/order/order.go
diff --git a/order/order_test.go b/pkg/order/order_test.go
similarity index 100%
rename from order/order_test.go
rename to pkg/order/order_test.go
diff --git a/testutils/testutils.go b/pkg/testutils/testutils.go
similarity index 100%
rename from testutils/testutils.go
rename to pkg/testutils/testutils.go