aboutsummaryrefslogtreecommitdiffstats
path: root/internal/pkg/nfnNotify
diff options
context:
space:
mode:
authorKuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>2020-07-06 16:10:19 -0700
committerKuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>2020-09-17 16:25:10 -0700
commitce14abc0128d4c55a7805c52ea199e2ce6159428 (patch)
tree569f74510b497ed44814e931a4667de73d133ab0 /internal/pkg/nfnNotify
parent3de63ee756f9d7c0a4524b40a89e92b918a9249f (diff)
Adding node interface, SNAT and OVN Node switch port
- Adding nfn proto for node interface MAC and IP address - Adding node switch ports in NFN Operator - Adding grpc client in nfn agent to get mac and IP address for node interface - Adding feature to create Node interface with OVS internal port - Make sure pod controller requeue the pod request for empty node field in pod spec - Unique node interface name using SHA and maintain 15 charactor for OVS switch port - Adding SNAT for default interface in each node - Adding iptables modules for SNAT rules Signed-off-by: Kuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com> Change-Id: I6cfa36e45007e796eb651345f9f0751329defcf7
Diffstat (limited to 'internal/pkg/nfnNotify')
-rw-r--r--internal/pkg/nfnNotify/proto/nfn.pb.go75
-rw-r--r--internal/pkg/nfnNotify/proto/nfn.proto2
-rw-r--r--internal/pkg/nfnNotify/server.go13
3 files changed, 60 insertions, 30 deletions
diff --git a/internal/pkg/nfnNotify/proto/nfn.pb.go b/internal/pkg/nfnNotify/proto/nfn.pb.go
index d419af8..750d55b 100644
--- a/internal/pkg/nfnNotify/proto/nfn.pb.go
+++ b/internal/pkg/nfnNotify/proto/nfn.pb.go
@@ -371,6 +371,8 @@ func (m *DirectInfo) GetProviderIntf() string {
}
type InSync struct {
+ NodeIntfIpAddress string `protobuf:"bytes,1,opt,name=node_intf_ip_address,json=nodeIntfIpAddress,proto3" json:"node_intf_ip_address,omitempty"`
+ NodeIntfMacAddress string `protobuf:"bytes,2,opt,name=node_intf_mac_address,json=nodeIntfMacAddress,proto3" json:"node_intf_mac_address,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -401,6 +403,20 @@ func (m *InSync) XXX_DiscardUnknown() {
var xxx_messageInfo_InSync proto.InternalMessageInfo
+func (m *InSync) GetNodeIntfIpAddress() string {
+ if m != nil {
+ return m.NodeIntfIpAddress
+ }
+ return ""
+}
+
+func (m *InSync) GetNodeIntfMacAddress() string {
+ if m != nil {
+ return m.NodeIntfMacAddress
+ }
+ return ""
+}
+
func init() {
proto.RegisterType((*SubscribeContext)(nil), "SubscribeContext")
proto.RegisterType((*Notification)(nil), "Notification")
@@ -416,34 +432,37 @@ func init() {
}
var fileDescriptor_5b809db4a7814953 = []byte{
- // 431 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x5d, 0x6f, 0xd3, 0x30,
- 0x14, 0x5d, 0xd8, 0x94, 0x34, 0xb7, 0x1d, 0x74, 0x16, 0x1f, 0x05, 0x84, 0x34, 0xbc, 0x97, 0x8a,
- 0x87, 0x6c, 0x8c, 0x57, 0x9e, 0x18, 0x42, 0x8b, 0x84, 0x22, 0x94, 0x21, 0x5e, 0x2d, 0xd7, 0x71,
- 0x90, 0xb5, 0xf4, 0x3a, 0xf2, 0x4c, 0x4b, 0x7e, 0x00, 0xbf, 0x83, 0xbf, 0xc7, 0xcf, 0x40, 0xb1,
- 0x93, 0x35, 0x5d, 0xf7, 0xb2, 0x37, 0xfb, 0x9e, 0xeb, 0x73, 0xce, 0xbd, 0x3a, 0x86, 0x18, 0x4b,
- 0x4c, 0x6a, 0xa3, 0xad, 0xa6, 0xa7, 0x30, 0xbd, 0xfa, 0xb5, 0xb8, 0x11, 0x46, 0x2d, 0xe4, 0x85,
- 0x46, 0x2b, 0x7f, 0x5b, 0xf2, 0x1a, 0x62, 0xd4, 0x85, 0x64, 0xc8, 0x97, 0x72, 0x16, 0x1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x38, 0x81, 0x13, 0xfb, 0xb6, 0xeb, 0x55, 0xa6, 0x0a, 0xc6, 0xd3,
+ 0xb4, 0x94, 0x8b, 0x45, 0xc3, 0x1a, 0xd6, 0x58, 0xcd, 0x88, 0x8b, 0xf7, 0x0e, 0xc0, 0x4b, 0x38,
+ 0xdd, 0x10, 0xe6, 0x5c, 0xac, 0x19, 0x2e, 0x3d, 0xb6, 0x8c, 0x2f, 0x5c, 0x34, 0x94, 0xab, 0x77,
+ 0xb6, 0x60, 0xb6, 0x24, 0x15, 0x4e, 0x20, 0x58, 0x17, 0x0c, 0x87, 0xd1, 0xfd, 0xb2, 0xbd, 0x38,
+ 0x8e, 0xb6, 0xdb, 0x74, 0xe1, 0xcd, 0x3a, 0xb6, 0x98, 0x6f, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff,
+ 0xad, 0x54, 0x7e, 0xa2, 0xa5, 0x03, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
diff --git a/internal/pkg/nfnNotify/proto/nfn.proto b/internal/pkg/nfnNotify/proto/nfn.proto
index 02855e7..567df29 100644
--- a/internal/pkg/nfnNotify/proto/nfn.proto
+++ b/internal/pkg/nfnNotify/proto/nfn.proto
@@ -47,4 +47,6 @@ message DirectInfo {
}
message InSync {
+ string node_intf_ip_address = 1;
+ string node_intf_mac_address = 2;
}
diff --git a/internal/pkg/nfnNotify/server.go b/internal/pkg/nfnNotify/server.go
index ac22d68..a201618 100644
--- a/internal/pkg/nfnNotify/server.go
+++ b/internal/pkg/nfnNotify/server.go
@@ -4,13 +4,14 @@ import (
"fmt"
"net"
pb "ovn4nfv-k8s-plugin/internal/pkg/nfnNotify/proto"
+ "ovn4nfv-k8s-plugin/internal/pkg/node"
v1alpha1 "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1"
clientset "ovn4nfv-k8s-plugin/pkg/generated/clientset/versioned"
"strings"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
- "k8s.io/apimachinery/pkg/apis/meta/v1"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
@@ -45,6 +46,11 @@ func (s *serverDB) Subscribe(sc *pb.SubscribeContext, ss pb.NfnNotify_SubscribeS
if nodeName == "" {
return fmt.Errorf("Node name can't be empty")
}
+
+ nodeIntfIPAddr, nodeIntfMacAddr, err := node.AddNodeLogicalPorts(nodeName)
+ if err != nil {
+ return fmt.Errorf("Error in creating node logical port for node- %s: %v", nodeName, err)
+ }
cp := client{
context: sc,
stream: ss,
@@ -61,7 +67,10 @@ func (s *serverDB) Subscribe(sc *pb.SubscribeContext, ss pb.NfnNotify_SubscribeS
inSyncMsg := pb.Notification{
CniType: "ovn4nfv",
Payload: &pb.Notification_InSync{
- InSync: &pb.InSync{},
+ InSync: &pb.InSync{
+ NodeIntfIpAddress: nodeIntfIPAddr,
+ NodeIntfMacAddress: nodeIntfMacAddr,
+ },
},
}
log.Info("Send Insync")