Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRANSCEIVER-12 Fixed with adding required deviations #3638

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
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: NOKIA
}
deviations: {
interface_enabled: true
require_zr_oper_mode: true
explicit_dco_config: true
}
}
37 changes: 30 additions & 7 deletions internal/cfgplugins/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,36 @@ func InterfaceConfig(t *testing.T, dut *ondatra.DUTDevice, dp *ondatra.Port) {
i.Enabled = ygot.Bool(true)
i.Type = oc.IETFInterfaces_InterfaceType_ethernetCsmacd
gnmi.Replace(t, dut, gnmi.OC().Interface(dp.Name()).Config(), i)
ocComponent := components.OpticalChannelComponentFromPort(t, dut, dp)
t.Logf("Got opticalChannelComponent from port: %s", ocComponent)
gnmi.Update(t, dut, gnmi.OC().Component(ocComponent).Name().Config(), ocComponent)
gnmi.Replace(t, dut, gnmi.OC().Component(ocComponent).OpticalChannel().Config(), &oc.Component_OpticalChannel{
TargetOutputPower: ygot.Float64(targetOutputPowerdBm),
Frequency: ygot.Uint64(targetFrequencyMHz),
})
if deviations.ExplicitDcoConfig(dut) {
transceiverName := gnmi.Get(t, dut, gnmi.OC().Interface(dp.Name()).Transceiver().State())
gnmi.Replace(t, dut, gnmi.OC().Component(transceiverName).Config(), &oc.Component{
Name: ygot.String(transceiverName),
Transceiver: &oc.Component_Transceiver{
ModuleFunctionalType: oc.TransportTypes_TRANSCEIVER_MODULE_FUNCTIONAL_TYPE_TYPE_DIGITAL_COHERENT_OPTIC,
},
})
}
if deviations.RequireZrOperMode(dut) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not encode specific implementation's oper-mode's here.

If you want to specify a specific oper-mode, this should be done through a flag in the tests. As an example:

operationalModeFlag = flag.Int("operational_mode", 1, "vendor-specific operational-mode for the channel")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be using ConfigOpticalChannel() here and then we don't need a deviation?

func ConfigOpticalChannel(t *testing.T, dut *ondatra.DUTDevice, och string, frequency uint64, targetOpticalPower float64, operationalMode uint16) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can set this up calling ConfigOpticalChannel() under InterfaceConfig(); however will this have any negative impact on existing implementation of other vendors where the oper-mode may be self-discovered?

ocComponent := components.OpticalChannelComponentFromPort(t, dut, dp)
t.Logf("Got opticalChannelComponent from port: %s", ocComponent)
var operMode uint16 = 83
gnmi.Replace(t, dut, gnmi.OC().Component(ocComponent).Config(), &oc.Component{
Name: ygot.String(ocComponent),
OpticalChannel: &oc.Component_OpticalChannel{
TargetOutputPower: ygot.Float64(targetOutputPowerdBm),
Frequency: ygot.Uint64(targetFrequencyMHz),
OperationalMode: ygot.Uint16(operMode),
},
})
} else {
ocComponent := components.OpticalChannelComponentFromPort(t, dut, dp)
t.Logf("Got opticalChannelComponent from port: %s", ocComponent)
gnmi.Update(t, dut, gnmi.OC().Component(ocComponent).Name().Config(), ocComponent)
gnmi.Replace(t, dut, gnmi.OC().Component(ocComponent).OpticalChannel().Config(), &oc.Component_OpticalChannel{
TargetOutputPower: ygot.Float64(targetOutputPowerdBm),
Frequency: ygot.Uint64(targetFrequencyMHz),
})
}
}

// ValidateInterfaceConfig validates the output power and frequency for the given port.
Expand Down
10 changes: 10 additions & 0 deletions internal/deviations/deviations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1264,3 +1264,13 @@ func BgpSetMedV7Unsupported(dut *ondatra.DUTDevice) bool {
func EnableTableConnections(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetEnableTableConnections()
}

// RequireZrOperMode returns true for the devices that require a mandatory value in operational-mode leaf for optical-channel
func RequireZrOperMode(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetRequireZrOperMode()
}

// ExplicitDcoConfig returns true if a user-configured value is required in module-functional-type for the transceiver
func ExplicitDcoConfig(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetExplicitDcoConfig()
}
7 changes: 6 additions & 1 deletion proto/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,12 @@ message Metadata {
// Juniper: b/358534837
// Devices that do not support setting med value using union type in OC.
bool bgp_set_med_v7_unsupported = 241;

// Nokia: b/383369830
// RequireZrOperMode returns true if a user-configured value is required in operational-mode for the optical-channel
bool require_zr_oper_mode = 242;
// Nokia: b/383075189
// ExplicitDcoConfig returns true if explicit configurations are required in module-functional-type for the transceiver
bool explicit_dco_config = 243;
// Reserved field numbers and identifiers.
reserved 84, 9, 28, 20, 90, 97, 55, 89, 19, 36, 35, 40, 173;
}
Expand Down
Loading
Loading