Skip to content

Commit

Permalink
Updated the branch
Browse files Browse the repository at this point in the history
  • Loading branch information
hattikals committed Sep 30, 2024
1 parent bdf96bd commit b7c50ba
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 62 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{
}
opticalChannel2Config := &oc.Component_OpticalChannel{
TargetOutputPower: ygot.Float64(tc.targetOutputPower),
Frequency: ygot.Uint64(freq),
OperationalMode: ygot.Uint16(dp16QAM),
})
}
if !deviations.OperationalModeUnsupported(dut) {
opticalChannel1Config.SetOperationalMode(dp16QAM)
opticalChannel2Config.SetOperationalMode(dp16QAM)
}
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,20 @@ 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),
})
Frequency: ygot.Uint64(tc.frequency),
}
if !deviations.OperationalModeUnsupported(dut) {
opticalChannel1Config.SetOperationalMode(dp16QAM)
opticalChannel2Config.SetOperationalMode(dp16QAM)
}
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 +173,20 @@ 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.SetOperationalMode(dp16QAM)
opticalChannel2Config.SetOperationalMode(dp16QAM)
}
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 +235,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 @@ -1165,3 +1165,8 @@ func EthChannelIngressParametersUnsupported(dut *ondatra.DUTDevice) bool {
func EthChannelAssignmentCiscoNumbering(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetEthChannelAssignmentCiscoNumbering()
}

// 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 @@ -621,6 +621,9 @@ message Metadata {
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;
// operational_mode_unsupported is set to true for devices that do not support optical_channel leaf operational-mode
// Juniper: b/355456031
bool operational_mode_unsupported = 224;
// Reserved field numbers and identifiers.
reserved 84, 9, 28, 20, 90, 97, 55, 89, 19, 36, 35, 40, 173;
}
Expand Down
98 changes: 56 additions & 42 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.

0 comments on commit b7c50ba

Please sign in to comment.