Skip to content

Commit

Permalink
Merge pull request #492 from batfish/release-0.31-start-1
Browse files Browse the repository at this point in the history
Release 0.31.1
  • Loading branch information
dhalperi committed Oct 4, 2017
2 parents e5dfbba + d503fd2 commit b62754c
Show file tree
Hide file tree
Showing 39 changed files with 409 additions and 125 deletions.
2 changes: 1 addition & 1 deletion projects/allinone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.batfish</groupId>
<artifactId>batfish-parent</artifactId>
<version>0.31.0</version>
<version>0.31.1</version>
</parent>

<artifactId>allinone</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion projects/batfish-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.batfish</groupId>
<artifactId>batfish-parent</artifactId>
<version>0.31.0</version>
<version>0.31.1</version>
</parent>

<artifactId>batfish-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion projects/batfish-common-protocol/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.batfish</groupId>
<artifactId>batfish-parent</artifactId>
<version>0.31.0</version>
<version>0.31.1</version>
</parent>

<artifactId>batfish-common-protocol</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion projects/batfish/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.batfish</groupId>
<artifactId>batfish-parent</artifactId>
<version>0.31.0</version>
<version>0.31.1</version>
</parent>

<artifactId>batfish</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion projects/coordinator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.batfish</groupId>
<artifactId>batfish-parent</artifactId>
<version>0.31.0</version>
<version>0.31.1</version>
</parent>

<artifactId>coordinator</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion projects/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>org.batfish</groupId>
<artifactId>batfish-parent</artifactId>
<version>0.31.0</version>
<version>0.31.1</version>

<packaging>pom</packaging>

Expand Down
2 changes: 1 addition & 1 deletion projects/question/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.batfish</groupId>
<artifactId>batfish-parent</artifactId>
<version>0.31.0</version>
<version>0.31.1</version>
</parent>

