Skip to content

Commit

Permalink
Update interface.go
Browse files Browse the repository at this point in the history
  • Loading branch information
self-maurya committed Jan 6, 2025
1 parent 5254ca8 commit bde1657
Showing 1 changed file with 20 additions and 40 deletions.
60 changes: 20 additions & 40 deletions internal/cfgplugins/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,48 +140,28 @@ func ConfigETHChannel(t *testing.T, dut *ondatra.DUTDevice, interfaceName, trans
Transceiver: ygot.String(transceiverName),
}
}
var assignment = map[uint32]*oc.TerminalDevice_Channel_Assignment{}
var assignment = map[uint32]*oc.TerminalDevice_Channel_Assignment{
0: {
Index: ygot.Uint32(0),
LogicalChannel: ygot.Uint32(otnIndex),
Description: ygot.String("ETH to OTN"),
Allocation: ygot.Float64(400),
AssignmentType: oc.Assignment_AssignmentType_LOGICAL_CHANNEL,
},
}
if deviations.EthChannelAssignmentCiscoNumbering(dut) {
assignment = map[uint32]*oc.TerminalDevice_Channel_Assignment{
0: {
Index: ygot.Uint32(1),
LogicalChannel: ygot.Uint32(otnIndex),
Description: ygot.String("ETH to OTN"),
Allocation: ygot.Float64(400),
AssignmentType: oc.Assignment_AssignmentType_LOGICAL_CHANNEL,
},
}
} else {
assignment = map[uint32]*oc.TerminalDevice_Channel_Assignment{
0: {
Index: ygot.Uint32(0),
LogicalChannel: ygot.Uint32(otnIndex),
Description: ygot.String("ETH to OTN"),
Allocation: ygot.Float64(400),
AssignmentType: oc.Assignment_AssignmentType_LOGICAL_CHANNEL,
},
}
assignment[0].Index = ygot.Uint32(1)
}
var channel *oc.TerminalDevice_Channel
if deviations.ChannelRateClassParametersUnsupported(dut) {
channel = &oc.TerminalDevice_Channel{
Description: ygot.String("ETH Logical Channel"),
Index: ygot.Uint32(ethIndex),
LogicalChannelType: oc.TransportTypes_LOGICAL_ELEMENT_PROTOCOL_TYPE_PROT_ETHERNET,
TribProtocol: oc.TransportTypes_TRIBUTARY_PROTOCOL_TYPE_PROT_400GE,
Ingress: ingress,
Assignment: assignment,
}
} else {
channel = &oc.TerminalDevice_Channel{
Description: ygot.String("ETH Logical Channel"),
Index: ygot.Uint32(ethIndex),
LogicalChannelType: oc.TransportTypes_LOGICAL_ELEMENT_PROTOCOL_TYPE_PROT_ETHERNET,
TribProtocol: oc.TransportTypes_TRIBUTARY_PROTOCOL_TYPE_PROT_400GE,
RateClass: oc.TransportTypes_TRIBUTARY_RATE_CLASS_TYPE_TRIB_RATE_400G,
Ingress: ingress,
Assignment: assignment,
}
var channel = &oc.TerminalDevice_Channel{
Description: ygot.String("ETH Logical Channel"),
Index: ygot.Uint32(ethIndex),
LogicalChannelType: oc.TransportTypes_LOGICAL_ELEMENT_PROTOCOL_TYPE_PROT_ETHERNET,
TribProtocol: oc.TransportTypes_TRIBUTARY_PROTOCOL_TYPE_PROT_400GE,
Ingress: ingress,
Assignment: assignment,
}
if !deviations.ChannelRateClassParametersUnsupported(dut) {
channel.RateClass = oc.TransportTypes_TRIBUTARY_RATE_CLASS_TYPE_TRIB_RATE_400G
}
gnmi.Replace(t, dut, gnmi.OC().TerminalDevice().Channel(ethIndex).Config(), channel)
}

0 comments on commit bde1657

Please sign in to comment.