open-traffic-generator/snappi

The object "gosnappi.IsisLspFlags" requires a better way to check if it is empty.

abhijit-dhar opened this issue · 0 comments

While using gnmi transport, lsp.Flags() returns a blank structure {}, not nil, (also unsafe.Sizeof(lsp.Flags()) returns 16, not zero). But if a blank structure like {} is returned all the subsequent method call like lsp.Flags().PartitionRepair() throws exception. Possibly Gosnappi needs a better way to handle this situation. From a go program is there any way to query “gosnappi.IsisLspFlags” such that calls like lsp.Flags().PartitionRepair(), lsp.Flags().AttachedError() does not raise exception? unsafe.Sizeof(lsp.Flags()) is ruled out because irrespective of the structure is filled or not the function returns 16.
I guess return value of lsp.Flags() is of type gosnappi.IsisLspFlags.

See the sample code below. Since gnmi does not set any LSP flags calls like lsp.Flags().PartitionRepair(), lsp.Flags().AttachedError() Throws exception.

fmt.Println(lsp.Flags())
// returns {}
if expectedFlags.PartitionRepair != lsp.Flags().PartitionRepair() { // exception
fmt.Println("Partition Repair flag did not match")
fmt.Println("Expected = %v Actual = %v",
expectedFlags.PartitionRepair,
lsp.Flags().PartitionRepair())
return false, nil
}

// Match flags, when given -> AttachedError
if expectedFlags.AttachedError != lsp.Flags().AttachedError() { // exception
fmt.Println("Attached Error flag did not match")
fmt.Println("Expected = %v Actual = %v",
expectedFlags.AttachedError,
lsp.Flags().AttachedError())
return false, nil
}