aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/plugins/network/v1/types.go
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2019-05-16 01:23:52 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-16 01:23:52 +0000
commitfe05f71354a64e761bcd4d8b2307d7ede8164302 (patch)
tree88e0226379fa533d7b7b8dba336c12163c5a1329 /src/k8splugin/plugins/network/v1/types.go
parent82cbd4cf2d85f4e1025e3477c92f706d61cf875a (diff)
parent9b2e8b3e41dd89bd1cb9a661a10d5d76125af5b1 (diff)
Merge "Change format of the network file"
Diffstat (limited to 'src/k8splugin/plugins/network/v1/types.go')
-rw-r--r--src/k8splugin/plugins/network/v1/types.go23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/k8splugin/plugins/network/v1/types.go b/src/k8splugin/plugins/network/v1/types.go
index b4efa39a..96484efa 100644
--- a/src/k8splugin/plugins/network/v1/types.go
+++ b/src/k8splugin/plugins/network/v1/types.go
@@ -14,9 +14,7 @@ limitations under the License.
package v1
import (
- "encoding/json"
- pkgerrors "github.com/pkg/errors"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -33,7 +31,11 @@ type OnapNetwork struct {
// OnapNetworkSpec is the spec for OnapNetwork resource
type OnapNetworkSpec struct {
- Config string `json:"config"`
+ CniType string `json:"cnitype"`
+ Name string `json:"name"`
+ Subnet string `json:"subnet"`
+ Gateway string `json:"gateway"`
+
}
// DeepCopyObject returns a generically typed copy of an object
@@ -50,18 +52,3 @@ func (in OnapNetwork) DeepCopyObject() runtime.Object {
func (in OnapNetwork) GetObjectKind() schema.ObjectKind {
return &in.TypeMeta
}
-
-// DecodeConfig content
-func (in OnapNetwork) DecodeConfig() (map[string]interface{}, error) {
- var raw map[string]interface{}
-
- if in.Spec.Config == "" {
- return nil, pkgerrors.New("Invalid configuration value")
- }
-
- if err := json.Unmarshal([]byte(in.Spec.Config), &raw); err != nil {
- return nil, pkgerrors.Wrap(err, "JSON unmarshalling error")
- }
-
- return raw, nil
-}