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

Adding test files for 400G ZR++ chromatic dispersion test and uncorrectable fec test #3700

Merged
merged 23 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all 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 Dec 27, 2024
8079b21
Merge branch 'main' into jianchen-g/OC_github
jianchen-g Jan 4, 2025
6491d50
Adding README files for the testing of a new type of optics 400G ZR++
jianchen-g Jan 6, 2025
48a3941
Merge branch 'main' into jianchen-g/OC_github
jianchen-g Jan 6, 2025
956b6fa
add README file for zrp_input_output_power_test
jianchen-g Jan 7, 2025
318c8a1
restructed the test folder for two optics PMDs of 400G ZR and ZR++. E…
jianchen-g Jan 8, 2025
680c390
make sure test paths follow feature/<feature>/<subfeature>/<testkind>…
jianchen-g Jan 8, 2025
64d3e21
rename folder name to resovle the feature root errors
jianchen-g Jan 8, 2025
05b6cfb
rename folder name to test_item_tests to resovle the feature root errors
jianchen-g Jan 8, 2025
1133bcb
adding tests folder to resolve folder root errors for cd tests
jianchen-g Jan 9, 2025
4e0f3df
adding folder named tests to resolve folder root errors
jianchen-g Jan 9, 2025
609fea0
rename folder chromatic_dispersion
jianchen-g Jan 9, 2025
8704958
rename folder performance_metrics
jianchen-g Jan 9, 2025
3691fbb
Merge branch 'main' into jianchen-g/OC_github
jianchen-g Jan 16, 2025
00ea7f6
Merge branch 'main' into jianchen-g/OC_github
Ankur19 Jan 17, 2025
3f8287b
adding test files for 400G ZR++ chromatic dipersion test and uncorrec…
jianchen-g Jan 17, 2025
d52cbcd
adding a new line at the end of zrp_cd_test metadata.textproto file
jianchen-g Jan 17, 2025
27ee688
change plan id for zrp_cd_test
jianchen-g Jan 17, 2025
7547706
change plan id for zrp_fec_uncorrectable_frames_test
jianchen-g Jan 17, 2025
a63d132
resolving merge conflicts on zr++ cd and FEC test readme files
jianchen-g Jan 21, 2025
7a12bca
1) removed unnecessary portState constant; 2) make verifyAllCDValues …
jianchen-g Jan 22, 2025
ff85839
keep one value between desc and streamType
jianchen-g Jan 23, 2025
fd6ad6b
Merge branch 'main' into jianchen-g/OC_github
jianchen-g Jan 24, 2025
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
@@ -1,4 +1,4 @@
# TRANSCEIVER-1: Telemetry: 400ZR_PLUS Chromatic Dispersion(CD) telemetry values streaming
# TRANSCEIVER-1 (400ZR_PLUS): Telemetry: 400ZR_PLUS Chromatic Dispersion(CD) telemetry values streaming

## Summary

Expand Down
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
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
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)
Copy link
Contributor

Choose a reason for hiding this comment

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

t.Helper()

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,
operStatus: operStatus,
},
{
desc: "Max",
stream: p1StreamMax,
operStatus: operStatus,
},
{
desc: "Min",
stream: p1StreamMin,
operStatus: operStatus,
},
{
desc: "Avg",
stream: p1StreamAvg,
operStatus: operStatus,
},
}

for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
verifyCDValue(t, dut1, tt.stream, tt.desc, 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)

}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TRANSCEIVER-10: Telemetry: 400ZR_PLUS Optics FEC(Forward Error Correction) Uncorrectable Frames Streaming.
# TRANSCEIVER-10 (400ZR_PLUS): Telemetry: 400ZR_PLUS Optics FEC(Forward Error Correction) Uncorrectable Frames Streaming.

## Summary

Expand Down
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
}
}
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)
})
}
}
Loading