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

Improve client-side database content validation #197

Open
alexanderConstantinescu opened this issue Jul 15, 2021 · 0 comments
Open

Improve client-side database content validation #197

alexanderConstantinescu opened this issue Jul 15, 2021 · 0 comments

Comments

@alexanderConstantinescu
Copy link
Contributor

alexanderConstantinescu commented Jul 15, 2021

Goal: as a client of libovsdb I want to be able to write unit tests on my side and have libovsdb provide a framework which enables me to validate the result of the database at the end of my test.

Background: This is almost possible today given the fact that any client can inspect the state of the cache using .Cache().Table() / .Cache().Table().Row() APIs. However what would be really neat is if the cache could just be dumped and serialized to a string using a Cache().Dump() function. What would be even better than that is if libovsdb could run in "test mode" and generate deterministic UUIDs for items in the rows that have references to other models.

Today the output of a test run could look like:

 &LogicalRouter{UUID:1ca27333-af5e-4ad0-978a-44bff7efc13f Enabled:[] ExternalIDs:map[physical_ip:169.254.33.2 physical_ips:169.254.33.2] LoadBalancer:[] Name:GR_test-node Nat:[] Options:map[always_learn_from_arp_request:false chassis:SYSTEM-ID dynamic_neigh_routers:true lb_force_snat_ip:router_ip snat-ct-zone:0] Policies:[] Ports:[15a53efb-3acb-4c1d-aeaa-6e02cfdeb5bb] StaticRoutes:[90fbcd84-edd6-4886-acb6-2c0e4fad217b, 15a53efb-edd6-4886-3acb-2c0e4fad217b]}

It would be cool if the generated object could look like:

 &LogicalRouter{UUID:1 Enabled:[] ExternalIDs:map[physical_ip:169.254.33.2 physical_ips:169.254.33.2] LoadBalancer:[] Name:GR_test-node Nat:[] Options:map[always_learn_from_arp_request:false chassis:SYSTEM-ID dynamic_neigh_routers:true lb_force_snat_ip:router_ip snat-ct-zone:0] Policies:[] Ports:[0] StaticRoutes:[0, 1]}

The assertion of the database content would practically become trivial in that case.

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