openconfig / featureprofiles

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

ATE Traffic stop is failing when EgressTracking is enabled and not packets recieved on ATE #1640

Closed bkreddy143 closed 1 year ago

bkreddy143 commented 1 year ago

Here is code for flow creation and traffic verification , more details in PR # 1315. Where there is traffic received on port it is working fine, panic is seen when there is no traffic and try to stop the traffic,

// createFlow returns a flow from atePort1 to the dstPfx. func createFlow(t testing.T, ate ondatra.ATEDevice, top ondatra.ATETopology, name string) ondatra.Flow { srcEndPoint := top.Interfaces()[atePort1.Name] dstEndPoint := top.Interfaces()[atePort2.Name] ethHeader := ondatra.NewEthernetHeader() ipv4Header := ondatra.NewIPv4Header() ipv4Header.DstAddressRange().WithMin(ateDstIP).WithCount(1)

    flow := ate.Traffic().NewFlow("Flow").
            WithSrcEndpoints(srcEndPoint).
            WithDstEndpoints(dstEndPoint).
            WithHeaders(ethHeader, ipv4Header)
    flow.EgressTracking().WithOffset(33).WithWidth(15)
    return flow

}

// ValidateTraffic generates traffic flow from source network to // destination network via srcEndPoint to dstEndPoint and checks for // packet loss and returns loss percentage as float. // Also validate the flows are with expected EgressTracking filter for MAC NH case func ValidateTraffic(t testing.T, ate ondatra.ATEDevice, top ondatra.ATETopology, flow ondatra.Flow, flowFilter string) float32 { ate.Traffic().Start(t, flow) time.Sleep(15 * time.Second) ate.Traffic().Stop(t)

    time.Sleep(time.Minute)
    flowPath := gnmi.OC().Flow(flow.Name())
    val, _ := gnmi.Watch(t, ate, flowPath.LossPct().State(), time.Minute, func(val *ygnmi.Value[float32]) bool {
            return val.IsPresent()
    }).Await(t)
    lossPct, present := val.Val()
    if !present {
            t.Fatalf("Could not read loss percentage for flow %q from ATE.", flow.Name())
    }
    if int(lossPct) == 0 && flowFilter != "" {
            inPkts := gnmi.Get(t, ate, flowPath.State()).GetCounters().GetInPkts()
            etPath := flowPath.EgressTrackingAny()
            ets := gnmi.GetAll(t, ate, etPath.State())
            if got := len(ets); got != 1 {
                    t.Errorf("EgressTracking got %d items, want %d", got, 1)
            }
            if got := ets[0].GetFilter(); got != flowFilter {
                    t.Errorf("EgressTracking filter got %q, want %q", got, macFilter)
            }
            if got := ets[0].GetCounters().GetInPkts(); got != inPkts {
                    t.Errorf("EgressTracking counter in-pkts got %d, want %d", got, inPkts)
            }
    }
    return lossPct

}

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x5e02a67]

goroutine 422 [running]: github.com/openconfig/ondatra/gnmi/oc.(Flow).GetOrCreateEgressTracking(0x0, {0xc001c2ef00, 0x1e}) /home/nokia/go/pkg/mod/github.com/openconfig/ondatra@v0.1.13/gnmi/oc/structs-0.go:23498 +0x27 github.com/openconfig/ondatra/internal/ixgnmi.translateEgressStats({0xc0021df450?, 0xc0018c2660?, 0xa14333b?}, {0x0, 0x0, 0x0?}, {0x0, 0x0, 0xc0018c26e0?}) /home/nokia/go/pkg/mod/github.com/openconfig/ondatra@v0.1.13/internal/ixgnmi/translate.go:263 +0x5f7 github.com/openconfig/ondatra/internal/ixgnmi.translate(0xc00375d040) /home/nokia/go/pkg/mod/github.com/openconfig/ondatra@v0.1.13/internal/ixgnmi/translate.go:69 +0x15f github.com/openconfig/ondatra/internal/ixgnmi.(Client).readStats(0xc001f0c640, {0xa8500a0, 0xc002a679b0}, {0xa12e206, 0x5}, {0xc0018c26c0, 0x3, 0x3}) /home/nokia/go/pkg/mod/github.com/openconfig/ondatra@v0.1.13/internal/ixgnmi/ixgnmi.go:287 +0x171 github.com/openconfig/ondatra/internal/ixgnmi.glob..func1({0xa8500a0?, 0xc002a679b0?}, 0xc111256f998fe6a3?, {0xa12e206?, 0xf0d4c00?}, {0xc0018c26c0?, 0x0?, 0x9030ce0?}) /home/nokia/go/pkg/mod/github.com/openconfig/ondatra@v0.1.13/internal/ixgnmi/ixgnmi.go:68 +0x3c github.com/openconfig/ondatra/internal/ixgnmi.statViewReader.func1({0xa8500a0?, 0xc002a679b0?}, 0xa12ed71?, 0x6?) /home/nokia/go/pkg/mod/github.com/openconfig/ondatra@v0.1.13/internal/ixgnmi/ixgnmi.go:109 +0x94 github.com/openconfig/ondatra/internal/ixgnmi.(Client).publishRoot(0xc001f0c640, {0xa8500a0, 0xc002a679b0}, {0xa12ed71, 0x6}, 0x0?) /home/nokia/go/pkg/mod/github.com/openconfig/ondatra@v0.1.13/internal/ixgnmi/ixgnmi.go:261 +0x14b github.com/openconfig/ondatra/internal/ixgnmi.(subClient).publishRoots(0xc001f0ccd0) /home/nokia/go/pkg/mod/github.com/openconfig/ondatra@v0.1.13/internal/ixgnmi/ixgnmi.go:487 +0xc5 github.com/openconfig/ondatra/internal/ixgnmi.(subClient).Recv.func1() /home/nokia/go/pkg/mod/github.com/openconfig/ondatra@v0.1.13/internal/ixgnmi/ixgnmi.go:468 +0x98 created by github.com/openconfig/ondatra/internal/ixgnmi.(subClient).Recv /home/nokia/go/pkg/mod/github.com/openconfig/ondatra@v0.1.13/internal/ixgnmi/ixgnmi.go:462 +0x145 exit status 2 FAIL github.com/openconfig/featureprofiles/feature/gribi/ate_tests/base_hierarchical_route_installation_test 353.546s

xw-g commented 1 year ago

@jasdeep-hundal or @greg-dennis do you know who can help triage this issue? Thanks.

greg-dennis commented 1 year ago

I'll take this one

bkreddy143 commented 1 year ago

@greg-dennis , do we have any update on this. it is blocking PR#1315 merge .

greg-dennis commented 1 year ago

Yes, this is fixed in Ondatra version https://github.com/openconfig/ondatra/releases/tag/v0.1.15