Skip to content
Snippets Groups Projects
Commit eb12fc49 authored by Malte Bauch's avatar Malte Bauch
Browse files

commented createPlugin, loadPlugin functions and requestPlugin method

parent c6c527dd
Branches
No related tags found
1 merge request!230Resolve "Containerised Southbound Interfaces and the corresponding device config representation within the controller"
Pipeline #91806 passed
This commit is part of merge request !230. Comments created here will be created in the context of that merge request.
...@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment