Skip to content

Commit

Permalink
Cisco transceiver 3 (openconfig#3457)
Browse files Browse the repository at this point in the history
* uncorrectable_frames deviation

* uncorrectable_frames deviation

* pm + logical-channels deviations

* fec blocks

* revert

* firmware version

* deviation for tunable params test

* error fix

* error fix

* error fix

* error fix

* PR suggestions

* PR changes

* metadata changes
  • Loading branch information
karthikeya-remilla authored Sep 30, 2024
1 parent 3f72a23 commit bdf96bd
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@ platform_exceptions: {
missing_port_to_optical_channel_component_mapping: true
}
}
platform_exceptions: {
platform: {
vendor: CISCO
}
deviations: {
otn_channel_trib_unsupported: true
eth_channel_ingress_parameters_unsupported: true
eth_channel_assignment_cisco_numbering: true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ func TestZrUncorrectableFrames(t *testing.T) {
for _, port := range ports {
t.Run(fmt.Sprintf("Port:%s", port), func(t *testing.T) {
dp := dut.Port(t, port)

gnmi.Await(t, dut, gnmi.OC().Interface(dp.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP)

streamFecOtn := samplestream.New(t, dut, gnmi.OC().TerminalDevice().Channel(otnIndexes[dp.Name()]).Otn().FecUncorrectableBlocks().State(), sampleInterval)
defer streamFecOtn.Close()
validateFecUncorrectableBlocks(t, streamFecOtn)
Expand All @@ -98,13 +96,13 @@ func TestZrUncorrectableFrames(t *testing.T) {
// Disable interface
i.Enabled = ygot.Bool(false)
gnmi.Replace(t, dut, gnmi.OC().Interface(dp.Name()).Config(), i)
// Wait for the cooling off period
// Wait for the cooling-off period
gnmi.Await(t, dut, gnmi.OC().Interface(dp.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_DOWN)

// Enable interface
i.Enabled = ygot.Bool(true)
gnmi.Replace(t, dut, gnmi.OC().Interface(dp.Name()).Config(), i)
// Wait for the cooling off period
// Wait for the cooling-off period
gnmi.Await(t, dut, gnmi.OC().Interface(dp.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP)

validateFecUncorrectableBlocks(t, streamFecOtn)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"testing"
"time"

"github.com/openconfig/featureprofiles/internal/cfgplugins"
"github.com/openconfig/featureprofiles/internal/components"
"github.com/openconfig/featureprofiles/internal/fptest"
"github.com/openconfig/featureprofiles/internal/samplestream"
Expand All @@ -29,7 +30,6 @@ import (
)

const (
dp16QAM = 1
targetOutputPower = -10
frequency = 193100000
)
Expand All @@ -46,8 +46,13 @@ func configInterface(t *testing.T, dut1 *ondatra.DUTDevice, dp *ondatra.Port, en
i.Enabled = ygot.Bool(enable)
i.Type = oc.IETFInterfaces_InterfaceType_ethernetCsmacd
gnmi.Replace(t, dut1, gnmi.OC().Interface(dp.Name()).Config(), i)
component := components.OpticalChannelComponentFromPort(t, dut1, dp)
gnmi.Replace(t, dut1, gnmi.OC().Component(component).OpticalChannel().Config(), &oc.Component_OpticalChannel{
componentName := components.OpticalChannelComponentFromPort(t, dut1, dp)
// Set config container leaf for optical channel
component := gnmi.OC().Component(componentName)
gnmi.Replace(t, dut1, component.Config(), &oc.Component{
Name: ygot.String(componentName),
})
gnmi.Replace(t, dut1, component.OpticalChannel().Config(), &oc.Component_OpticalChannel{
TargetOutputPower: ygot.Float64(targetOutputPower),
Frequency: ygot.Uint64(frequency),
})
Expand All @@ -74,8 +79,8 @@ func TestZRFirmwareVersionState(t *testing.T) {
dp2 := dut1.Port(t, "port2")
t.Logf("dut1: %v", dut1)
t.Logf("dut1 dp1 name: %v", dp1.Name())
configInterface(t, dut1, dp1, true)
configInterface(t, dut1, dp2, true)
cfgplugins.InterfaceConfig(t, dut1, dp1)
cfgplugins.InterfaceConfig(t, dut1, dp2)
gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), time.Minute*2, oc.Interface_OperStatus_UP)
transceiverName := gnmi.Get(t, dut1, gnmi.OC().Interface(dp1.Name()).Transceiver().State())
// Check if TRANSCEIVER is of type 400ZR
Expand All @@ -97,8 +102,8 @@ func TestZRFirmwareVersionStateInterfaceFlap(t *testing.T) {
dp2 := dut1.Port(t, "port2")
t.Logf("dut1: %v", dut1)
t.Logf("dut1 dp1 name: %v", dp1.Name())
configInterface(t, dut1, dp1, true)
configInterface(t, dut1, dp2, true)
cfgplugins.InterfaceConfig(t, dut1, dp1)
cfgplugins.InterfaceConfig(t, dut1, dp2)
gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), time.Minute, oc.Interface_OperStatus_UP)
transceiverName := gnmi.Get(t, dut1, gnmi.OC().Interface(dp1.Name()).Transceiver().State())
// Check if TRANSCEIVER is of type 400ZR
Expand All @@ -111,7 +116,7 @@ func TestZRFirmwareVersionStateInterfaceFlap(t *testing.T) {

p1Stream := samplestream.New(t, dut1, component1.FirmwareVersion().State(), 10*time.Second)

// Wait 60 sec cooling off period
// Wait 60 sec cooling-off period
gnmi.Await(t, dut1, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), 2*time.Minute, oc.Interface_OperStatus_DOWN)
verifyFirmwareVersionValue(t, dut1, p1Stream)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ platform_exceptions: {
default_network_instance: "default"
missing_zr_optical_channel_tunable_parameters_telemetry: true
}
}
}
99 changes: 69 additions & 30 deletions internal/cfgplugins/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"testing"

"github.com/openconfig/featureprofiles/internal/components"
"github.com/openconfig/featureprofiles/internal/deviations"
"github.com/openconfig/ondatra"
"github.com/openconfig/ondatra/gnmi"
"github.com/openconfig/ondatra/gnmi/oc"
Expand Down Expand Up @@ -77,6 +78,7 @@ func ToggleInterface(t *testing.T, dut *ondatra.DUTDevice, intf string, isEnable

// ConfigOpticalChannel configures the optical channel.
func ConfigOpticalChannel(t *testing.T, dut *ondatra.DUTDevice, och string, frequency uint64, targetOpticalPower float64, operationalMode uint16) {
gnmi.Update(t, dut, gnmi.OC().Component(och).Name().Config(), och)
gnmi.Replace(t, dut, gnmi.OC().Component(och).OpticalChannel().Config(), &oc.Component_OpticalChannel{
OperationalMode: ygot.Uint16(operationalMode),
Frequency: ygot.Uint64(frequency),
Expand All @@ -87,50 +89,87 @@ func ConfigOpticalChannel(t *testing.T, dut *ondatra.DUTDevice, och string, freq
// ConfigOTNChannel configures the OTN channel.
func ConfigOTNChannel(t *testing.T, dut *ondatra.DUTDevice, och string, otnIndex, ethIndex uint32) {
t.Helper()
gnmi.Replace(t, dut, gnmi.OC().TerminalDevice().Channel(otnIndex).Config(), &oc.TerminalDevice_Channel{
Description: ygot.String("OTN Logical Channel"),
Index: ygot.Uint32(otnIndex),
LogicalChannelType: oc.TransportTypes_LOGICAL_ELEMENT_PROTOCOL_TYPE_PROT_OTN,
TribProtocol: oc.TransportTypes_TRIBUTARY_PROTOCOL_TYPE_PROT_400GE,
Assignment: map[uint32]*oc.TerminalDevice_Channel_Assignment{
0: {
Index: ygot.Uint32(0),
OpticalChannel: ygot.String(och),
Description: ygot.String("OTN to Optical Channel"),
Allocation: ygot.Float64(400),
AssignmentType: oc.Assignment_AssignmentType_OPTICAL_CHANNEL,
if deviations.OTNChannelTribUnsupported(dut) {
gnmi.Replace(t, dut, gnmi.OC().TerminalDevice().Channel(otnIndex).Config(), &oc.TerminalDevice_Channel{
Description: ygot.String("OTN Logical Channel"),
Index: ygot.Uint32(otnIndex),
LogicalChannelType: oc.TransportTypes_LOGICAL_ELEMENT_PROTOCOL_TYPE_PROT_OTN,
Assignment: map[uint32]*oc.TerminalDevice_Channel_Assignment{
0: {
Index: ygot.Uint32(1),
OpticalChannel: ygot.String(och),
Description: ygot.String("OTN to Optical Channel"),
Allocation: ygot.Float64(400),
AssignmentType: oc.Assignment_AssignmentType_OPTICAL_CHANNEL,
},
},
1: {
Index: ygot.Uint32(1),
LogicalChannel: ygot.Uint32(ethIndex),
Description: ygot.String("OTN to ETH"),
Allocation: ygot.Float64(400),
AssignmentType: oc.Assignment_AssignmentType_LOGICAL_CHANNEL,
})
} else {
gnmi.Replace(t, dut, gnmi.OC().TerminalDevice().Channel(otnIndex).Config(), &oc.TerminalDevice_Channel{
Description: ygot.String("OTN Logical Channel"),
Index: ygot.Uint32(otnIndex),
LogicalChannelType: oc.TransportTypes_LOGICAL_ELEMENT_PROTOCOL_TYPE_PROT_OTN,
TribProtocol: oc.TransportTypes_TRIBUTARY_PROTOCOL_TYPE_PROT_400GE,
Assignment: map[uint32]*oc.TerminalDevice_Channel_Assignment{
0: {
Index: ygot.Uint32(0),
OpticalChannel: ygot.String(och),
Description: ygot.String("OTN to Optical Channel"),
Allocation: ygot.Float64(400),
AssignmentType: oc.Assignment_AssignmentType_OPTICAL_CHANNEL,
},
1: {
Index: ygot.Uint32(1),
LogicalChannel: ygot.Uint32(ethIndex),
Description: ygot.String("OTN to ETH"),
Allocation: ygot.Float64(400),
AssignmentType: oc.Assignment_AssignmentType_LOGICAL_CHANNEL,
},
},
},
})
})
}
}

// ConfigETHChannel configures the ETH channel.
func ConfigETHChannel(t *testing.T, dut *ondatra.DUTDevice, interfaceName, transceiverName string, otnIndex, ethIndex uint32) {
t.Helper()
gnmi.Replace(t, dut, gnmi.OC().TerminalDevice().Channel(ethIndex).Config(), &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: &oc.TerminalDevice_Channel_Ingress{
var ingress = &oc.TerminalDevice_Channel_Ingress{}
if !deviations.EthChannelIngressParametersUnsupported(dut) {
ingress = &oc.TerminalDevice_Channel_Ingress{
Interface: ygot.String(interfaceName),
Transceiver: ygot.String(transceiverName),
},
Assignment: map[uint32]*oc.TerminalDevice_Channel_Assignment{
}
}
var assignment = map[uint32]*oc.TerminalDevice_Channel_Assignment{}
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,
},
},
})
}
}
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,
}
gnmi.Replace(t, dut, gnmi.OC().TerminalDevice().Channel(ethIndex).Config(), channel)
}
15 changes: 15 additions & 0 deletions internal/deviations/deviations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1150,3 +1150,18 @@ func UseParentComponentForTemperatureTelemetry(dut *ondatra.DUTDevice) bool {
func ComponentMfgDateUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetComponentMfgDateUnsupported()
}

// OTNChannelTribUnsupported returns true if TRIB parameter is unsupported under OTN channel configuration
func OTNChannelTribUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetOtnChannelTribUnsupported()
}

// EthChannelIngressParametersUnsupported returns true if ingress parameters are unsupported under ETH channel configuration
func EthChannelIngressParametersUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetEthChannelIngressParametersUnsupported()
}

// EthChannelAssignmentCiscoNumbering returns true if eth channel assignment index starts from 1 instead of 0
func EthChannelAssignmentCiscoNumbering(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetEthChannelAssignmentCiscoNumbering()
}
10 changes: 8 additions & 2 deletions proto/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ message Metadata {
// equal to the canonical hardware model name of its device.
bool model_name_unsupported = 194;
// community_match_with_redistribution_unsupported is set to true for devices that do not support matching community at the redistribution attach point.
bool community_match_with_redistribution_unsupported = 195;
bool community_match_with_redistribution_unsupported = 195;
// Devices that do not support components/component/state/install-component
// and components/component/state/install-position.
bool install_position_and_install_component_unsupported = 196;
Expand All @@ -575,7 +575,7 @@ message Metadata {
// weighted ecmp feature verification using fixed packet
bool weighted_ecmp_fixed_packet_verification = 202;
// Override default NextHop scale while enabling encap/decap scale
// CISCO:
// CISCO:
bool override_default_nh_scale = 203;
// Devices that donot support setting bgp extended community set
bool bgp_extended_community_set_unsupported = 204;
Expand Down Expand Up @@ -615,6 +615,12 @@ message Metadata {
bool use_parent_component_for_temperature_telemetry = 219;
// component manufactured date is unsupported
bool component_mfg_date_unsupported = 220;
// trib protocol field under otn channel config unsupported
bool otn_channel_trib_unsupported = 221;
// ingress parameters under eth channel config unsupported
bool eth_channel_ingress_parameters_unsupported = 222;
// Cisco numbering for eth channel assignment starts from 1 instead of 0
bool eth_channel_assignment_cisco_numbering = 223;
// Reserved field numbers and identifiers.
reserved 84, 9, 28, 20, 90, 97, 55, 89, 19, 36, 35, 40, 173;
}
Expand Down
Loading

0 comments on commit bdf96bd

Please sign in to comment.