From 44a2929ea7d1f56c3cbc5adc859d832ec9ce76d1 Mon Sep 17 00:00:00 2001
From: Fabian Helm <fabian.helm@stud.h-da.de>
Date: Thu, 3 Feb 2022 11:37:54 +0100
Subject: [PATCH] enabled multiple sids for getSbiRequest

---
 go/gosdn/pnd/pnd.pb.go                  | 12 ++++++------
 go/gosdn/pnd/pnd.pb.gw.go               |  4 ++--
 openapiv2/gosdn_northbound.swagger.json | 13 +++++++++----
 proto/gosdn/pnd/pnd.proto               |  2 +-
 4 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/go/gosdn/pnd/pnd.pb.go b/go/gosdn/pnd/pnd.pb.go
index 2c74f39..8148794 100644
--- a/go/gosdn/pnd/pnd.pb.go
+++ b/go/gosdn/pnd/pnd.pb.go
@@ -412,9 +412,9 @@ type GetSbiRequest struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Timestamp int64  `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Timestamp in nanoseconds since Epoch.
-	Sid       string `protobuf:"bytes,3,opt,name=sid,proto3" json:"sid,omitempty"`
-	Pid       string `protobuf:"bytes,4,opt,name=pid,proto3" json:"pid,omitempty"`
+	Timestamp int64    `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Timestamp in nanoseconds since Epoch.
+	Sid       []string `protobuf:"bytes,3,rep,name=sid,proto3" json:"sid,omitempty"`
+	Pid       string   `protobuf:"bytes,4,opt,name=pid,proto3" json:"pid,omitempty"`
 }
 
 func (x *GetSbiRequest) Reset() {
@@ -456,11 +456,11 @@ func (x *GetSbiRequest) GetTimestamp() int64 {
 	return 0
 }
 
-func (x *GetSbiRequest) GetSid() string {
+func (x *GetSbiRequest) GetSid() []string {
 	if x != nil {
 		return x.Sid
 	}
-	return ""
+	return nil
 }
 
 func (x *GetSbiRequest) GetPid() string {
@@ -2315,7 +2315,7 @@ var file_gosdn_pnd_pnd_proto_rawDesc = []byte{
 	0x70, 0x69, 0x64, 0x22, 0x51, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x53, 0x62, 0x69, 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, 0x73, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x6d, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52,
 	0x03, 0x73, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
 	0x09, 0x52, 0x03, 0x70, 0x69, 0x64, 0x22, 0x46, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61,
 	0x6e, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c,
diff --git a/go/gosdn/pnd/pnd.pb.gw.go b/go/gosdn/pnd/pnd.pb.gw.go
index e942ff6..2b75200 100644
--- a/go/gosdn/pnd/pnd.pb.gw.go
+++ b/go/gosdn/pnd/pnd.pb.gw.go
@@ -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.String(val)
+	protoReq.Sid, err = runtime.StringSlice(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.String(val)
+	protoReq.Sid, err = runtime.StringSlice(val, ",")
 	if err != nil {
 		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sid", err)
 	}
diff --git a/openapiv2/gosdn_northbound.swagger.json b/openapiv2/gosdn_northbound.swagger.json
index a769928..0d7b4e6 100644
--- a/openapiv2/gosdn_northbound.swagger.json
+++ b/openapiv2/gosdn_northbound.swagger.json
@@ -23,14 +23,14 @@
     {
       "name": "AgentManager"
     },
-    {
-      "name": "CoreService"
-    },
     {
       "name": "CsbiService"
     },
     {
       "name": "Collector"
+    },
+    {
+      "name": "CoreService"
     }
   ],
   "consumes": [
@@ -712,7 +712,12 @@
             "name": "sid",
             "in": "path",
             "required": true,
-            "type": "string"
+            "type": "array",
+            "items": {
+              "type": "string"
+            },
+            "collectionFormat": "csv",
+            "minItems": 1
           },
           {
             "name": "timestamp",
diff --git a/proto/gosdn/pnd/pnd.proto b/proto/gosdn/pnd/pnd.proto
index d7fd3f8..6bfb88a 100644
--- a/proto/gosdn/pnd/pnd.proto
+++ b/proto/gosdn/pnd/pnd.proto
@@ -134,7 +134,7 @@ message GetSbiListRequest {
 }
 message GetSbiRequest {
   int64 timestamp = 1;          // Timestamp in nanoseconds since Epoch.
-  string sid = 3;
+  repeated string sid = 3;
   string pid = 4;
 }
 
-- 
GitLab