summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2019-05-27 02:58:55 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-27 02:58:55 +0000
commit98fdb49bd98debd97fe62c5daa3ca54228ae74bf (patch)
tree31384fbc0827b4afa09431ed213efbd29cf6a322 /src
parent5403852b41fdaef7f849178e00b93bff10940ff5 (diff)
parentea3f76b78378350564b58e46c9da44cf67a269ec (diff)
Merge "Remove env variable"0.4.0
Diffstat (limited to 'src')
-rw-r--r--src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go b/src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go
index 3f5d80ba..d8f354fb 100644
--- a/src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go
+++ b/src/k8splugin/plugins/ovn4nfvk8s-network/plugin.go
@@ -16,17 +16,17 @@ package main
import (
"bytes"
"fmt"
- kexec "k8s.io/utils/exec"
- "os"
-
- pkgerrors "github.com/pkg/errors"
- "k8splugin/plugins/network/v1"
"log"
+ "math/rand"
"strings"
+ "time"
"unicode"
- "math/rand"
- "time"
+ "k8splugin/internal/config"
+ v1 "k8splugin/plugins/network/v1"
+
+ pkgerrors "github.com/pkg/errors"
+ kexec "k8s.io/utils/exec"
)
const (
@@ -77,20 +77,20 @@ func init() {
// CreateNetwork in OVN controller
func CreateNetwork(network *v1.OnapNetwork) (string, error) {
- name := network.Spec.Name
- if name == "" {
- return "", pkgerrors.New("Invalid Network Name")
- }
+ name := network.Spec.Name
+ if name == "" {
+ return "", pkgerrors.New("Invalid Network Name")
+ }
- subnet := network.Spec.Subnet
- if subnet == "" {
- return "", pkgerrors.New("Invalid Subnet Address")
- }
+ subnet := network.Spec.Subnet
+ if subnet == "" {
+ return "", pkgerrors.New("Invalid Subnet Address")
+ }
- gatewayIPMask := network.Spec.Gateway
- if gatewayIPMask == "" {
- return "", pkgerrors.New("Invalid Gateway Address")
- }
+ 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 {
@@ -148,6 +148,6 @@ func DeleteNetwork(name string) error {
func getAuthStr() string {
//TODO: Remove hardcoding: Use ESR data passed to Initialize
- ovnCentralAddress := os.Getenv("OVN_CENTRAL_ADDRESS")
+ ovnCentralAddress := config.GetConfiguration().OVNCentralAddress
return "--db=tcp:" + ovnCentralAddress
}