use of org.batfish.datamodel.StaticRoute in project batfish by batfish.
the class BatfishCompressionTest method simpleNetwork.
private SortedMap<String, Configuration> simpleNetwork() {
NetworkFactory nf = new NetworkFactory();
Configuration.Builder cb = nf.configurationBuilder().setConfigurationFormat(ConfigurationFormat.CISCO_IOS);
Configuration c1 = cb.build();
Configuration c2 = cb.build();
Configuration c3 = cb.build();
Vrf.Builder vb = nf.vrfBuilder().setName(Configuration.DEFAULT_VRF_NAME);
Vrf v1 = vb.setOwner(c1).build();
Vrf v2 = vb.setOwner(c2).build();
Vrf v3 = vb.setOwner(c3).build();
Prefix p12 = Prefix.parse("10.12.0.0/31");
Prefix p23 = Prefix.parse("10.23.0.0/31");
Interface.Builder ib = nf.interfaceBuilder().setActive(true);
ib.setOwner(c1).setVrf(v1).setAddress(new InterfaceAddress(p12.getStartIp(), p12.getPrefixLength())).build();
ib.setOwner(c2).setVrf(v2).setAddress(new InterfaceAddress(p12.getEndIp(), p12.getPrefixLength())).build();
ib.setAddress(new InterfaceAddress(p23.getStartIp(), p23.getPrefixLength())).build();
ib.setOwner(c3).setVrf(v3).setAddress(new InterfaceAddress(p23.getEndIp(), p23.getPrefixLength())).build();
StaticRoute s13 = StaticRoute.builder().setNetwork(p23).setNextHopIp(p12.getEndIp()).build();
v1.getStaticRoutes().add(s13);
StaticRoute s31 = StaticRoute.builder().setNetwork(p12).setNextHopIp(p23.getStartIp()).build();
v3.getStaticRoutes().add(s31);
return new TreeMap<>(ImmutableSortedMap.of(c1.getName(), c1, c2.getName(), c2, c3.getName(), c3));
}
Aggregations