[VOL-3419] Supporting new flow format.
Releasing version 1.3.0
Change-Id: Ie35c06c62797cc5966305a0a82492600a0dec871
diff --git a/internal/bbr/devices/olt.go b/internal/bbr/devices/olt.go
index 94e2908..2093520 100644
--- a/internal/bbr/devices/olt.go
+++ b/internal/bbr/devices/olt.go
@@ -29,7 +29,7 @@
"github.com/opencord/bbsim/internal/bbsim/devices"
"github.com/opencord/bbsim/internal/bbsim/packetHandlers"
"github.com/opencord/bbsim/internal/common"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
)
diff --git a/internal/bbsim/alarmsim/alarmsim.go b/internal/bbsim/alarmsim/alarmsim.go
index 838e15a..cbb51da 100644
--- a/internal/bbsim/alarmsim/alarmsim.go
+++ b/internal/bbsim/alarmsim/alarmsim.go
@@ -25,7 +25,7 @@
"github.com/opencord/bbsim/api/bbsim"
"github.com/opencord/bbsim/internal/bbsim/devices"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
diff --git a/internal/bbsim/devices/helpers.go b/internal/bbsim/devices/helpers.go
index 6b3d220..722a1f1 100644
--- a/internal/bbsim/devices/helpers.go
+++ b/internal/bbsim/devices/helpers.go
@@ -23,7 +23,7 @@
"github.com/looplab/fsm"
"github.com/opencord/bbsim/internal/common"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
)
type mode int
diff --git a/internal/bbsim/devices/messageTypes.go b/internal/bbsim/devices/messageTypes.go
index b677416..e103ceb 100644
--- a/internal/bbsim/devices/messageTypes.go
+++ b/internal/bbsim/devices/messageTypes.go
@@ -19,7 +19,7 @@
import (
"github.com/google/gopacket"
"github.com/opencord/bbsim/internal/bbsim/packetHandlers"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
"net"
)
diff --git a/internal/bbsim/devices/olt.go b/internal/bbsim/devices/olt.go
index 9610961..c3e0866 100644
--- a/internal/bbsim/devices/olt.go
+++ b/internal/bbsim/devices/olt.go
@@ -20,7 +20,7 @@
"context"
"encoding/hex"
"fmt"
- "github.com/opencord/voltha-protos/v3/go/ext/config"
+ "github.com/opencord/voltha-protos/v4/go/ext/config"
"net"
"sync"
"time"
@@ -33,9 +33,9 @@
bbsim "github.com/opencord/bbsim/internal/bbsim/types"
"github.com/opencord/bbsim/internal/common"
omcisim "github.com/opencord/omci-sim"
- common_protos "github.com/opencord/voltha-protos/v3/go/common"
- "github.com/opencord/voltha-protos/v3/go/openolt"
- "github.com/opencord/voltha-protos/v3/go/tech_profile"
+ common_protos "github.com/opencord/voltha-protos/v4/go/common"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/tech_profile"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -1214,7 +1214,7 @@
return &res, nil
}
-func (o *OltDevice) GetOnuByFlowId(flowId uint32) (*Onu, error) {
+func (o *OltDevice) GetOnuByFlowId(flowId uint64) (*Onu, error) {
for _, pon := range o.Pons {
for _, onu := range pon.Onus {
for _, fId := range onu.FlowIds {
diff --git a/internal/bbsim/devices/olt_test.go b/internal/bbsim/devices/olt_test.go
index 1536baf..0081ffa 100644
--- a/internal/bbsim/devices/olt_test.go
+++ b/internal/bbsim/devices/olt_test.go
@@ -21,7 +21,7 @@
"net"
"testing"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
"gotest.tools/assert"
)
diff --git a/internal/bbsim/devices/onu.go b/internal/bbsim/devices/onu.go
index 650dcfe..42c48bb 100644
--- a/internal/bbsim/devices/onu.go
+++ b/internal/bbsim/devices/onu.go
@@ -34,8 +34,8 @@
"github.com/opencord/bbsim/internal/common"
omcilib "github.com/opencord/bbsim/internal/common/omci"
omcisim "github.com/opencord/omci-sim"
- "github.com/opencord/voltha-protos/v3/go/openolt"
- "github.com/opencord/voltha-protos/v3/go/tech_profile"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/tech_profile"
log "github.com/sirupsen/logrus"
)
@@ -44,7 +44,7 @@
})
type FlowKey struct {
- ID uint32
+ ID uint64
Direction string
}
@@ -67,7 +67,7 @@
// deprecated (gemPort is on a Service basis)
GemPortAdded bool
Flows []FlowKey
- FlowIds []uint32 // keep track of the flows we currently have in the ONU
+ FlowIds []uint64 // keep track of the flows we currently have in the ONU
OperState *fsm.FSM
SerialNumber *openolt.SerialNumber
@@ -622,6 +622,8 @@
"ClassifierOPbits": msg.Flow.Classifier.OPbits,
"ClassifierIVid": msg.Flow.Classifier.IVid,
"ClassifierOVid": msg.Flow.Classifier.OVid,
+ "ReplicateFlow": msg.Flow.ReplicateFlow,
+ "PbitToGemport": msg.Flow.PbitToGemport,
}).Debug("OLT receives FlowAdd for ONU")
if msg.Flow.UniId != 0 {
@@ -635,7 +637,18 @@
}
o.FlowIds = append(o.FlowIds, msg.Flow.FlowId)
- o.addGemPortToService(uint32(msg.Flow.GemportId), msg.Flow.Classifier.EthType, msg.Flow.Classifier.OVid, msg.Flow.Classifier.IVid)
+
+ var gemPortId uint32
+ if msg.Flow.ReplicateFlow {
+ // This means that the OLT should replicate the flow for each PBIT, for BBSim it's enough to use the
+ // first available gemport (we only need to send one packet)
+ // NOTE different TP may create different mapping between PBits and GemPorts, this may require some changes
+ gemPortId = msg.Flow.PbitToGemport[0]
+ } else {
+ // if replicateFlows is false, then the flow is carrying the correct GemPortId
+ gemPortId = uint32(msg.Flow.GemportId)
+ }
+ o.addGemPortToService(gemPortId, msg.Flow.Classifier.EthType, msg.Flow.Classifier.OVid, msg.Flow.Classifier.IVid)
if msg.Flow.Classifier.EthType == uint32(layers.EthernetTypeEAPOL) && msg.Flow.Classifier.OVid == 4091 {
// NOTE storing the PortNO, it's needed when sending PacketIndications
@@ -822,7 +835,7 @@
AccessIntfId: int32(o.PonPortID),
OnuId: int32(o.ID),
UniId: int32(0), // NOTE do not hardcode this, we need to support multiple UNIs
- FlowId: uint32(o.ID),
+ FlowId: uint64(o.ID),
FlowType: "downstream",
AllocId: int32(0),
NetworkIntfId: int32(0),
@@ -870,7 +883,7 @@
AccessIntfId: int32(o.PonPortID),
OnuId: int32(o.ID),
UniId: int32(0), // FIXME do not hardcode this
- FlowId: uint32(o.ID),
+ FlowId: uint64(o.ID),
FlowType: "downstream",
AllocId: int32(0),
NetworkIntfId: int32(0),
diff --git a/internal/bbsim/devices/onu_flow_test.go b/internal/bbsim/devices/onu_flow_test.go
index 0b8037a..1464ae5 100644
--- a/internal/bbsim/devices/onu_flow_test.go
+++ b/internal/bbsim/devices/onu_flow_test.go
@@ -19,7 +19,7 @@
import (
"github.com/google/gopacket/layers"
"github.com/looplab/fsm"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
"gotest.tools/assert"
"testing"
)
@@ -41,7 +41,7 @@
assert.Equal(t, client.FlowAddSpy.Calls[1].AccessIntfId, int32(onu.PonPortID))
assert.Equal(t, client.FlowAddSpy.Calls[1].OnuId, int32(onu.ID))
assert.Equal(t, client.FlowAddSpy.Calls[1].UniId, int32(0))
- assert.Equal(t, client.FlowAddSpy.Calls[1].FlowId, onu.ID)
+ assert.Equal(t, client.FlowAddSpy.Calls[1].FlowId, uint64(onu.ID))
assert.Equal(t, client.FlowAddSpy.Calls[1].FlowType, "downstream")
assert.Equal(t, client.FlowAddSpy.Calls[1].PortNo, onu.ID)
}
@@ -61,14 +61,14 @@
}
onu.handleFlowAdd(msg)
assert.Equal(t, len(onu.FlowIds), 1)
- assert.Equal(t, onu.FlowIds[0], uint32(64))
+ assert.Equal(t, onu.FlowIds[0], uint64(64))
}
// checks that we only remove the correct flow
func Test_HandleFlowRemoveFlowId(t *testing.T) {
onu := createMockOnu(1, 1)
- onu.FlowIds = []uint32{1, 2, 34, 64, 92}
+ onu.FlowIds = []uint64{1, 2, 34, 64, 92}
flow := openolt.Flow{
FlowId: 64,
@@ -81,10 +81,10 @@
}
onu.handleFlowRemove(msg)
assert.Equal(t, len(onu.FlowIds), 4)
- assert.Equal(t, onu.FlowIds[0], uint32(1))
- assert.Equal(t, onu.FlowIds[1], uint32(2))
- assert.Equal(t, onu.FlowIds[2], uint32(34))
- assert.Equal(t, onu.FlowIds[3], uint32(92))
+ assert.Equal(t, onu.FlowIds[0], uint64(1))
+ assert.Equal(t, onu.FlowIds[1], uint64(2))
+ assert.Equal(t, onu.FlowIds[2], uint64(34))
+ assert.Equal(t, onu.FlowIds[3], uint64(92))
}
// checks that when the last flow is removed we reset the stored flags in the ONU
@@ -101,7 +101,7 @@
onu.GemPortAdded = true
- onu.FlowIds = []uint32{64}
+ onu.FlowIds = []uint64{64}
flow := openolt.Flow{
FlowId: 64,
@@ -134,7 +134,7 @@
AccessIntfId: int32(onu.PonPortID),
OnuId: int32(onu.ID),
UniId: int32(0),
- FlowId: uint32(onu.ID),
+ FlowId: uint64(onu.ID),
FlowType: "downstream",
AllocId: int32(0),
NetworkIntfId: int32(0),
@@ -181,7 +181,7 @@
AccessIntfId: int32(onu.PonPortID),
OnuId: int32(onu.ID),
UniId: int32(0),
- FlowId: uint32(onu.ID),
+ FlowId: uint64(onu.ID),
FlowType: "downstream",
AllocId: int32(0),
NetworkIntfId: int32(0),
@@ -222,7 +222,7 @@
AccessIntfId: int32(onu.PonPortID),
OnuId: int32(onu.ID),
UniId: int32(1),
- FlowId: uint32(onu.ID),
+ FlowId: uint64(onu.ID),
FlowType: "downstream",
AllocId: int32(0),
NetworkIntfId: int32(0),
@@ -264,7 +264,7 @@
AccessIntfId: int32(onu.PonPortID),
OnuId: int32(onu.ID),
UniId: int32(0),
- FlowId: uint32(onu.ID),
+ FlowId: uint64(onu.ID),
FlowType: "downstream",
AllocId: int32(0),
NetworkIntfId: int32(0),
@@ -308,7 +308,7 @@
AccessIntfId: int32(onu.PonPortID),
OnuId: int32(onu.ID),
UniId: int32(0),
- FlowId: uint32(onu.ID),
+ FlowId: uint64(onu.ID),
FlowType: "downstream",
AllocId: int32(0),
NetworkIntfId: int32(0),
@@ -352,7 +352,7 @@
AccessIntfId: int32(onu.PonPortID),
OnuId: int32(onu.ID),
UniId: int32(0),
- FlowId: uint32(onu.ID),
+ FlowId: uint64(onu.ID),
FlowType: "downstream",
AllocId: int32(0),
NetworkIntfId: int32(0),
@@ -395,7 +395,7 @@
AccessIntfId: int32(onu.PonPortID),
OnuId: int32(onu.ID),
UniId: int32(0),
- FlowId: uint32(onu.ID),
+ FlowId: uint64(onu.ID),
FlowType: "downstream",
AllocId: int32(0),
NetworkIntfId: int32(0),
@@ -442,7 +442,7 @@
AccessIntfId: int32(onu.PonPortID),
OnuId: int32(onu.ID),
UniId: int32(0),
- FlowId: uint32(onu.ID),
+ FlowId: uint64(onu.ID),
FlowType: "downstream",
AllocId: int32(0),
NetworkIntfId: int32(0),
diff --git a/internal/bbsim/devices/onu_indications_test.go b/internal/bbsim/devices/onu_indications_test.go
index 1905c20..1a34da1 100644
--- a/internal/bbsim/devices/onu_indications_test.go
+++ b/internal/bbsim/devices/onu_indications_test.go
@@ -22,7 +22,7 @@
"testing"
"time"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
"google.golang.org/grpc"
"gotest.tools/assert"
)
diff --git a/internal/bbsim/devices/onu_test_helpers.go b/internal/bbsim/devices/onu_test_helpers.go
index d98dc3f..89eb195 100644
--- a/internal/bbsim/devices/onu_test_helpers.go
+++ b/internal/bbsim/devices/onu_test_helpers.go
@@ -19,12 +19,12 @@
import (
"context"
"errors"
- "github.com/opencord/voltha-protos/v3/go/common"
- "github.com/opencord/voltha-protos/v3/go/ext/config"
+ "github.com/opencord/voltha-protos/v4/go/common"
+ "github.com/opencord/voltha-protos/v4/go/ext/config"
"time"
- "github.com/opencord/voltha-protos/v3/go/openolt"
- "github.com/opencord/voltha-protos/v3/go/tech_profile"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/tech_profile"
"google.golang.org/grpc"
)
diff --git a/internal/bbsim/devices/pon.go b/internal/bbsim/devices/pon.go
index f9b0d8d..6910ece 100644
--- a/internal/bbsim/devices/pon.go
+++ b/internal/bbsim/devices/pon.go
@@ -21,7 +21,7 @@
"fmt"
"github.com/looplab/fsm"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
log "github.com/sirupsen/logrus"
)
diff --git a/internal/bbsim/devices/service_test.go b/internal/bbsim/devices/service_test.go
index 548a14a..a71a50c 100644
--- a/internal/bbsim/devices/service_test.go
+++ b/internal/bbsim/devices/service_test.go
@@ -20,7 +20,7 @@
"context"
"github.com/opencord/bbsim/internal/bbsim/types"
"github.com/opencord/bbsim/internal/common"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
"github.com/stretchr/testify/assert"
"net"
"testing"
diff --git a/internal/bbsim/responders/dhcp/dhcp.go b/internal/bbsim/responders/dhcp/dhcp.go
index fe7e847..f3c7e72 100644
--- a/internal/bbsim/responders/dhcp/dhcp.go
+++ b/internal/bbsim/responders/dhcp/dhcp.go
@@ -26,7 +26,7 @@
"github.com/looplab/fsm"
"github.com/opencord/bbsim/internal/bbsim/packetHandlers"
bbsim "github.com/opencord/bbsim/internal/bbsim/types"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
log "github.com/sirupsen/logrus"
"net"
"reflect"
diff --git a/internal/bbsim/responders/dhcp/dhcp_test.go b/internal/bbsim/responders/dhcp/dhcp_test.go
index bcb5c46..7b598a0 100644
--- a/internal/bbsim/responders/dhcp/dhcp_test.go
+++ b/internal/bbsim/responders/dhcp/dhcp_test.go
@@ -23,7 +23,7 @@
"testing"
"github.com/looplab/fsm"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
)
diff --git a/internal/bbsim/responders/eapol/eapol.go b/internal/bbsim/responders/eapol/eapol.go
index f9488fb..0860935 100644
--- a/internal/bbsim/responders/eapol/eapol.go
+++ b/internal/bbsim/responders/eapol/eapol.go
@@ -27,7 +27,7 @@
"github.com/looplab/fsm"
bbsim "github.com/opencord/bbsim/internal/bbsim/types"
omci "github.com/opencord/omci-sim"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
log "github.com/sirupsen/logrus"
)
diff --git a/internal/bbsim/responders/eapol/eapol_test.go b/internal/bbsim/responders/eapol/eapol_test.go
index 05dcf9f..936a02d 100644
--- a/internal/bbsim/responders/eapol/eapol_test.go
+++ b/internal/bbsim/responders/eapol/eapol_test.go
@@ -22,7 +22,7 @@
"testing"
"github.com/looplab/fsm"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
"google.golang.org/grpc"
"gotest.tools/assert"
)
diff --git a/internal/bbsim/responders/igmp/igmp.go b/internal/bbsim/responders/igmp/igmp.go
index 5390347..ae1f36c 100644
--- a/internal/bbsim/responders/igmp/igmp.go
+++ b/internal/bbsim/responders/igmp/igmp.go
@@ -24,7 +24,7 @@
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
bbsim "github.com/opencord/bbsim/internal/bbsim/types"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
log "github.com/sirupsen/logrus"
)
diff --git a/internal/bbsim/responders/igmp/igmp_test.go b/internal/bbsim/responders/igmp/igmp_test.go
index a1788c0..8037869 100644
--- a/internal/bbsim/responders/igmp/igmp_test.go
+++ b/internal/bbsim/responders/igmp/igmp_test.go
@@ -21,7 +21,7 @@
"fmt"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"net"
diff --git a/internal/bbsim/types/interfaces.go b/internal/bbsim/types/interfaces.go
index 6a12136..380af34 100644
--- a/internal/bbsim/types/interfaces.go
+++ b/internal/bbsim/types/interfaces.go
@@ -17,7 +17,7 @@
package types
import (
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
)
// represent a gRPC stream
diff --git a/internal/common/helpers.go b/internal/common/helpers.go
index 77d4607..6153283 100644
--- a/internal/common/helpers.go
+++ b/internal/common/helpers.go
@@ -20,7 +20,7 @@
"net"
"strconv"
- "github.com/opencord/voltha-protos/v3/go/openolt"
+ "github.com/opencord/voltha-protos/v4/go/openolt"
)
func OnuSnToString(sn *openolt.SerialNumber) string {