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
eb12fc49
Commit
eb12fc49
authored
3 years ago
by
Malte Bauch
Browse files
Options
Downloads
Patches
Plain Diff
commented createPlugin, loadPlugin functions and requestPlugin method
parent
c6c527dd
No related branches found
No related tags found
1 merge request
!230
Resolve "Containerised Southbound Interfaces and the corresponding device config representation within the controller"
Pipeline
#91806
passed
3 years ago
Stage: build
Stage: test
Stage: analyze
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nucleus/principalNetworkDomain.go
+9
-0
9 additions, 0 deletions
nucleus/principalNetworkDomain.go
with
9 additions
and
0 deletions
nucleus/principalNetworkDomain.go
+
9
−
0
View file @
eb12fc49
...
@@ -464,6 +464,11 @@ func (pnd *pndImplementation) createCsbiDevice(ctx context.Context, name string,
...
@@ -464,6 +464,11 @@ func (pnd *pndImplementation) createCsbiDevice(ctx context.Context, name string,
return
nil
return
nil
}
}
// requestPlugin is a feature for cSBIs and sends a plugin request to the cSBI
// orchestrator and processes the received ygot generated go code, builds the plugin
// and integrates the Plugin within the goSDN as SouthboundInterface. The
// generated code is passed into a gostruct.go file, which is the foundation
// for the created plugin.
func
(
pnd
*
pndImplementation
)
requestPlugin
(
name
string
,
opt
*
tpb
.
TransportOption
)
(
southbound
.
SouthboundInterface
,
error
)
{
func
(
pnd
*
pndImplementation
)
requestPlugin
(
name
string
,
opt
*
tpb
.
TransportOption
)
(
southbound
.
SouthboundInterface
,
error
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
time
.
Minute
*
10
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
time
.
Minute
*
10
)
defer
cancel
()
defer
cancel
()
...
@@ -514,6 +519,8 @@ func (pnd *pndImplementation) requestPlugin(name string, opt *tpb.TransportOptio
...
@@ -514,6 +519,8 @@ func (pnd *pndImplementation) requestPlugin(name string, opt *tpb.TransportOptio
return
loadPlugin
(
id
,
folderName
)
return
loadPlugin
(
id
,
folderName
)
}
}
// createPlugin builds a go plugin from ygot generated go code provided within
// a plugin folder.
func
createPlugin
(
id
uuid
.
UUID
,
folderName
string
)
error
{
func
createPlugin
(
id
uuid
.
UUID
,
folderName
string
)
error
{
pPath
:=
folderName
+
id
.
String
()
+
"/plugin.so"
pPath
:=
folderName
+
id
.
String
()
+
"/plugin.so"
sPath
:=
folderName
+
id
.
String
()
+
"/gostructs.go"
sPath
:=
folderName
+
id
.
String
()
+
"/gostructs.go"
...
@@ -538,6 +545,8 @@ func createPlugin(id uuid.UUID, folderName string) error {
...
@@ -538,6 +545,8 @@ func createPlugin(id uuid.UUID, folderName string) error {
return
nil
return
nil
}
}
// loadPlugin loads a go plugin as SouthboundInterface from within a plugin
// folder.
func
loadPlugin
(
id
uuid
.
UUID
,
folderName
string
)
(
southbound
.
SouthboundInterface
,
error
)
{
func
loadPlugin
(
id
uuid
.
UUID
,
folderName
string
)
(
southbound
.
SouthboundInterface
,
error
)
{
p
,
err
:=
plugin
.
Open
(
folderName
+
id
.
String
()
+
"/plugin.so"
)
p
,
err
:=
plugin
.
Open
(
folderName
+
id
.
String
()
+
"/plugin.so"
)
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