-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from batfish/unstable
Unstable
- Loading branch information
Showing
3 changed files
with
191 additions
and
5 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
projects/batfish-common-protocol/src/org/batfish/datamodel/VerboseEdge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package org.batfish.datamodel; | ||
|
||
import org.batfish.common.Pair; | ||
import org.batfish.datamodel.collections.VerboseNodeInterfacePair; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public class VerboseEdge | ||
extends Pair<VerboseNodeInterfacePair, VerboseNodeInterfacePair> { | ||
private static final String EDGE_VAR = "edgesummary"; | ||
|
||
private static final String INT1_VAR = "node1interface"; | ||
|
||
private static final String INT2_VAR = "node2interface"; | ||
|
||
private static final String NODE1_VAR = "node1"; | ||
|
||
private static final String NODE2_VAR = "node2"; | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
protected final Edge edge; | ||
|
||
@JsonCreator | ||
public VerboseEdge(@JsonProperty(NODE1_VAR) Configuration node1, | ||
@JsonProperty(INT1_VAR) Interface int1, | ||
@JsonProperty(NODE2_VAR) Configuration node2, | ||
@JsonProperty(INT2_VAR) Interface int2, | ||
@JsonProperty(EDGE_VAR) Edge e) { | ||
this(new VerboseNodeInterfacePair(node1, int1), | ||
new VerboseNodeInterfacePair(node2, int2), e); | ||
} | ||
|
||
public VerboseEdge(VerboseNodeInterfacePair p1, VerboseNodeInterfacePair p2, | ||
Edge e) { | ||
super(p1, p2); | ||
this.edge = e; | ||
} | ||
|
||
@JsonProperty(EDGE_VAR) | ||
public Edge getEdgeSummary() { | ||
return edge; | ||
} | ||
|
||
@JsonProperty(INT1_VAR) | ||
public Interface getInt1() { | ||
return _first.getInterface(); | ||
} | ||
|
||
@JsonProperty(INT2_VAR) | ||
public Interface getInt2() { | ||
return _second.getInterface(); | ||
} | ||
|
||
@JsonIgnore | ||
public VerboseNodeInterfacePair getInterface1() { | ||
return _first; | ||
} | ||
|
||
@JsonIgnore | ||
public VerboseNodeInterfacePair getInterface2() { | ||
return _second; | ||
} | ||
|
||
@JsonProperty(NODE1_VAR) | ||
public Configuration getNode1() { | ||
return _first.getHost(); | ||
} | ||
|
||
@JsonProperty(NODE2_VAR) | ||
public Configuration getNode2() { | ||
return _second.getHost(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "<" + getNode1() + ":" + getInt1() + ", " + getNode2() + ":" | ||
+ getInt2() + ">"; | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
...tfish-common-protocol/src/org/batfish/datamodel/collections/VerboseNodeInterfacePair.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.batfish.datamodel.collections; | ||
|
||
import org.batfish.common.Pair; | ||
import org.batfish.datamodel.Configuration; | ||
import org.batfish.datamodel.Interface; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public class VerboseNodeInterfacePair extends Pair<Configuration, Interface> { | ||
|
||
private static final String HOST_VAR = "host"; | ||
|
||
private static final String INTERFACE_VAR = "interface"; | ||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
|
||
@JsonCreator | ||
public VerboseNodeInterfacePair(@JsonProperty(HOST_VAR) Configuration node, | ||
@JsonProperty(INTERFACE_VAR) Interface iface) { | ||
super(node, iface); | ||
} | ||
|
||
@JsonProperty(HOST_VAR) | ||
public Configuration getHost() { | ||
return _first; | ||
} | ||
|
||
@JsonProperty(INTERFACE_VAR) | ||
public Interface getInterface() { | ||
return _second; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return _first + ":" + _second; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters