Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 111-cli-expansion-stateful-behaviour-more-command-feedback
  • 120-integration-tests-fail
  • 138-making-gnmi-response-processing-more-error-tolerable
  • 140-refactor-pipelines
  • 156-a-setrequest-to-change-a-specific-path-of-an-ond-only-works-for-paths-with-string-values
  • 186-creating-a-device-based-on-plugin-or-csbi-is-not-possible
  • 195-requesting-changes-does-not-work-in-storemode-database
  • 223-database-pnd-store-is-missing-option-to-search-by-name
  • 225-adding-support-and-visualization-for-the-test-coverage2
  • 233-structs-like-loadeddevice-loadedsbi-loadedrole-loadeduser-are-never-passed-as-pointer
  • 242-improve-security-by-enabling-and-enforcing-more-linting-rules
  • 242-improve-security-by-enabling-and-enforcing-more-linting-rules-govet
  • 246-implement-our-own-version-to-send-gnmi-requests
  • 258-deal-with-read-only-fields-in-yang
  • 282-refactoring-of-the-current-test-setup
  • 289-quantum-safe-communication-between-rabbitmq-and-sdn-controller
  • 291-lab-vm-for-arm64-apple
  • 296-related-existing-work-about-change-logic-for-yang-models
  • 320-deadline-and-cancellation-for-grpc-calls
  • 336-add-error-handling-for-mne-watching-if-the-provided-paths-do-not-exist
  • 349-integration-test-for-lab01
  • 350-applying-a-sdn-configuration-should-also-update-the-internal-configuration-of-managed-network
  • 351-link-shadowing-of-global-variables
  • 383-re-organize-comands-in-cli
  • 392-remove-renovate
  • PSD_VGU_Logging
  • add-backup-script
  • add-dockerignore
  • add-script-with-docker-stats
  • add-sr-linux-yang-models
  • add-support-for-mtls-in-plugins
  • allow-slashes-in-branch-names
  • arm-build
  • bump-ygot-generator-to-0-0-5
  • check-unit-tests
  • ci-refactor-1337
  • cli-docs
  • create-health-check-api
  • custom-marshal-for-grpc-gateway
  • deployment-docker-compose
  • develop
  • docker-build-cache-experiments
  • fbi1478-master-patch-42436
  • fix-docker-registry-error
  • fix-linting-in-makefile
  • fix-viper
  • go-plugin-playground
  • gosdn-storage-cleanup
  • heiss_bachelor_thesis
  • hotfix-unique-list-error-from-a-device-get-request
  • integration-test-pipeline-fix
  • inventory-manager-netbox
  • istaester/add-git-hooks
  • istaester/architecture-figures
  • istaester/basic-persistance-layer
  • istaester/bump-ygot-version
  • istaester/cli-tests
  • istaester/db
  • istaester/handle-makefile-in-editorconfig
  • istaester/init-monorepo
  • istaester/plugin-registry
  • istaester/provide-pnd-service
  • istaester/tooling
  • istaester/update-readme
  • master
  • mb/plugin-registry
  • mk/benchmark-stores
  • mpsd-at-vgu
  • neil/cobra-tests
  • new-integration-test-setup-v1
  • profile
  • proto-getters
  • recursive-read-only-try-1337
  • registry-used-by-app
  • remove-stuff
  • renovate/babel-runtime-7.x-lockfile
  • renovate/buf.build-gen-go-bufbuild-protovalidate-protocolbuffers-go-1.x
  • renovate/dompurify-3.x-lockfile
  • renovate/eslint-9.x-lockfile
  • renovate/eslint-plugin-prettier-5.x-lockfile
  • renovate/eslint-plugin-react-7.x-lockfile
  • renovate/eslint-plugin-react-hooks-5.x-lockfile
  • renovate/eslint-plugin-react-refresh-0.x-lockfile
  • renovate/fortawesome-fontawesome-svg-core-6.x-lockfile
  • renovate/fortawesome-free-regular-svg-icons-6.x-lockfile
  • renovate/fortawesome-free-solid-svg-icons-6.x-lockfile
  • renovate/github.com-aristanetworks-goarista-digest
  • renovate/github.com-bufbuild-protovalidate-go-0.x
  • renovate/github.com-docker-docker-27.x
  • renovate/github.com-docker-docker-28.x
  • renovate/github.com-grpc-ecosystem-grpc-gateway-v2-2.x
  • renovate/github.com-hashicorp-go-plugin-1.x
  • renovate/github.com-lesismal-nbio-1.x
  • renovate/github.com-openconfig-gnmi-0.x
  • renovate/github.com-prometheus-client_golang-1.x
  • renovate/go.mongodb.org-mongo-driver-2.x
  • renovate/golangci-golangci-lint-1.x
  • renovate/google.golang.org-genproto-googleapis-api-digest
  • renovate/react-18.x-lockfile
  • renovate/react-bootstrap-2.x-lockfile
  • 0.1.0
