Skip to content
Snippets Groups Projects

Resolve "Containerised Southbound Interfaces and the corresponding device config representation within the controller"

1 file
+ 9
0
Compare changes
  • Side-by-side
  • Inline
@@ -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 {
Loading