Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
goSDN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
goSDN
Commits
58bc4a98
Commit
58bc4a98
authored
2 years ago
by
Malte Bauch
Committed by
Malte Bauch
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Removed multiple calls of pnd.GetDevice for a NBI request of all devices
parent
cec566bb
No related branches found
No related tags found
2 merge requests
!352
Draft: Resolve "Structs like LoadedDevice, LoadedSbi, LoadedRole, LoadedUser are never passed as pointer"
,
!347
Resolve "Requesting information from the Controller via NBI takes very long"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
controller/northbound/server/pnd.go
+22
-14
22 additions, 14 deletions
controller/northbound/server/pnd.go
controller/nucleus/principalNetworkDomain.go
+1
-0
1 addition, 0 deletions
controller/nucleus/principalNetworkDomain.go
with
23 additions
and
14 deletions
controller/northbound/server/pnd.go
+
22
−
14
View file @
58bc4a98
...
@@ -8,6 +8,7 @@ import (
...
@@ -8,6 +8,7 @@ import (
ppb
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd"
ppb
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd"
spb
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/southbound"
spb
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/southbound"
"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/networkdomain"
"code.fbi.h-da.de/danet/gosdn/controller/metrics"
"code.fbi.h-da.de/danet/gosdn/controller/metrics"
"code.fbi.h-da.de/danet/gosdn/controller/nucleus"
"code.fbi.h-da.de/danet/gosdn/controller/nucleus"
...
@@ -52,7 +53,13 @@ func (p PndServer) GetOnd(ctx context.Context, request *ppb.GetOndRequest) (*ppb
...
@@ -52,7 +53,13 @@ func (p PndServer) GetOnd(ctx context.Context, request *ppb.GetOndRequest) (*ppb
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
}
}
ond
,
err
:=
fillOndBySpecificPath
(
pnd
,
request
.
Did
,
"/"
)
device
,
err
:=
pnd
.
GetDevice
(
request
.
Did
)
if
err
!=
nil
{
log
.
Error
(
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
}
ond
,
err
:=
fillOndBySpecificPath
(
pnd
,
device
,
"/"
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
...
@@ -85,14 +92,15 @@ func (p PndServer) GetOndList(ctx context.Context, request *ppb.GetOndListReques
...
@@ -85,14 +92,15 @@ func (p PndServer) GetOndList(ctx context.Context, request *ppb.GetOndListReques
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
}
}
onds
:=
make
([]
*
ppb
.
OrchestratedNetworkingDevice
,
len
(
pnd
.
Devices
()))
onds
:=
pnd
.
Devices
()
for
i
,
ond
:=
range
pnd
.
Devices
()
{
ondsBySpecificPath
:=
make
([]
*
ppb
.
OrchestratedNetworkingDevice
,
len
(
onds
))
ond
,
err
:=
fillOndBySpecificPath
(
pnd
,
ond
.
ID
()
.
String
(),
"/"
)
for
i
,
ond
:=
range
onds
{
ond
,
err
:=
fillOndBySpecificPath
(
pnd
,
ond
,
"/"
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
}
}
onds
[
i
]
=
ond
onds
BySpecificPath
[
i
]
=
ond
}
}
return
&
ppb
.
GetOndListResponse
{
return
&
ppb
.
GetOndListResponse
{
...
@@ -102,17 +110,11 @@ func (p PndServer) GetOndList(ctx context.Context, request *ppb.GetOndListReques
...
@@ -102,17 +110,11 @@ func (p PndServer) GetOndList(ctx context.Context, request *ppb.GetOndListReques
Name
:
pnd
.
GetName
(),
Name
:
pnd
.
GetName
(),
Description
:
pnd
.
GetDescription
(),
Description
:
pnd
.
GetDescription
(),
},
},
Ond
:
onds
,
Ond
:
onds
BySpecificPath
,
},
nil
},
nil
}
}
func
fillOndBySpecificPath
(
pnd
networkdomain
.
NetworkDomain
,
did
string
,
path
string
)
(
*
ppb
.
OrchestratedNetworkingDevice
,
error
)
{
func
fillOndBySpecificPath
(
pnd
networkdomain
.
NetworkDomain
,
d
device
.
Device
,
path
string
)
(
*
ppb
.
OrchestratedNetworkingDevice
,
error
)
{
d
,
err
:=
pnd
.
GetDevice
(
did
)
if
err
!=
nil
{
log
.
Error
(
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
}
gnmiPath
,
err
:=
ygot
.
StringToStructuredPath
(
path
)
gnmiPath
,
err
:=
ygot
.
StringToStructuredPath
(
path
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
...
@@ -294,6 +296,12 @@ func (p PndServer) GetPath(ctx context.Context, request *ppb.GetPathRequest) (*p
...
@@ -294,6 +296,12 @@ func (p PndServer) GetPath(ctx context.Context, request *ppb.GetPathRequest) (*p
log
.
Error
(
err
)
log
.
Error
(
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
}
}
device
,
err
:=
pnd
.
GetDevice
(
request
.
Did
)
if
err
!=
nil
{
log
.
Error
(
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
}
duid
,
err
:=
uuid
.
Parse
(
request
.
Did
)
duid
,
err
:=
uuid
.
Parse
(
request
.
Did
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
...
@@ -309,7 +317,7 @@ func (p PndServer) GetPath(ctx context.Context, request *ppb.GetPathRequest) (*p
...
@@ -309,7 +317,7 @@ func (p PndServer) GetPath(ctx context.Context, request *ppb.GetPathRequest) (*p
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
}
}
ond
,
err
:=
fillOndBySpecificPath
(
pnd
,
request
.
Did
,
path
)
ond
,
err
:=
fillOndBySpecificPath
(
pnd
,
device
,
path
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
Aborted
,
"%v"
,
err
)
...
...
This diff is collapsed.
Click to expand it.
controller/nucleus/principalNetworkDomain.go
+
1
−
0
View file @
58bc4a98
...
@@ -260,6 +260,7 @@ func (pnd *pndImplementation) AddDevice(name string, opt *tpb.TransportOption, s
...
@@ -260,6 +260,7 @@ func (pnd *pndImplementation) AddDevice(name string, opt *tpb.TransportOption, s
return
pnd
.
addDevice
(
d
)
return
pnd
.
addDevice
(
d
)
}
}
// TODO: (maba): This should be changed to UUID
func
(
pnd
*
pndImplementation
)
GetDevice
(
identifier
string
)
(
device
.
Device
,
error
)
{
func
(
pnd
*
pndImplementation
)
GetDevice
(
identifier
string
)
(
device
.
Device
,
error
)
{
id
,
err
:=
uuid
.
Parse
(
identifier
)
id
,
err
:=
uuid
.
Parse
(
identifier
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment