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

mib2dev.py: automatic values hit ConstraintsIntersection #66

Open
mbonnier-gv opened this issue Mar 5, 2019 · 5 comments
Open

mib2dev.py: automatic values hit ConstraintsIntersection #66

mbonnier-gv opened this issue Mar 5, 2019 · 5 comments

Comments

@mbonnier-gv
Copy link

mbonnier-gv commented Mar 5, 2019

While generating a data set, mib2dev.py, I got the error:

 *** Inconsistent value: <ConstraintsIntersection .... '<ConstraintsUnion object at 0x7fd9feb73438 consts <SingleValueConstraint object at 0x7fd9feb73400 consts 1, 2, 3>  .... # Scalar PROFLINE-STARG2-MIB::starg2SetClockLockTo (type LockToSourceModes)

Processing this MIB entry:

starg2SetClockLockTo OBJECT-TYPE
   SYNTAX          LockToSourceModes
   MAX-ACCESS      read-write
   STATUS          current
   DESCRIPTION     "Lock the internal clock to the time received from an external source.
                    1 = off
                    2 = sntp over mgmt
                    3 = ntp over mpe"
   ::= { starg2SetClock 2 }

Since the script suggest me the proper values, is it possible to add an option so that the generator just pick one of them (randomly) ?

Is the option: [--automatic-values=<max-probes>] is the one used for that ?

EDIT: After I tried 15 MIBs from different companies, 8 cannot be synthesized ... mainly because of
ConstraintsIntersection, or "invalid literal for int() with base 10" (generated value is a string 'kept Jaded...'

Thanks for this project,

@etingof
Copy link
Owner

etingof commented Mar 5, 2019

is it possible to add an option so that the generator just pick one of them (randomly) ?

Depending on the underlying type of LockToSourceModes, you may try --unsigned-range=<min,max> or --integer32-range=<min,max> option to set the range of all values of this type for the MIB you are simulating.

Once you have the initial .snmprec file, you could edit it by hand to adjust the values.

There is currently no option to limit the values of specific MIB objects, but it could be added.

@etingof etingof changed the title mib2dev.py: ConstraintsIntersection mib2dev.py: automatic values hit ConstraintsIntersection Mar 5, 2019
@mbonnier-gv
Copy link
Author

The --XXX-range options can't be used since they affects all the value.

The best would be to add the option, since the possible values are present in the error message.

One problem is that we don't want to go interactive - an interim solution would be to add an option to: output the variable name (as MIB::var) that can't be generated on stdout and continue.

The idea here is to generate some data ASAP when we develop. an SNMP driver.

@etingof
Copy link
Owner

etingof commented Mar 6, 2019

That seems doable. Let me see if I get a bit of time to work on this.

@etingof
Copy link
Owner

etingof commented Mar 7, 2019

That seems doable. Let me see if I get a bit of time to work on this.

Well, not quite, apparently. Trouble is that whenever we fail on SNMP table index, we effectively fail on the whole table row... There is a good chance that, for some tightly constrained table indices, we are unlikely to ever pick the right value. That leads to skipping the whole table, what makes this tool next to being useless.

That makes me think that the better course of action would be to "reverse" the constraints meaning the ability to generate samples out of constraints.

That would be the reflective operation in the sense that what we currently have is that we feed a value to the constraints tree to see if the value fits the constraints. What we'd need, I think, is given the constraints tree we produce a value which would satisfy the constraints.

@mbonnier-gv
Copy link
Author

Indeed, that would the best solution and a more architecturally sound solution.
Thanks.
Still, the option to "not got interactive and just log the OID that cannot be resolved" would be an easy and quick way so that the script continue to run as long as possible.

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

2 participants