Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
abhijit-dhar opened this issue Oct 11, 2022 · 0 comments

Comments

@abhijit-dhar
Copy link

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant