Skip to content

Commit

Permalink
Resolved conflicts (openconfig#3334)
Browse files Browse the repository at this point in the history
Co-authored-by: Swetha-haridasula <[email protected]>
  • Loading branch information
2 people authored and alshabib committed Jan 19, 2025
1 parent 5dc6a56 commit b21a699
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ platform_exceptions: {
default_network_instance: "default"
missing_zr_optical_channel_tunable_parameters_telemetry: true
}
}
platform_exceptions: {
platform: {
vendor: JUNIPER
}
deviations: {
operational_mode_unsupported:true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,21 @@ func Test400ZRTunableFrequency(t *testing.T) {
t.Run(tc.description, func(t *testing.T) {
for freq := tc.startFreq; freq <= tc.endFreq; freq += tc.freqStep {
t.Run(fmt.Sprintf("Freq: %v", freq), func(t *testing.T) {
gnmi.Replace(t, dut, gnmi.OC().Component(oc1).OpticalChannel().Config(), &oc.Component_OpticalChannel{
opticalChannel1Config := &oc.Component_OpticalChannel{
TargetOutputPower: ygot.Float64(tc.targetOutputPower),
Frequency: ygot.Uint64(freq),
OperationalMode: ygot.Uint16(dp16QAM),
})
gnmi.Replace(t, dut, gnmi.OC().Component(oc2).OpticalChannel().Config(), &oc.Component_OpticalChannel{
OperationalMode: ygot.Uint16(dp16QAM)}
opticalChannel2Config := &oc.Component_OpticalChannel{
TargetOutputPower: ygot.Float64(tc.targetOutputPower),
Frequency: ygot.Uint64(freq),
OperationalMode: ygot.Uint16(dp16QAM),
})
OperationalMode: ygot.Uint16(dp16QAM)}

if deviations.OperationalModeUnsupported(dut) {
opticalChannel1Config.OperationalMode = nil
opticalChannel2Config.OperationalMode = nil
}
gnmi.Replace(t, dut, gnmi.OC().Component(oc1).OpticalChannel().Config(), opticalChannel1Config)
gnmi.Replace(t, dut, gnmi.OC().Component(oc2).OpticalChannel().Config(), opticalChannel2Config)
gnmi.Await(t, dut, gnmi.OC().Interface(p1.Name()).OperStatus().State(), time.Minute, oc.Interface_OperStatus_UP)
gnmi.Await(t, dut, gnmi.OC().Interface(p2.Name()).OperStatus().State(), time.Minute, oc.Interface_OperStatus_UP)
validateOpticsTelemetry(t, []*samplestream.SampleStream[*oc.Component]{streamOC1, streamOC2}, freq, tc.targetOutputPower)
Expand Down Expand Up @@ -132,16 +137,23 @@ func Test400ZRTunableOutputPower(t *testing.T) {
for _, tc := range tests {
for top := tc.startTargetOutputPower; top <= tc.endTargetOutputPower; top += tc.targetOutputPowerStep {
t.Run(fmt.Sprintf("Target Power: %v", top), func(t *testing.T) {
gnmi.Replace(t, dut, gnmi.OC().Component(oc1).OpticalChannel().Config(), &oc.Component_OpticalChannel{
opticalChannel1Config := &oc.Component_OpticalChannel{
TargetOutputPower: ygot.Float64(top),
Frequency: ygot.Uint64(tc.frequency),
OperationalMode: ygot.Uint16(dp16QAM),
})
gnmi.Replace(t, dut, gnmi.OC().Component(oc2).OpticalChannel().Config(), &oc.Component_OpticalChannel{
}
opticalChannel2Config := &oc.Component_OpticalChannel{
TargetOutputPower: ygot.Float64(top),
Frequency: ygot.Uint64(tc.frequency),
OperationalMode: ygot.Uint16(dp16QAM),
})
}
if deviations.OperationalModeUnsupported(dut) {
opticalChannel1Config.OperationalMode = nil
opticalChannel2Config.OperationalMode = nil
}

gnmi.Replace(t, dut, gnmi.OC().Component(oc1).OpticalChannel().Config(), opticalChannel1Config)
gnmi.Replace(t, dut, gnmi.OC().Component(oc2).OpticalChannel().Config(), opticalChannel2Config)
gnmi.Await(t, dut, gnmi.OC().Interface(p1.Name()).OperStatus().State(), time.Minute, oc.Interface_OperStatus_UP)
gnmi.Await(t, dut, gnmi.OC().Interface(p2.Name()).OperStatus().State(), time.Minute, oc.Interface_OperStatus_UP)
validateOpticsTelemetry(t, []*samplestream.SampleStream[*oc.Component]{streamOC1, streamOC2}, tc.frequency, top)
Expand All @@ -164,16 +176,25 @@ func Test400ZRInterfaceFlap(t *testing.T) {
defer streamOC2.Close()
targetPower := float64(-9)
frequency := uint64(193100000)
gnmi.Replace(t, dut, gnmi.OC().Component(oc1).OpticalChannel().Config(), &oc.Component_OpticalChannel{

opticalChannel1Config := &oc.Component_OpticalChannel{
TargetOutputPower: ygot.Float64(targetPower),
Frequency: ygot.Uint64(frequency),
OperationalMode: ygot.Uint16(dp16QAM),
})
gnmi.Replace(t, dut, gnmi.OC().Component(oc2).OpticalChannel().Config(), &oc.Component_OpticalChannel{
}
opticalChannel2Config := &oc.Component_OpticalChannel{
TargetOutputPower: ygot.Float64(targetPower),
Frequency: ygot.Uint64(frequency),
OperationalMode: ygot.Uint16(dp16QAM),
})
}

if deviations.OperationalModeUnsupported(dut) {
opticalChannel1Config.OperationalMode = nil
opticalChannel2Config.OperationalMode = nil
}

gnmi.Replace(t, dut, gnmi.OC().Component(oc1).OpticalChannel().Config(), opticalChannel1Config)
gnmi.Replace(t, dut, gnmi.OC().Component(oc2).OpticalChannel().Config(), opticalChannel2Config)
gnmi.Await(t, dut, gnmi.OC().Interface(p1.Name()).OperStatus().State(), time.Minute, oc.Interface_OperStatus_UP)
gnmi.Await(t, dut, gnmi.OC().Interface(p2.Name()).OperStatus().State(), time.Minute, oc.Interface_OperStatus_UP)
t.Run("Telemetry before flap", func(t *testing.T) {
Expand Down Expand Up @@ -222,7 +243,7 @@ func validateOpticsTelemetry(t *testing.T, streams []*samplestream.SampleStream[
avg := oc.GetCarrierFrequencyOffset().GetAvg()
min := oc.GetCarrierFrequencyOffset().GetMin()
max := oc.GetCarrierFrequencyOffset().GetMax()
if got, want := opm, uint16(dp16QAM); got != want {
if got, want := opm, uint16(dp16QAM); got != want && !deviations.OperationalModeUnsupported(dut) {
t.Errorf("Optical-Channel: operational-mode: got %v, want %v", got, want)
}
// Laser frequency offset should not be more than +/- 1.8 GHz max from the
Expand Down
5 changes: 5 additions & 0 deletions internal/deviations/deviations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1186,3 +1186,8 @@ func PowerDisableEnableLeafRefValidation(dut *ondatra.DUTDevice) bool {
func SSHServerCountersUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetSshServerCountersUnsupported()
}

// OperationalModeUnsupported returns true if operational-mode leaf is unsupported
func OperationalModeUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetOperationalModeUnsupported()
}
3 changes: 3 additions & 0 deletions proto/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,9 @@ message Metadata {
bool power_disable_enable_leaf_ref_validation = 226;
// Device does not support ssh server counters.
bool ssh_server_counters_unsupported = 227;
// True when the optical-channel operational-mode is unsupported.
// Juniper: b/355456031
bool operational_mode_unsupported = 228;

// 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 b21a699

Please sign in to comment.