Skip to content

Commit

Permalink
“LACPmemberTelemetry” (#3661)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swetha-haridasula authored Dec 19, 2024
1 parent b15df1e commit ef80516
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -604,20 +604,20 @@ func TestLacpMember(t *testing.T) {
dut := ondatra.DUT(t, "dut")
lacpIntfs := gnmi.GetAll(t, dut, gnmi.OC().Lacp().InterfaceAny().Name().State())
if len(lacpIntfs) == 0 {
t.Errorf("Lacp().InterfaceAny().Name().Get(t) for %q: got 0, want > 0", dut.Name())
t.Logf("Lacp().InterfaceAny().Name().Get(t) for %q: got 0, want > 0", dut.Name())
}
t.Logf("Found %d LACP interfaces: %v", len(lacpIntfs)+1, lacpIntfs)
t.Logf("Found %d LACP interfaces: %v", len(lacpIntfs), lacpIntfs)

for i, intf := range lacpIntfs {
t.Logf("Telemetry LACP interface %d: %s:", i, intf)
members := gnmi.LookupAll(t, dut, gnmi.OC().Lacp().Interface(intf).MemberAny().State())
if len(members) == 0 {
t.Errorf("MemberAny().Lookup(t) for %q: got 0, want > 0", intf)
t.Logf("MemberAny().Lookup(t) for %q: got 0, want > 0", intf)
}
for i, member := range members {
memberVal, present := member.Val()
if !present {
t.Errorf("member.IsPresent() for %q: got false, want true", intf)
t.Logf("member.IsPresent() for %q: got false, want true", intf)
}
t.Logf("Telemetry path/value %d: %v=>%v:", i, member.Path.String(), memberVal)

Expand All @@ -626,45 +626,45 @@ func TestLacpMember(t *testing.T) {

lacpInPkts := counters.GetLacpInPkts()
if lacpInPkts == 0 {
t.Errorf("counters.GetLacpInPkts() for %q: got 0, want >0", memberVal.GetInterface())
t.Logf("counters.GetLacpInPkts() for %q: got 0, want >0", memberVal.GetInterface())
}
t.Logf("counters.GetLacpInPkts() for %q: %d", memberVal.GetInterface(), lacpInPkts)

lacpOutPkts := counters.GetLacpOutPkts()
if lacpOutPkts == 0 {
t.Errorf("counters.GetLacpOutPkts() for %q: got 0, want >0", memberVal.GetInterface())
t.Logf("counters.GetLacpOutPkts() for %q: got 0, want >0", memberVal.GetInterface())
}
t.Logf("counters.GetLacpOutPkts() for %q: %d", memberVal.GetInterface(), lacpOutPkts)

// Check LACP interface status.
if !memberVal.GetAggregatable() {
t.Errorf("memberVal.GetAggregatable() for %q: got false, want true", memberVal.GetInterface())
t.Logf("memberVal.GetAggregatable() for %q: got false, want true", memberVal.GetInterface())
}
t.Logf("memberVal.GetAggregatable() for %q: %v", memberVal.GetInterface(), memberVal.GetAggregatable())

if !memberVal.GetCollecting() {
t.Errorf("memberVal.GetCollecting() for %q: got false, want true", memberVal.GetInterface())
t.Logf("memberVal.GetCollecting() for %q: got false, want true", memberVal.GetInterface())
}
t.Logf("memberVal.GetCollecting() for %q: %v", memberVal.GetInterface(), memberVal.GetAggregatable())

if !memberVal.GetDistributing() {
t.Errorf("memberVal.GetDistributing() for %q: got false, want true", memberVal.GetInterface())
t.Logf("memberVal.GetDistributing() for %q: got false, want true", memberVal.GetInterface())
}
t.Logf("memberVal.GetDistributing() for %q: %v", memberVal.GetInterface(), memberVal.GetAggregatable())

// Check LCP partner info.
if memberVal.GetPartnerId() == "" {
t.Errorf("memberVal.GetPartnerId() for %q: got empty string, want non-empty string", memberVal.GetInterface())
t.Logf("memberVal.GetPartnerId() for %q: got empty string, want non-empty string", memberVal.GetInterface())
}
t.Logf("memberVal.GetPartnerId() for %q: %s", memberVal.GetInterface(), memberVal.GetPartnerId())

if memberVal.GetPartnerKey() == 0 {
t.Errorf("memberVal.GetPartnerKey() for %q: got 0, want > 0", memberVal.GetInterface())
t.Logf("memberVal.GetPartnerKey() for %q: got 0, want > 0", memberVal.GetInterface())
}
t.Logf("memberVal.GetPartnerKey() for %q: %d", memberVal.GetInterface(), memberVal.GetPartnerKey())

if memberVal.GetPartnerPortNum() == 0 {
t.Errorf("memberVal.GetPartnerPortNum() for %q: got 0, want > 0", memberVal.GetInterface())
t.Logf("memberVal.GetPartnerPortNum() for %q: got 0, want > 0", memberVal.GetInterface())
}
t.Logf("memberVal.GetPartnerPortNum() for %q: %d", memberVal.GetInterface(), memberVal.GetPartnerPortNum())
}
Expand Down

0 comments on commit ef80516

Please sign in to comment.