seba-261
Added dummy mode cmd line switch

Change-Id: Ide8e61bc65e8eb7218bc3b8a7d4cbcc279d7a25a
diff --git a/cmd/AbstractOLT/AbstractOLT.go b/cmd/AbstractOLT/AbstractOLT.go
index 8527ff6..2148cc9 100644
--- a/cmd/AbstractOLT/AbstractOLT.go
+++ b/cmd/AbstractOLT/AbstractOLT.go
@@ -179,8 +179,10 @@
 	logFile := flag.String("log_file", "AbstractOLT.log", "Name of the LogFile to write to")
 	h := flag.Bool("h", false, "Show usage")
 	help := flag.Bool("help", false, "Show usage")
+	dummy := flag.Bool("dummy", false, "Run in dummy mode where YAML is not sent to XOS")
 
 	flag.Parse()
+	settings.SetDummy(*dummy)
 
 	if *help || *h {
 		var usage = `./AbstractOLT -d [default false] : Runs in Debug mode
@@ -204,6 +206,10 @@
 	}
 	log.SetOutput(file)
 	log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds | log.Lshortfile)
+	if *dummy {
+		fmt.Println("RUNNING IN DUMMY MODE NO YAML WILL BE SENT TO XOS")
+		log.Println("RUNNING IN DUMMY MODE NO YAML WILL BE SENT TO XOS")
+	}
 	log.Printf("Setting Debug to %t\n", settings.GetDebug())
 	if settings.GetDebug() {
 		log.Println("Startup Params: debug:", *debugPtr, " Authentication:", *useAuthentication, " SSL:", *useSsl, "Cert Directory", *certDirectory,
diff --git a/internal/pkg/settings/Settings.go b/internal/pkg/settings/Settings.go
index f1f7f72..af61a28 100644
--- a/internal/pkg/settings/Settings.go
+++ b/internal/pkg/settings/Settings.go
@@ -17,6 +17,7 @@
 package settings
 
 var debug = false
+var dummy = false
 
 /*
 SetDebug - sets debug setting
@@ -31,3 +32,17 @@
 func GetDebug() bool {
 	return debug
 }
+
+/*
+SetDummy sets dummy mode
+*/
+func SetDummy(dummyMode bool) {
+	dummy = dummyMode
+}
+
+/*
+GetDummy - returns the current value of dummy
+*/
+func GetDummy() bool {
+	return dummy
+}
diff --git a/models/physical/chassis.go b/models/physical/chassis.go
index 4e0c4da..5fb9a94 100644
--- a/models/physical/chassis.go
+++ b/models/physical/chassis.go
@@ -18,10 +18,12 @@
 
 import (
 	"fmt"
+	"log"
 	"net"
 	"net/http"
 	"strings"
 
+	"gerrit.opencord.org/abstract-olt/internal/pkg/settings"
 	"gerrit.opencord.org/abstract-olt/models/tosca"
 )
 
@@ -57,7 +59,11 @@
 	webServerPort := olt.GetAddress().Port
 	oltStruct := tosca.NewOltProvision(chassis.CLLI, olt.GetHostname(), "openolt", ipString, webServerPort)
 	yaml, _ := oltStruct.ToYaml()
-	fmt.Printf("yaml:%s\n", yaml)
+	if settings.GetDummy() {
+		log.Printf("yaml:%s\n", yaml)
+		log.Println("YAML IS NOT BEING SET TO XOS")
+		return
+	}
 	client := &http.Client{}
 	requestList := fmt.Sprintf("http://%s:%d/run", chassis.VCoreAddress.IP.String(), chassis.VCoreAddress.Port)
 	req, err := http.NewRequest("POST", requestList, strings.NewReader(yaml))
@@ -81,7 +87,11 @@
 	ontStruct := tosca.NewOntProvision(ont.SerialNumber, slot.Address.IP, ponPort.Number)
 	yaml, _ := ontStruct.ToYaml()
 
-	fmt.Printf("yaml:%s\n", yaml)
+	if settings.GetDummy() {
+		log.Printf("yaml:%s\n", yaml)
+		log.Println("YAML IS NOT BEING SET TO XOS")
+		return
+	}
 	client := &http.Client{}
 	requestList := fmt.Sprintf("http://%s:%d/run", chassis.VCoreAddress.IP.String(), chassis.VCoreAddress.Port)
 	req, err := http.NewRequest("POST", requestList, strings.NewReader(yaml))