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
9c33424a
Commit
9c33424a
authored
1 year ago
by
Fabian Seidl
Browse files
Options
Downloads
Patches
Plain Diff
add API stuff for configuration management
parent
e17e6adc
No related branches found
No related tags found
1 merge request
!790
Resolve "Update gRPC abstraction API with missing calls and refactoring"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
controller/api/configurationManagement.go
+38
-0
38 additions, 0 deletions
controller/api/configurationManagement.go
controller/northbound/client/configurationManagement.go
+17
-0
17 additions, 0 deletions
controller/northbound/client/configurationManagement.go
with
55 additions
and
0 deletions
controller/api/configurationManagement.go
0 → 100644
+
38
−
0
View file @
9c33424a
package
api
import
(
"context"
"time"
cpb
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/configurationmanagement"
nbi
"code.fbi.h-da.de/danet/gosdn/controller/northbound/client"
)
// ExportSDNConfig returns the SDN configuration.
func
ExportSDNConfig
(
ctx
context
.
Context
,
addr
,
pid
string
)
(
*
cpb
.
ExportSDNConfigResponse
,
error
)
{
configClient
,
err
:=
nbi
.
ConfigurationManagementClient
(
addr
,
dialOptions
...
)
if
err
!=
nil
{
return
nil
,
err
}
req
:=
&
cpb
.
ExportSDNConfigRequest
{
Timestamp
:
time
.
Now
()
.
UnixNano
(),
Pid
:
pid
,
}
return
configClient
.
ExportSDNConfig
(
ctx
,
req
)
}
// ImportSDNConfig receives an SDN configuration and imports it.
func
ImportSDNConfig
(
ctx
context
.
Context
,
addr
,
pid
,
sdnConfigData
string
)
(
*
cpb
.
ImportSDNConfigResponse
,
error
)
{
configClient
,
err
:=
nbi
.
ConfigurationManagementClient
(
addr
,
dialOptions
...
)
if
err
!=
nil
{
return
nil
,
err
}
req
:=
&
cpb
.
ImportSDNConfigRequest
{
Timestamp
:
time
.
Now
()
.
UnixNano
(),
Pid
:
pid
,
SdnConfigData
:
sdnConfigData
,
}
return
configClient
.
ImportSDNConfig
(
ctx
,
req
)
}
This diff is collapsed.
Click to expand it.
controller/northbound/client/configurationManagement.go
0 → 100644
+
17
−
0
View file @
9c33424a
package
client
import
(
cpb
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/configurationmanagement"
"google.golang.org/grpc"
)
// ConfigurationManagementClient returns a client for the gRPC ConfigurationManagement service. It takes
// the address of the gRPC endpoint and optional grpc.DialOption
// as argument.
func
ConfigurationManagementClient
(
addr
string
,
opts
...
grpc
.
DialOption
)
(
cpb
.
ConfigurationManagementServiceClient
,
error
)
{
conn
,
err
:=
grpc
.
Dial
(
addr
,
opts
...
)
if
err
!=
nil
{
return
nil
,
err
}
return
cpb
.
NewConfigurationManagementServiceClient
(
conn
),
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