summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go
diff options
context:
space:
mode:
authorRitu Sood <ritu.sood@intel.com>2019-05-14 16:36:48 +0000
committerRitu Sood <ritu.sood@intel.com>2019-05-14 16:44:47 +0000
commit9b2e8b3e41dd89bd1cb9a661a10d5d76125af5b1 (patch)
tree92dc5ba622c8e9a746a1c025c7404a513df1c444 /src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go
parent52853025e3b450957fa3813cb4e9861f3573510a (diff)
Change format of the network file
Format of network file is different between KUD and Plugin. Change the format to match the format in KUD Change-Id: I360741b23e91e60d790a50a7eeb213576b0508b3 Signed-off-by: Ritu Sood <ritu.sood@intel.com> Issue-ID: MULTICLOUD-304
Diffstat (limited to 'src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go')
-rw-r--r--src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go b/src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go
index 959586bc..32bca8fb 100644
--- a/src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go
+++ b/src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go
@@ -76,25 +76,21 @@ func init() {
// CreateNetwork in OVN controller
func CreateNetwork(network *v1.OnapNetwork) (string, error) {
- config, err := network.DecodeConfig()
- if err != nil {
- return "", err
- }
- name := config["name"].(string)
- if name == "" {
- return "", pkgerrors.New("Empty Name value")
- }
+ name := network.Spec.Name
+ if name == "" {
+ return "", pkgerrors.New("Invalid Network Name")
+ }
- subnet := config["subnet"].(string)
- if subnet == "" {
- return "", pkgerrors.New("Empty Subnet value")
- }
+ subnet := network.Spec.Subnet
+ if subnet == "" {
+ return "", pkgerrors.New("Invalid Subnet Address")
+ }
- gatewayIPMask := config["gateway"].(string)
- if gatewayIPMask == "" {
- return "", pkgerrors.New("Empty Gateway IP Mask")
- }
+ gatewayIPMask := network.Spec.Gateway
+ if gatewayIPMask == "" {
+ return "", pkgerrors.New("Invalid Gateway Address")
+ }
routerMac, stderr, err := ovnCmd.Run(getAuthStr(), "--if-exist", "-v", "get", "logical_router_port", "rtos-"+name, "mac")
if err != nil {