From eb12fc49e50c1a7e2e9f96ebdf9b34b0e22d379d Mon Sep 17 00:00:00 2001
From: Malte Bauch <malte.bauch@stud.h-da.de>
Date: Tue, 18 Jan 2022 16:35:34 +0100
Subject: [PATCH] commented createPlugin, loadPlugin functions and
 requestPlugin method

---
 nucleus/principalNetworkDomain.go | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/nucleus/principalNetworkDomain.go b/nucleus/principalNetworkDomain.go
index 1a5215bf1..99f181eb8 100644
--- a/nucleus/principalNetworkDomain.go
+++ b/nucleus/principalNetworkDomain.go
@@ -464,6 +464,11 @@ func (pnd *pndImplementation) createCsbiDevice(ctx context.Context, name string,
 	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) {
 	ctx, cancel := context.WithTimeout(context.Background(), time.Minute*10)
 	defer cancel()
@@ -514,6 +519,8 @@ func (pnd *pndImplementation) requestPlugin(name string, opt *tpb.TransportOptio
 	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 {
 	pPath := folderName + id.String() + "/plugin.so"
 	sPath := folderName + id.String() + "/gostructs.go"
@@ -538,6 +545,8 @@ func createPlugin(id uuid.UUID, folderName string) error {
 	return nil
 }
 
+// loadPlugin loads a go plugin as SouthboundInterface from within a plugin
+// folder.
 func loadPlugin(id uuid.UUID, folderName string) (southbound.SouthboundInterface, error) {
 	p, err := plugin.Open(folderName + id.String() + "/plugin.so")
 	if err != nil {
-- 
GitLab