aboutsummaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
authorKuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>2020-03-25 20:03:10 +0000
committerKuralamudhan Ramakrishan <kuralamudhan.ramakrishnan@intel.com>2020-03-26 03:19:59 +0000
commit4eedc027c850857e5511e6341e36fbae968f3653 (patch)
treecc808eaa387e98eba31ac82dc4faa723cb21f2e0 /internal
parente8c9eed2f954bf3a10746a53c113318d4341e96d (diff)
adding direct provider network
- update nfn.proto - update direct provider network crd and apis - modified nfn-agent to include the direct provider network - modified nfnNotify server to include the direct provider network Change-Id: I9c2d4cc62178088c8908c50c2b734772ed7f99f4 Co-authored-by: Ritu Sood <ritu.sood@intel.com> Signed-off-by: Kuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/pkg/nfnNotify/proto/nfn.pb.go133
-rw-r--r--internal/pkg/nfnNotify/proto/nfn.proto8
-rw-r--r--internal/pkg/nfnNotify/server.go71
3 files changed, 167 insertions, 45 deletions
diff --git a/internal/pkg/nfnNotify/proto/nfn.pb.go b/internal/pkg/nfnNotify/proto/nfn.pb.go
index 7f9a182..d419af8 100644
--- a/internal/pkg/nfnNotify/proto/nfn.pb.go
+++ b/internal/pkg/nfnNotify/proto/nfn.pb.go
@@ -167,11 +167,12 @@ func (*Notification) XXX_OneofWrappers() []interface{} {
}
type ProviderNetworkCreate struct {
- ProviderNwName string `protobuf:"bytes,1,opt,name=provider_nw_name,json=providerNwName,proto3" json:"provider_nw_name,omitempty"`
- Vlan *VlanInfo `protobuf:"bytes,2,opt,name=vlan,proto3" json:"vlan,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
+ ProviderNwName string `protobuf:"bytes,1,opt,name=provider_nw_name,json=providerNwName,proto3" json:"provider_nw_name,omitempty"`
+ Vlan *VlanInfo `protobuf:"bytes,2,opt,name=vlan,proto3" json:"vlan,omitempty"`
+ Direct *DirectInfo `protobuf:"bytes,3,opt,name=direct,proto3" json:"direct,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
}
func (m *ProviderNetworkCreate) Reset() { *m = ProviderNetworkCreate{} }
@@ -213,9 +214,17 @@ func (m *ProviderNetworkCreate) GetVlan() *VlanInfo {
return nil
}
+func (m *ProviderNetworkCreate) GetDirect() *DirectInfo {
+ if m != nil {
+ return m.Direct
+ }
+ return nil
+}
+
type ProviderNetworkRemove struct {
ProviderNwName string `protobuf:"bytes,1,opt,name=provider_nw_name,json=providerNwName,proto3" json:"provider_nw_name,omitempty"`
VlanLogicalIntf string `protobuf:"bytes,2,opt,name=vlan_logical_intf,json=vlanLogicalIntf,proto3" json:"vlan_logical_intf,omitempty"`
+ DirectProviderIntf string `protobuf:"bytes,3,opt,name=direct_provider_intf,json=directProviderIntf,proto3" json:"direct_provider_intf,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -260,6 +269,13 @@ func (m *ProviderNetworkRemove) GetVlanLogicalIntf() string {
return ""
}
+func (m *ProviderNetworkRemove) GetDirectProviderIntf() string {
+ if m != nil {
+ return m.DirectProviderIntf
+ }
+ return ""
+}
+
type VlanInfo struct {
VlanId string `protobuf:"bytes,1,opt,name=vlan_id,json=vlanId,proto3" json:"vlan_id,omitempty"`
ProviderIntf string `protobuf:"bytes,2,opt,name=provider_intf,json=providerIntf,proto3" json:"provider_intf,omitempty"`
@@ -315,6 +331,45 @@ func (m *VlanInfo) GetLogicalIntf() string {
return ""
}
+type DirectInfo struct {
+ ProviderIntf string `protobuf:"bytes,1,opt,name=provider_intf,json=providerIntf,proto3" json:"provider_intf,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *DirectInfo) Reset() { *m = DirectInfo{} }
+func (m *DirectInfo) String() string { return proto.CompactTextString(m) }
+func (*DirectInfo) ProtoMessage() {}
+func (*DirectInfo) Descriptor() ([]byte, []int) {
+ return fileDescriptor_5b809db4a7814953, []int{5}
+}
+
+func (m *DirectInfo) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_DirectInfo.Unmarshal(m, b)
+}
+func (m *DirectInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_DirectInfo.Marshal(b, m, deterministic)
+}
+func (m *DirectInfo) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_DirectInfo.Merge(m, src)
+}
+func (m *DirectInfo) XXX_Size() int {
+ return xxx_messageInfo_DirectInfo.Size(m)
+}
+func (m *DirectInfo) XXX_DiscardUnknown() {
+ xxx_messageInfo_DirectInfo.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_DirectInfo proto.InternalMessageInfo
+
+func (m *DirectInfo) GetProviderIntf() string {
+ if m != nil {
+ return m.ProviderIntf
+ }
+ return ""
+}
+
type InSync struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -325,7 +380,7 @@ func (m *InSync) Reset() { *m = InSync{} }
func (m *InSync) String() string { return proto.CompactTextString(m) }
func (*InSync) ProtoMessage() {}
func (*InSync) Descriptor() ([]byte, []int) {
- return fileDescriptor_5b809db4a7814953, []int{5}
+ return fileDescriptor_5b809db4a7814953, []int{6}
}
func (m *InSync) XXX_Unmarshal(b []byte) error {
@@ -352,46 +407,52 @@ func init() {
proto.RegisterType((*ProviderNetworkCreate)(nil), "ProviderNetworkCreate")
proto.RegisterType((*ProviderNetworkRemove)(nil), "ProviderNetworkRemove")
proto.RegisterType((*VlanInfo)(nil), "VlanInfo")
+ proto.RegisterType((*DirectInfo)(nil), "DirectInfo")
proto.RegisterType((*InSync)(nil), "InSync")
}
-func init() { proto.RegisterFile("nfn.proto", fileDescriptor_5b809db4a7814953) }
+func init() {
+ proto.RegisterFile("nfn.proto", fileDescriptor_5b809db4a7814953)
+}
var fileDescriptor_5b809db4a7814953 = []byte{
- // 380 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x4f, 0xaf, 0xd2, 0x40,
- 0x14, 0xc5, 0xa9, 0x90, 0xfe, 0xb9, 0x80, 0xc2, 0x24, 0x6a, 0xd5, 0x98, 0x60, 0xdd, 0x10, 0x17,
- 0xc5, 0xe0, 0xd6, 0x95, 0x24, 0x86, 0x26, 0xa6, 0x31, 0xc5, 0xb8, 0xad, 0xc3, 0x74, 0x6a, 0x26,
- 0xb4, 0x77, 0x9a, 0x32, 0x82, 0xfd, 0xc6, 0xef, 0x63, 0xbc, 0x74, 0x4a, 0x79, 0x85, 0xc7, 0xe6,
- 0xed, 0xda, 0x73, 0xee, 0x9c, 0xdf, 0xf4, 0xf6, 0x80, 0x83, 0x29, 0xfa, 0x45, 0x29, 0x95, 0xf4,
- 0x16, 0x30, 0xd9, 0xfc, 0xdb, 0xee, 0x59, 0x29, 0xb6, 0x7c, 0x25, 0x51, 0xf1, 0xff, 0x8a, 0xbc,
- 0x03, 0x07, 0x65, 0xc2, 0x63, 0xa4, 0x39, 0x77, 0x8d, 0x99, 0x31, 0x77, 0x22, 0xbb, 0x16, 0x42,
- 0x9a, 0x73, 0xef, 0xce, 0x80, 0x51, 0x28, 0x95, 0x48, 0x05, 0xa3, 0x4a, 0x48, 0x24, 0x6f, 0xc0,
- 0x66, 0x28, 0x62, 0x55, 0x15, 0xed, 0xb0, 0xc5, 0x50, 0xfc, 0xaa, 0x0a, 0x4e, 0x3c, 0xb0, 0x04,
- 0xc6, 0xfb, 0x0a, 0x99, 0xfb, 0x6c, 0x66, 0xcc, 0x87, 0x4b, 0xcb, 0x0f, 0x70, 0x53, 0x21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f, 0x5a, 0xe0, 0xab, 0xaf, 0xa7, 0x68, 0x4b, 0x72,
+ 0x06, 0x4f, 0xbd, 0x32, 0xbb, 0x25, 0x77, 0xed, 0xfb, 0xae, 0x9d, 0x78, 0xac, 0x37, 0xd4, 0xbe,
+ 0xa0, 0xd7, 0x30, 0xea, 0x07, 0x23, 0x2f, 0x20, 0x72, 0x4a, 0xaa, 0xe8, 0xac, 0x84, 0xed, 0x35,
+ 0x2d, 0xc8, 0x09, 0x1c, 0x6e, 0xf3, 0x79, 0xf9, 0x49, 0x3d, 0x60, 0x22, 0x6f, 0x61, 0xb2, 0x65,
+ 0xd1, 0x6b, 0x8e, 0xab, 0x8d, 0x3d, 0xfa, 0x1e, 0x60, 0xb3, 0xa4, 0x5d, 0xd6, 0x60, 0x97, 0x95,
+ 0x8e, 0x20, 0xf4, 0xc1, 0x3b, 0xff, 0xe8, 0xc2, 0xef, 0x02, 0xdc, 0x90, 0x53, 0x88, 0x6f, 0xc3,
+ 0x4f, 0x8e, 0x92, 0xbb, 0x1f, 0xe1, 0xd5, 0x61, 0x32, 0x4c, 0xfa, 0x59, 0xb0, 0x08, 0xdd, 0xa7,
+ 0xf9, 0xf0, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x24, 0xa2, 0x9f, 0x85, 0x41, 0x03, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
-var _ grpc.ClientConn
+var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
-const _ = grpc.SupportPackageIsVersion4
+const _ = grpc.SupportPackageIsVersion6
// NfnNotifyClient is the client API for NfnNotify service.
//
@@ -401,10 +462,10 @@ type NfnNotifyClient interface {
}
type nfnNotifyClient struct {
- cc *grpc.ClientConn
+ cc grpc.ClientConnInterface
}
-func NewNfnNotifyClient(cc *grpc.ClientConn) NfnNotifyClient {
+func NewNfnNotifyClient(cc grpc.ClientConnInterface) NfnNotifyClient {
return &nfnNotifyClient{cc}
}
diff --git a/internal/pkg/nfnNotify/proto/nfn.proto b/internal/pkg/nfnNotify/proto/nfn.proto
index 85e2131..02855e7 100644
--- a/internal/pkg/nfnNotify/proto/nfn.proto
+++ b/internal/pkg/nfnNotify/proto/nfn.proto
@@ -25,12 +25,14 @@ message Notification {
message ProviderNetworkCreate {
string provider_nw_name = 1;
VlanInfo vlan = 2;
+ DirectInfo direct =3;
// Add other types supported here beyond vlan
}
message ProviderNetworkRemove {
string provider_nw_name = 1;
string vlan_logical_intf = 2;
+ string direct_provider_intf = 3;
// Add other types supported here
}
@@ -40,5 +42,9 @@ message VlanInfo {
string logical_intf = 3;
}
+message DirectInfo {
+ string provider_intf = 1;
+}
+
message InSync {
-} \ No newline at end of file
+}
diff --git a/internal/pkg/nfnNotify/server.go b/internal/pkg/nfnNotify/server.go
index 6ec4a98..ac22d68 100644
--- a/internal/pkg/nfnNotify/server.go
+++ b/internal/pkg/nfnNotify/server.go
@@ -2,17 +2,18 @@ package nfn
import (
"fmt"
- "google.golang.org/grpc"
- "google.golang.org/grpc/reflection"
"net"
pb "ovn4nfv-k8s-plugin/internal/pkg/nfnNotify/proto"
v1alpha1 "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1"
- logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
+ 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"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
- clientset "ovn4nfv-k8s-plugin/pkg/generated/clientset/versioned"
+ logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
)
var log = logf.Log.WithName("rpc-server")
@@ -90,7 +91,7 @@ func updatePnStatus(pn *v1alpha1.ProviderNetwork, status string) error {
return err
}
-func createMsg(pn *v1alpha1.ProviderNetwork) pb.Notification {
+func createVlanMsg(pn *v1alpha1.ProviderNetwork) pb.Notification {
msg := pb.Notification{
CniType: "ovn4nfv",
Payload: &pb.Notification_ProviderNwCreate{
@@ -107,7 +108,7 @@ func createMsg(pn *v1alpha1.ProviderNetwork) pb.Notification {
return msg
}
-func deleteMsg(pn *v1alpha1.ProviderNetwork) pb.Notification {
+func deleteVlanMsg(pn *v1alpha1.ProviderNetwork) pb.Notification {
msg := pb.Notification{
CniType: "ovn4nfv",
Payload: &pb.Notification_ProviderNwRemove{
@@ -120,6 +121,34 @@ func deleteMsg(pn *v1alpha1.ProviderNetwork) pb.Notification {
return msg
}
+func createDirectMsg(pn *v1alpha1.ProviderNetwork) pb.Notification {
+ msg := pb.Notification{
+ CniType: "ovn4nfv",
+ Payload: &pb.Notification_ProviderNwCreate{
+ ProviderNwCreate: &pb.ProviderNetworkCreate{
+ ProviderNwName: pn.Name,
+ Direct: &pb.DirectInfo{
+ ProviderIntf: pn.Spec.Direct.ProviderInterfaceName,
+ },
+ },
+ },
+ }
+ return msg
+}
+
+func deleteDirectMsg(pn *v1alpha1.ProviderNetwork) pb.Notification {
+ msg := pb.Notification{
+ CniType: "ovn4nfv",
+ Payload: &pb.Notification_ProviderNwRemove{
+ ProviderNwRemove: &pb.ProviderNetworkRemove{
+ ProviderNwName: pn.Name,
+ DirectProviderIntf: pn.Spec.Direct.ProviderInterfaceName,
+ },
+ },
+ }
+ return msg
+}
+
//SendNotif to client
func SendNotif(pn *v1alpha1.ProviderNetwork, msgType string, nodeReq string) error {
var msg pb.Notification
@@ -130,9 +159,9 @@ func SendNotif(pn *v1alpha1.ProviderNetwork, msgType string, nodeReq string) err
switch {
case pn.Spec.ProviderNetType == "VLAN":
if msgType == "create" {
- msg = createMsg(pn)
+ msg = createVlanMsg(pn)
} else if msgType == "delete" {
- msg = deleteMsg(pn)
+ msg = deleteVlanMsg(pn)
}
if strings.EqualFold(pn.Spec.Vlan.VlanNodeSelector, "SPECIFIC") {
for _, label := range pn.Spec.Vlan.NodeLabelList {
@@ -154,6 +183,32 @@ func SendNotif(pn *v1alpha1.ProviderNetwork, msgType string, nodeReq string) err
}
}
}
+ case pn.Spec.ProviderNetType == "DIRECT":
+ if msgType == "create" {
+ msg = createDirectMsg(pn)
+ } else if msgType == "delete" {
+ msg = deleteDirectMsg(pn)
+ }
+ if strings.EqualFold(pn.Spec.Direct.DirectNodeSelector, "SPECIFIC") {
+ for _, label := range pn.Spec.Direct.NodeLabelList {
+ l := strings.Split(label, "=")
+ if len(l) == 0 {
+ log.Error(fmt.Errorf("Syntax error label: %v", label), "NodeListIterator")
+ return nil
+ }
+ }
+ labels := strings.Join(pn.Spec.Direct.NodeLabelList[:], ",")
+ err = sendMsg(msg, labels, "specific", nodeReq)
+ } else if strings.EqualFold(pn.Spec.Direct.DirectNodeSelector, "ALL") {
+ err = sendMsg(msg, "", "all", nodeReq)
+ } else if strings.EqualFold(pn.Spec.Direct.DirectNodeSelector, "ANY") {
+ if pn.Status.State != v1alpha1.Created {
+ err = sendMsg(msg, "", "any", nodeReq)
+ if err == nil {
+ updatePnStatus(pn, v1alpha1.Created)
+ }
+ }
+ }
default:
return fmt.Errorf("Unsupported Provider Network type")
}