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 (4)
Showing
with 653 additions and 584 deletions
......@@ -18,6 +18,7 @@ unit-test:
- cd controller
- make ci-unit-test
after_script:
- cd controller
- go tool cover -func=coverage.out
<<: *test
......
......@@ -5,6 +5,7 @@ run:
issues-exit-code: 1
# directories to be ignored by linters
skip-dirs:
- artifacts
- controller/forks
- controller/test
- controller/mocks
......
......@@ -71,16 +71,17 @@ func (Status) EnumDescriptor() ([]byte, []int) {
return file_gosdn_core_core_proto_rawDescGZIP(), []int{0}
}
type GetPndListRequest struct {
type GetPndRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Timestamp in nanoseconds since Epoch.
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Timestamp in nanoseconds since Epoch.
Pid string `protobuf:"bytes,2,opt,name=pid,proto3" json:"pid,omitempty"`
}
func (x *GetPndListRequest) Reset() {
*x = GetPndListRequest{}
func (x *GetPndRequest) Reset() {
*x = GetPndRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_gosdn_core_core_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
......@@ -88,13 +89,13 @@ func (x *GetPndListRequest) Reset() {
}
}
func (x *GetPndListRequest) String() string {
func (x *GetPndRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetPndListRequest) ProtoMessage() {}
func (*GetPndRequest) ProtoMessage() {}
func (x *GetPndListRequest) ProtoReflect() protoreflect.Message {
func (x *GetPndRequest) ProtoReflect() protoreflect.Message {
mi := &file_gosdn_core_core_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
......@@ -106,29 +107,36 @@ func (x *GetPndListRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use GetPndListRequest.ProtoReflect.Descriptor instead.
func (*GetPndListRequest) Descriptor() ([]byte, []int) {
// Deprecated: Use GetPndRequest.ProtoReflect.Descriptor instead.
func (*GetPndRequest) Descriptor() ([]byte, []int) {
return file_gosdn_core_core_proto_rawDescGZIP(), []int{0}
}
func (x *GetPndListRequest) GetTimestamp() int64 {
func (x *GetPndRequest) GetTimestamp() int64 {
if x != nil {
return x.Timestamp
}
return 0
}
type GetPndRequest struct {
func (x *GetPndRequest) GetPid() string {
if x != nil {
return x.Pid
}
return ""
}
type GetPndResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Timestamp in nanoseconds since Epoch.
Pid []string `protobuf:"bytes,3,rep,name=pid,proto3" json:"pid,omitempty"`
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Timestamp in nanoseconds since Epoch.
Pnd *pnd.PrincipalNetworkDomain `protobuf:"bytes,2,opt,name=pnd,proto3" json:"pnd,omitempty"`
}
func (x *GetPndRequest) Reset() {
*x = GetPndRequest{}
func (x *GetPndResponse) Reset() {
*x = GetPndResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_gosdn_core_core_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
......@@ -136,13 +144,13 @@ func (x *GetPndRequest) Reset() {
}
}
func (x *GetPndRequest) String() string {
func (x *GetPndResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetPndRequest) ProtoMessage() {}
func (*GetPndResponse) ProtoMessage() {}
func (x *GetPndRequest) ProtoReflect() protoreflect.Message {
func (x *GetPndResponse) ProtoReflect() protoreflect.Message {
mi := &file_gosdn_core_core_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
......@@ -154,36 +162,35 @@ func (x *GetPndRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use GetPndRequest.ProtoReflect.Descriptor instead.
func (*GetPndRequest) Descriptor() ([]byte, []int) {
// Deprecated: Use GetPndResponse.ProtoReflect.Descriptor instead.
func (*GetPndResponse) Descriptor() ([]byte, []int) {
return file_gosdn_core_core_proto_rawDescGZIP(), []int{1}
}
func (x *GetPndRequest) GetTimestamp() int64 {
func (x *GetPndResponse) GetTimestamp() int64 {
if x != nil {
return x.Timestamp
}
return 0
}
func (x *GetPndRequest) GetPid() []string {
func (x *GetPndResponse) GetPnd() *pnd.PrincipalNetworkDomain {
if x != nil {
return x.Pid
return x.Pnd
}
return nil
}
type GetPndListResponse struct {
type GetPndListRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Timestamp in nanoseconds since Epoch.
Pnd []*pnd.PrincipalNetworkDomain `protobuf:"bytes,2,rep,name=pnd,proto3" json:"pnd,omitempty"`
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Timestamp in nanoseconds since Epoch.
}
func (x *GetPndListResponse) Reset() {
*x = GetPndListResponse{}
func (x *GetPndListRequest) Reset() {
*x = GetPndListRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_gosdn_core_core_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
......@@ -191,13 +198,13 @@ func (x *GetPndListResponse) Reset() {
}
}
func (x *GetPndListResponse) String() string {
func (x *GetPndListRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetPndListResponse) ProtoMessage() {}
func (*GetPndListRequest) ProtoMessage() {}
func (x *GetPndListResponse) ProtoReflect() protoreflect.Message {
func (x *GetPndListRequest) ProtoReflect() protoreflect.Message {
mi := &file_gosdn_core_core_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
......@@ -209,26 +216,19 @@ func (x *GetPndListResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use GetPndListResponse.ProtoReflect.Descriptor instead.
func (*GetPndListResponse) Descriptor() ([]byte, []int) {
// Deprecated: Use GetPndListRequest.ProtoReflect.Descriptor instead.
func (*GetPndListRequest) Descriptor() ([]byte, []int) {
return file_gosdn_core_core_proto_rawDescGZIP(), []int{2}
}
func (x *GetPndListResponse) GetTimestamp() int64 {
func (x *GetPndListRequest) GetTimestamp() int64 {
if x != nil {
return x.Timestamp
}
return 0
}
func (x *GetPndListResponse) GetPnd() []*pnd.PrincipalNetworkDomain {
if x != nil {
return x.Pnd
}
return nil
}
type GetPndResponse struct {
type GetPndListResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
......@@ -237,8 +237,8 @@ type GetPndResponse struct {
Pnd []*pnd.PrincipalNetworkDomain `protobuf:"bytes,2,rep,name=pnd,proto3" json:"pnd,omitempty"`
}
func (x *GetPndResponse) Reset() {
*x = GetPndResponse{}
func (x *GetPndListResponse) Reset() {
*x = GetPndListResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_gosdn_core_core_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
......@@ -246,13 +246,13 @@ func (x *GetPndResponse) Reset() {
}
}
func (x *GetPndResponse) String() string {
func (x *GetPndListResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetPndResponse) ProtoMessage() {}
func (*GetPndListResponse) ProtoMessage() {}
func (x *GetPndResponse) ProtoReflect() protoreflect.Message {
func (x *GetPndListResponse) ProtoReflect() protoreflect.Message {
mi := &file_gosdn_core_core_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
......@@ -264,19 +264,19 @@ func (x *GetPndResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use GetPndResponse.ProtoReflect.Descriptor instead.
func (*GetPndResponse) Descriptor() ([]byte, []int) {
// Deprecated: Use GetPndListResponse.ProtoReflect.Descriptor instead.
func (*GetPndListResponse) Descriptor() ([]byte, []int) {
return file_gosdn_core_core_proto_rawDescGZIP(), []int{3}
}
func (x *GetPndResponse) GetTimestamp() int64 {
func (x *GetPndListResponse) GetTimestamp() int64 {
if x != nil {
return x.Timestamp
}
return 0
}
func (x *GetPndResponse) GetPnd() []*pnd.PrincipalNetworkDomain {
func (x *GetPndListResponse) GetPnd() []*pnd.PrincipalNetworkDomain {
if x != nil {
return x.Pnd
}
......@@ -574,21 +574,21 @@ var file_gosdn_core_core_proto_rawDesc = []byte{
0x6f, 0x72, 0x65, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x13, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x70, 0x6e, 0x64, 0x2f, 0x70, 0x6e, 0x64,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x31, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64,
0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74,
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09,
0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x3f, 0x0a, 0x0d, 0x47, 0x65, 0x74,
0x50, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69,
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74,
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18,
0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x70, 0x69, 0x64, 0x22, 0x67, 0x0a, 0x12, 0x47, 0x65,
0x74, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20,
0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x33,
0x0a, 0x03, 0x70, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f,
0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x50, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61,
0x6c, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x03,
0x70, 0x6e, 0x64, 0x22, 0x63, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x52, 0x65, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73,
0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65,
0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x70, 0x69, 0x64, 0x22, 0x63, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x6e,
0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d,
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69,
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x33, 0x0a, 0x03, 0x70, 0x6e, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64,
0x2e, 0x50, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72,
0x6b, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x03, 0x70, 0x6e, 0x64, 0x22, 0x31, 0x0a, 0x11,
0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01,
0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22,
0x67, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
0x61, 0x6d, 0x70, 0x12, 0x33, 0x0a, 0x03, 0x70, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
......@@ -674,10 +674,10 @@ var file_gosdn_core_core_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_gosdn_core_core_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_gosdn_core_core_proto_goTypes = []interface{}{
(Status)(0), // 0: gosdn.core.Status
(*GetPndListRequest)(nil), // 1: gosdn.core.GetPndListRequest
(*GetPndRequest)(nil), // 2: gosdn.core.GetPndRequest
(*GetPndListResponse)(nil), // 3: gosdn.core.GetPndListResponse
(*GetPndResponse)(nil), // 4: gosdn.core.GetPndResponse
(*GetPndRequest)(nil), // 1: gosdn.core.GetPndRequest
(*GetPndResponse)(nil), // 2: gosdn.core.GetPndResponse
(*GetPndListRequest)(nil), // 3: gosdn.core.GetPndListRequest
(*GetPndListResponse)(nil), // 4: gosdn.core.GetPndListResponse
(*CreatePndListRequest)(nil), // 5: gosdn.core.CreatePndListRequest
(*PndCreateProperties)(nil), // 6: gosdn.core.PndCreateProperties
(*CreatePndListResponse)(nil), // 7: gosdn.core.CreatePndListResponse
......@@ -686,17 +686,17 @@ var file_gosdn_core_core_proto_goTypes = []interface{}{
(*pnd.PrincipalNetworkDomain)(nil), // 10: gosdn.pnd.PrincipalNetworkDomain
}
var file_gosdn_core_core_proto_depIdxs = []int32{
10, // 0: gosdn.core.GetPndListResponse.pnd:type_name -> gosdn.pnd.PrincipalNetworkDomain
10, // 1: gosdn.core.GetPndResponse.pnd:type_name -> gosdn.pnd.PrincipalNetworkDomain
10, // 0: gosdn.core.GetPndResponse.pnd:type_name -> gosdn.pnd.PrincipalNetworkDomain
10, // 1: gosdn.core.GetPndListResponse.pnd:type_name -> gosdn.pnd.PrincipalNetworkDomain
6, // 2: gosdn.core.CreatePndListRequest.pnd:type_name -> gosdn.core.PndCreateProperties
0, // 3: gosdn.core.CreatePndListResponse.status:type_name -> gosdn.core.Status
0, // 4: gosdn.core.DeletePndResponse.status:type_name -> gosdn.core.Status
2, // 5: gosdn.core.CoreService.GetPnd:input_type -> gosdn.core.GetPndRequest
1, // 6: gosdn.core.CoreService.GetPndList:input_type -> gosdn.core.GetPndListRequest
1, // 5: gosdn.core.CoreService.GetPnd:input_type -> gosdn.core.GetPndRequest
3, // 6: gosdn.core.CoreService.GetPndList:input_type -> gosdn.core.GetPndListRequest
5, // 7: gosdn.core.CoreService.CreatePndList:input_type -> gosdn.core.CreatePndListRequest
8, // 8: gosdn.core.CoreService.DeletePnd:input_type -> gosdn.core.DeletePndRequest
4, // 9: gosdn.core.CoreService.GetPnd:output_type -> gosdn.core.GetPndResponse
3, // 10: gosdn.core.CoreService.GetPndList:output_type -> gosdn.core.GetPndListResponse
2, // 9: gosdn.core.CoreService.GetPnd:output_type -> gosdn.core.GetPndResponse
4, // 10: gosdn.core.CoreService.GetPndList:output_type -> gosdn.core.GetPndListResponse
7, // 11: gosdn.core.CoreService.CreatePndList:output_type -> gosdn.core.CreatePndListResponse
9, // 12: gosdn.core.CoreService.DeletePnd:output_type -> gosdn.core.DeletePndResponse
9, // [9:13] is the sub-list for method output_type
......@@ -713,7 +713,7 @@ func file_gosdn_core_core_proto_init() {
}
if !protoimpl.UnsafeEnabled {
file_gosdn_core_core_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetPndListRequest); i {
switch v := v.(*GetPndRequest); i {
case 0:
return &v.state
case 1:
......@@ -725,7 +725,7 @@ func file_gosdn_core_core_proto_init() {
}
}
file_gosdn_core_core_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetPndRequest); i {
switch v := v.(*GetPndResponse); i {
case 0:
return &v.state
case 1:
......@@ -737,7 +737,7 @@ func file_gosdn_core_core_proto_init() {
}
}
file_gosdn_core_core_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetPndListResponse); i {
switch v := v.(*GetPndListRequest); i {
case 0:
return &v.state
case 1:
......@@ -749,7 +749,7 @@ func file_gosdn_core_core_proto_init() {
}
}
file_gosdn_core_core_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetPndResponse); i {
switch v := v.(*GetPndListResponse); i {
case 0:
return &v.state
case 1:
......
......@@ -51,7 +51,7 @@ func request_CoreService_GetPnd_0(ctx context.Context, marshaler runtime.Marshal
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pid")
}
protoReq.Pid, err = runtime.StringSlice(val, ",")
protoReq.Pid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pid", err)
}
......@@ -84,7 +84,7 @@ func local_request_CoreService_GetPnd_0(ctx context.Context, marshaler runtime.M
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pid")
}
protoReq.Pid, err = runtime.StringSlice(val, ",")
protoReq.Pid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pid", err)
}
......
This diff is collapsed.
......@@ -131,7 +131,7 @@ func request_PndService_GetOnd_0(ctx context.Context, marshaler runtime.Marshale
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "did")
}
protoReq.Did, err = runtime.StringSlice(val, ",")
protoReq.Did, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
......@@ -174,7 +174,7 @@ func local_request_PndService_GetOnd_0(ctx context.Context, marshaler runtime.Ma
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "did")
}
protoReq.Did, err = runtime.StringSlice(val, ",")
protoReq.Did, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
......@@ -359,7 +359,7 @@ func request_PndService_GetSbi_0(ctx context.Context, marshaler runtime.Marshale
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sid")
}
protoReq.Sid, err = runtime.StringSlice(val, ",")
protoReq.Sid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sid", err)
}
......@@ -402,7 +402,7 @@ func local_request_PndService_GetSbi_0(ctx context.Context, marshaler runtime.Ma
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sid")
}
protoReq.Sid, err = runtime.StringSlice(val, ",")
protoReq.Sid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sid", err)
}
......@@ -587,7 +587,7 @@ func request_PndService_GetChange_0(ctx context.Context, marshaler runtime.Marsh
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cuid")
}
protoReq.Cuid, err = runtime.String(val)
protoReq.Cuid, err = runtime.StringSlice(val, ",")
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cuid", err)
}
......@@ -630,7 +630,7 @@ func local_request_PndService_GetChange_0(ctx context.Context, marshaler runtime
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cuid")
}
protoReq.Cuid, err = runtime.String(val)
protoReq.Cuid, err = runtime.StringSlice(val, ",")
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cuid", err)
}
......
......@@ -146,12 +146,7 @@
"name": "pid",
"in": "path",
"required": true,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv",
"minItems": 1
"type": "string"
},
{
"name": "timestamp",
......@@ -383,7 +378,12 @@
"name": "cuid",
"in": "path",
"required": true,
"type": "string"
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv",
"minItems": 1
},
{
"name": "timestamp",
......@@ -427,12 +427,7 @@
"name": "did",
"in": "path",
"required": true,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv",
"minItems": 1
"type": "string"
},
{
"name": "timestamp",
......@@ -795,12 +790,7 @@
"name": "sid",
"in": "path",
"required": true,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv",
"minItems": 1
"type": "string"
},
{
"name": "timestamp",
......@@ -1314,10 +1304,7 @@
"format": "int64"
},
"pnd": {
"type": "array",
"items": {
"$ref": "#/definitions/pndPrincipalNetworkDomain"
}
"$ref": "#/definitions/pndPrincipalNetworkDomain"
}
}
},
......@@ -2479,6 +2466,9 @@
"type": "string",
"format": "int64"
},
"id": {
"type": "string"
},
"status": {
"$ref": "#/definitions/gosdnpndStatus"
}
......@@ -2564,6 +2554,9 @@
},
"state": {
"$ref": "#/definitions/pndChangeState"
},
"diff": {
"$ref": "#/definitions/gnmiNotification"
}
}
},
......@@ -2677,10 +2670,7 @@
"description": "TODO: Check if this is really needed. Perhaps a reference to the PND's ID\nis also sufficient."
},
"ond": {
"type": "array",
"items": {
"$ref": "#/definitions/pndOrchestratedNetworkingDevice"
}
"$ref": "#/definitions/pndOrchestratedNetworkingDevice"
}
}
},
......@@ -2734,10 +2724,7 @@
"description": "TODO: Check if this is really needed. Perhaps a reference to the PND's ID\nis also sufficient."
},
"sbi": {
"type": "array",
"items": {
"$ref": "#/definitions/southboundSouthboundInterface"
}
"$ref": "#/definitions/southboundSouthboundInterface"
}
}
},
......
......@@ -4,7 +4,7 @@ deps:
- remote: buf.build
owner: googleapis
repository: googleapis
commit: f3590c56d388417ebbedefae77ac12bf
commit: 8ab0a452adb64b36ac7a40ae95bd59b2
- remote: buf.build
owner: grpc-ecosystem
repository: grpc-gateway
......
......@@ -35,25 +35,26 @@ service CoreService {
}
}
message GetPndListRequest {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
}
message GetPndRequest {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
repeated string pid = 3;
string pid = 2;
}
message GetPndListResponse {
message GetPndResponse {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
repeated .gosdn.pnd.PrincipalNetworkDomain pnd = 2;
.gosdn.pnd.PrincipalNetworkDomain pnd = 2;
}
message GetPndResponse {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
repeated .gosdn.pnd.PrincipalNetworkDomain pnd = 2;
message GetPndListRequest {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
}
message GetPndListResponse {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
repeated .gosdn.pnd.PrincipalNetworkDomain pnd = 2;
}
message CreatePndListRequest {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
repeated PndCreateProperties pnd = 2;
......
......@@ -118,34 +118,35 @@ service PndService {
message GetOndListRequest {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
string pid = 4;
string pid = 2;
}
message GetOndRequest {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
repeated string did = 3;
string pid = 4;
string did = 2;
string pid = 3;
}
message GetSbiListRequest {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
string pid = 4;
string pid = 2;
}
message GetSbiRequest {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
repeated string sid = 3;
string pid = 4;
string sid = 2;
string pid = 3;
}
message GetChangeListRequest {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
string pid = 4;
string pid = 2;
}
message GetChangeRequest {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
string cuid = 3;
string pid = 4;
repeated string cuid = 2;
string pid = 3;
}
message GetPathRequest {
......@@ -160,7 +161,7 @@ message GetOndResponse {
// TODO: Check if this is really needed. Perhaps a reference to the PND's ID
// is also sufficient.
PrincipalNetworkDomain pnd = 2;
repeated OrchestratedNetworkingDevice ond = 3;
OrchestratedNetworkingDevice ond = 3;
}
message GetOndListResponse {
......@@ -176,7 +177,7 @@ message GetSbiResponse {
// TODO: Check if this is really needed. Perhaps a reference to the PND's ID
// is also sufficient.
PrincipalNetworkDomain pnd = 2;
repeated .gosdn.southbound.SouthboundInterface sbi = 3;
.gosdn.southbound.SouthboundInterface sbi = 3;
}
message GetSbiListResponse {
......@@ -235,8 +236,8 @@ enum ChangeState {
message Change {
string id = 1;
int64 age = 2;
ChangeState state = 3;
gnmi.Notification diff = 4;
}
message SetOndListRequest {
......@@ -310,7 +311,8 @@ message SetChange {
message SetResponse{
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
Status status = 2;
string id = 2;
Status status = 3;
}
message SetOndListResponse{
......@@ -344,8 +346,8 @@ message SetPathListResponse{
message DeleteOndRequest {
int64 timestamp = 1; // Timestamp in nanoseconds since Epoch.
string pid = 4;
string did = 5;
string pid = 2;
string did = 3;
}
message DeleteOndResponse {
......
package adapter
......@@ -5,15 +5,12 @@ import (
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core"
ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd"
spb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/southbound"
tpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/transport"
"code.fbi.h-da.de/danet/gosdn/controller/api"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/change"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/southbound"
"code.fbi.h-da.de/danet/gosdn/controller/nucleus/errors"
"github.com/google/uuid"
"github.com/openconfig/goyang/pkg/yang"
log "github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
"google.golang.org/protobuf/proto"
)
......@@ -69,22 +66,22 @@ func (p *PndAdapter) GetSbiSchemaTree(ctx context.Context, sid uuid.UUID) (map[s
// GetDevice requests one or multiple devices belonging to a given
// PrincipalNetworkDomain from the controller.
func (p *PndAdapter) GetDevice(ctx context.Context, identifier ...string) ([]*ppb.OrchestratedNetworkingDevice, error) {
resp, err := api.GetDevice(ctx, p.endpoint, p.id.String(), identifier...)
func (p *PndAdapter) GetDevice(ctx context.Context, identifier string) (*ppb.GetOndResponse, error) {
resp, err := api.GetDevice(ctx, p.endpoint, p.id.String(), identifier)
if err != nil {
return nil, err
}
return resp.Ond, nil
return resp, nil
}
// GetDevices requests all devices belonging to the PrincipalNetworkDomain
// attached to this adapter.
func (p *PndAdapter) GetDevices(ctx context.Context) ([]*ppb.OrchestratedNetworkingDevice, error) {
func (p *PndAdapter) GetDevices(ctx context.Context) (*ppb.GetOndListResponse, error) {
resp, err := api.GetDevices(ctx, p.endpoint, p.id.String())
if err != nil {
return nil, err
}
return resp.Ond, nil
return resp, nil
}
// RemoveDevice removes a device from the controller
......@@ -108,22 +105,21 @@ func (p *PndAdapter) RemovePnd(ctx context.Context, pid uuid.UUID) (*core.Delete
// ChangeOND sends an API call to the controller requesting the creation of
// a change from the provided Operation, path and value. The Change is marked
// as Pending and times out after the specified timeout period
func (p *PndAdapter) ChangeOND(ctx context.Context, duid uuid.UUID, operation ppb.ApiOperation, path string, value ...string) (uuid.UUID, error) {
func (p *PndAdapter) ChangeOND(ctx context.Context, duid uuid.UUID, operation ppb.ApiOperation, path string, value ...string) (*ppb.SetPathListResponse, error) {
var v string
if len(value) != 0 {
v = value[0]
}
resp, err := api.ChangeRequest(ctx, p.endpoint, duid.String(), p.id.String(), path, v, operation)
if err != nil {
return uuid.Nil, err
return nil, err
}
log.Info(resp)
return uuid.Nil, err
return resp, err
}
// Request sends an API call to the controller requesting the specified path
// for the specified device
func (p *PndAdapter) Request(ctx context.Context, did uuid.UUID, path string) (proto.Message, error) {
func (p *PndAdapter) Request(ctx context.Context, did uuid.UUID, path string) (*ppb.GetPathResponse, error) {
resp, err := api.GetPath(ctx, p.endpoint, p.id.String(), did.String(), path)
if err != nil {
return nil, err
......@@ -169,22 +165,22 @@ func (p *PndAdapter) ContainsDevice(uuid.UUID) bool {
// GetSbi sends an API call to the controller requesting the
// registered SBI with the provided ID.
func (p *PndAdapter) GetSbi(ctx context.Context, sid ...string) ([]*spb.SouthboundInterface, error) {
resp, err := api.GetSbi(ctx, p.endpoint, p.id.String(), sid...)
func (p *PndAdapter) GetSbi(ctx context.Context, sid string) (*ppb.GetSbiResponse, error) {
resp, err := api.GetSbi(ctx, p.endpoint, p.id.String(), sid)
if err != nil {
return nil, err
}
return resp.Sbi, nil
return resp, nil
}
// GetSBIs sends an API call to the controller requesting the
// registered SBIs. Not implemented, always returns nil
func (p *PndAdapter) GetSBIs(ctx context.Context) ([]*spb.SouthboundInterface, error) {
func (p *PndAdapter) GetSBIs(ctx context.Context) (*ppb.GetSbiListResponse, error) {
resp, err := api.GetSBIs(ctx, p.endpoint, p.id.String())
if err != nil {
return nil, err
}
return resp.Sbi, nil
return resp, nil
}
// ID returns the PND Adapter's UUID
......@@ -199,57 +195,67 @@ func (p *PndAdapter) Endpoint() string {
// PendingChanges sends an API call to the controller requesting
// the UUIDs of all pending changes
func (p *PndAdapter) PendingChanges(ctx context.Context) []uuid.UUID {
func (p *PndAdapter) PendingChanges(ctx context.Context) ([]*ppb.Change, error) {
resp, err := api.GetChanges(ctx, p.endpoint, p.id.String())
if err != nil {
log.Error(err)
return nil
return nil, err
}
return filterChanges(ppb.ChangeState_CHANGE_STATE_PENDING, resp)
return filterChanges(ppb.ChangeState_CHANGE_STATE_PENDING, resp), nil
}
// CommittedChanges sends an API call to the controller requesting
// the UUIDs of all committed changes
func (p *PndAdapter) CommittedChanges(ctx context.Context) []uuid.UUID {
func (p *PndAdapter) CommittedChanges(ctx context.Context) ([]*ppb.Change, error) {
resp, err := api.GetChanges(ctx, p.endpoint, p.id.String())
if err != nil {
log.Error(err)
return nil
return nil, err
}
return filterChanges(ppb.ChangeState_CHANGE_STATE_COMMITTED, resp)
return filterChanges(ppb.ChangeState_CHANGE_STATE_COMMITTED, resp), nil
}
// GetChange sends an API call to the controller requesting the specified change
func (p *PndAdapter) GetChange(uuid.UUID) (change.Change, error) {
return nil, &errors.ErrNotYetImplemented{}
// ConfirmedChanges sends an API call to the controller requesting
// the UUIDs of all confirmed changes
func (p *PndAdapter) ConfirmedChanges(ctx context.Context) ([]*ppb.Change, error) {
resp, err := api.GetChanges(ctx, p.endpoint, p.id.String())
if err != nil {
return nil, err
}
return filterChanges(ppb.ChangeState_CHANGE_STATE_CONFIRMED, resp), nil
}
// GetChange sends an API call to the controller requesting one or more changes
// for the specific PND
func (p *PndAdapter) GetChange(ctx context.Context, identifier ...string) (*ppb.GetChangeResponse, error) {
resp, err := api.GetChange(ctx, p.endpoint, p.id.String(), identifier...)
if err != nil {
return nil, err
}
return resp, nil
}
// Commit sends an API call to the controller committing the specified change
func (p *PndAdapter) Commit(ctx context.Context, cuid uuid.UUID) error {
func (p *PndAdapter) Commit(ctx context.Context, cuid uuid.UUID) (*ppb.SetChangeListResponse, error) {
resp, err := api.Commit(ctx, p.endpoint, p.id.String(), cuid.String())
if err != nil {
return err
return nil, err
}
log.Info(resp)
return nil
return resp, nil
}
// Confirm sends an API call to the controller confirming the specified change
func (p *PndAdapter) Confirm(ctx context.Context, cuid uuid.UUID) error {
func (p *PndAdapter) Confirm(ctx context.Context, cuid uuid.UUID) (*ppb.SetChangeListResponse, error) {
resp, err := api.Confirm(ctx, p.endpoint, p.id.String(), cuid.String())
if err != nil {
return err
return nil, err
}
log.Info(resp)
return nil
return resp, nil
}
func filterChanges(state ppb.ChangeState, resp *ppb.GetChangeListResponse) []uuid.UUID {
changes := make([]uuid.UUID, 0)
func filterChanges(state ppb.ChangeState, resp *ppb.GetChangeListResponse) []*ppb.Change {
changes := make([]*ppb.Change, 0)
for _, ch := range resp.Change {
if ch.State == state {
id, _ := uuid.Parse(ch.Id)
changes = append(changes, id)
changes = append(changes, ch)
}
}
return changes
......
......@@ -385,7 +385,7 @@ func TestPndAdapter_PendingChanges(t *testing.T) {
id: tt.fields.id,
endpoint: tt.fields.endpoint,
}
if got := p.PendingChanges(context.TODO()); !reflect.DeepEqual(got, tt.want) {
if got, _ := p.PendingChanges(context.TODO()); !reflect.DeepEqual(got, tt.want) {
t.Errorf("PndAdapter.PendingChanges() = %v, want %v", got, tt.want)
}
})
......@@ -410,7 +410,7 @@ func TestPndAdapter_CommittedChanges(t *testing.T) {
id: tt.fields.id,
endpoint: tt.fields.endpoint,
}
if got := p.CommittedChanges(context.TODO()); !reflect.DeepEqual(got, tt.want) {
if got, _ := p.CommittedChanges(context.TODO()); !reflect.DeepEqual(got, tt.want) {
t.Errorf("PndAdapter.CommittedChanges() = %v, want %v", got, tt.want)
}
})
......@@ -423,7 +423,7 @@ func TestPndAdapter_GetChange(t *testing.T) {
endpoint string
}
type args struct {
in uuid.UUID
in []string
}
tests := []struct {
name string
......@@ -440,7 +440,7 @@ func TestPndAdapter_GetChange(t *testing.T) {
id: tt.fields.id,
endpoint: tt.fields.endpoint,
}
got, err := p.GetChange(tt.args.in)
got, err := p.GetChange(context.TODO(), tt.args.in...)
if (err != nil) != tt.wantErr {
t.Errorf("PndAdapter.GetChange() error = %v, wantErr %v", err, tt.wantErr)
return
......@@ -474,7 +474,7 @@ func TestPndAdapter_Commit(t *testing.T) {
id: tt.fields.id,
endpoint: tt.fields.endpoint,
}
if err := p.Commit(context.TODO(), tt.args.cuid); (err != nil) != tt.wantErr {
if _, err := p.Commit(context.TODO(), tt.args.cuid); (err != nil) != tt.wantErr {
t.Errorf("PndAdapter.Commit() error = %v, wantErr %v", err, tt.wantErr)
}
})
......@@ -503,7 +503,7 @@ func TestPndAdapter_Confirm(t *testing.T) {
id: tt.fields.id,
endpoint: tt.fields.endpoint,
}
if err := p.Confirm(context.TODO(), tt.args.cuid); (err != nil) != tt.wantErr {
if _, err := p.Confirm(context.TODO(), tt.args.cuid); (err != nil) != tt.wantErr {
t.Errorf("PndAdapter.Confirm() error = %v, wantErr %v", err, tt.wantErr)
}
})
......
......@@ -33,7 +33,7 @@ package cmd
import (
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
)
......@@ -48,10 +48,14 @@ Change UUID must be specified as positional argument.`,
Run: func(cmd *cobra.Command, args []string) {
cuid, err := uuid.Parse(args[0])
if err != nil {
log.Fatal(err)
pterm.Error.Println(err)
}
if err := pndAdapter.Commit(createContextWithAuthorization(), cuid); err != nil {
log.Fatal(err)
resp, err := pndAdapter.Commit(createContextWithAuthorization(), cuid)
if err != nil {
pterm.Error.Println(err)
}
for _, r := range resp.GetResponses() {
pterm.Info.Println(r.String())
}
},
}
......
......@@ -33,7 +33,7 @@ package cmd
import (
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
)
......@@ -48,10 +48,15 @@ Change UUID must be specified as positional argument`,
Run: func(cmd *cobra.Command, args []string) {
cuid, err := uuid.Parse(args[0])
if err != nil {
log.Fatal(err)
pterm.Error.Println(err)
}
if err := pndAdapter.Confirm(createContextWithAuthorization(), cuid); err != nil {
log.Fatal(err)
resp, err := pndAdapter.Confirm(createContextWithAuthorization(), cuid)
if err != nil {
pterm.Error.Println(err)
}
for _, r := range resp.GetResponses() {
pterm.Info.Println(r.String())
}
},
}
......
......@@ -32,44 +32,41 @@ POSSIBILITY OF SUCH DAMAGE.
package cmd
import (
"fmt"
"os"
log "github.com/sirupsen/logrus"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"google.golang.org/protobuf/encoding/protojson"
)
var controllerAPIEndpoint string
// confirmCmd represents the confirm command
var getCmd = &cobra.Command{
Use: "get [uuid]",
Args: cobra.ExactArgs(1),
Short: "returns information about the requested change",
Long: `Returns detailed information about a specific change. The
changes UUID has to be specified via a positional argument.`,
// initCmd represents the init command
var initCmd = &cobra.Command{
Use: "init",
Short: "initialise controller",
Long: `Initialise PND and SBI and saves values to config file on controller.
The --controller flag is required to change the controller address`,
Run: func(cmd *cobra.Command, args []string) {
changes, err := pndAdapter.GetChange(createContextWithAuthorization(), args[0])
if err != nil {
pterm.Error.Println(err)
}
for _, c := range changes.GetChange() {
title := pterm.Sprintf("Change with ID: %s", c.GetId())
panel1 := pterm.DefaultBox.WithTitle("Age:").Sprint(c.GetAge())
panel2 := pterm.DefaultBox.WithTitle("State:").Sprint(c.GetState())
panel3 := pterm.DefaultBox.WithTitle("Diff:").Sprint(protojson.Format(c.GetDiff()))
RunE: func(cmd *cobra.Command, args []string) error {
log.Infof("New controller address: %v", viper.GetString("controllerAPIEndpoint"))
panels, _ := pterm.DefaultPanel.WithPanels(pterm.Panels{
{{Data: panel1}},
{{Data: panel2}},
{{Data: panel3}},
}).Srender()
if err := viper.WriteConfig(); err != nil {
fmt.Fprintln(os.Stderr, "Could not write config:", err)
pterm.DefaultBox.WithTitle(title).WithTitleTopCenter().WithRightPadding(0).WithBottomPadding(0).Println(panels)
}
return nil
},
}
func init() {
rootCmd.AddCommand(initCmd)
initCmd.Flags().StringVar(&controllerAPIEndpoint, "controller", "gosdn-develop.apps.ocp.fbi.h-da.de:55055", "address of the controller")
err := viper.BindPFlag("controllerAPIEndpoint", initCmd.Flags().Lookup("controller"))
if err != nil {
fmt.Fprintln(os.Stderr, "Could not bind controllerAPIEndpoint:", err)
}
// Set controller flag as required (possibly not?)
//if err := initCmd.MarkFlagRequired("controller"); err != nil {
// fmt.Fprintln(os.Stderr, "Could not mark controller flag as required:", err)
//}
changeCmd.AddCommand(getCmd)
}
......@@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
package cmd
import (
log "github.com/sirupsen/logrus"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
)
......@@ -43,17 +43,33 @@ var changeListCmd = &cobra.Command{
Short: "list all changes",
Long: `Lists all configuration changes with their UUIDs.`,
Run: func(cmd *cobra.Command, args []string) {
committed := pndAdapter.CommittedChanges(createContextWithAuthorization())
log.Info("committed changes:")
for i, ch := range committed {
log.Infof(" Change %v: %v", i+1, ch.String())
RunE: func(cmd *cobra.Command, args []string) error {
spinner, _ := pterm.DefaultSpinner.Start("Process change list request")
committed, err := pndAdapter.CommittedChanges(createContextWithAuthorization())
if err != nil {
spinner.Fail(err)
return err
}
pending := pndAdapter.PendingChanges(createContextWithAuthorization())
log.Info("pending changes:")
for i, ch := range pending {
log.Infof(" Change %v: %v", i+1, ch.String())
pending, err := pndAdapter.PendingChanges(createContextWithAuthorization())
if err != nil {
spinner.Fail(err)
return err
}
// TODO: maybe we want to return more information about changes? E.g.,
// the diff of the change (probably only for a single get of a change).
// This would require us to change pndAdapter methods.
data := pterm.TableData{[]string{"UUID", "Status"}}
for _, ch := range pending {
data = append(data, []string{ch.String(), "pending"})
}
for _, ch := range committed {
data = append(data, []string{ch.String(), "commited"})
}
spinner.Success()
pterm.DefaultTable.WithHasHeader().WithData(data).Render()
return nil
},
}
......
......@@ -33,9 +33,8 @@ package cmd
import (
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
"google.golang.org/protobuf/encoding/protojson"
spb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/southbound"
tpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/transport"
......@@ -50,8 +49,10 @@ Device address must be provided with IP and port,e.g., 192.168.1.1:6030. User cr
if they diverge from the default credentials (user:'admin' and pw:'arista').`,
RunE: func(cmd *cobra.Command, args []string) error {
spinner, _ := pterm.DefaultSpinner.Start("Creating new device")
err := checkIPPort(address)
if err != nil {
spinner.Fail(err)
return err
}
......@@ -73,16 +74,19 @@ if they diverge from the default credentials (user:'admin' and pw:'arista').`,
}
sid, err := uuid.Parse(cliSbi)
if err != nil {
spinner.Fail(err)
return err
}
resp, err := pndAdapter.AddDevice(createContextWithAuthorization(), deviceName, opt, sid)
if err != nil {
spinner.Fail(err)
return err
}
log.Info(protojson.Format(resp))
for _, r := range resp.GetResponses() {
spinner.Success("Device has been created with ID: ", r.GetId())
}
return nil
},
}
......
......@@ -34,7 +34,7 @@ package cmd
import (
ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
)
......@@ -46,17 +46,27 @@ var deviceDeleteCmd = &cobra.Command{
Long: `Delete a path for a given orchestrated network device.
The device UUID and request path must be specified as a positional arguments.`,
Run: func(cmd *cobra.Command, args []string) {
RunE: func(cmd *cobra.Command, args []string) error {
spinner, _ := pterm.DefaultSpinner.Start("Create a path deletion request.")
did, err := uuid.Parse(args[0])
if err != nil {
log.Fatal(err)
spinner.Fail(err)
return err
}
log.Info(pndAdapter.ChangeOND(
resp, err := pndAdapter.ChangeOND(
createContextWithAuthorization(),
did,
ppb.ApiOperation_API_OPERATION_DELETE,
args[1],
))
)
for _, r := range resp.Responses {
if r.Status == ppb.Status_STATUS_OK {
spinner.Success("A change for path deletion for Device: ", did.String(), "has been created -> Change ID: ", r.GetId())
} else {
spinner.Fail("An error occured while creating a path deletion request for Device with ID: ", r.GetId(), r.GetStatus())
}
}
return nil
},
}
......
......@@ -33,7 +33,7 @@ package cmd
import (
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
"google.golang.org/protobuf/encoding/protojson"
)
......@@ -46,22 +46,37 @@ var deviceGetCmd = &cobra.Command{
Long: `Requests a path from a specified orchestrated network device on the controller.
The device UUID and request path must be specified as a positional arguments.`,
Run: func(cmd *cobra.Command, args []string) {
RunE: func(cmd *cobra.Command, args []string) error {
did, err := uuid.Parse(args[0])
if err != nil {
log.Fatal(err)
pterm.Error.Println(err)
return err
}
message, err := pndAdapter.Request(
res, err := pndAdapter.Request(
createContextWithAuthorization(),
did,
args[1],
)
if err != nil {
log.Error(err)
pterm.Error.Println(err)
return err
}
log.Info(protojson.Format(message))
for _, n := range res.Device {
panel1 := pterm.DefaultBox.WithTitle("Timestamp:").Sprint(n.GetTimestamp())
panel2 := pterm.DefaultBox.WithTitle("Requested Path:").Sprint(args[1])
panel3 := pterm.DefaultBox.WithTitle("Update:").Sprint(protojson.Format(n.Update[0]))
panels, _ := pterm.DefaultPanel.WithPanels(pterm.Panels{
{{Data: panel1}},
{{Data: panel2}},
{{Data: panel3}},
}).Srender()
pterm.DefaultBox.WithRightPadding(0).WithBottomPadding(0).Println(panels)
}
return nil
},
}
......