Skip to content

Commit

Permalink
Rt 5.6 fix (#2079)
Browse files Browse the repository at this point in the history
* added deviation to skip_interface_oper_status_lower_layer_down

* deviation to update interface loopback mode using raw gnmi

* fixed call

* fixed GNMI raw call

* updated logic for Interface_OperStatus_LOWER_LAYER_DOWN check

* added Interface_OperStatus_DOWN check

* rollback vendor call order

* rebase

* updated metadata.pb.go

* Fix nil dereference (#2128)

* RT-1.23 BGP AFI-SAFI OC Defaults (#2082)

* Initial commit for RT-1.23

* updated metadata

* Update bgp_afi_safi_defaults_test.go

* Update metadata.textproto

---------

Co-authored-by: Arul Kumar Sekar <[email protected]>
Co-authored-by: sachendras <[email protected]>

* fixed the tun1.9 subnet issue (#2088)

* fixed the tun1.9 subnet issue

* fixing the ip address assignment guidelines

---------

Co-authored-by: Arul Kumar Sekar <[email protected]>
Co-authored-by: sachendras <[email protected]>

* RT-1.11 - BGP remove private AS  - OTG test (#1853)

* added OTG test for RT-1.11

* added metadata

* updated

* updated

* added deviations to metadata

* Update bgp_remove_private_as_otg_test.go

updated int32 to uint32

* Addressing review comments

* Updated README

* Updated README

* Update metadata.textproto

* Adressing review comments

---------

Co-authored-by: Arul Kumar Sekar <[email protected]>

* updated call

---------

Co-authored-by: Greg Dennis <[email protected]>
Co-authored-by: cprabha <[email protected]>
Co-authored-by: Arul Kumar Sekar <[email protected]>
Co-authored-by: sachendras <[email protected]>
Co-authored-by: KandukuriSudheer <[email protected]>
Co-authored-by: guoshiuan <[email protected]>
  • Loading branch information
7 people authored Sep 18, 2023
1 parent 5f639b0 commit fe4c123
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package interface_loopback_aggregate_test

import (
"context"
"fmt"
"testing"
"time"
Expand All @@ -23,11 +24,13 @@ import (
"github.com/openconfig/featureprofiles/internal/attrs"
"github.com/openconfig/featureprofiles/internal/deviations"
"github.com/openconfig/featureprofiles/internal/fptest"
gpb "github.com/openconfig/gnmi/proto/gnmi"
"github.com/openconfig/ondatra"
"github.com/openconfig/ondatra/gnmi"
"github.com/openconfig/ondatra/gnmi/oc"
"github.com/openconfig/ondatra/netutil"
"github.com/openconfig/ondatra/otg"
"github.com/openconfig/ygnmi/ygnmi"
"github.com/openconfig/ygot/ygot"
)

Expand Down Expand Up @@ -198,23 +201,73 @@ func TestInterfaceLoopbackMode(t *testing.T) {
})

t.Run("Verify AE interface and port-1 are down on DUT", func(t *testing.T) {
gnmi.Await(t, dut, gnmi.OC().Interface(aggID).OperStatus().State(), 2*time.Minute, oc.Interface_OperStatus_LOWER_LAYER_DOWN)
operStatus := gnmi.Get(t, dut, gnmi.OC().Interface(aggID).OperStatus().State())
if want := oc.Interface_OperStatus_LOWER_LAYER_DOWN; operStatus != want {
t.Errorf("Get(DUT AE interface oper status): got %v, want %v", operStatus, want)

want := []oc.E_Interface_OperStatus{oc.Interface_OperStatus_LOWER_LAYER_DOWN, oc.Interface_OperStatus_DOWN}
opStatus, statusCheckResult := gnmi.Watch(t, dut, gnmi.OC().Interface(aggID).OperStatus().State(), 2*time.Minute, func(y *ygnmi.Value[oc.E_Interface_OperStatus]) bool {
opStatus, ok := y.Val()
if !ok {
return false
}
for _, expectedStatus := range want {
if opStatus == expectedStatus {
return true
}
}
return false
}).Await(t)
if !statusCheckResult {
val, _ := opStatus.Val()
t.Errorf("Get(DUT AE interface oper status): got %v, want %v", val.String(), want)
}

gnmi.Await(t, dut, gnmi.OC().Interface(dutPort1.Name()).OperStatus().State(), 1*time.Minute, oc.Interface_OperStatus_DOWN)
operStatus = gnmi.Get(t, dut, gnmi.OC().Interface(dutPort1.Name()).OperStatus().State())
operStatus := gnmi.Get(t, dut, gnmi.OC().Interface(dutPort1.Name()).OperStatus().State())
if want := oc.Interface_OperStatus_DOWN; operStatus != want {
t.Errorf("Get(DUT port1 oper status): got %v, want %v", operStatus, want)
}
})

t.Run("Configure interface loopback mode FACILITY on DUT AE interface", func(t *testing.T) {
gnmi.Update(t, dut, gnmi.OC().Interface(aggID).LoopbackMode().Config(), oc.Interfaces_LoopbackModeType_FACILITY)
if deviations.AggregateLoopbackModeRequiresMemberPortLoopbackMode(dut) {
gnmi.Update(t, dut, gnmi.OC().Interface(dutPort1.Name()).LoopbackMode().Config(), oc.Interfaces_LoopbackModeType_FACILITY)
if deviations.InterfaceLoopbackModeRawGnmi(dut) {
gpbSetRequest := &gpb.SetRequest{
Update: []*gpb.Update{{
Path: &gpb.Path{
Origin: "openconfig",
Elem: []*gpb.PathElem{
{
Name: "interfaces",
},
{
Name: "interface",
Key: map[string]string{
"name": dut.Port(t, "port1").Name(),
},
},
{
Name: "config",
},
{
Name: "loopback-mode",
},
},
},
Val: &gpb.TypedValue{
Value: &gpb.TypedValue_JsonIetfVal{
JsonIetfVal: []byte("true"),
},
},
}},
}
gnmiClient := dut.RawAPIs().GNMI(t)
_, err := gnmiClient.Set(context.Background(), gpbSetRequest)
if err != nil {
t.Errorf("Failed to update interface loopback mode")
}
} else {
gnmi.Update(t, dut, gnmi.OC().Interface(aggID).LoopbackMode().Config(), oc.Interfaces_LoopbackModeType_FACILITY)
if deviations.AggregateLoopbackModeRequiresMemberPortLoopbackMode(dut) {
gnmi.Update(t, dut, gnmi.OC().Interface(dutPort1.Name()).LoopbackMode().Config(), oc.Interfaces_LoopbackModeType_FACILITY)
}
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ platform_exceptions: {
aggregate_loopback_mode_requires_member_port_loopback_mode: true
}
}
platform_exceptions: {
platform: {
vendor: CISCO
}
deviations: {
interface_loopback_mode_raw_gnmi: true
}
}
6 changes: 6 additions & 0 deletions internal/deviations/deviations.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,3 +602,9 @@ func ISISCounterPartChangesUnsupported(dut *ondatra.DUTDevice) bool {
func TransceiverThresholdsUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetTransceiverThresholdsUnsupported()
}

// InterfaceLoopbackModeRawGnmi returns true if interface loopback mode needs to be updated using raw gnmi API due to server version.
// Default value is false.
func InterfaceLoopbackModeRawGnmi(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetInterfaceLoopbackModeRawGnmi()
}
2 changes: 2 additions & 0 deletions proto/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ message Metadata {
bool isis_counter_part_changes_unsupported = 107;
// Devices do not support threshold container under /components/component/transceiver.
bool transceiver_thresholds_unsupported = 108;
// Update interface loopback mode using raw gnmi API due to server version.
bool interface_loopback_mode_raw_gnmi = 109;

// Reserved field numbers and identifiers.
reserved 84, 9, 28, 90;
Expand Down
87 changes: 50 additions & 37 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 fe4c123

Please sign in to comment.