VOL-4413 Apply port-number changes in voltha-lib to components
Change-Id: I1c4c37914254ac5b1d80c5d2e6e817f0bc4b58a2
diff --git a/go.mod b/go.mod
index 9ec8bd6..2eb0e11 100644
--- a/go.mod
+++ b/go.mod
@@ -13,7 +13,7 @@
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.2
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
- github.com/opencord/voltha-lib-go/v7 v7.0.1
+ github.com/opencord/voltha-lib-go/v7 v7.0.4
github.com/opencord/voltha-protos/v5 v5.0.0
go.etcd.io/etcd v3.3.25+incompatible
google.golang.org/grpc v1.41.0
diff --git a/go.sum b/go.sum
index ced6807..08d95cd 100644
--- a/go.sum
+++ b/go.sum
@@ -185,8 +185,8 @@
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.14.0 h1:ep6kpPVwmr/nTbklSx2nrLNSIO62DoYAhnPNIMhK8gI=
github.com/onsi/gomega v1.14.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0=
-github.com/opencord/voltha-lib-go/v7 v7.0.1 h1:3rwfJL+IalcWp/JzH0yDXv+tkPKBjz9b6GA5q0s16TQ=
-github.com/opencord/voltha-lib-go/v7 v7.0.1/go.mod h1:iZueJRS4XJ3rpm3iy0Zdnhz1lG5bWx2pZoPormwgUKk=
+github.com/opencord/voltha-lib-go/v7 v7.0.4 h1:nVVRkEZyfEkGYewfgmO3NzIAIVdm8G/vVyEaCUwYW6g=
+github.com/opencord/voltha-lib-go/v7 v7.0.4/go.mod h1:iZueJRS4XJ3rpm3iy0Zdnhz1lG5bWx2pZoPormwgUKk=
github.com/opencord/voltha-protos/v5 v5.0.0 h1:US2k7qYPMnOueOCrprq9LjuMT3wK9uyxPwAVwjMmKhc=
github.com/opencord/voltha-protos/v5 v5.0.0/go.mod h1:uVKXQB499Ir6G+rc47dSThNja1S4Vy3h9JLSDuJGmzI=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
diff --git a/internal/pkg/core/device_handler_test.go b/internal/pkg/core/device_handler_test.go
index 924355a..60ed30b 100644
--- a/internal/pkg/core/device_handler_test.go
+++ b/internal/pkg/core/device_handler_test.go
@@ -998,8 +998,8 @@
{"PacketOut-1", dh1, args{egressPortNo: 0, packet: pktout}, false},
{"PacketOut-2", dh2, args{egressPortNo: 1, packet: pktout}, false},
{"PacketOut-3", dh2, args{egressPortNo: 4112, packet: pktout}, false},
- {"PacketOut-4", dh1, args{egressPortNo: 1048577, packet: pktout}, false},
- {"PacketOut-5", dh2, args{egressPortNo: 1048576, packet: pktout}, false},
+ {"PacketOut-4", dh1, args{egressPortNo: 16777217, packet: pktout}, false},
+ {"PacketOut-5", dh2, args{egressPortNo: 16777216, packet: pktout}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -1205,8 +1205,8 @@
mcs := newMockCoreService()
mcs.DevicePorts[dh.device.Id] = []*voltha.Port{
{PortNo: 1, Label: "pon", Type: voltha.Port_PON_OLT},
- {PortNo: 1048577, Label: "nni", Type: voltha.Port_ETHERNET_NNI},
- {PortNo: 1048578, Label: "nni", Type: voltha.Port_ETHERNET_NNI},
+ {PortNo: 16777216, Label: "nni", Type: voltha.Port_ETHERNET_NNI},
+ {PortNo: 16777218, Label: "nni", Type: voltha.Port_ETHERNET_NNI},
}
dh.coreClient.SetService(mcs)
dh.portStats.NorthBoundPort = make(map[uint32]*NniPort)
diff --git a/internal/pkg/core/openolt_flowmgr_test.go b/internal/pkg/core/openolt_flowmgr_test.go
index 01c608f..0a557ca 100644
--- a/internal/pkg/core/openolt_flowmgr_test.go
+++ b/internal/pkg/core/openolt_flowmgr_test.go
@@ -305,7 +305,7 @@
//multicast flow
multicastFa := &fu.FlowArgs{
MatchFields: []*ofp.OfpOxmOfbField{
- fu.InPort(1048576),
+ fu.InPort(16777216),
fu.VlanVid(660), //vlan
fu.Metadata_ofp(uint64(66)), //inner vlan
fu.EthType(0x800), //ipv4
@@ -373,7 +373,7 @@
Actions: []*ofp.OfpAction{
//fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
fu.SetField(fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 257)),
- fu.Output(1048576),
+ fu.Output(16777216),
fu.PushVlan(0x8100),
},
KV: kw,
@@ -382,7 +382,7 @@
// Downstream flow
fa3 := &fu.FlowArgs{
MatchFields: []*ofp.OfpOxmOfbField{
- fu.InPort(1048576),
+ fu.InPort(16777216),
fu.Metadata_ofp(1),
fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 257),
},
@@ -516,7 +516,7 @@
fu.Metadata_ofp(1),
fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT)),
fu.VlanPcp(1000),
- fu.UdpDst(1048576),
+ fu.UdpDst(16777216),
fu.UdpSrc(536870912),
fu.Ipv4Dst(65535),
fu.Ipv4Src(536870912),
@@ -551,7 +551,7 @@
//multicast flow
fa11 := &fu.FlowArgs{
MatchFields: []*ofp.OfpOxmOfbField{
- fu.InPort(1048576),
+ fu.InPort(16777216),
fu.VlanVid(660), //vlan
fu.Metadata_ofp(uint64(66)), //inner vlan
fu.EthType(0x800), //ipv4
@@ -776,10 +776,10 @@
}{
// TODO: Add test cases.
{"GetLogicalPortFromPacketIn", args{packetIn: &openoltpb2.PacketIndication{IntfType: "pon", IntfId: 0, GemportId: 255, OnuId: 1, UniId: 0, FlowId: 100, PortNo: 1, Cookie: 100, Pkt: []byte("GetLogicalPortFromPacketIn")}}, 1, false},
- {"GetLogicalPortFromPacketIn", args{packetIn: &openoltpb2.PacketIndication{IntfType: "nni", IntfId: 0, GemportId: 1, OnuId: 1, UniId: 0, FlowId: 100, PortNo: 1, Cookie: 100, Pkt: []byte("GetLogicalPortFromPacketIn")}}, 1048576, false},
+ {"GetLogicalPortFromPacketIn", args{packetIn: &openoltpb2.PacketIndication{IntfType: "nni", IntfId: 0, GemportId: 1, OnuId: 1, UniId: 0, FlowId: 100, PortNo: 1, Cookie: 100, Pkt: []byte("GetLogicalPortFromPacketIn")}}, 16777216, false},
// Negative Test cases.
{"GetLogicalPortFromPacketIn", args{packetIn: &openoltpb2.PacketIndication{IntfType: "pon", IntfId: 1, GemportId: 1, OnuId: 1, UniId: 0, FlowId: 100, PortNo: 1, Cookie: 100, Pkt: []byte("GetLogicalPortFromPacketIn")}}, 1, false},
- {"GetLogicalPortFromPacketIn", args{packetIn: &openoltpb2.PacketIndication{IntfType: "pon", IntfId: 0, GemportId: 257, OnuId: 1, UniId: 0, FlowId: 100, PortNo: 0, Cookie: 100, Pkt: []byte("GetLogicalPortFromPacketIn")}}, 16, false},
+ {"GetLogicalPortFromPacketIn", args{packetIn: &openoltpb2.PacketIndication{IntfType: "pon", IntfId: 0, GemportId: 257, OnuId: 1, UniId: 0, FlowId: 100, PortNo: 0, Cookie: 100, Pkt: []byte("GetLogicalPortFromPacketIn")}}, 256, false},
}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
@@ -915,7 +915,7 @@
Actions: []*ofp.OfpAction{
//fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
fu.SetField(fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 257)),
- fu.Output(1048576),
+ fu.Output(16777216),
fu.PushVlan(0x8100),
},
KV: kw,
@@ -933,7 +933,7 @@
Actions: []*ofp.OfpAction{
//fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
fu.SetField(fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 257)),
- fu.Output(1048576),
+ fu.Output(16777216),
fu.PushVlan(0x8100),
},
KV: kw,
@@ -950,7 +950,7 @@
Actions: []*ofp.OfpAction{
//fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
fu.SetField(fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT))),
- fu.Output(1048576),
+ fu.Output(16777216),
fu.PushVlan(0x8100),
},
KV: kw,
@@ -958,7 +958,7 @@
fa4 := &fu.FlowArgs{
MatchFields: []*ofp.OfpOxmOfbField{
- fu.InPort(1048576),
+ fu.InPort(16777216),
fu.Metadata_ofp(1),
fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT)),
fu.VlanPcp(1),
@@ -983,7 +983,7 @@
},
Actions: []*ofp.OfpAction{
fu.SetField(fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 257)),
- fu.Output(1048576),
+ fu.Output(16777216),
fu.PushVlan(0x8100),
},
KV: kw,
@@ -1233,7 +1233,7 @@
//create multicast flow
multicastFlowArgs := &fu.FlowArgs{
MatchFields: []*ofp.OfpOxmOfbField{
- fu.InPort(1048576),
+ fu.InPort(16777216),
fu.VlanVid(660), //vlan
fu.Metadata_ofp(uint64(66)), //inner vlan
fu.EthType(0x800), //ipv4
@@ -1316,7 +1316,7 @@
// Downstream LLDP Trap from NNI0 flow
fa0 := &fu.FlowArgs{
MatchFields: []*ofp.OfpOxmOfbField{
- fu.InPort(1048576),
+ fu.InPort(16777216),
fu.EthType(35020),
},
Actions: []*ofp.OfpAction{
@@ -1333,7 +1333,7 @@
fu.IpProto(17), // dhcp
fu.VlanPcp(0),
fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT)),
- fu.TunnelId(16),
+ fu.TunnelId(256),
},
Actions: []*ofp.OfpAction{
//fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
@@ -1352,7 +1352,7 @@
fu.EthType(0x888E),
fu.VlanPcp(1),
fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 257),
- fu.TunnelId(16),
+ fu.TunnelId(256),
},
Actions: []*ofp.OfpAction{
//fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
@@ -1370,12 +1370,12 @@
fu.Metadata_ofp(1),
//fu.EthType(0x8100),
fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT)),
- fu.TunnelId(16),
+ fu.TunnelId(256),
},
Actions: []*ofp.OfpAction{
//fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
fu.SetField(fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT))),
- fu.Output(1048576),
+ fu.Output(16777216),
fu.PushVlan(0x8100),
},
KV: kwTable1Meter1,
@@ -1384,11 +1384,11 @@
// Downstream HSIA - ONU1 UNI0 PON0
fa4 := &fu.FlowArgs{
MatchFields: []*ofp.OfpOxmOfbField{
- fu.InPort(1048576),
+ fu.InPort(16777216),
fu.Metadata_ofp(1),
fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT)),
fu.VlanPcp(1),
- fu.TunnelId(16),
+ fu.TunnelId(256),
},
Actions: []*ofp.OfpAction{
//fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
@@ -1407,7 +1407,7 @@
fu.IpProto(17), // dhcp
fu.VlanPcp(0),
fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT)),
- fu.TunnelId(16),
+ fu.TunnelId(256),
},
Actions: []*ofp.OfpAction{
//fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
@@ -1426,7 +1426,7 @@
fu.EthType(0x888E),
fu.VlanPcp(1),
fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 259),
- fu.TunnelId(16),
+ fu.TunnelId(256),
},
Actions: []*ofp.OfpAction{
//fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
@@ -1445,7 +1445,7 @@
fu.EthType(0x8863),
fu.VlanPcp(1),
fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 257),
- fu.TunnelId(16),
+ fu.TunnelId(256),
},
Actions: []*ofp.OfpAction{
//fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
@@ -1464,7 +1464,7 @@
fu.EthType(0x8863),
fu.VlanPcp(1),
fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 259),
- fu.TunnelId(16),
+ fu.TunnelId(256),
},
Actions: []*ofp.OfpAction{
//fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
diff --git a/vendor/github.com/opencord/voltha-lib-go/v7/pkg/grpc/client.go b/vendor/github.com/opencord/voltha-lib-go/v7/pkg/grpc/client.go
index de649d6..a3dec75 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v7/pkg/grpc/client.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v7/pkg/grpc/client.go
@@ -228,8 +228,8 @@
isGrpcMonitorKeyPresentInContext(ctx) {
c.stateLock.Lock()
if c.state == stateConnected {
- logger.Warnw(context.Background(), "sending-disconnect-event", log.Fields{"endpoint": c.apiEndPoint, "error": err})
c.state = stateDisconnected
+ logger.Warnw(context.Background(), "sending-disconnect-event", log.Fields{"endpoint": c.apiEndPoint, "error": err, "curr-state": stateConnected, "new-state": c.state})
c.events <- eventDisconnected
}
c.stateLock.Unlock()
@@ -290,6 +290,9 @@
c.activeCh = make(chan struct{}, 10)
c.activeChMutex.Unlock()
+ grpcMonitorCheckRunning := false
+ var grpcMonitorCheckRunningLock sync.RWMutex
+
// Interval to wait for no activity before probing the connection
timeout := c.monitorInterval
loop:
@@ -298,11 +301,14 @@
select {
case <-c.activeCh:
- logger.Debugw(ctx, "received-active-notification", log.Fields{"endpoint": c.apiEndPoint})
+ logger.Debugw(ctx, "endpoint-reachable", log.Fields{"endpoint": c.apiEndPoint})
// Reset timer
if !timeoutTimer.Stop() {
- <-timeoutTimer.C
+ select {
+ case <-timeoutTimer.C:
+ default:
+ }
}
case <-ctx.Done():
@@ -312,10 +318,21 @@
// Trigger an activity check if the state is connected. If the state is not connected then there is already
// a backoff retry mechanism in place to retry establishing connection.
c.stateLock.RLock()
- runCheck := c.state == stateConnected
+ grpcMonitorCheckRunningLock.RLock()
+ runCheck := (c.state == stateConnected) && !grpcMonitorCheckRunning
+ grpcMonitorCheckRunningLock.RUnlock()
c.stateLock.RUnlock()
if runCheck {
go func() {
+ grpcMonitorCheckRunningLock.Lock()
+ if grpcMonitorCheckRunning {
+ grpcMonitorCheckRunningLock.Unlock()
+ logger.Debugw(ctx, "connection-check-already-in-progress", log.Fields{"api-endpoint": c.apiEndPoint})
+ return
+ }
+ grpcMonitorCheckRunning = true
+ grpcMonitorCheckRunningLock.Unlock()
+
logger.Debugw(ctx, "connection-check-start", log.Fields{"api-endpoint": c.apiEndPoint})
subCtx, cancel := context.WithTimeout(ctx, c.backoffMaxInterval)
defer cancel()
@@ -326,6 +343,9 @@
response := handler(subCtx, c.connection)
logger.Debugw(ctx, "connection-check-response", log.Fields{"api-endpoint": c.apiEndPoint, "up": response != nil})
}
+ grpcMonitorCheckRunningLock.Lock()
+ grpcMonitorCheckRunning = false
+ grpcMonitorCheckRunningLock.Unlock()
}()
}
}
@@ -362,9 +382,8 @@
logger.Debugw(ctx, "received-event", log.Fields{"event": event, "endpoint": c.apiEndPoint})
switch event {
case eventConnecting:
- logger.Debugw(ctx, "connection-start", log.Fields{"endpoint": c.apiEndPoint, "attempts": attempt})
-
c.stateLock.Lock()
+ logger.Debugw(ctx, "connection-start", log.Fields{"endpoint": c.apiEndPoint, "attempts": attempt, "curr-state": c.state})
if c.state == stateConnected {
c.state = stateDisconnected
}
@@ -393,9 +412,9 @@
c.stateLock.Unlock()
case eventConnected:
- logger.Debugw(ctx, "endpoint-connected", log.Fields{"endpoint": c.apiEndPoint})
attempt = 1
c.stateLock.Lock()
+ logger.Debugw(ctx, "endpoint-connected", log.Fields{"endpoint": c.apiEndPoint, "curr-state": c.state})
if c.state != stateConnected {
c.state = stateConnected
if initialConnection {
@@ -418,7 +437,9 @@
if p != nil {
p.UpdateStatus(ctx, c.apiEndPoint, probe.ServiceStatusNotReady)
}
- logger.Debugw(ctx, "endpoint-disconnected", log.Fields{"endpoint": c.apiEndPoint, "status": c.state})
+ c.stateLock.RLock()
+ logger.Debugw(ctx, "endpoint-disconnected", log.Fields{"endpoint": c.apiEndPoint, "curr-state": c.state})
+ c.stateLock.RUnlock()
// Try to connect again
c.events <- eventConnecting
diff --git a/vendor/github.com/opencord/voltha-lib-go/v7/pkg/platform/platform.go b/vendor/github.com/opencord/voltha-lib-go/v7/pkg/platform/platform.go
index 470d4a9..688ccd8 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v7/pkg/platform/platform.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v7/pkg/platform/platform.go
@@ -32,19 +32,20 @@
OpenFlow port number corresponding to PON UNI
- 20 12 4 0
- +--+--------+--------------+------+
- |0 | pon id | onu id |uni id|
- +--+--------+--------------+------+
+ 24 16 8 0
+ +--+--------+----------+----------+
+ |0 | pon id | onu id | uni id |
+ +--+--------+----------+----------+
pon id = 8 bits = 256 PON ports
onu id = 8 bits = 256 ONUs per PON port
+ uni id = 8 bits = 256 UNIs per ONU
Logical (OF) NNI port number
OpenFlow port number corresponding to PON NNI
- 20 0
+ 24 0
+--+----------------------------+
|1 | intf_id |
+--+----------------------------+
@@ -64,7 +65,7 @@
const (
// Number of bits for the physical UNI of the ONUs
- bitsForUniID = 4
+ bitsForUniID = 8
// Number of bits for the ONU ID
bitsForONUID = 8
// Number of bits for PON ID
@@ -81,33 +82,39 @@
ponIntfMarkerPos = 28
// Value of marker used to distinguish PON port type of OF port
ponIntfMarkerValue = 0x2
- // Number of bits for NNI ID
- bitsforNNIID = 20
- // minNniIntPortNum is used to store start range of nni port number (1 << 20) 1048576
- minNniIntPortNum = (1 << bitsforNNIID)
- // maxNniPortNum is used to store the maximum range of nni port number ((1 << 21)-1) 2097151
- maxNniPortNum = ((1 << (bitsforNNIID + 1)) - 1)
- // minPonIntfPortNum stores the minimum pon port number
+ // minNniPortNum is used to store start range of nni port number (1 << 24) 16777216
+ minNniPortNum = (1 << nniUniDiffPos)
+ // maxNniPortNum is used to store the maximum range of nni port number ((1 << 25)-1) 33554431
+ maxNniPortNum = ((1 << (nniUniDiffPos + 1)) - 1)
+ // minPonIntfPortNum stores the minimum pon port number (536870912)
minPonIntfPortNum = ponIntfMarkerValue << ponIntfMarkerPos
- // maxPonIntfPortNum stores the maximum pon port number
- maxPonIntfPortNum = (ponIntfMarkerValue << ponIntfMarkerPos) | (1 << bitsForPONID)
+ // maxPonIntfPortNum stores the maximum pon port number (536871167)
+ maxPonIntfPortNum = ((ponIntfMarkerValue << ponIntfMarkerPos) | (1 << bitsForPONID)) - 1
upstream = "upstream"
downstream = "downstream"
+ //Technology Profiles ID start value
+ TpIDStart = 64
+ //Technology Profiles ID end value
+ TpIDEnd = 256
+ //Number of Technology Profiles can be defined.
+ TpRange = TpIDEnd - TpIDStart
)
-//MinUpstreamPortID value
-var MinUpstreamPortID = 0xfffd
-
-//MaxUpstreamPortID value
-var MaxUpstreamPortID = 0xfffffffd
-
var controllerPorts = []uint32{0xfffd, 0x7ffffffd, 0xfffffffd}
//MkUniPortNum returns new UNIportNum based on intfID, inuID and uniID
func MkUniPortNum(ctx context.Context, intfID, onuID, uniID uint32) uint32 {
- var limit = int(onuID)
+ var limit = int(intfID)
+ if limit > MaxPonsPerOlt {
+ logger.Warn(ctx, "Warning: exceeded the MAX pons per OLT")
+ }
+ limit = int(onuID)
if limit > MaxOnusPerPon {
- logger.Warn(ctx, "exceeded-the-max-onus-per-pon")
+ logger.Warn(ctx, "Warning: exceeded the MAX ONUS per PON")
+ }
+ limit = int(uniID)
+ if limit > MaxUnisPerOnu {
+ logger.Warn(ctx, "Warning: exceeded the MAX UNIS per ONU")
}
return (intfID << (bitsForUniID + bitsForONUID)) | (onuID << bitsForUniID) | uniID
}
@@ -151,11 +158,11 @@
//IntfIDFromNniPortNum returns Intf ID derived from portNum
func IntfIDFromNniPortNum(ctx context.Context, portNum uint32) (uint32, error) {
- if portNum < minNniIntPortNum || portNum > maxNniPortNum {
+ if portNum < minNniPortNum || portNum > maxNniPortNum {
logger.Errorw(ctx, "nniportnumber-is-not-in-valid-range", log.Fields{"portnum": portNum})
return uint32(0), status.Errorf(codes.InvalidArgument, "nni-port-number-out-of-range:%d", portNum)
}
- return (portNum & 0xFFFF), nil
+ return (portNum & (minNniPortNum - 1)), nil
}
//IntfIDFromPonPortNum returns Intf ID derived from portNum
@@ -164,7 +171,7 @@
logger.Errorw(ctx, "ponportnumber-is-not-in-valid-range", log.Fields{"portnum": portNum})
return uint32(0), status.Errorf(codes.InvalidArgument, "invalid-pon-port-number:%d", portNum)
}
- return (portNum & 0x7FFF), nil
+ return (portNum & ((1 << ponIntfMarkerPos) - 1)), nil
}
//IntfIDToPortTypeName returns port type derived from the intfId
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 85fb517..db38b89 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -114,7 +114,7 @@
github.com/klauspost/compress/huff0
github.com/klauspost/compress/zstd
github.com/klauspost/compress/zstd/internal/xxhash
-# github.com/opencord/voltha-lib-go/v7 v7.0.1
+# github.com/opencord/voltha-lib-go/v7 v7.0.4
## explicit
github.com/opencord/voltha-lib-go/v7/pkg/config
github.com/opencord/voltha-lib-go/v7/pkg/db