Adapt network plugin to interface restrictions 12/91812/1
authorKonrad Bańka <k.banka@samsung.com>
Mon, 22 Jul 2019 13:48:31 +0000 (15:48 +0200)
committerKonrad Bańka <k.banka@samsung.com>
Mon, 22 Jul 2019 13:48:31 +0000 (15:48 +0200)
Network plugin was not fully compliant with interface it should
implement due to type of one function argument. Relevant functions
have been adapted to utilize proper types.

Issue-ID: MULTICLOUD-708

Signed-off-by: Konrad Bańka <k.banka@samsung.com>
Change-Id: Ic619ad476dba5e6582759290e18edceaa98c332f

src/k8splugin/plugins/network/plugin.go

index e69a075..ca5aa95 100644 (file)
@@ -18,8 +18,8 @@ import (
        "regexp"
 
        utils "github.com/onap/multicloud-k8s/src/k8splugin/internal"
-       "github.com/onap/multicloud-k8s/src/k8splugin/internal/app"
        "github.com/onap/multicloud-k8s/src/k8splugin/internal/helm"
+       "github.com/onap/multicloud-k8s/src/k8splugin/internal/plugin"
 
        pkgerrors "github.com/pkg/errors"
        "k8s.io/apimachinery/pkg/runtime/schema"
@@ -43,7 +43,7 @@ func extractData(data string) (cniType, networkName string) {
 }
 
 // Create an ONAP Network object
-func (p networkPlugin) Create(yamlFilePath string, namespace string, client *app.KubernetesClient) (string, error) {
+func (p networkPlugin) Create(yamlFilePath string, namespace string, client plugin.KubernetesConnector) (string, error) {
        network := &v1.OnapNetwork{}
        if _, err := utils.DecodeYAML(yamlFilePath, network); err != nil {
                return "", pkgerrors.Wrap(err, "Decode network object error")
@@ -69,19 +69,19 @@ func (p networkPlugin) Create(yamlFilePath string, namespace string, client *app
 }
 
 // Get a Network
-func (p networkPlugin) Get(resource helm.KubernetesResource, namespace string, client *app.KubernetesClient) (string, error) {
+func (p networkPlugin) Get(resource helm.KubernetesResource, namespace string, client plugin.KubernetesConnector) (string, error) {
        return "", nil
 }
 
 // List of Networks
 func (p networkPlugin) List(gvk schema.GroupVersionKind, namespace string,
-       client *app.KubernetesClient) ([]helm.KubernetesResource, error) {
+       client plugin.KubernetesConnector) ([]helm.KubernetesResource, error) {
 
        return nil, nil
 }
 
 // Delete an existing Network
-func (p networkPlugin) Delete(resource helm.KubernetesResource, namespace string, client *app.KubernetesClient) error {
+func (p networkPlugin) Delete(resource helm.KubernetesResource, namespace string, client plugin.KubernetesConnector) error {
        cniType, networkName := extractData(resource.Name)
        typePlugin, ok := utils.LoadedPlugins[cniType+"-network"]
        if !ok {