VOL-1596 Add Support for handling multicast groups in OpenOLT Adapter.
VOL-1595 Add Support for handling multicast flows in OpenOLT Adapter.
Depends voltha-protos from the patch below:
https://gerrit.opencord.org/#/c/16690/
Change-Id: I1cc9900bd6400bb31aed11beda674138838a21d2
diff --git a/mocks/mockAdapterProxy.go b/mocks/mockAdapterProxy.go
index 19b59de..817e675 100644
--- a/mocks/mockAdapterProxy.go
+++ b/mocks/mockAdapterProxy.go
@@ -22,7 +22,7 @@
"errors"
"github.com/golang/protobuf/proto"
- "github.com/opencord/voltha-protos/v2/go/inter_container"
+ "github.com/opencord/voltha-protos/v3/go/inter_container"
)
// MockAdapterProxy mocks the AdapterProxy interface.
diff --git a/mocks/mockCoreProxy.go b/mocks/mockCoreProxy.go
index 24f60c8..2c3a81c 100644
--- a/mocks/mockCoreProxy.go
+++ b/mocks/mockCoreProxy.go
@@ -22,8 +22,8 @@
"errors"
"fmt"
- "github.com/opencord/voltha-lib-go/v2/pkg/kafka"
- "github.com/opencord/voltha-protos/v2/go/voltha"
+ "github.com/opencord/voltha-lib-go/v3/pkg/kafka"
+ "github.com/opencord/voltha-protos/v3/go/voltha"
)
// MockCoreProxy mocks the CoreProxy interface
@@ -82,7 +82,7 @@
}
// PortsStateUpdate implements mock PortsStateUpdate
-func (mcp *MockCoreProxy) PortsStateUpdate(ctx context.Context, deviceID string, operStatus voltha.OperStatus_OperStatus) error {
+func (mcp *MockCoreProxy) PortsStateUpdate(ctx context.Context, deviceID string, operStatus voltha.OperStatus_Types) error {
if deviceID == "" {
return errors.New("no Device")
}
@@ -99,7 +99,7 @@
// DeviceStateUpdate implements mock DeviceStateUpdate
func (mcp *MockCoreProxy) DeviceStateUpdate(ctx context.Context, deviceID string,
- connStatus voltha.ConnectStatus_ConnectStatus, operStatus voltha.OperStatus_OperStatus) error {
+ connStatus voltha.ConnectStatus_Types, operStatus voltha.OperStatus_Types) error {
if deviceID == "" {
return errors.New("no Device id")
}
@@ -209,6 +209,6 @@
// PortStateUpdate implements mock PortStateUpdate
func (mcp *MockCoreProxy) PortStateUpdate(ctx context.Context, deviceID string, pType voltha.Port_PortType, portNo uint32,
- operStatus voltha.OperStatus_OperStatus) error {
+ operStatus voltha.OperStatus_Types) error {
return nil
}
diff --git a/mocks/mockEventproxy.go b/mocks/mockEventproxy.go
index 605bfdd..d2621ab 100644
--- a/mocks/mockEventproxy.go
+++ b/mocks/mockEventproxy.go
@@ -20,7 +20,7 @@
import (
"errors"
- "github.com/opencord/voltha-protos/v2/go/voltha"
+ "github.com/opencord/voltha-protos/v3/go/voltha"
)
// MockEventProxy for mocking EventProxyIntf
@@ -28,8 +28,8 @@
}
// SendDeviceEvent mocks the SendDeviceEvent function
-func (me *MockEventProxy) SendDeviceEvent(deviceEvent *voltha.DeviceEvent, category voltha.EventCategory_EventCategory,
- subCategory voltha.EventSubCategory_EventSubCategory, raisedTs int64) error {
+func (me *MockEventProxy) SendDeviceEvent(deviceEvent *voltha.DeviceEvent, category voltha.EventCategory_Types,
+ subCategory voltha.EventSubCategory_Types, raisedTs int64) error {
if raisedTs == 0 {
return errors.New("raisedTS cannot be zero")
}
@@ -37,8 +37,8 @@
}
// SendKpiEvent mocks the SendKpiEvent function
-func (me *MockEventProxy) SendKpiEvent(id string, deviceEvent *voltha.KpiEvent2, category voltha.EventCategory_EventCategory,
- subCategory voltha.EventSubCategory_EventSubCategory, raisedTs int64) error {
+func (me *MockEventProxy) SendKpiEvent(id string, deviceEvent *voltha.KpiEvent2, category voltha.EventCategory_Types,
+ subCategory voltha.EventSubCategory_Types, raisedTs int64) error {
if raisedTs == 0 {
return errors.New("raisedTS cannot be zero")
}
diff --git a/mocks/mockKVClient.go b/mocks/mockKVClient.go
index b6ba991..7d12cac 100644
--- a/mocks/mockKVClient.go
+++ b/mocks/mockKVClient.go
@@ -23,12 +23,12 @@
"strconv"
"strings"
- "github.com/opencord/voltha-lib-go/v2/pkg/log"
+ "github.com/opencord/voltha-lib-go/v3/pkg/log"
"github.com/opencord/voltha-openolt-adapter/adaptercore/resourcemanager"
- "github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore"
- ofp "github.com/opencord/voltha-protos/v2/go/openflow_13"
- openolt "github.com/opencord/voltha-protos/v2/go/openolt"
+ "github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore"
+ ofp "github.com/opencord/voltha-protos/v3/go/openflow_13"
+ openolt "github.com/opencord/voltha-protos/v3/go/openolt"
)
const (
@@ -46,6 +46,10 @@
GemportIDs = "gemport_ids"
// AllocIDs to extract alloc_ids
AllocIDs = "alloc_ids"
+ //FlowGroup flow_groups/<flow_group_id>
+ FlowGroup = "flow_groups"
+ //FlowGroupCached flow_groups_cached/<flow_group_id>
+ FlowGroupCached = "flow_groups_cached"
)
// MockKVClient mocks the AdapterProxy interface.
@@ -131,6 +135,7 @@
{
Flow: &openolt.Flow{FlowId: 1, OnuId: 1, UniId: 1, GemportId: 1},
FlowStoreCookie: uint64(48132224281636694),
+ LogicalFlowID: 1,
},
}
log.Debug("Error Error Error Key:", FlowIDs)
@@ -147,6 +152,16 @@
str, _ := json.Marshal(1)
return kvstore.NewKVPair(key, str, "mock", 3000, 1), nil
}
+ if strings.Contains(key, FlowGroup) || strings.Contains(key, FlowGroupCached) {
+ log.Debug("Error Error Error Key:", FlowGroup)
+ groupInfo := resourcemanager.GroupInfo{
+ GroupID: 2,
+ OutPorts: []uint32{1},
+ }
+ str, _ := json.Marshal(&groupInfo)
+ return kvstore.NewKVPair(key, str, "mock", 3000, 1), nil
+ }
+
maps := make(map[string]*kvstore.KVPair)
maps[key] = &kvstore.KVPair{Key: key}
return maps[key], nil
diff --git a/mocks/mockOpenOltClient.go b/mocks/mockOpenOltClient.go
index 00a9fd5..652f959 100644
--- a/mocks/mockOpenOltClient.go
+++ b/mocks/mockOpenOltClient.go
@@ -22,8 +22,8 @@
"errors"
"io"
- openolt "github.com/opencord/voltha-protos/v2/go/openolt"
- tech_profile "github.com/opencord/voltha-protos/v2/go/tech_profile"
+ openolt "github.com/opencord/voltha-protos/v3/go/openolt"
+ tech_profile "github.com/opencord/voltha-protos/v3/go/tech_profile"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)
@@ -222,3 +222,8 @@
func (mock *mockOpenoltEnableIndicationClient) RecvMsg(m interface{}) error {
return nil
}
+
+// PerformGroupOperation mocks the PerformGroupOperation function of Openoltclient.
+func (ooc *MockOpenoltClient) PerformGroupOperation(ctx context.Context, in *openolt.Group, opts ...grpc.CallOption) (*openolt.Empty, error) {
+ return &openolt.Empty{}, nil
+}
diff --git a/mocks/mockTechprofile.go b/mocks/mockTechprofile.go
index 6fa3c39..e4edf2f 100644
--- a/mocks/mockTechprofile.go
+++ b/mocks/mockTechprofile.go
@@ -18,10 +18,10 @@
package mocks
import (
- "github.com/opencord/voltha-lib-go/v2/pkg/db"
- "github.com/opencord/voltha-lib-go/v2/pkg/log"
- tp "github.com/opencord/voltha-lib-go/v2/pkg/techprofile"
- tp_pb "github.com/opencord/voltha-protos/v2/go/tech_profile"
+ "github.com/opencord/voltha-lib-go/v3/pkg/db"
+ "github.com/opencord/voltha-lib-go/v3/pkg/log"
+ tp "github.com/opencord/voltha-lib-go/v3/pkg/techprofile"
+ tp_pb "github.com/opencord/voltha-protos/v3/go/tech_profile"
)
// MockTechProfile mock struct for OpenoltClient.