101 results

Target

Select target project
  • danet/gosdn
1 result
Select Git revision
  • 111-cli-expansion-stateful-behaviour-more-command-feedback
  • 120-integration-tests-fail
  • 138-making-gnmi-response-processing-more-error-tolerable
  • 140-refactor-pipelines
  • 156-a-setrequest-to-change-a-specific-path-of-an-ond-only-works-for-paths-with-string-values
  • 186-creating-a-device-based-on-plugin-or-csbi-is-not-possible
  • 195-requesting-changes-does-not-work-in-storemode-database
  • 223-database-pnd-store-is-missing-option-to-search-by-name
  • 225-adding-support-and-visualization-for-the-test-coverage2
  • 233-structs-like-loadeddevice-loadedsbi-loadedrole-loadeduser-are-never-passed-as-pointer
  • 242-improve-security-by-enabling-and-enforcing-more-linting-rules
  • 242-improve-security-by-enabling-and-enforcing-more-linting-rules-govet
  • 246-implement-our-own-version-to-send-gnmi-requests
  • 258-deal-with-read-only-fields-in-yang
  • 282-refactoring-of-the-current-test-setup
  • 289-quantum-safe-communication-between-rabbitmq-and-sdn-controller
  • 291-lab-vm-for-arm64-apple
  • 296-related-existing-work-about-change-logic-for-yang-models
  • 320-deadline-and-cancellation-for-grpc-calls
  • 336-add-error-handling-for-mne-watching-if-the-provided-paths-do-not-exist
  • 349-integration-test-for-lab01
  • 350-applying-a-sdn-configuration-should-also-update-the-internal-configuration-of-managed-network
  • 351-link-shadowing-of-global-variables
  • 383-re-organize-comands-in-cli
  • 392-remove-renovate
  • PSD_VGU_Logging
  • add-backup-script
  • add-dockerignore
  • add-script-with-docker-stats
  • add-sr-linux-yang-models
  • add-support-for-mtls-in-plugins
  • allow-slashes-in-branch-names
  • arm-build
  • bump-ygot-generator-to-0-0-5
  • check-unit-tests
  • ci-refactor-1337
  • cli-docs
  • create-health-check-api
  • custom-marshal-for-grpc-gateway
  • deployment-docker-compose
  • develop
  • docker-build-cache-experiments
  • fbi1478-master-patch-42436
  • fix-docker-registry-error
  • fix-linting-in-makefile
  • fix-viper
  • go-plugin-playground
  • gosdn-storage-cleanup
  • heiss_bachelor_thesis
  • hotfix-unique-list-error-from-a-device-get-request
  • integration-test-pipeline-fix
  • inventory-manager-netbox
  • istaester/add-git-hooks
  • istaester/architecture-figures
  • istaester/basic-persistance-layer
  • istaester/bump-ygot-version
  • istaester/cli-tests
  • istaester/db
  • istaester/handle-makefile-in-editorconfig
  • istaester/init-monorepo
  • istaester/plugin-registry
  • istaester/provide-pnd-service
  • istaester/tooling
  • istaester/update-readme
  • master
  • mb/plugin-registry
  • mk/benchmark-stores
  • mpsd-at-vgu
  • neil/cobra-tests
  • new-integration-test-setup-v1
  • profile
  • proto-getters
  • recursive-read-only-try-1337
  • registry-used-by-app
  • remove-stuff
  • renovate/babel-runtime-7.x-lockfile
  • renovate/buf.build-gen-go-bufbuild-protovalidate-protocolbuffers-go-1.x
  • renovate/dompurify-3.x-lockfile
  • renovate/eslint-9.x-lockfile
  • renovate/eslint-plugin-prettier-5.x-lockfile
  • renovate/eslint-plugin-react-7.x-lockfile
  • renovate/eslint-plugin-react-hooks-5.x-lockfile
  • renovate/eslint-plugin-react-refresh-0.x-lockfile
  • renovate/fortawesome-fontawesome-svg-core-6.x-lockfile
  • renovate/fortawesome-free-regular-svg-icons-6.x-lockfile
  • renovate/fortawesome-free-solid-svg-icons-6.x-lockfile
  • renovate/github.com-aristanetworks-goarista-digest
  • renovate/github.com-bufbuild-protovalidate-go-0.x
  • renovate/github.com-docker-docker-27.x
  • renovate/github.com-docker-docker-28.x
  • renovate/github.com-grpc-ecosystem-grpc-gateway-v2-2.x
  • renovate/github.com-hashicorp-go-plugin-1.x
  • renovate/github.com-lesismal-nbio-1.x
  • renovate/github.com-openconfig-gnmi-0.x
  • renovate/github.com-prometheus-client_golang-1.x
  • renovate/go.mongodb.org-mongo-driver-2.x
  • renovate/golangci-golangci-lint-1.x
  • renovate/google.golang.org-genproto-googleapis-api-digest
  • renovate/react-18.x-lockfile
  • renovate/react-bootstrap-2.x-lockfile
  • 0.1.0
