use of org.batfish.datamodel.NetworkFactory in project batfish by batfish.
the class RouteReflectionTest method setup.
/**
* Initialize builders with values common to all tests
*/
@Before
public void setup() {
_ab = new BgpAdvertisement.Builder().setClusterList(ImmutableSortedSet.of()).setCommunities(ImmutableSortedSet.of()).setDstVrf(Configuration.DEFAULT_VRF_NAME).setOriginType(OriginType.INCOMPLETE).setSrcProtocol(RoutingProtocol.AGGREGATE).setSrcVrf(Configuration.DEFAULT_VRF_NAME).setType(BgpAdvertisementType.EBGP_SENT);
_nf = new NetworkFactory();
_cb = _nf.configurationBuilder().setConfigurationFormat(ConfigurationFormat.CISCO_IOS);
_ib = _nf.interfaceBuilder().setActive(true);
_nb = _nf.bgpNeighborBuilder().setLocalAs(2);
_pb = _nf.bgpProcessBuilder();
_vb = _nf.vrfBuilder().setName(Configuration.DEFAULT_VRF_NAME);
If acceptIffBgp = new If();
Disjunction guard = new Disjunction();
guard.setDisjuncts(ImmutableList.of(new MatchProtocol(RoutingProtocol.BGP), new MatchProtocol(RoutingProtocol.IBGP)));
acceptIffBgp.setGuard(guard);
acceptIffBgp.setTrueStatements(ImmutableList.of(Statements.ExitAccept.toStaticStatement()));
acceptIffBgp.setFalseStatements(ImmutableList.of(Statements.ExitReject.toStaticStatement()));
/* Builder that creates default BGP export policy */
_defaultExportPolicyBuilder = _nf.routingPolicyBuilder().setStatements(ImmutableList.of(acceptIffBgp));
/* Builder that creates BGP export policy that rejects everything */
_nullExportPolicyBuilder = _nf.routingPolicyBuilder().setStatements(ImmutableList.of(Statements.ExitReject.toStaticStatement()));
}
use of org.batfish.datamodel.NetworkFactory in project batfish by batfish.
the class VirtualRouterTest method makeIosRouter.
private static Node makeIosRouter(String hostname) {
NetworkFactory nf = new NetworkFactory();
Configuration c = nf.configurationBuilder().setHostname(hostname).setConfigurationFormat(ConfigurationFormat.CISCO_IOS).build();
nf.vrfBuilder().setName(Configuration.DEFAULT_VRF_NAME).setOwner(c).build();
return new Node(c);
}
use of org.batfish.datamodel.NetworkFactory in project batfish by batfish.
the class VirtualRouterTest method setup.
@Before
public void setup() {
NetworkFactory nf = new NetworkFactory();
_testVirtualRouter = createEmptyVirtualRouter(nf, TEST_VIRTUAL_ROUTER_NAME);
BgpProcess bgpProcess = nf.bgpProcessBuilder().setVrf(_testVirtualRouter._vrf).setRouterId(TEST_SRC_IP).build();
_neighborConfiguration = nf.configurationBuilder().setConfigurationFormat(FORMAT).setHostname(NEIGHBOR_HOST_NAME).build();
_bgpNeighborBuilder = nf.bgpNeighborBuilder().setOwner(_neighborConfiguration).setPeerAddress(TEST_DEST_IP).setLocalIp(TEST_SRC_IP).setLocalAs(TEST_AS1).setBgpProcess(bgpProcess);
_bgpRouteBuilder = new BgpRoute.Builder().setNetwork(TEST_NETWORK).setProtocol(RoutingProtocol.BGP).setOriginType(OriginType.INCOMPLETE).setOriginatorIp(TEST_SRC_IP);
_ipOwners = ImmutableMap.of(TEST_SRC_IP, ImmutableSet.of(TEST_VIRTUAL_ROUTER_NAME));
_routingPolicyBuilder = nf.routingPolicyBuilder().setOwner(_testVirtualRouter._c);
}
use of org.batfish.datamodel.NetworkFactory in project batfish by batfish.
the class VirtualRouterTest method addInterfaces.
private static void addInterfaces(Configuration c, Map<String, InterfaceAddress> interfaceAddresses) {
NetworkFactory nf = new NetworkFactory();
Interface.Builder ib = nf.interfaceBuilder().setActive(true).setOwner(c).setVrf(c.getDefaultVrf());
interfaceAddresses.forEach((ifaceName, address) -> ib.setName(ifaceName).setAddress(address).build());
}
use of org.batfish.datamodel.NetworkFactory in project batfish by batfish.
the class HostInterfaceTest method setup.
@Before
public void setup() {
_factory = new NetworkFactory();
_c = _factory.configurationBuilder().setConfigurationFormat(ConfigurationFormat.HOST).setHostname("hostInterfaceTest").build();
_w = new Warnings();
}
Aggregations