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 (3)
Showing
with 228 additions and 76 deletions
......@@ -4,6 +4,7 @@ build
documentation
mocks
test
clab-gosdn_csbi_arista_base
.cobra.yaml
.dockeringore
.gitlab-ci.yaml
......
......@@ -4,7 +4,18 @@ artifacts/
# containerlab
.gosdn.clab.yml
clab-gosdn_csbi_arista_base/
# non vimmers
.vscode/
# test artifacts
coverage.out
report.xml
# artifacts
controller/gosdn
cli/gosdnc
# testing
controller/configs/testing-gosdn.toml
......@@ -46,11 +46,12 @@ var deviceListCmd = &cobra.Command{
Long: "List all orchestrated network devices within the current PND.",
RunE: func(cmd *cobra.Command, args []string) error {
resp, err := pndAdapter.GetDevices()
respONDs, err := pndAdapter.GetDevices()
if err != nil {
return err
}
for i, dev := range resp {
for i, dev := range respONDs {
log.Infof("OND %v: name: %v, uuid: %v", i+1, dev.Name, dev.Id)
sid, err := uuid.Parse(dev.GetSbi().GetId())
if err != nil {
......
......@@ -58,6 +58,7 @@ The --controller flag is required to change the controller address`,
if err != nil {
return err
}
sid := resp.Sbi[0].GetId()
viper.Set("CLI_SBI", sid)
log.Infof("SBI: %v", sid)
......
......@@ -29,16 +29,16 @@ clean:
rm -f $(BINARY_NAME)
start: clean build
./$(BINARY_NAME) -l debug
ENVIRONMENT=development ./$(BINARY_NAME) -l debug
start-insecure: clean build
./$(BINARY_NAME) -l debug -s insecure
ENVIRONMENT=development ./$(BINARY_NAME) -l debug -s insecure
unit-test: install-tools
./$(TOOLS_DIR)/gotestsum --junitfile report.xml --format testname -- -short -race $$( go list ./... | grep -v /forks/ | grep -v /mocks ) -v -coverprofile=coverage.out
ENVIRONMENT=testing ./$(TOOLS_DIR)/gotestsum --junitfile report.xml --format testname -- -short -race $$( go list ./... | grep -v /forks/ | grep -v /mocks ) -v -coverprofile=coverage.out
controller-test: install-tools
./$(TOOLS_DIR)/gotestsum --junitfile report.xml --format testname -- -race -v -run TestRun
ENVIRONMENT=testing ./$(TOOLS_DIR)/gotestsum --junitfile report.xml --format testname -- -race -v -run TestRun
lint: install-tools
./$(TOOLS_DIR)/golangci-lint run --config .gitlab/ci/.golangci-config/.golangci.yml
......@@ -50,12 +50,13 @@ ci-lint:
golangci-lint run --config ../.gitlab/ci/.golangci-config/.golangci.yml --out-format code-climate | jq -r '.[] | "\(.location.path):\(.location.lines.begin) \(.description)"'
ci-unit-test: ci-install-tools
gotestsum --junitfile report.xml --format testname -- -short -race $$( go list ./... | grep -v /forks/ | grep -v /mocks ) -v -coverprofile=coverage.out
ENVIRONMENT=testing gotestsum --junitfile report.xml --format testname -- -short -race $$( go list ./... | grep -v /forks/ | grep -v /mocks ) -v -coverprofile=coverage.out
ci-controller-test: ci-install-tools
gotestsum --junitfile report.xml --format testname -- -race -v -run TestRun
ENVIRONMENT=testing gotestsum --junitfile report.xml --format testname -- -race -v -run TestRun
integration-test-nucleus:
ENVIRONMENT=testing &&\
cd ./test/integration &&\
go test -race -v -run TestGnmi_SetIntegration &&\
go test -race -v -run TestGnmi_GetIntegration &&\
......@@ -63,5 +64,6 @@ integration-test-nucleus:
go test -race -v -run TestGnmi_CapabilitiesIntegration
integration-test-api:
ENVIRONMENT=testing &&\
cd ./api &&\
go test -race -v -run TestApiIntegration
......@@ -12,11 +12,13 @@ import (
ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd"
tpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/transport"
"code.fbi.h-da.de/danet/gosdn/controller/config"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/device"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkdomain"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/southbound"
"code.fbi.h-da.de/danet/gosdn/controller/mocks"
nbi "code.fbi.h-da.de/danet/gosdn/controller/northbound/server"
"code.fbi.h-da.de/danet/gosdn/controller/nucleus"
"code.fbi.h-da.de/danet/gosdn/controller/nucleus/util/proto"
"code.fbi.h-da.de/danet/gosdn/controller/store"
"code.fbi.h-da.de/danet/yang-models/generated/openconfig"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
......@@ -40,8 +42,8 @@ const changeID = "0992d600-f7d4-4906-9559-409b04d59a5f"
const sbiID = "f6fd4b35-f039-4111-9156-5e4501bb8a5a"
const ondID = "7e0ed8cc-ebf5-46fa-9794-741494914883"
var pndStore *store.PndStore
var sbiStore *store.SbiStore
var pndStore networkdomain.PndStore
var sbiStore southbound.SbiStore
var lis *bufconn.Listener
var pndUUID uuid.UUID
var sbiUUID uuid.UUID
......@@ -74,8 +76,8 @@ func bootstrapUnitTest() {
log.Fatal(err)
}
pndStore = store.NewPndStore()
sbiStore = store.NewSbiStore(pndUUID)
pndStore = nucleus.NewPndStore()
sbiStore = nucleus.NewSbiStore(pndUUID)
mockChange := &mocks.Change{}
mockChange.On("Age").Return(time.Hour)
......@@ -95,8 +97,13 @@ func bootstrapUnitTest() {
}, nil)
mockPnd.On("Commit", mock.Anything).Return(nil)
mockPnd.On("Confirm", mock.Anything).Return(nil)
mockPnd.On("Devices").Return([]uuid.UUID{deviceUUID})
mockPnd.On("GetSBIs").Return(sbiStore)
mockPnd.On("Devices").Return([]device.Device{
&nucleus.CommonDevice{
UUID: deviceUUID,
GoStruct: &openconfig.Device{},
},
})
mockPnd.On("GetSBIs").Return([]mocks.SouthboundInterface{})
mockPnd.On("ChangeOND", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(uuid.Nil, nil)
if err := pndStore.Add(&mockPnd); err != nil {
......
......@@ -33,10 +33,12 @@ package cmd
import (
"context"
"fmt"
"os"
"path/filepath"
"code.fbi.h-da.de/danet/gosdn/controller"
"code.fbi.h-da.de/danet/gosdn/controller/config"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
......@@ -96,10 +98,14 @@ func initConfig() {
// Use config file from the flag.
viper.SetConfigFile(cfgFile)
} else {
env := config.DetermineConfigEnvironment()
log.Infof("environment is %s\n", env)
viper.AddConfigPath(configHome)
viper.AddConfigPath("/usr/local/etc/gosdn/")
viper.SetConfigType(configType)
viper.SetConfigName(configName)
viper.SetConfigName(fmt.Sprintf("%s-%s", env, configName))
}
viper.AutomaticEnv() // read in environment variables that match
......
......@@ -16,6 +16,7 @@ const (
baseSouthBoundTypeKey = "baseSouthBoundType"
baseSouthBoundUUIDKey = "baseSouthBoundUUID"
changeTimeoutKey = "GOSDN_CHANGE_TIMEOUT"
databaseConnectionKey = "databaseConnection"
)
// BasePndUUID is an uuid for the base PND
......@@ -33,6 +34,9 @@ var ChangeTimeout time.Duration
// LogLevel ist the default log level
var LogLevel logrus.Level
// DatabaseConnection holds the credentials and address of the used database
var DatabaseConnection string
// Init gets called on module import
func Init() {
err := InitializeConfig()
......@@ -75,9 +79,17 @@ func InitializeConfig() error {
setLogLevel()
DatabaseConnection = getStringFromViper(databaseConnectionKey)
return nil
}
// UseDatabase enables other modules to decide if they should use
// a database as backend.
func UseDatabase() bool {
return len(DatabaseConnection) != 0
}
func getUUIDFromViper(viperKey string) (uuid.UUID, error) {
UUIDAsString := viper.GetString(viperKey)
if UUIDAsString == "" {
......@@ -98,6 +110,12 @@ func getUUIDFromViper(viperKey string) (uuid.UUID, error) {
return parsedUUID, nil
}
func getStringFromViper(viperKey string) string {
stringFromViper := viper.GetString(viperKey)
return stringFromViper
}
func setChangeTimeout() error {
e := os.Getenv(changeTimeoutKey)
if e != "" {
......
......@@ -15,11 +15,11 @@ func TestInit(t *testing.T) {
viper.Set("baseSouthBoundUUID", "bf8160d4-4659-4a1b-98fd-f409a04111eb")
viper.Set("basePNDUUID", "bf8160d4-4659-4a1b-98fd-f409a04111ec")
viper.Set("GOSDN_CHANGE_TIMEOUT", "10m")
viper.Set("databaseConnection", "test@test:test")
}
func TestUseExistingConfig(t *testing.T) {
TestInit(t)
err := InitializeConfig()
if err != nil {
t.Error(err)
......@@ -59,4 +59,29 @@ func TestUseExistingConfig(t *testing.T) {
logrus.InfoLevel, LogLevel)
}
}
if DatabaseConnection != "test@test:test" {
t.Fatalf("DatabaseConnection is not test@test:test. got=%s",
DatabaseConnection)
}
if UseDatabase() != true {
t.Fatalf("DatabaseConnection is not set, but should not be used. got=%t",
UseDatabase())
}
}
func TestUseDatabase(t *testing.T) {
viper.Set("databaseConnection", "")
err := InitializeConfig()
if err != nil {
t.Error(err)
return
}
if UseDatabase() != false {
t.Fatalf("DatabaseConnection is not set and should not be used. got=%t",
UseDatabase())
}
}
basepnduuid = "bf8160d4-4659-4a1b-98fd-f409a04111ec"
basesouthboundtype = 1
basesouthbounduuid = "bf8160d4-4659-4a1b-98fd-f409a04111eb"
databaseconnection = "test@test:test"
gosdn_change_timeout = "10m"
package config
import (
"os"
"strings"
)
// Environment is used to determine the environment the controller is running in.
type Environment int64
const (
// Development is used for local development
Development Environment = iota
// Production is used for production deployments
Production
// Testing is used for tests
Testing
)
func (e Environment) String() string {
switch e {
case Development:
return "development"
case Production:
return "production"
case Testing:
return "testing"
}
return "development"
}
// DetermineConfigEnvironment returns the environment mode the controller should use.
func DetermineConfigEnvironment() Environment {
env := os.Getenv("ENVIRONMENT")
switch strings.ToLower(env) {
case "development":
return Development
case "production":
return Production
case "testing":
return Testing
default:
return Development
}
}
basepnduuid = "d4dd9fcb-7fe3-4657-aa33-f9071b2ae257"
basesouthboundtype = 1
basesouthbounduuid = "a325693a-aa16-45fc-965d-08c986c476c1"
basepnduuid = "5f20f34b-cbd0-4511-9ddc-c50cf6a3b49d"
basesouthboundtype = 1
basesouthbounduuid = "ca29311a-3b17-4385-96f8-515b602a97ac"
cli_pnd = "0455b241-5863-4660-ad15-dfde7617738e"
cli_sbi = "a249f2d2-f7da-481d-8a99-b7f11471e0af"
config = ""
csbi-orchestrator = "localhost:55056"
grpc-port = ""
help = false
log-level = "debug"
pnduuid = "bf8160d4-4659-4a1b-98fd-f409a04111ec"
socket = ":55055"
databaseConnection = "mongodb://root:example@localhost:27017"
......@@ -22,6 +22,8 @@ import (
apb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/rbac"
spb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/southbound"
"code.fbi.h-da.de/danet/gosdn/controller/config"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/device"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkdomain"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/southbound"
"code.fbi.h-da.de/danet/gosdn/controller/northbound/server"
nbi "code.fbi.h-da.de/danet/gosdn/controller/northbound/server"
......@@ -36,7 +38,7 @@ var coreOnce sync.Once
// Core is the representation of the controller's core
type Core struct {
pndc *store.PndStore
pndc networkdomain.PndStore
httpServer *http.Server
grpcServer *grpc.Server
nbi *nbi.NorthboundInterface
......@@ -47,18 +49,21 @@ type Core struct {
var c *Core
func init() {
// initialize does start-up housekeeping like reading controller config files
func initialize() error {
err := config.InitializeConfig()
if err != nil {
return err
}
c = &Core{
pndc: store.NewPndStore(),
pndc: nucleus.NewPndStore(),
stopChan: make(chan os.Signal, 1),
}
// Setting up signal capturing
signal.Notify(c.stopChan, os.Interrupt, syscall.SIGTERM)
}
// initialize does start-up housekeeping like reading controller config files
func initialize() error {
if err := startGrpc(); err != nil {
return err
}
......@@ -67,22 +72,12 @@ func initialize() error {
startHttpServer()
coreLock.Unlock()
err := config.InitializeConfig()
if err != nil {
return err
}
err = restorePrincipalNetworkDomains()
err = config.InitializeConfig()
if err != nil {
return err
}
sbi, err := createSouthboundInterfaces()
if err != nil {
return err
}
err = createPrincipalNetworkDomain(sbi)
err = createPrincipalNetworkDomain()
if err != nil {
return err
}
......@@ -135,52 +130,28 @@ func createSouthboundInterfaces() (southbound.SouthboundInterface, error) {
}
// createPrincipalNetworkDomain initializes the controller with an initial PND
func createPrincipalNetworkDomain(s southbound.SouthboundInterface) error {
if !c.pndc.Exists(config.BasePndUUID) {
pnd, err := nucleus.NewPND("base", "gosdn base pnd", config.BasePndUUID, s, c.csbiClient, callback)
if err != nil {
return err
}
err = c.pndc.Add(pnd)
if err != nil {
return err
}
return nil
}
return nil
}
// restorePrincipalNetworkDomains restores previously stored PNDs
func restorePrincipalNetworkDomains() error {
pndsFromStore, err := c.pndc.Load()
if err != nil {
return err
}
sbi, err := createSouthboundInterfaces()
func createPrincipalNetworkDomain() error {
basePnd, err := c.pndc.Get(store.Query{ID: config.BasePndUUID})
if err != nil {
return err
log.Info(err)
}
for _, pndFromStore := range pndsFromStore {
log.Debugf("Restoring PND: %s\n", pndFromStore.Name)
newPnd, err := nucleus.NewPND(
pndFromStore.Name,
pndFromStore.Description,
pndFromStore.ID,
sbi,
if basePnd == nil {
pnd, err := nucleus.NewPND(
"base",
"gosdn base pnd",
config.BasePndUUID,
c.csbiClient,
callback,
)
if err != nil {
return err
}
err = c.pndc.Add(newPnd)
err = c.pndc.Add(pnd)
if err != nil {
return err
}
return nil
}
return nil
......@@ -215,7 +186,7 @@ func shutdown() error {
return stopHttpServer()
}
func callback(id uuid.UUID, ch chan store.DeviceDetails) {
func callback(id uuid.UUID, ch chan device.Details) {
if ch != nil {
c.pndc.AddPendingChannel(id, ch)
log.Infof("pending channel %v added", id)
......
......@@ -12,7 +12,7 @@ import (
const (
configHome string = "./configs"
configName string = "gosdn"
configName string = "ci-testing-gosdn"
configType string = "toml"
)
......
......@@ -6,6 +6,8 @@ import (
"github.com/google/uuid"
"github.com/openconfig/ygot/ygot"
"google.golang.org/protobuf/proto"
tpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/transport"
)
// Device represents an Orchestrated Network Device (OND) which is managed by
......@@ -18,3 +20,10 @@ type Device interface {
SBI() southbound.SouthboundInterface
ProcessResponse(proto.Message) error
}
// Details contains details of a device used by the cSBI mechanism
type Details struct {
ID string
Address string
TransportOption *tpb.TransportOption
}
package device
import (
"code.fbi.h-da.de/danet/gosdn/controller/store"
)
// Store describes an interface for device store implementations.
type Store interface {
Add(d Device) error
Update(d Device) error
Delete(Device) error
Get(store.Query) (Device, error)
GetAll() ([]Device, error)
}
......@@ -6,7 +6,6 @@ import (
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/change"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/device"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/southbound"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/store"
"github.com/google/uuid"
"google.golang.org/protobuf/proto"
)
......@@ -18,18 +17,17 @@ type NetworkDomain interface {
AddSbi(s southbound.SouthboundInterface) error
RemoveSbi(uuid.UUID) error
AddDevice(name string, opts *tpb.TransportOption, sid uuid.UUID) error
AddDeviceFromStore(name string, deviceUUID uuid.UUID, opt *tpb.TransportOption, sid uuid.UUID) error
GetDevice(identifier string) (device.Device, error)
RemoveDevice(uuid.UUID) error
Devices() []uuid.UUID
Devices() []device.Device
ChangeOND(uuid uuid.UUID, operation ppb.ApiOperation, path string, value ...string) (uuid.UUID, error)
Request(uuid.UUID, string) (proto.Message, error)
RequestAll(string) error
GetName() string
GetDescription() string
MarshalDevice(string) (string, error)
ContainsDevice(uuid.UUID) bool
GetSBIs() store.Store
GetSBIs() ([]southbound.SouthboundInterface, error)
GetSBI(uuid.UUID) (southbound.SouthboundInterface, error)
ID() uuid.UUID
PendingChanges() []uuid.UUID
CommittedChanges() []uuid.UUID
......
package networkdomain
import (
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/device"
"code.fbi.h-da.de/danet/gosdn/controller/store"
"github.com/google/uuid"
)
// PndStore describes an interface for pnd store implementations.
type PndStore interface {
Add(NetworkDomain) error
Delete(NetworkDomain) error
Get(store.Query) (NetworkDomain, error)
GetAll() ([]NetworkDomain, error)
PendingChannels(id uuid.UUID, parseErrors ...error) (chan device.Details, error)
AddPendingChannel(id uuid.UUID, ch chan device.Details)
RemovePendingChannel(id uuid.UUID)
}
......@@ -23,4 +23,5 @@ type SouthboundInterface interface { // nolint
SetID(id uuid.UUID)
Type() spb.Type
Unmarshal([]byte, *gpb.Path, ygot.ValidatedGoStruct, ...ytypes.UnmarshalOpt) error
Name() string
}