101 results
Show changes
Commits on Source (6)
......@@ -18,23 +18,20 @@ documentation:pdf:
- documentation/design/documentation.pdf
.mdbook_common: &rust
before_script:
- cargo install mdbook
image:
name: rust:latest
image:
name: $CI_REGISTRY/danet/internetworking/mdbook:latest
entrypoint:
- ''
stage: deploy
script:
- mdbook build documentation --dest-dir public
cache:
paths:
- /root/.cargo/
documentation:static:
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
artifacts:
paths:
- documentation/public
- public
expire_in: 1 week
<<: *rust
......
......@@ -2,10 +2,10 @@ package main
import (
pb "code.fbi.h-da.de/cocsn/gosdn/api/proto"
"code.fbi.h-da.de/cocsn/gosdn/log"
"context"
"flag"
"fmt"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
"os"
"time"
......
......@@ -8,7 +8,7 @@ import (
"code.fbi.h-da.de/cocsn/gosdn/cmd/gosdn-tview/app"
grpc "code.fbi.h-da.de/cocsn/gosdn/cmd/gosdn-tview/grpc"
"code.fbi.h-da.de/cocsn/gosdn/cmd/gosdn-tview/views"
"code.fbi.h-da.de/cocsn/gosdn/log"
log "github.com/sirupsen/logrus"
)
func main() {
......
package main
import (
"code.fbi.h-da.de/cocsn/gosdn/log"
"code.fbi.h-da.de/cocsn/gosdn/nucleus"
"flag"
log "github.com/sirupsen/logrus"
)
func main() {
......@@ -16,7 +16,7 @@ func main() {
flag.Parse()
cliSocket := *cliListenAddr + ":" + *cliListenPort
log.Loglevel(log.DEBUG)
log.SetLevel(log.DebugLevel)
// Setup a channel to communicate if goSDN should shutdown.
IsRunningChannel := make(chan bool)
......
package database
import (
"code.fbi.h-da.de/cocsn/gosdn/log"
"errors"
"github.com/neo4j/neo4j-go-driver/neo4j"
log "github.com/sirupsen/logrus"
)
//Database is a database
......
......@@ -13,6 +13,7 @@ require (
github.com/neo4j/neo4j-go-driver v1.8.3
github.com/onsi/ginkgo v1.13.0 // indirect
github.com/rivo/tview v0.0.0-20201018122409-d551c850a743
github.com/sirupsen/logrus v1.4.2
golang.org/x/net v0.0.0-20200904194848-62affa334b73 // indirect
google.golang.org/genproto v0.0.0-20200519141106-08726f379972 // indirect
google.golang.org/grpc v1.29.1
......
package log
import (
"fmt"
"io"
"log/syslog"
"os"
"reflect"
"runtime"
"strconv"
"strings"
"sync"
"time"
)
var logger *Logger
var once sync.Once
// Logger is a wrapper for log.Logger and provides
// methods to enable and disable logging.
type Logger struct {
DefaultWriter io.Writer
LoglevelWriter map[Level]io.Writer
toSyslog map[Level]bool
Loglevel Level
lock sync.Mutex
builder strings.Builder
}
func (l *Logger) buildMessage(level Level, syslog bool, args ...interface{}) {
if !syslog {
l.builder.WriteString(time.Now().Format(time.RFC3339))
}
l.builder.WriteRune('\t')
l.builder.WriteString(prefix(level))
l.builder.WriteRune('\t')
function, line := callers()
functionSplitted := strings.SplitAfter(function, "/")
function = functionSplitted[len(functionSplitted)-1]
l.builder.WriteString(function)
l.builder.WriteRune(':')
l.builder.WriteString(strconv.Itoa(line))
l.builder.WriteRune('\t')
l.builder.WriteString(fmt.Sprint(args...))
l.builder.WriteRune('\n')
}
func get() *Logger {
once.Do(func() {
logger = &Logger{
DefaultWriter: os.Stderr,
LoglevelWriter: make(map[Level]io.Writer),
toSyslog: make(map[Level]bool),
Loglevel: INFO,
lock: sync.Mutex{},
}
})
return logger
}
// Loglevel sets the verbosity of the logger
// Defaults to INFO
func Loglevel(level Level) {
l := get()
l.lock.Lock()
defer l.lock.Unlock()
l.Loglevel = level
}
// Output defines the output of the logger
// Defaults to os.Stderr
func Output(out io.Writer) {
l := get()
l.lock.Lock()
defer l.lock.Unlock()
l.DefaultWriter = out
}
// LoglevelOutput defines a special output
// for a certain log level
func LoglevelOutput(level Level, out io.Writer) {
l := get()
l.lock.Lock()
defer l.lock.Unlock()
l.LoglevelWriter[level] = out
if reflect.TypeOf(out) == reflect.TypeOf(&syslog.Writer{}) {
l.toSyslog[level] = true
}
}
// Debug passes the DEBUG flag and a
// message to the logger
func Debug(args ...interface{}) {
log(DEBUG, args...)
}
// Info passes the INFO flag and a
// message to the logger
func Info(args ...interface{}) {
log(INFO, args...)
}
// Warn passes the WARNING flag and a
// message to the logger
func Warn(args ...interface{}) {
log(WARNING, args...)
}
// Error passes the ERROR flag and a
// message to the logger
func Error(args ...interface{}) {
log(ERROR, args...)
}
// Fatal passes the FATAL flag and a
// message to the logger and calls
// os.Exit(1)
func Fatal(args ...interface{}) {
log(FATAL, args...)
os.Exit(1)
}
// Debugf passes the DEBUG flag,
// a formatted string and a
// message to the logger
func Debugf(format string, args ...interface{}) {
logf(DEBUG, format, args...)
}
// Infof passes the INFO flag,
// a formatted string and and a
// message to the logger
func Infof(format string, args ...interface{}) {
logf(INFO, format, args...)
}
// Warnf passes the WARNING flag,
// a formatted string and and a
// message to the logger
func Warnf(format string, args ...interface{}) {
logf(WARNING, format, args...)
}
// Errorf passes the ERROR flag,
// a formatted string and and a
// message to the logger
func Errorf(format string, args ...interface{}) {
logf(ERROR, format, args...)
}
// Fatalf passes the FATAL flag,
// a formatted string and and a
// message to the logger and calls
// os.Exit(1)
func Fatalf(format string, args ...interface{}) {
logf(FATAL, format, args...)
os.Exit(1)
}
func logf(level Level, format string, args ...interface{}) {
log(level, fmt.Sprintf(format, args...))
}
func log(level Level, args ...interface{}) {
defer func() {
if r := recover(); r != nil {
fmt.Println("Recovered in f", r)
}
}()
l := get()
l.lock.Lock()
defer l.lock.Unlock()
defer l.builder.Reset()
if level <= l.Loglevel {
l.buildMessage(level, l.toSyslog[level], args...)
msg := []byte(l.builder.String())
writer, ok := l.LoglevelWriter[level]
var err error
if !ok {
_, err = l.DefaultWriter.Write(msg)
} else {
_, err = writer.Write(msg)
}
if err != nil {
panic(err)
}
}
}
func callers() (string, int) {
pc := make([]uintptr, 15)
n := runtime.Callers(5, pc)
frames := runtime.CallersFrames(pc[:n])
frame, _ := frames.Next()
return frame.Function, frame.Line
}
func prefix(level Level) string {
switch level {
case FATAL:
return "FATAL"
case ERROR:
return "ERROR"
case WARNING:
return "WARNING"
case INFO:
return "INFO"
case DEBUG:
return "DEBUG"
}
return ""
}
package log
// Level is an 8 bit integer representing a
// log level for the logger
type Level uint8
// Constants for more verbose integer
// values
const (
FATAL Level = iota
ERROR
WARNING
INFO
DEBUG
)
......@@ -14,8 +14,8 @@ import (
"sync"
pb "code.fbi.h-da.de/cocsn/gosdn/api/proto"
"code.fbi.h-da.de/cocsn/gosdn/log"
"code.fbi.h-da.de/cocsn/gosdn/sbi/restconf/client/ciena"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
......@@ -120,7 +120,7 @@ func getCLIGoing(core *Core) {
//TODO: move?
wrt := io.MultiWriter(os.Stdout, &logBuffer)
log.Output(wrt)
log.SetOutput(wrt)
healthpb.RegisterHealthServer(cliControlServer, healthCheck)
pb.RegisterGrpcCliServer(cliControlServer, srv)
......
......@@ -2,10 +2,10 @@ package nucleus
import (
"code.fbi.h-da.de/cocsn/gosdn/database"
"code.fbi.h-da.de/cocsn/gosdn/log"
"code.fbi.h-da.de/cocsn/gosdn/nucleus/interfaces"
"code.fbi.h-da.de/cocsn/gosdn/sbi/restconf/client/ciena"
"github.com/BurntSushi/toml"
log "github.com/sirupsen/logrus"
"os"
)
......
......@@ -2,8 +2,8 @@ package nucleus
import (
"code.fbi.h-da.de/cocsn/gosdn/database"
"code.fbi.h-da.de/cocsn/gosdn/log"
"code.fbi.h-da.de/cocsn/gosdn/nucleus/interfaces"
log "github.com/sirupsen/logrus"
"time"
)
......
......@@ -3,7 +3,6 @@ package ciena
import (
"bytes"
"code.fbi.h-da.de/cocsn/gosdn/database"
"code.fbi.h-da.de/cocsn/gosdn/log"
"code.fbi.h-da.de/cocsn/gosdn/nucleus/interfaces"
"code.fbi.h-da.de/cocsn/gosdn/sbi/restconf/util"
apiclient "code.fbi.h-da.de/cocsn/swagger/apis/mcp/client"
......@@ -11,6 +10,7 @@ import (
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
log "github.com/sirupsen/logrus"
"net/http"
)
......