Skip to content
Snippets Groups Projects
Commit 5fcea82f authored by Malte Bauch's avatar Malte Bauch
Browse files

formatting and changed from goimports to gofmt

parent 9b8d9e74
No related branches found
No related tags found
2 merge requests!23Resolve "CI/CD",!18Develop
Pipeline #52088 failed
...@@ -9,7 +9,7 @@ linters-settings: ...@@ -9,7 +9,7 @@ linters-settings:
linters: linters:
disable-all: true disable-all: true
enable: enable:
- goimports - gofmt
- golint - golint
- gocyclo - gocyclo
- govet - govet
...@@ -105,7 +105,7 @@ func (d Database) StoreNodeEdgePoints(json string) { ...@@ -105,7 +105,7 @@ func (d Database) StoreNodeEdgePoints(json string) {
} }
func (d Database) StoreConnections(json string){} func (d Database) StoreConnections(json string) {}
//setNodeNodeEdgePointsRelation creates the database relations between "nodes" and "node edge points" //setNodeNodeEdgePointsRelation creates the database relations between "nodes" and "node edge points"
func setNodeNodeEdgePointsRelation(session neo4j.Session) { func setNodeNodeEdgePointsRelation(session neo4j.Session) {
......
...@@ -3,13 +3,13 @@ package main ...@@ -3,13 +3,13 @@ package main
import ( import (
pb "code.fbi.h-da.de/cocsn/gosdn/cliInterface" pb "code.fbi.h-da.de/cocsn/gosdn/cliInterface"
"context" "context"
"flag"
"fmt" "fmt"
"github.com/rivo/tview" "github.com/rivo/tview"
"google.golang.org/grpc" "google.golang.org/grpc"
"log" "log"
"os" "os"
"time" "time"
"flag"
) )
const ( const (
...@@ -29,27 +29,27 @@ var ( ...@@ -29,27 +29,27 @@ var (
type cliClientConfig struct { type cliClientConfig struct {
goSDNCLIAddr4 *string goSDNCLIAddr4 *string
goSDNCLIPort4 *int goSDNCLIPort4 *int
interactive *bool interactive *bool
goSDNCommand *string goSDNCommand *string
} }
type commandOptions struct { type commandOptions struct {
name string name string
description string description string
command func(conn *grpc.ClientConn) () command func(conn *grpc.ClientConn)
} }
var commandList = map[string] commandOptions { var commandList = map[string]commandOptions{
"hello": {"hello", "test connection to goSDN controller", goSDNSayHello}, "hello": {"hello", "test connection to goSDN controller", goSDNSayHello},
"shutdown": {"shutdown", "request goSDN controller to shutdown", goSDNShutdown}, "shutdown": {"shutdown", "request goSDN controller to shutdown", goSDNShutdown},
"testdb" : {"testdb", "test all database connections", goSDNTestDB}, "testdb": {"testdb", "test all database connections", goSDNTestDB},
} }
/* /*
gosdn-cli allows to mode of operations: gosdn-cli allows to mode of operations:
- interactive: text GUI to operate goSDN - interactive: text GUI to operate goSDN
- non-interactive: basic CLI without text GUI - non-interactive: basic CLI without text GUI
*/ */
func main() { func main() {
// This holds the basic configuration for gosdn-cli // This holds the basic configuration for gosdn-cli
...@@ -64,7 +64,7 @@ func main() { ...@@ -64,7 +64,7 @@ func main() {
flag.Parse() flag.Parse()
// Print complete command list and exit // Print complete command list and exit
if (*printCommandList == true) { if *printCommandList == true {
for _, element := range commandList { for _, element := range commandList {
fmt.Println(element.name + "\t" + element.description) fmt.Println(element.name + "\t" + element.description)
} }
...@@ -87,11 +87,11 @@ func main() { ...@@ -87,11 +87,11 @@ func main() {
log.Println(("Connected to " + conn.Target())) log.Println(("Connected to " + conn.Target()))
// Check for non-interactive or interactive mode // Check for non-interactive or interactive mode
if(*myConfiguration.interactive == false) { if *myConfiguration.interactive == false {
log.Println("starting in non-interactive mode") log.Println("starting in non-interactive mode")
// Lookup command or die // Lookup command or die
_, found := commandList[*myConfiguration.goSDNCommand] _, found := commandList[*myConfiguration.goSDNCommand]
if(found) { if found {
// Excecute desired command // Excecute desired command
commandList[*myConfiguration.goSDNCommand].command(conn) commandList[*myConfiguration.goSDNCommand].command(conn)
} else { } else {
...@@ -118,8 +118,7 @@ func main() { ...@@ -118,8 +118,7 @@ func main() {
} }
} }
func goSDNSayHello(conn *grpc.ClientConn) {
func goSDNSayHello (conn *grpc.ClientConn) {
c := pb.NewGreeterClient(conn) c := pb.NewGreeterClient(conn)
...@@ -136,10 +135,9 @@ func goSDNSayHello (conn *grpc.ClientConn) { ...@@ -136,10 +135,9 @@ func goSDNSayHello (conn *grpc.ClientConn) {
} }
log.Printf("Greeting: %s", r.GetMessage()) log.Printf("Greeting: %s", r.GetMessage())
} }
func goSDNShutdown (conn *grpc.ClientConn) { func goSDNShutdown(conn *grpc.ClientConn) {
c := pb.NewGreeterClient(conn) c := pb.NewGreeterClient(conn)
...@@ -157,6 +155,6 @@ func goSDNShutdown (conn *grpc.ClientConn) { ...@@ -157,6 +155,6 @@ func goSDNShutdown (conn *grpc.ClientConn) {
log.Printf("Greeting: %s", r.GetMessage()) log.Printf("Greeting: %s", r.GetMessage())
} }
func goSDNTestDB(conn *grpc.ClientConn){ func goSDNTestDB(conn *grpc.ClientConn) {
// TODO: fill with code // TODO: fill with code
} }
\ No newline at end of file
...@@ -9,7 +9,7 @@ type YANGConsumer struct { ...@@ -9,7 +9,7 @@ type YANGConsumer struct {
Data *[]byte Data *[]byte
} }
func (yc YANGConsumer)Consume(reader io.Reader, _ interface{}) error { func (yc YANGConsumer) Consume(reader io.Reader, _ interface{}) error {
var err error = nil var err error = nil
*yc.Data, err = ioutil.ReadAll(reader) *yc.Data, err = ioutil.ReadAll(reader)
return err return err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment