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

RoundTrip testing Using QuickCheck #6

Merged
merged 21 commits into from
Oct 15, 2013
Merged

RoundTrip testing Using QuickCheck #6

merged 21 commits into from
Oct 15, 2013

Conversation

seliopou
Copy link
Collaborator

Implement roundtrip testing using QuickCheck for the following modules:

  • OF0x01.Match
  • OF0x01.PseudoPort
  • OF0x01.Action
  • OF0x01.FlowMod.Command
  • OF0x01.FlowMod.Timeout
  • OF0x01.Flowmod

This pull request had to modify all their public APIs to expose the marshal and parse functions—though they're sometimes called something else—as well as any other necessary functions to perform roundtrip testing. This pull request also introduces several interfaces that are useful for setting up these tests:

  • OpenFlow0x01_Arbitrary: requires a marshal, parse, and to_string function on the data type, and you also must specify the serialization type for the types to work out.
  • OpenFlow0x01_ArbitraryCstruct: assumes the serialized type is a Cstruct, and therefore also requires a size_of function; and
  • OpenFlow0x01_Unsize: a functor to convert the latter module to the former.

I only found one bug throughout testing, which I fixed in 092b7fd.

Somebody else should look at this commit. Because of they way that the
parse and marshal (i.e., make) functions work for PseudoPort, the code
manually tracks parameter of the Controller constructor in the
serialization datatype. This test therefore does not check whether or
not the artibrary instance generates valid data for that parameter.
Use OpenFlow0x01_ArbitraryCstruct when a data structure can be
serialized to a Cstruct.t and exposes a to_string function on its type.
Use the functor OpenFlow0x01_Unsize to transform the module into one of
type OpenFlow0x01_Arbitrary.
These are reusable arbitrary instances. They should likely live
somewhere outside of the Match QuickCheck module, but for now they're
fine there.
The controller parameter should be an unsigned int. It was not
previously exercised by the PseudoPort roundtrip test, but will be
exercised in subsequent commits.
These are all the functions that are necessary to creat an
OpenFlow0x01_ArbitraryCstruct module.
to_int and of_info for marshal and parse, respectively.
to_int and of_info for marshal and parse, respectively.
Certain functions on in the OpenFlow0x01 API expect a pseudoPort but
do not handle the Controller variant properly. At some point the code
should discriminate on the different input domains at the type level,
but until then use this function to test.

With this commit the Enqueue case of the Action roundtrip test now
works, which was introduced but commented out in fa51a3f.

Related to #5.
These are all the functions that are necessary to creat an
OpenFlow0x01_ArbitraryCstruct module.
The out_port was always assumed to be either absent or to be
representing a physical port. The PseudoPort.make functions was simply
not being called.
jnfoster added a commit that referenced this pull request Oct 15, 2013
RoundTrip testing Using QuickCheck
@jnfoster jnfoster merged commit bfbc4af into master Oct 15, 2013
@jnfoster
Copy link
Member

Looks great.

@arjunguha arjunguha deleted the quicktest branch November 2, 2013 18:29
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

Successfully merging this pull request may close these issues.

None yet

3 participants