<artifactId>question</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,57 +30,62 @@ public class JsonPathResult {

public static class JsonPathResultEntry {

private static final String PROP_PREFIX = "prefix";
private static final String PROP_CONCRETE_PATH = "concretePath";

private static final String PROP_SUFFIX = "suffix";

private final JsonNode _prefix;
private final List<String> _concretePath;

private final JsonNode _suffix;

@JsonCreator
public JsonPathResultEntry(
@JsonProperty(PROP_PREFIX) JsonNode prefix, @JsonProperty(PROP_SUFFIX) JsonNode suffix) {
_prefix = prefix;
@JsonProperty(PROP_CONCRETE_PATH) List<String> concretePath,
@JsonProperty(PROP_SUFFIX) JsonNode suffix) {
_concretePath = concretePath;
if (suffix != null && suffix.isNull()) {
_suffix = null;
} else {
_suffix = suffix;
}
}

public JsonPathResultEntry(JsonNode prefix, JsonNode suffix) {
this(getPrefixParts(prefix), suffix);
}

@Override
public boolean equals(Object o) {
if (o == null) {
return o == null;
} else if (!(o instanceof JsonPathResultEntry)) {
return false;
}
return Objects.equal(_prefix, ((JsonPathResultEntry) o)._prefix)
return Objects.equal(_concretePath, ((JsonPathResultEntry) o)._concretePath)
&& Objects.equal(_suffix, ((JsonPathResultEntry) o)._suffix);
}

@JsonIgnore
public String getMapKey() {
return String.join("->", getPrefixParts());
return String.join("->", _concretePath);
}

@JsonProperty(PROP_PREFIX)
public JsonNode getPrefix() {
return _prefix;
@JsonProperty(PROP_CONCRETE_PATH)
public List<String> getConcretePath() {
return _concretePath;
}

public String getPrefixPart(int index) {
List<String> parts = getPrefixParts();
if (parts.size() <= index) {
throw new BatfishException("No valid part at index " + index + "for prefix " + _prefix);
if (_concretePath.size() <= index) {
throw new BatfishException(
"No valid part at index " + index + "for concrete path " + _concretePath);
}
// remove the single quotes around the string
return parts.get(index).replaceAll("^\'|\'$", "");
return _concretePath.get(index).replaceAll("^\'|\'$", "");
}

private List<String> getPrefixParts() {
String text = _prefix.textValue();
private static List<String> getPrefixParts(JsonNode prefix) {
String text = prefix.textValue();
if (text.equals("$")) {
return Arrays.asList("$");
}
Expand All @@ -98,7 +103,7 @@ public JsonNode getSuffix() {

@Override
public int hashCode() {
return Objects.hashCode(_prefix, _suffix);
return Objects.hashCode(_concretePath, _suffix);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void testEvaluateEqualsFalse() {
jpAssertion.setType(JsonPathAssertionType.equals);
try {
BatfishObjectMapper mapper = new BatfishObjectMapper();
JsonNode expect = mapper.readValue("[{\"prefix\": \"kkl\"}]", JsonNode.class);
JsonNode expect = mapper.readValue("[{\"concretePath\": [\"'kkl'\"]}]", JsonNode.class);
jpAssertion.setExpect(expect);
} catch (IOException e) {
e.printStackTrace();
Expand All @@ -124,7 +124,7 @@ public void testEvaluateEqualsTrueWithSuffix() {
JsonNode expect =
mapper.readValue(
"[{"
+ "\"prefix\": \"$[\'nodes\'][\'node1\'][\'ntpServers\']\", "
+ "\"concretePath\": [\"'nodes'\", \"'node1'\", \"'ntpServers'\"], "
+ "\"suffix\" : [\"1.2.3.4\", \"5.6.7.8\"]"
+ "}]",
JsonNode.class);
Expand All @@ -146,7 +146,7 @@ public void testEvaluateEqualsTrueWithoutSuffix() {
try {
BatfishObjectMapper mapper = new BatfishObjectMapper();
JsonNode expect =
mapper.readValue("[{\"prefix\": \"$[\'nodes\'][\'node1\']\"}]", JsonNode.class);
mapper.readValue("[{\"concretePath\": [\"'nodes'\", \"'node1'\"]}]", JsonNode.class);
jpAssertion.setExpect(expect);
} catch (IOException e) {
e.printStackTrace();
Expand Down
4 changes: 2 additions & 2 deletions test_rigs/parsing-tests/dc-as-reuse.ref
Original file line number Diff line number Diff line change
Expand Up @@ -4680,7 +4680,7 @@
]
}
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.ConvertConfigurationAnswerElement",
Expand Down Expand Up @@ -4836,7 +4836,7 @@
}
}
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.InitInfoAnswerElement",
Expand Down
4 changes: 2 additions & 2 deletions test_rigs/parsing-tests/disable-as-suppression.ref
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@
]
}
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.ConvertConfigurationAnswerElement",
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.InitInfoAnswerElement",
Expand Down
4 changes: 2 additions & 2 deletions test_rigs/parsing-tests/example-juniper.ref
Original file line number Diff line number Diff line change
Expand Up @@ -10365,7 +10365,7 @@
]
}
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.ConvertConfigurationAnswerElement",
Expand Down Expand Up @@ -10494,7 +10494,7 @@
}
}
},
"version" : "0.31.0",
"version" : "0.31.1",
"warnings" : {
"as1border1" : {
"Red flags" : {
Expand Down
4 changes: 2 additions & 2 deletions test_rigs/parsing-tests/example.ref
Original file line number Diff line number Diff line change
Expand Up @@ -10699,7 +10699,7 @@
]
}
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.ConvertConfigurationAnswerElement",
Expand Down Expand Up @@ -10842,7 +10842,7 @@
}
}
},
"version" : "0.31.0",
"version" : "0.31.1",
"warnings" : {
"as1border1" : {
"Red flags" : {
Expand Down
4 changes: 2 additions & 2 deletions test_rigs/parsing-tests/indirection.ref
Original file line number Diff line number Diff line change
Expand Up @@ -944,11 +944,11 @@
]
}
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.ConvertConfigurationAnswerElement",
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.InitInfoAnswerElement",
Expand Down
4 changes: 2 additions & 2 deletions test_rigs/parsing-tests/isis.ref
Original file line number Diff line number Diff line change
Expand Up @@ -2445,11 +2445,11 @@
]
}
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.ConvertConfigurationAnswerElement",
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.InitInfoAnswerElement",
Expand Down
4 changes: 2 additions & 2 deletions test_rigs/parsing-tests/policy-routing.ref
Original file line number Diff line number Diff line change
Expand Up @@ -1904,11 +1904,11 @@
]
}
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.ConvertConfigurationAnswerElement",
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.InitInfoAnswerElement",
Expand Down
4 changes: 2 additions & 2 deletions test_rigs/parsing-tests/snat.ref
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,11 @@
]
}
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.ConvertConfigurationAnswerElement",
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.InitInfoAnswerElement",
Expand Down
4 changes: 2 additions & 2 deletions test_rigs/parsing-tests/srx-testbed.ref
Original file line number Diff line number Diff line change
Expand Up @@ -5912,7 +5912,7 @@
]
}
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.ConvertConfigurationAnswerElement",
Expand All @@ -5930,7 +5930,7 @@
}
}
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.InitInfoAnswerElement",
Expand Down
4 changes: 2 additions & 2 deletions test_rigs/parsing-tests/unit-tests.ref
Original file line number Diff line number Diff line change
Expand Up @@ -38694,7 +38694,7 @@
]
}
},
"version" : "0.31.0",
"version" : "0.31.1",
"warnings" : {
"bgp_address_family" : {
"Red flags" : {
Expand Down Expand Up @@ -40053,7 +40053,7 @@
}
}
},
"version" : "0.31.0",
"version" : "0.31.1",
"warnings" : {
"address_family" : {
"Red flags" : {
Expand Down
2 changes: 1 addition & 1 deletion tests/basic/genDp-delta.ref
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"8" : 301
},
"ospfInternalIterations" : 3,
"version" : "0.31.0"
"version" : "0.31.1"
}
],
"status" : "SUCCESS",
Expand Down
2 changes: 1 addition & 1 deletion tests/basic/genDp.ref
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"8" : 298
},
"ospfInternalIterations" : 3,
"version" : "0.31.0"
"version" : "0.31.1"
}
],
"status" : "SUCCESS",
Expand Down
4 changes: 2 additions & 2 deletions tests/basic/init-dc-as-reuse.ref
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"pod_1_tor_0" : "PASSED",
"pod_1_tor_1" : "PASSED"
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.ConvertConfigurationAnswerElement",
Expand Down Expand Up @@ -182,7 +182,7 @@
}
}
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.InitInfoAnswerElement",
Expand Down
4 changes: 2 additions & 2 deletions tests/basic/init-delta.ref
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"testrig/iptables/host1.iptables" : "PASSED",
"testrig/iptables/host2.iptables" : "PASSED"
},
"version" : "0.31.0"
"version" : "0.31.1"
},
{
"class" : "org.batfish.datamodel.answers.ConvertConfigurationAnswerElement",
Expand Down Expand Up @@ -180,7 +180,7 @@
}
}
},
"version" : "0.31.0",
"version" : "0.31.1",
"warnings" : {
"as1border1" : {
"Red flags" : {
Expand Down

0 comments on commit b62754c

Please sign in to comment.