Skip to content

Commit

Permalink
Input output power (openconfig#3303)
Browse files Browse the repository at this point in the history
* modify power range, update logical chanel config and remove min/max/avg check

* Modify README file

* Modify README

* adding library to properly configure logical channels

* update in/out power to align with other zr tests

* update in/out power README

* update in/out power README one more time

* update in/out power README one more time

* update in/out power README one more time

* update in/out power README one more time

* update in/out power README one more time

* update in/out power README one more time

* increase sleep time for pm test

* remove min/max/avg validaion
  • Loading branch information
rezachit authored Jul 17, 2024
1 parent 45db7ed commit c536b13
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions feature/platform/transceiver/tests/zr_pm_test/zr_pm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestPM(t *testing.T) {
for _, p := range dut.Ports() {
gnmi.Await(t, dut, gnmi.OC().Interface(p.Name()).OperStatus().State(), timeout, oc.Interface_OperStatus_UP)
}
time.Sleep(samplingInterval) // Wait an extra sample interval to ensure the device has time to process the change.
time.Sleep(3 * samplingInterval) // Wait an extra sample interval to ensure the device has time to process the change.

validateAllSamples(t, dut, true, interfaceStreams, otnStreams)

Expand All @@ -108,7 +108,7 @@ func TestPM(t *testing.T) {
for _, p := range dut.Ports() {
gnmi.Await(t, dut, gnmi.OC().Interface(p.Name()).OperStatus().State(), timeout, oc.Interface_OperStatus_DOWN)
}
time.Sleep(samplingInterval) // Wait an extra sample interval to ensure the device has time to process the change.
time.Sleep(3 * samplingInterval) // Wait an extra sample interval to ensure the device has time to process the change.

validateAllSamples(t, dut, false, interfaceStreams, otnStreams)

Expand All @@ -121,7 +121,7 @@ func TestPM(t *testing.T) {
for _, p := range dut.Ports() {
gnmi.Await(t, dut, gnmi.OC().Interface(p.Name()).OperStatus().State(), timeout, oc.Interface_OperStatus_UP)
}
time.Sleep(samplingInterval) // Wait an extra sample interval to ensure the device has time to process the change.
time.Sleep(3 * samplingInterval) // Wait an extra sample interval to ensure the device has time to process the change.

validateAllSamples(t, dut, true, interfaceStreams, otnStreams)
}
Expand Down Expand Up @@ -195,18 +195,18 @@ func validateSampleStream(t *testing.T, interfaceData *ygnmi.Value[*oc.Interface
}

// validatePMValue validates the pm value.
func validatePMValue(t *testing.T, portName, pm string, instant, min, max, avg, minAllowed, maxAllowed, inactiveValue float64, linkState oc.E_Interface_OperStatus) {
switch linkState {
func validatePMValue(t *testing.T, portName, pm string, instant, min, max, avg, minAllowed, maxAllowed, inactiveValue float64, operStatus oc.E_Interface_OperStatus) {
switch operStatus {
case oc.Interface_OperStatus_UP:
if instant < minAllowed || instant > maxAllowed {
t.Errorf("Invalid %v sample when %v is UP --> min : %v, max : %v, avg : %v, instant : %v", pm, portName, min, max, avg, instant)
return
}
case oc.Interface_OperStatus_DOWN:
if instant != inactiveValue || avg != inactiveValue || min != inactiveValue || max != inactiveValue {
if instant != inactiveValue {
t.Errorf("Invalid %v sample when %v is DOWN --> min : %v, max : %v, avg : %v, instant : %v", pm, portName, min, max, avg, instant)
return
}
}
t.Logf("Valid %v sample when %v is %v --> min : %v, max : %v, avg : %v, instant : %v", pm, portName, linkState, min, max, avg, instant)
t.Logf("Valid %v sample when %v is %v --> min : %v, max : %v, avg : %v, instant : %v", pm, portName, operStatus, min, max, avg, instant)
}

0 comments on commit c536b13

Please sign in to comment.