openconfig / featureprofiles

Feature Profiles are groups of OpenConfig paths and tests which verify their behavior
Apache License 2.0
53 stars 150 forks source link

gNOI-5.1: Ping #148

Closed yashikakn closed 2 years ago

yashikakn commented 2 years ago

Hi, https://github.com/openconfig/featureprofiles/blob/main/feature/gnoi/tests/ping_test/ping_test.go#L99

lo0 := dut.Telemetry().Interface("Loopback0").Subinterface(0)

Was trying this script and seems the loopback interface name is hardcoded to "Loopback0" in Line 99. Could you please clarify on same as the name varies with Vendor?

Thanks.

dplore commented 2 years ago

@sezhang2 can you help with this question?

sezhang2 commented 2 years ago

I tried "Loopback0" on a couple of different vendor platforms. It works fine.

I will make Loopback0 as the default and allow user to specify new name based on the vendor if needed.

greg-dennis commented 2 years ago

I thought Juniper named the interface lo0. I can easily create a helper function in ondatra/netutil for returning the Loopback0 interface name specific to the vendor.

yashikakn commented 2 years ago

Yes. Juniper loopback interface is named as lo0. A helper function for returning the Loopback0 interface name specific to the vendor would be good. Thanks.

sezhang2 commented 2 years ago

Here is the code I used:

lbIntf := "Loopback0"
if dut.Vendor() == ondatra.JUNIPER {
    lbIntf = "lo0"
}
subintf := dut.Telemetry().Interface(lbIntf).Subinterface(0)
greg-dennis commented 2 years ago

Done. You can now use netutil.LookbackInterface to get a Loopback interface name per vendor: https://github.com/openconfig/ondatra/blob/main/netutil/interface.go#L45

sezhang2 commented 2 years ago

Fixed.