VOL-1674 - add version reporting information

Change-Id: Ie6cc244c66077467d371ffb3506ea0f4e817c197
diff --git a/rw_core/config/config.go b/rw_core/config/config.go
index a282b9b..34b5867 100644
--- a/rw_core/config/config.go
+++ b/rw_core/config/config.go
@@ -41,6 +41,7 @@
 	default_KVStoreDataPrefix         = "service/voltha"
 	default_LogLevel                  = 0
 	default_Banner                    = false
+	default_DisplayVersionOnly        = false
 	default_CoreTopic                 = "rwcore"
 	default_RWCoreEndpoint            = "rwcore"
 	default_RWCoreKey                 = "pki/voltha.key"
@@ -74,6 +75,7 @@
 	CoreTopic                 string
 	LogLevel                  int
 	Banner                    bool
+	DisplayVersionOnly        bool
 	RWCoreKey                 string
 	RWCoreCert                string
 	RWCoreCA                  string
@@ -109,6 +111,7 @@
 		CoreTopic:                 default_CoreTopic,
 		LogLevel:                  default_LogLevel,
 		Banner:                    default_Banner,
+		DisplayVersionOnly:        default_DisplayVersionOnly,
 		RWCoreKey:                 default_RWCoreKey,
 		RWCoreCert:                default_RWCoreCert,
 		RWCoreCA:                  default_RWCoreCA,
@@ -193,6 +196,9 @@
 	help = fmt.Sprintf("Show startup banner log lines")
 	flag.BoolVar(&cf.Banner, "banner", default_Banner, help)
 
+	help = fmt.Sprintf("Show version information and exit")
+	flag.BoolVar(&cf.DisplayVersionOnly, "version", default_DisplayVersionOnly, help)
+
 	help = fmt.Sprintf("The name of the meta-key whose value is the rw-core group to which the ofagent is bound")
 	flag.StringVar(&(cf.CoreBindingKey), "core_binding_key", default_CoreBindingKey, help)
 
diff --git a/rw_core/main.go b/rw_core/main.go
index 084e339..fc135f6 100644
--- a/rw_core/main.go
+++ b/rw_core/main.go
@@ -21,6 +21,7 @@
 	"fmt"
 	grpcserver "github.com/opencord/voltha-go/common/grpc"
 	"github.com/opencord/voltha-go/common/log"
+	"github.com/opencord/voltha-go/common/version"
 	"github.com/opencord/voltha-go/db/kvstore"
 	"github.com/opencord/voltha-go/kafka"
 	"github.com/opencord/voltha-go/rw_core/config"
@@ -210,6 +211,11 @@
 	fmt.Println("                                            ")
 }
 
+func printVersion() {
+	fmt.Println("VOLTHA Read-Write Core")
+	fmt.Println(version.VersionInfo.String("  "))
+}
+
 func main() {
 	start := time.Now()
 
@@ -238,6 +244,12 @@
 
 	defer log.CleanUp()
 
+	// Print verison / build information and exit
+	if cf.DisplayVersionOnly {
+		printVersion()
+		return
+	}
+
 	// Print banner if specified
 	if cf.Banner {
 		printBanner()