[YANGTOOLS-450] v6 prefix checking broken Created: 23/Apr/15 Updated: 10/Apr/22 Resolved: 08/Jun/15 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Anton Ivanov | Assignee: | Tony Tkacik |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| Issue Links: |
|
||||||||
| External issue ID: | 3051 | ||||||||
| Description |
|
This is an example piece of code from openflowplugin tests. ActionSetNwSrcReactorTest.java:45 new Ipv6Builder().setIpv6Address(new Ipv6Prefix("1234:5678:9abc:def1:2345:6789:abcd:ef12")).build(), This passes a prefix without a /X to the Ipv6Prefix constructor. This should not work. But it does - test passes in stock openflowplugin from helium. |
| Comments |
| Comment by Tony Tkacik [ 23/Apr/15 ] |
| Comment by Anton Ivanov [ 23/Apr/15 ] |
|
Exec summary: I have no clue what is going on here. The java code generated by yangtools looks correct. However it accepts input which should definitely fail (as in the openflow example). The regexps are correct. If I cut-n-paste them into the following perl snippet they work: #!/usr/bin/perl @z = ("^((:|[0-9a-fA-F] {0,4})
((([0-9a-fA-F] {0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9]) (25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9] {2})|(1[0-1][0-9])|(12[0-8])))\$", "^(([^:]+ (([^:]:[^:])|(. while ($a = <STDIN>) { else { print "NOK for $regexp\n"; } } Unless there is something in the yang generated code which I have missed, this looks like a bug in the underlying regexp library. |
| Comment by Carol Sanders [ 19/May/15 ] |
|
Awaiting down stream projects to update their code. Projects Still failing: |
| Comment by Anil Vishnoi [ 20/May/15 ] |
|
Hi Carol, What exactly are the changes that down stream project need to do? Thanks |
| Comment by Anton Ivanov [ 20/May/15 ] |
|
Anil, you need to replace any instantiation of IpvXPrefix (mostly found in Matchers) which is being done without a netmask with a correct argument - with netmask. The easiest way is utility class with multiple createPrefix() methods: Ipv6Prefix createPrefix(string); Ipv6Prefix createPrefix(Ipv6Address); Ipv4Prefix createPrefix(string); Ipv4Prefix createPrefix(Ipv4Address); You just drop that in instead of the direct new IpvXPrefix() instantiation across the board. It will take whatever argument you are feeding it and consume it. I ended up adding temprorarily (string, string) for openflowplugin, but IMHO that is temporary, the mask has no need of being a string in a network application. Ever. The easiest way to get that done would have been to override the yangtools generation if we had that facility. As we do not have it, you have to do it manually. |