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 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
snaragund marked this conversation as resolved.
Show resolved Hide resolved
snaragund marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -1292,3 +1292,13 @@ func DefaultBgpInstanceName(dut *ondatra.DUTDevice) string {
}
return "DEFAULT"
}

// 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()
}
6 changes: 6 additions & 0 deletions proto/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,12 @@ message Metadata {
// Cisco: b/388983709
// default bgp instance name is used to set bgp instance name value other than DEFAULT
string default_bgp_instance_name = 246;
// 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 = 247;
// Nokia: b/383075189
// ExplicitDcoConfig returns true if explicit configurations are required in module-functional-type for the transceiver
bool explicit_dco_config = 248;

// Reserved field numbers and identifiers.
reserved 84, 9, 28, 20, 90, 97, 55, 89, 19, 36, 35, 40, 173;
Expand Down
115 changes: 70 additions & 45 deletions proto/metadata_go_proto/metadata.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading