-
Notifications
You must be signed in to change notification settings - Fork 157
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
Adding test files for 400G ZR++ chromatic dispersion test and uncorrectable fec test #3700
Merged
Merged
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
ae7f698
bug fixes: 1) in zr_laser_bias_current_test file, the time.Duration f…
jianchen-g 8079b21
Merge branch 'main' into jianchen-g/OC_github
jianchen-g 6491d50
Adding README files for the testing of a new type of optics 400G ZR++
jianchen-g 48a3941
Merge branch 'main' into jianchen-g/OC_github
jianchen-g 956b6fa
add README file for zrp_input_output_power_test
jianchen-g 318c8a1
restructed the test folder for two optics PMDs of 400G ZR and ZR++. E…
jianchen-g 680c390
make sure test paths follow feature/<feature>/<subfeature>/<testkind>…
jianchen-g 64d3e21
rename folder name to resovle the feature root errors
jianchen-g 05b6cfb
rename folder name to test_item_tests to resovle the feature root errors
jianchen-g 1133bcb
adding tests folder to resolve folder root errors for cd tests
jianchen-g 4e0f3df
adding folder named tests to resolve folder root errors
jianchen-g 609fea0
rename folder chromatic_dispersion
jianchen-g 8704958
rename folder performance_metrics
jianchen-g 3691fbb
Merge branch 'main' into jianchen-g/OC_github
jianchen-g 00ea7f6
Merge branch 'main' into jianchen-g/OC_github
Ankur19 3f8287b
adding test files for 400G ZR++ chromatic dipersion test and uncorrec…
jianchen-g d52cbcd
adding a new line at the end of zrp_cd_test metadata.textproto file
jianchen-g 27ee688
change plan id for zrp_cd_test
jianchen-g 7547706
change plan id for zrp_fec_uncorrectable_frames_test
jianchen-g a63d132
resolving merge conflicts on zr++ cd and FEC test readme files
jianchen-g 7a12bca
1) removed unnecessary portState constant; 2) make verifyAllCDValues …
jianchen-g ff85839
keep one value between desc and streamType
jianchen-g fd6ad6b
Merge branch 'main' into jianchen-g/OC_github
jianchen-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
feature/platform/transceiver/chromatic_dispersion/tests/zrp_cd_test/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
feature/platform/transceiver/chromatic_dispersion/tests/zrp_cd_test/metadata.textproto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# proto-file: github.com/openconfig/featureprofiles/proto/metadata.proto | ||
# proto-message: Metadata | ||
uuid: "6ee614f9-efa6-4d1c-bdea-b15332feedc7" | ||
plan_id: "TRANSCEIVER-1 (400ZR_PLUS)" | ||
description: "Telemetry: 400ZR_PLUS Chromatic Dispersion(CD) telemetry values streaming" | ||
testbed: TESTBED_DUT_400ZR_PLUS | ||
platform_exceptions: { | ||
platform: { | ||
vendor: ARISTA | ||
} | ||
deviations: { | ||
default_network_instance: "default" | ||
missing_port_to_optical_channel_component_mapping: true | ||
} | ||
} |
176 changes: 176 additions & 0 deletions
176
feature/platform/transceiver/chromatic_dispersion/tests/zrp_cd_test/zrp_cd_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
package zrp_cd_test | ||
|
||
import ( | ||
"flag" | ||
"reflect" | ||
"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" | ||
"github.com/openconfig/ondatra" | ||
"github.com/openconfig/ondatra/gnmi" | ||
"github.com/openconfig/ondatra/gnmi/oc" | ||
) | ||
|
||
const ( | ||
samplingInterval = 10 * time.Second | ||
minCDValue = -200 | ||
maxCDValue = 2400 | ||
inActiveCDValue = 0.0 | ||
timeout = 10 * time.Minute | ||
flapInterval = 30 * time.Second | ||
) | ||
|
||
var ( | ||
frequencies = []uint64{191400000, 196100000} | ||
targetOutputPowers = []float64{-7, 0} | ||
operationalModeFlag = flag.Int("operational_mode", 5, "vendor-specific operational-mode for the channel") | ||
operationalMode uint16 | ||
) | ||
|
||
func TestMain(m *testing.M) { | ||
fptest.RunTests(m) | ||
} | ||
|
||
func verifyCDValue(t *testing.T, dut1 *ondatra.DUTDevice, pStream *samplestream.SampleStream[float64], sensorName string, operStatus oc.E_Interface_OperStatus) float64 { | ||
cdSampleNexts := pStream.Nexts(2) | ||
cdSample := cdSampleNexts[1] | ||
t.Logf("CDSampleNexts %v", cdSampleNexts) | ||
if cdSample == nil { | ||
t.Fatalf("CD telemetry %s was not streamed in the most recent subscription interval", sensorName) | ||
} | ||
cdVal, ok := cdSample.Val() | ||
if !ok { | ||
t.Fatalf("CD %q telemetry is not present", cdSample) | ||
} | ||
if reflect.TypeOf(cdVal).Kind() != reflect.Float64 { | ||
t.Fatalf("CD value is not type float64") | ||
} | ||
// Check CD return value of correct type | ||
switch operStatus { | ||
case oc.Interface_OperStatus_DOWN: | ||
if cdVal != inActiveCDValue { | ||
t.Fatalf("The inactive CD is %v, expected %v", cdVal, inActiveCDValue) | ||
} | ||
case oc.Interface_OperStatus_UP: | ||
if cdVal < minCDValue || cdVal > maxCDValue { | ||
t.Fatalf("The variable CD is %v, expected range (%v, %v)", cdVal, minCDValue, maxCDValue) | ||
} | ||
default: | ||
t.Fatalf("Invalid status %v", operStatus) | ||
} | ||
// Get current time | ||
now := time.Now() | ||
// Format the time string | ||
formattedTime := now.Format("2006-01-02 15:04:05") | ||
t.Logf("%s Device %v CD %s value at status %v: %v", formattedTime, dut1.Name(), sensorName, operStatus, cdVal) | ||
|
||
return cdVal | ||
} | ||
|
||
// TODO: Avg and Instant value checks are not available. Need to align their sample streaming windows. | ||
func verifyAllCDValues(t *testing.T, dut1 *ondatra.DUTDevice, p1StreamInstant, p1StreamMax, p1StreamMin, p1StreamAvg *samplestream.SampleStream[float64], operStatus oc.E_Interface_OperStatus) { | ||
tests := []struct { | ||
desc string | ||
stream *samplestream.SampleStream[float64] | ||
streamType string | ||
operStatus oc.E_Interface_OperStatus | ||
}{ | ||
{ | ||
desc: "Instant", | ||
stream: p1StreamInstant, | ||
streamType: "Instant", | ||
operStatus: operStatus, | ||
}, | ||
{ | ||
desc: "Max", | ||
stream: p1StreamMax, | ||
streamType: "Max", | ||
operStatus: operStatus, | ||
}, | ||
{ | ||
desc: "Min", | ||
stream: p1StreamMin, | ||
streamType: "Min", | ||
operStatus: operStatus, | ||
}, | ||
{ | ||
desc: "Avg", | ||
stream: p1StreamAvg, | ||
streamType: "Avg", | ||
jianchen-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
operStatus: operStatus, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.desc, func(t *testing.T) { | ||
verifyCDValue(t, dut1, tt.stream, tt.streamType, tt.operStatus) | ||
}) | ||
} | ||
} | ||
|
||
func TestCDValue(t *testing.T) { | ||
dut := ondatra.DUT(t, "dut") | ||
if operationalModeFlag != nil { | ||
operationalMode = uint16(*operationalModeFlag) | ||
} else { | ||
t.Fatalf("Please specify the vendor-specific operational-mode flag") | ||
} | ||
fptest.ConfigureDefaultNetworkInstance(t, dut) | ||
|
||
dp1 := dut.Port(t, "port1") | ||
dp2 := dut.Port(t, "port2") | ||
|
||
och1 := components.OpticalChannelComponentFromPort(t, dut, dp1) | ||
och2 := components.OpticalChannelComponentFromPort(t, dut, dp2) | ||
|
||
component1 := gnmi.OC().Component(och1) | ||
for _, frequency := range frequencies { | ||
for _, targetOutputPower := range targetOutputPowers { | ||
cfgplugins.ConfigOpticalChannel(t, dut, och1, frequency, targetOutputPower, operationalMode) | ||
cfgplugins.ConfigOpticalChannel(t, dut, och2, frequency, targetOutputPower, operationalMode) | ||
|
||
// Wait for channels to be up. | ||
gnmi.Await(t, dut, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), timeout, oc.Interface_OperStatus_UP) | ||
gnmi.Await(t, dut, gnmi.OC().Interface(dp2.Name()).OperStatus().State(), timeout, oc.Interface_OperStatus_UP) | ||
|
||
p1StreamInstant := samplestream.New(t, dut, component1.OpticalChannel().ChromaticDispersion().Instant().State(), samplingInterval) | ||
p1StreamMin := samplestream.New(t, dut, component1.OpticalChannel().ChromaticDispersion().Min().State(), samplingInterval) | ||
p1StreamMax := samplestream.New(t, dut, component1.OpticalChannel().ChromaticDispersion().Max().State(), samplingInterval) | ||
p1StreamAvg := samplestream.New(t, dut, component1.OpticalChannel().ChromaticDispersion().Avg().State(), samplingInterval) | ||
|
||
defer p1StreamInstant.Close() | ||
defer p1StreamMin.Close() | ||
defer p1StreamMax.Close() | ||
defer p1StreamAvg.Close() | ||
|
||
verifyAllCDValues(t, dut, p1StreamInstant, p1StreamMax, p1StreamMin, p1StreamAvg, oc.Interface_OperStatus_UP) | ||
|
||
// Disable interface. | ||
for _, p := range dut.Ports() { | ||
cfgplugins.ToggleInterface(t, dut, p.Name(), false) | ||
} | ||
// Wait for channels to be down. | ||
gnmi.Await(t, dut, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), timeout, oc.Interface_OperStatus_DOWN) | ||
gnmi.Await(t, dut, gnmi.OC().Interface(dp2.Name()).OperStatus().State(), timeout, oc.Interface_OperStatus_DOWN) | ||
t.Logf("Interfaces are down: %v, %v", dp1.Name(), dp2.Name()) | ||
verifyAllCDValues(t, dut, p1StreamInstant, p1StreamMax, p1StreamMin, p1StreamAvg, oc.Interface_OperStatus_DOWN) | ||
|
||
time.Sleep(flapInterval) | ||
|
||
// Enable interface. | ||
for _, p := range dut.Ports() { | ||
cfgplugins.ToggleInterface(t, dut, p.Name(), true) | ||
} | ||
// Wait for channels to be up. | ||
gnmi.Await(t, dut, gnmi.OC().Interface(dp1.Name()).OperStatus().State(), timeout, oc.Interface_OperStatus_UP) | ||
gnmi.Await(t, dut, gnmi.OC().Interface(dp2.Name()).OperStatus().State(), timeout, oc.Interface_OperStatus_UP) | ||
t.Logf("Interfaces are up: %v, %v", dp1.Name(), dp2.Name()) | ||
verifyAllCDValues(t, dut, p1StreamInstant, p1StreamMax, p1StreamMin, p1StreamAvg, oc.Interface_OperStatus_UP) | ||
|
||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...iver/fec_uncorrectable_frames/tests/zrp_fec_uncorrectable_frames_test/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...eiver/fec_uncorrectable_frames/tests/zrp_fec_uncorrectable_frames_test/metadata.textproto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# proto-file: github.com/openconfig/featureprofiles/proto/metadata.proto | ||
# proto-message: Metadata | ||
|
||
uuid: "387c1f76-7811-4a04-99e3-f690fba1e98e" | ||
plan_id: "TRANSCEIVER-10 (400ZR_PLUS)" | ||
description: "Telemetry: 400ZR_PLUS Optics FEC(Forward Error Correction) Uncorrectable Frames Streaming." | ||
testbed: TESTBED_DUT_400ZR_PLUS | ||
platform_exceptions: { | ||
platform: { | ||
vendor: ARISTA | ||
} | ||
deviations: { | ||
interface_enabled: true | ||
default_network_instance: "default" | ||
missing_port_to_optical_channel_component_mapping: true | ||
channel_assignment_rate_class_parameters_unsupported: true | ||
} | ||
} | ||
platform_exceptions: { | ||
platform: { | ||
vendor: CISCO | ||
} | ||
deviations: { | ||
otn_channel_trib_unsupported: true | ||
eth_channel_ingress_parameters_unsupported: true | ||
eth_channel_assignment_cisco_numbering: true | ||
} | ||
} |
116 changes: 116 additions & 0 deletions
116
...table_frames/tests/zrp_fec_uncorrectable_frames_test/zrp_fec_uncorrectable_frames_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package zrp_fec_uncorrectable_frames_test | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"reflect" | ||
"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" | ||
"github.com/openconfig/ondatra" | ||
"github.com/openconfig/ondatra/gnmi" | ||
"github.com/openconfig/ondatra/gnmi/oc" | ||
) | ||
|
||
const ( | ||
sampleInterval = 10 * time.Second | ||
intUpdateTime = 5 * time.Minute | ||
otnIndexBase = uint32(4000) | ||
ethIndexBase = uint32(40000) | ||
targetOutputPower = -3 | ||
frequency = 193100000 | ||
) | ||
|
||
var ( | ||
operationalModeFlag = flag.Int("operational_mode", 5, "vendor-specific operational-mode for the channel") | ||
operationalMode uint16 | ||
) | ||
|
||
func TestMain(m *testing.M) { | ||
fptest.RunTests(m) | ||
} | ||
|
||
func validateFecUncorrectableBlocks(t *testing.T, stream *samplestream.SampleStream[uint64]) { | ||
fecStream := stream.Next() | ||
if fecStream == nil { | ||
t.Fatalf("Fec Uncorrectable Blocks was not streamed in the most recent subscription interval") | ||
} | ||
fec, ok := fecStream.Val() | ||
if !ok { | ||
t.Fatalf("Error capturing streaming Fec value") | ||
} | ||
if reflect.TypeOf(fec).Kind() != reflect.Uint64 { | ||
t.Fatalf("fec value is not type uint64") | ||
} | ||
if fec != 0 { | ||
t.Fatalf("Got FecUncorrectableBlocks got %d, want 0", fec) | ||
} | ||
} | ||
|
||
func TestZrUncorrectableFrames(t *testing.T) { | ||
if operationalModeFlag != nil { | ||
operationalMode = uint16(*operationalModeFlag) | ||
} else { | ||
t.Fatalf("Please specify the vendor-specific operational-mode flag") | ||
} | ||
dut := ondatra.DUT(t, "dut") | ||
|
||
var ( | ||
// trs = make(map[string]string) | ||
// ochs = make(map[string]string) | ||
otnIndexes = make(map[string]uint32) | ||
ethIndexes = make(map[string]uint32) | ||
) | ||
|
||
ports := []string{"port1", "port2"} | ||
|
||
for i, port := range ports { | ||
p := dut.Port(t, port) | ||
och := components.OpticalChannelComponentFromPort(t, dut, p) | ||
otnIndexes[p.Name()] = otnIndexBase + uint32(i) | ||
ethIndexes[p.Name()] = ethIndexBase + uint32(i) | ||
cfgplugins.ConfigOpticalChannel(t, dut, och, frequency, targetOutputPower, operationalMode) | ||
cfgplugins.ConfigOTNChannel(t, dut, och, otnIndexes[p.Name()], ethIndexes[p.Name()]) | ||
cfgplugins.ConfigETHChannel(t, dut, p.Name(), och, otnIndexes[p.Name()], ethIndexes[p.Name()]) | ||
} | ||
|
||
for _, port := range ports { | ||
t.Run(fmt.Sprintf("Port:%s", port), func(t *testing.T) { | ||
p := dut.Port(t, port) | ||
gnmi.Await(t, dut, gnmi.OC().Interface(p.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP) | ||
streamFecOtn := samplestream.New(t, dut, gnmi.OC().TerminalDevice().Channel(otnIndexes[p.Name()]).Otn().FecUncorrectableBlocks().State(), sampleInterval) | ||
defer streamFecOtn.Close() | ||
validateFecUncorrectableBlocks(t, streamFecOtn) | ||
|
||
// Disable interface | ||
cfgplugins.ToggleInterface(t, dut, p.Name(), false) | ||
// Wait for the cooling-off period | ||
gnmi.Await(t, dut, gnmi.OC().Interface(p.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_DOWN) | ||
|
||
// Enable interface | ||
cfgplugins.ToggleInterface(t, dut, p.Name(), true) | ||
// Wait for the cooling-off period | ||
gnmi.Await(t, dut, gnmi.OC().Interface(p.Name()).OperStatus().State(), intUpdateTime, oc.Interface_OperStatus_UP) | ||
|
||
validateFecUncorrectableBlocks(t, streamFecOtn) | ||
}) | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.Helper()