diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b4b6eaebcc248328659b56f591161df4440d2eb..8af2957d993b7301900a98cea837012c103eb80d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ variables: GOSDN_IMAGE: "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}" GOSDN_TESTING_IMAGE: "${CI_REGISTRY_IMAGE}:testing_${CI_COMMIT_SHA}" CEOS_IMAGE: "${CI_PCONTAINERS_REGISTRY_IMAGE}/ceos:4.28.0F" - GOLANG_VERSION: "1.18" + GOLANG_VERSION: "1.19" workflow: rules: diff --git a/.golangci.yml b/.golangci.yml index 2141fe8030ba212bcf2a72c1dd7b5096475b6a01..0332b1e58f4a7daec560a8eb55ecfc0e87344427 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,5 @@ run: - go: 1.18 + go: 1.19 concurrency: 4 timeout: 10m issues-exit-code: 1 diff --git a/cli/build/ci/.test.yml b/cli/build/ci/.test.yml index 1e22f61576c4e922b5e355e125298018eea4a8c3..ae33d27b1e3175885edf9be1e4b088c1faccd637 100644 --- a/cli/build/ci/.test.yml +++ b/cli/build/ci/.test.yml @@ -1,5 +1,5 @@ test: - image: golang:1.18 + image: golang:1.19 stage: test needs: - job: "apply" @@ -22,7 +22,7 @@ test: - go test -race ./test/integration -v -coverprofile=coverage.out .test: &test - image: golang:1.18 + image: golang:1.19 stage: test allow_failure: true variables: diff --git a/cli/cli.Dockerfile b/cli/cli.Dockerfile index 5787b748088a30b0b4849143b095ec654ebe665b..59f3b5ec20b681602594d11e2475378c62dff822 100644 --- a/cli/cli.Dockerfile +++ b/cli/cli.Dockerfile @@ -1,4 +1,4 @@ -ARG GOLANG_VERSION=1.18 +ARG GOLANG_VERSION=1.19 ARG BUILDARGS ARG $GITLAB_PROXY diff --git a/cli/cmd/list.go b/cli/cmd/list.go index 62216bc03c4a3fdf37fecd022344b3839b90bc09..52f916d5dd6fbc632f90a9a90f31f2ab111d6f69 100644 --- a/cli/cmd/list.go +++ b/cli/cmd/list.go @@ -38,8 +38,8 @@ import ( "github.com/spf13/viper" ) -//TODO: this requires us to make getDevices in grpc.go of gosdn public and we -//also need to implement GetSBI() +// TODO: this requires us to make getDevices in grpc.go of gosdn public and we +// also need to implement GetSBI() // pndCmd represents the pnd command. var listCmd = &cobra.Command{ Use: "list", diff --git a/cli/main.go b/cli/main.go index fe7ac423e254522b99c42a551eaf17d1d4ec09b6..440014d01547d2349b2962f7503d5d90eba71eb0 100644 --- a/cli/main.go +++ b/cli/main.go @@ -5,16 +5,16 @@ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/controller/api/sbi.go b/controller/api/sbi.go index e34ec6a9d4c61fdbc52dc3876770a7515b7501e2..9eea164e431af0ccd141473a7337b05f3548de0c 100644 --- a/controller/api/sbi.go +++ b/controller/api/sbi.go @@ -24,7 +24,7 @@ func GetSbi(ctx context.Context, addr string, pid string, sid string) (*ppb.GetS return client.GetSbi(ctx, req) } -//GetSBIs requests all to the provided PND belonging SBIs from the controller. +// GetSBIs requests all to the provided PND belonging SBIs from the controller. func GetSBIs(ctx context.Context, addr string, pid string) (*ppb.GetSbiListResponse, error) { client, err := nbi.PndClient(addr, dialOptions...) if err != nil { diff --git a/controller/api/user.go b/controller/api/user.go index 484ebe3b789ec92ce9031b257271706010f31354..9a303b4484e4b1adf91caf1c192fb0a8a87b9039 100644 --- a/controller/api/user.go +++ b/controller/api/user.go @@ -25,7 +25,7 @@ func CreateUsers(ctx context.Context, addr string, users []*apb.User) (*apb.Crea return userClient.CreateUsers(ctx, r) } -//GetUser returns one requested user found by name. +// GetUser returns one requested user found by name. func GetUser(ctx context.Context, addr, name string, uuid uuid.UUID) (*apb.GetUserResponse, error) { userClient, err := nbi.UserClient(addr, dialOptions...) if err != nil { diff --git a/controller/cmd/gosdn/main.go b/controller/cmd/gosdn/main.go index b5917e46eb17c897d94f12379a3749dcbf2c95af..62e954f10e4ddee64e61077a983b83a4937051df 100644 --- a/controller/cmd/gosdn/main.go +++ b/controller/cmd/gosdn/main.go @@ -5,16 +5,16 @@ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/controller/controller.Dockerfile b/controller/controller.Dockerfile index 344d7975dc1c8b1d85da6de18eabbf1045c1a423..d8dd3592f54387f3a67d20477c0016855118a386 100644 --- a/controller/controller.Dockerfile +++ b/controller/controller.Dockerfile @@ -1,4 +1,4 @@ -ARG GOLANG_VERSION=1.18 +ARG GOLANG_VERSION=1.19 ARG BUILDARGS ARG $GITLAB_PROXY diff --git a/controller/interfaces/plugin/plugin.go b/controller/interfaces/plugin/plugin.go index 019c0d9399ce9a973481204f6311f56f1cf8dcb4..05d6456a99b0363a3298520782ca950d26fb0177 100644 --- a/controller/interfaces/plugin/plugin.go +++ b/controller/interfaces/plugin/plugin.go @@ -2,7 +2,7 @@ package plugin import ( "fmt" - "io/ioutil" + "os" "regexp" "code.fbi.h-da.de/danet/gosdn/controller/customerrs" @@ -88,7 +88,7 @@ func (m *Manifest) Validate() error { func ReadManifestFromFile(path string) (*Manifest, error) { manifest := &Manifest{} - manifestFile, err := ioutil.ReadFile(path) + manifestFile, err := os.ReadFile(path) if err != nil { return nil, err } diff --git a/controller/nucleus/deviceFilesystemStore.go b/controller/nucleus/deviceFilesystemStore.go index eef874f5b4f11ae0367827525f03d8b75eca4d7e..61561f83dc5b52ce2078b24f65e6f07a9ab51824 100644 --- a/controller/nucleus/deviceFilesystemStore.go +++ b/controller/nucleus/deviceFilesystemStore.go @@ -2,7 +2,7 @@ package nucleus import ( "encoding/json" - "io/ioutil" + "os" "sync" "code.fbi.h-da.de/danet/gosdn/controller/customerrs" @@ -36,7 +36,7 @@ func NewFilesystemDeviceStore(pndUUID uuid.UUID) device.Store { func (s *FilesystemDeviceStore) readAllDevicesFromFile() ([]device.LoadedDevice, error) { var loadedDevices []device.LoadedDevice - content, err := ioutil.ReadFile(s.pathToDeviceFile) + content, err := os.ReadFile(s.pathToDeviceFile) if err != nil { return nil, err } @@ -55,7 +55,7 @@ func (s *FilesystemDeviceStore) writeAllDevicesToFile(devices []device.LoadedDev return err } - err = ioutil.WriteFile(s.pathToDeviceFile, serializedData, 0600) + err = os.WriteFile(s.pathToDeviceFile, serializedData, 0600) if err != nil { return err } diff --git a/controller/nucleus/gnmi_transport.go b/controller/nucleus/gnmi_transport.go index 6ade294cecb5b14f6c65b16a2d81863aa68fdcf1..31ca51feb04ec114752989a218226ac96a2fc66f 100644 --- a/controller/nucleus/gnmi_transport.go +++ b/controller/nucleus/gnmi_transport.go @@ -195,7 +195,7 @@ func createSetRequest(ctx context.Context, diff *gpb.Notification, json []byte, return req, nil } -//Subscribe subscribes to a gNMI target. +// Subscribe subscribes to a gNMI target. func (g *Gnmi) Subscribe(ctx context.Context, params ...string) error { if g.client == nil { return &customerrs.NilClientError{} diff --git a/controller/nucleus/initialise_test.go b/controller/nucleus/initialise_test.go index 88c55cedb56131247e41f6c0704c8c3206bfbdc5..bd7799944df58bbd4875f4e6ca38cb2a9e3d4e4f 100644 --- a/controller/nucleus/initialise_test.go +++ b/controller/nucleus/initialise_test.go @@ -3,7 +3,6 @@ package nucleus import ( "context" "io/fs" - "io/ioutil" "os" "path/filepath" "testing" @@ -185,7 +184,7 @@ func removeTestPlugins() { var seconds int64 = 10 // get all available files - dirs, err := ioutil.ReadDir(currentDirectory) + dirs, err := os.ReadDir(currentDirectory) if err != nil { log.Info(err) } diff --git a/controller/nucleus/pndFilesystemStore.go b/controller/nucleus/pndFilesystemStore.go index 6625a93fff5b3bdaf5b7376e09c0fec1bd628e1e..524945a6a6c5f4006e7e58a2d5a6511d82aa0758 100644 --- a/controller/nucleus/pndFilesystemStore.go +++ b/controller/nucleus/pndFilesystemStore.go @@ -2,7 +2,7 @@ package nucleus import ( "encoding/json" - "io/ioutil" + "os" "sync" cpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/csbi" @@ -41,7 +41,7 @@ func NewFilesystemPndStore() FilesystemPndStore { func (t *FilesystemPndStore) readAllPndsFromFile() ([]networkdomain.NetworkDomain, error) { var loadedPnds []LoadedPnd - content, err := ioutil.ReadFile(t.pathToPndFile) + content, err := os.ReadFile(t.pathToPndFile) if err != nil { return nil, err } @@ -81,7 +81,7 @@ func (t *FilesystemPndStore) writeAllPndsToFile(pnds []networkdomain.NetworkDoma return err } - err = ioutil.WriteFile(t.pathToPndFile, serializedData, 0600) + err = os.WriteFile(t.pathToPndFile, serializedData, 0600) if err != nil { return err } diff --git a/controller/nucleus/principalNetworkDomain.go b/controller/nucleus/principalNetworkDomain.go index 05216b02ba98a36a71e593ddab73b800904f8e14..86d4f5ee978ba96c19067249c4deca72d59eb7a8 100644 --- a/controller/nucleus/principalNetworkDomain.go +++ b/controller/nucleus/principalNetworkDomain.go @@ -495,9 +495,10 @@ func (pnd *pndImplementation) ensureIntendedConfigurationIsAppliedOnDevice(devic return nil } -//nolint:gocyclo // ChangeOND creates a change from the provided Operation, path and value. // The Change is Pending and times out after the specified timeout period. +// +// nolint:gocyclo func (pnd *pndImplementation) ChangeOND(duid uuid.UUID, operation ppb.ApiOperation, path string, value ...string) (uuid.UUID, error) { //TODO: check if we can get cyclomatic complexity from 16 to at least 15 d, err := pnd.deviceService.Get(store.Query{ @@ -638,7 +639,7 @@ func mapModeToAristaFork(mode ppb.SubscriptionMode) (string, error) { } } -//nolint +// nolint // handleRollbackError will be implemented in the near future func handleRollbackError(id uuid.UUID, err error) { log.Error(err) diff --git a/controller/nucleus/sbiFilesystemStore.go b/controller/nucleus/sbiFilesystemStore.go index d75a2f3e1d0bbba6232459c42334ffdd9fee3b0a..4f792ad8486dc501b617ca3c136e9b0c5c6fa506 100644 --- a/controller/nucleus/sbiFilesystemStore.go +++ b/controller/nucleus/sbiFilesystemStore.go @@ -2,7 +2,7 @@ package nucleus import ( "encoding/json" - "io/ioutil" + "os" "sync" "code.fbi.h-da.de/danet/gosdn/controller/customerrs" @@ -38,7 +38,7 @@ func NewFilesystemSbiStore(pndUUID uuid.UUID) southbound.Store { func (s *FilesystemSbiStore) readAllSbisFromFile() ([]southbound.LoadedSbi, error) { var loadedSbis []southbound.LoadedSbi - content, err := ioutil.ReadFile(s.pathToSbiFile) + content, err := os.ReadFile(s.pathToSbiFile) if err != nil { return nil, err } @@ -56,7 +56,7 @@ func (s *FilesystemSbiStore) writeAllSbisToFile(sbis []southbound.LoadedSbi) err return err } - err = ioutil.WriteFile(s.pathToSbiFile, serializedData, 0600) + err = os.WriteFile(s.pathToSbiFile, serializedData, 0600) if err != nil { return err } diff --git a/controller/nucleus/southbound.go b/controller/nucleus/southbound.go index 9ab599b3e81a82d31a0b2f97eae4cf8dd276b1a3..de92fad6e964f392450d762a7df18a214bfb5068 100644 --- a/controller/nucleus/southbound.go +++ b/controller/nucleus/southbound.go @@ -122,7 +122,7 @@ func (oc *OpenConfig) Unmarshal(bytes []byte, path *gpb.Path, goStruct ygot.GoSt return unmarshal(oc.Schema(), bytes, path, goStruct, opt...) } -//unmarshal parses a gNMI response to a go struct. +// unmarshal parses a gNMI response to a go struct. func unmarshal(schema *ytypes.Schema, bytes []byte, path *gpb.Path, goStruct ygot.GoStruct, opt ...ytypes.UnmarshalOpt) error { defer func() { if r := recover(); r != nil { diff --git a/controller/nucleus/util/gnmi/convert.go b/controller/nucleus/util/gnmi/convert.go index 9f3abae5d92a9f4ed9f9687ca6815090de065083..e04614306062f3483aed7de29ec1f9bf4e143cf3 100644 --- a/controller/nucleus/util/gnmi/convert.go +++ b/controller/nucleus/util/gnmi/convert.go @@ -9,8 +9,8 @@ import ( "github.com/openconfig/goyang/pkg/yang" ) -//ConvertStringToGnmiTypedValue allows to convert a string into a -//gnmi.TypedValue; this conversion is based on the provided YANG type. +// ConvertStringToGnmiTypedValue allows to convert a string into a +// gnmi.TypedValue; this conversion is based on the provided YANG type. func ConvertStringToGnmiTypedValue(s string, t *yang.YangType) (*gnmi.TypedValue, error) { // TODO: add more types switch t.Kind { diff --git a/controller/nucleus/util/proto/message.go b/controller/nucleus/util/proto/message.go index 96db7baec12707ef25dafe3a8661b6ead0c3cd91..e379a09f97c6c5d1a790876532afb64d9af3d25f 100644 --- a/controller/nucleus/util/proto/message.go +++ b/controller/nucleus/util/proto/message.go @@ -2,7 +2,7 @@ package proto import ( "fmt" - "io/ioutil" + "os" "path/filepath" "google.golang.org/protobuf/proto" @@ -19,7 +19,7 @@ func Write(message proto.Message, filename string) error { return fmt.Errorf("cannot marshal proto message to binary: %w", err) } - err = ioutil.WriteFile(filename, data, 0600) + err = os.WriteFile(filename, data, 0600) if err != nil { return fmt.Errorf("cannot write binary data to file: %w", err) } @@ -30,7 +30,7 @@ func Write(message proto.Message, filename string) error { // Read reads a binary file (containing a marshaled protocol buffer message) // and unmarshals it back into a protocol buffer message. func Read(filename string, message proto.Message) error { - data, err := ioutil.ReadFile(filepath.Clean(filename)) + data, err := os.ReadFile(filepath.Clean(filename)) if err != nil { return fmt.Errorf("cannot read binary data from file: %w", err) } diff --git a/controller/rbac/memoryRoleStore.go b/controller/rbac/memoryRoleStore.go index 0c1ef261d29611c50f57a66a7bba49a043614a64..86c6ee25f44ae67d876b00c656b33830127d85d2 100644 --- a/controller/rbac/memoryRoleStore.go +++ b/controller/rbac/memoryRoleStore.go @@ -8,7 +8,7 @@ import ( "code.fbi.h-da.de/danet/gosdn/controller/store" ) -//MemoryRoleStore provides a in-memory implementation for roles. +// MemoryRoleStore provides a in-memory implementation for roles. type MemoryRoleStore struct { Store map[string]rbac.LoadedRole nameLookupTable map[string]string diff --git a/controller/rbac/memoryUserStore.go b/controller/rbac/memoryUserStore.go index e8d08ad4322d75c1f4b2f48f68c382448fa00f14..b9bab5832703788b0dbbef0b13452d586d4d7dfc 100644 --- a/controller/rbac/memoryUserStore.go +++ b/controller/rbac/memoryUserStore.go @@ -8,7 +8,7 @@ import ( "code.fbi.h-da.de/danet/gosdn/controller/store" ) -//MemoryUserStore provides a in-memory implementation for users. +// MemoryUserStore provides a in-memory implementation for users. type MemoryUserStore struct { Store map[string]rbac.LoadedUser nameLookupTable map[string]string diff --git a/controller/rbac/roleFileSystemStore.go b/controller/rbac/roleFileSystemStore.go index bd4102357a3ed4d571222c77f3ee89f585abae11..c0780d9505baf0ea4cfef2e5dbea2a44739789aa 100644 --- a/controller/rbac/roleFileSystemStore.go +++ b/controller/rbac/roleFileSystemStore.go @@ -2,7 +2,7 @@ package rbac import ( "encoding/json" - "io/ioutil" + "os" "sync" "code.fbi.h-da.de/danet/gosdn/controller/customerrs" @@ -31,7 +31,7 @@ func NewFileSystemRoleStore() rbac.RoleStore { func (s *FileSystemRoleStore) readAllRolesFromFile() ([]rbac.LoadedRole, error) { var loadedRoles []rbac.LoadedRole - content, err := ioutil.ReadFile(s.pathToRoleFile) + content, err := os.ReadFile(s.pathToRoleFile) if err != nil { return nil, err } @@ -50,7 +50,7 @@ func (s *FileSystemRoleStore) writeAllRolesToFile(roles []rbac.LoadedRole) error return err } - err = ioutil.WriteFile(s.pathToRoleFile, serializedData, 0600) + err = os.WriteFile(s.pathToRoleFile, serializedData, 0600) if err != nil { return err } @@ -84,7 +84,7 @@ func (s *FileSystemRoleStore) Add(roleToAdd rbac.Role) error { return nil } -//Delete deletes a Role from the Role store. +// Delete deletes a Role from the Role store. func (s *FileSystemRoleStore) Delete(roleToDelete rbac.Role) error { s.fileMutex.Lock() defer s.fileMutex.Unlock() @@ -112,7 +112,7 @@ func (s *FileSystemRoleStore) Delete(roleToDelete rbac.Role) error { return &customerrs.CouldNotDeleteError{Identifier: roleToDelete.ID(), Type: roleToDelete, Err: err} } -//Get takes a Roles ID and return the Role if found. +// Get takes a Roles ID and return the Role if found. func (s *FileSystemRoleStore) Get(query store.Query) (rbac.LoadedRole, error) { s.fileMutex.Lock() defer s.fileMutex.Unlock() @@ -141,7 +141,7 @@ func (s *FileSystemRoleStore) GetAll() ([]rbac.LoadedRole, error) { return Roles, err } -//Update updates an exsisting Role. +// Update updates an exsisting Role. func (s *FileSystemRoleStore) Update(roleToUpdate rbac.Role) error { s.fileMutex.Lock() defer s.fileMutex.Unlock() diff --git a/controller/rbac/userFileSystemStore.go b/controller/rbac/userFileSystemStore.go index 1842d54dd3fb7a89e0b1e0615ddd36137ed615d0..257fb5e111b897ddb67c3cf4832af9e2bc36f258 100644 --- a/controller/rbac/userFileSystemStore.go +++ b/controller/rbac/userFileSystemStore.go @@ -2,7 +2,7 @@ package rbac import ( "encoding/json" - "io/ioutil" + "os" "sync" "code.fbi.h-da.de/danet/gosdn/controller/customerrs" @@ -31,7 +31,7 @@ func NewFileSystemUserStore() rbac.UserStore { func (s *FileSystemUserStore) readAllUsersFromFile() ([]rbac.LoadedUser, error) { var loadedUsers []rbac.LoadedUser - content, err := ioutil.ReadFile(s.pathToUserFile) + content, err := os.ReadFile(s.pathToUserFile) if err != nil { return nil, err } @@ -50,7 +50,7 @@ func (s *FileSystemUserStore) writeAllUsersToFile(users []rbac.LoadedUser) error return err } - err = ioutil.WriteFile(s.pathToUserFile, serializedData, 0600) + err = os.WriteFile(s.pathToUserFile, serializedData, 0600) if err != nil { return err } @@ -84,7 +84,7 @@ func (s *FileSystemUserStore) Add(UserToAdd rbac.User) error { return nil } -//Delete deletes a User from the User store. +// Delete deletes a User from the User store. func (s *FileSystemUserStore) Delete(userToDelete rbac.User) error { s.fileMutex.Lock() defer s.fileMutex.Unlock() @@ -112,7 +112,7 @@ func (s *FileSystemUserStore) Delete(userToDelete rbac.User) error { return &customerrs.CouldNotDeleteError{Identifier: userToDelete.ID(), Type: userToDelete, Err: err} } -//Get takes a Users ID and return the User if found. +// Get takes a Users ID and return the User if found. func (s *FileSystemUserStore) Get(query store.Query) (rbac.LoadedUser, error) { s.fileMutex.Lock() defer s.fileMutex.Unlock() @@ -141,7 +141,7 @@ func (s *FileSystemUserStore) GetAll() ([]rbac.LoadedUser, error) { return Users, err } -//Update updates an exsisting user. +// Update updates an exsisting user. func (s *FileSystemUserStore) Update(userToUpdate rbac.User) error { s.fileMutex.Lock() defer s.fileMutex.Unlock() diff --git a/controller/store/utils.go b/controller/store/utils.go index 985bb928f40150817983516bf70c6aac119a31e2..06bc41d5e1014d6144113ae046afa7274c8da7ff 100644 --- a/controller/store/utils.go +++ b/controller/store/utils.go @@ -27,7 +27,7 @@ func FromString(id string) (uuid.UUID, error) { return idAsUUID, nil } -//EnsureFilesystemStorePathExists ensures that the filesystem store path exists. +// EnsureFilesystemStorePathExists ensures that the filesystem store path exists. func EnsureFilesystemStorePathExists(storeFileName string) error { completeStorePath := filepath.Join(config.FilesystemPathToStores, storeFileName) if _, err := os.Stat(completeStorePath); os.IsNotExist(err) { @@ -67,12 +67,12 @@ func ensureDirExists(fileName string) error { return nil } -//GetCompletePathToFileStore gets the complete path to a file store. +// GetCompletePathToFileStore gets the complete path to a file store. func GetCompletePathToFileStore(storeName string) string { return filepath.Join(config.FilesystemPathToStores, storeName) } -//TransformObjectToLoadedObject transform an object into an loadedObject. +// TransformObjectToLoadedObject transform an object into an loadedObject. func TransformObjectToLoadedObject[T, R any](object T) (R, error) { var loadedObject R @@ -89,7 +89,7 @@ func TransformObjectToLoadedObject[T, R any](object T) (R, error) { return loadedObject, err } -//GetStoreFilenameForUUID returns the full filename for a given pndUUID and suffix. +// GetStoreFilenameForUUID returns the full filename for a given pndUUID and suffix. func GetStoreFilenameForUUID(pndUUID uuid.UUID, deviceFilenameSuffix string) string { return pndUUID.String() + "-" + deviceFilenameSuffix } diff --git a/csbi/cmd/csbi/main.go b/csbi/cmd/csbi/main.go index d9c772bd03b72b120615d6e6d6dd6db465a18794..0bf3548a378c06187d1685687e517a35a09a4e19 100644 --- a/csbi/cmd/csbi/main.go +++ b/csbi/cmd/csbi/main.go @@ -5,16 +5,16 @@ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/csbi/csbi.Dockerfile b/csbi/csbi.Dockerfile index b853e90c813b8db3b7f40e58a480976dcdce2de0..b9b3adebaa9b4afa33a6896196ff14d93f1a02fe 100644 --- a/csbi/csbi.Dockerfile +++ b/csbi/csbi.Dockerfile @@ -1,4 +1,4 @@ -ARG GOLANG_VERSION=1.18 +ARG GOLANG_VERSION=1.19 ARG BUILDARGS ARG $GITLAB_PROXY diff --git a/csbi/gnmi-target/gnmitarget.Dockerfile b/csbi/gnmi-target/gnmitarget.Dockerfile index afb2c4f3d766c29ef640bab79c4a24a1e23173ed..4af5963a84219b2ac290354c0b2bf18997b3c5c2 100644 --- a/csbi/gnmi-target/gnmitarget.Dockerfile +++ b/csbi/gnmi-target/gnmitarget.Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.18-alpine +FROM golang:1.19-alpine RUN go install github.com/google/gnxi/gnmi_target@latest RUN wget https://raw.githubusercontent.com/google/gnxi/master/gnmi_target/openconfig-openflow.json EXPOSE 7030 diff --git a/csbi/resources/Dockerfile b/csbi/resources/Dockerfile index af45738ce75b387f7109c5953ff9baab4fa21667..7ce79f87687cb4dba48cebbaf8023bb802e1e19e 100644 --- a/csbi/resources/Dockerfile +++ b/csbi/resources/Dockerfile @@ -1,5 +1,5 @@ # syntax = docker/dockerfile:1.2 -FROM golang:1.18-alpine AS installer +FROM golang:1.19-alpine AS installer ARG GITLAB_USER ARG GITLAB_TOKEN WORKDIR /src/csbi diff --git a/csbi/resources/go.mod b/csbi/resources/go.mod index e8fe79116253740fa5750a706ad4f5f2c4bb231a..4003eb6629b49743e70e93ff211897ce4b55c2d4 100644 --- a/csbi/resources/go.mod +++ b/csbi/resources/go.mod @@ -1,6 +1,6 @@ module code.fbi.h-da.de/danet/gosdn/csbi-autogen -go 1.18 +go 1.19 require ( code.fbi.h-da.de/danet/gosdn v0.0.3-0.20220805102430-8465989fb8b3 diff --git a/csbi/write.go b/csbi/write.go index ccc679bcf8dd611c267b387b1d3885287030f949..340d5055ed59f4fa3487c9641aba2d24e5d9ec99 100644 --- a/csbi/write.go +++ b/csbi/write.go @@ -5,7 +5,6 @@ import ( "context" "fmt" "io/fs" - "io/ioutil" "net" "os" "os/exec" @@ -226,7 +225,7 @@ func writeManifest(path string, manifest *Manifest) error { if err != nil { return err } - if err := ioutil.WriteFile(filepath.Join(path, manifestFileName), m, 0644); err != nil { + if err := os.WriteFile(filepath.Join(path, manifestFileName), m, 0644); err != nil { return err } return nil diff --git a/go.mod b/go.mod index e85eba76de0a415629df8987108ff7e26dcfb809..0f802294d2f2fa1d4b87b810999c2e69c3c362d6 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module code.fbi.h-da.de/danet/gosdn -go 1.18 +go 1.19 require ( github.com/aristanetworks/goarista v0.0.0-20220425175323-05f7c4c5e34c