Search in sources :

Example 1 with NetworkFactory

use of org.batfish.datamodel.NetworkFactory in project batfish by batfish.

the class BdpDataPlanePluginTest method setup.

@Before
public void setup() {
    _nf = new NetworkFactory();
    _cb = _nf.configurationBuilder();
    _ib = _nf.interfaceBuilder();
    _nb = _nf.bgpNeighborBuilder();
    _pb = _nf.bgpProcessBuilder();
    _vb = _nf.vrfBuilder();
    _epb = _nf.routingPolicyBuilder();
}
Also used : NetworkFactory(org.batfish.datamodel.NetworkFactory) Before(org.junit.Before)

Example 2 with NetworkFactory

use of org.batfish.datamodel.NetworkFactory in project batfish by batfish.

the class OspfTest method setup.

@Before
public void setup() {
    _nf = new NetworkFactory();
    _cb = _nf.configurationBuilder().setConfigurationFormat(ConfigurationFormat.CISCO_IOS);
    _vb = _nf.vrfBuilder().setName(Configuration.DEFAULT_VRF_NAME);
    _ib = _nf.interfaceBuilder().setActive(true).setOspfCost(1).setOspfEnabled(true);
    _opb = _nf.ospfProcessBuilder();
}
Also used : NetworkFactory(org.batfish.datamodel.NetworkFactory) Before(org.junit.Before)

Example 3 with NetworkFactory

use of org.batfish.datamodel.NetworkFactory in project batfish by batfish.

the class SynthesizerInputImplTest method setup.

@Before
public void setup() {
    _nf = new NetworkFactory();
    _cb = _nf.configurationBuilder().setConfigurationFormat(ConfigurationFormat.CISCO_IOS);
    _vb = _nf.vrfBuilder();
    _ib = _nf.interfaceBuilder().setActive(true).setBandwidth(1E9d);
    _aclb = _nf.aclBuilder();
    _acllb = IpAccessListLine.builder();
    _inputBuilder = SynthesizerInputImpl.builder();
    _snb = SourceNat.builder();
}
Also used : NetworkFactory(org.batfish.datamodel.NetworkFactory) Before(org.junit.Before)

Example 4 with NetworkFactory

use of org.batfish.datamodel.NetworkFactory in project batfish by batfish.

the class RoutingPolicyTests method initializeFactory.

@Before
public void initializeFactory() {
    NetworkFactory nf = new NetworkFactory();
    _c = nf.configurationBuilder().setConfigurationFormat(ConfigurationFormat.CISCO_IOS).build();
    _rpb = nf.routingPolicyBuilder().setOwner(_c);
    _w = new Warnings();
    _w.setRedFlagRecord(true);
}
Also used : NetworkFactory(org.batfish.datamodel.NetworkFactory) Warnings(org.batfish.common.Warnings) Before(org.junit.Before)

Example 5 with NetworkFactory

use of org.batfish.datamodel.NetworkFactory in project batfish by batfish.

the class BdpDataPlanePluginTest method testStaticInterfaceRoutesWithoutEdge.

@Test
public void testStaticInterfaceRoutesWithoutEdge() {
    NetworkFactory nf = new NetworkFactory();
    Configuration c = nf.configurationBuilder().setConfigurationFormat(ConfigurationFormat.CISCO_IOS).build();
    Vrf vrf = nf.vrfBuilder().setOwner(c).setName(DEFAULT_VRF_NAME).build();
    Interface i = nf.interfaceBuilder().setOwner(c).setVrf(vrf).setAddress(new InterfaceAddress("10.0.0.0/24")).setActive(true).build();
    StaticRoute srBoth = StaticRoute.builder().setNetwork(Prefix.parse("10.0.1.0/24")).setNextHopInterface(i.getName()).setNextHopIp(new Ip("10.0.0.1")).build();
    vrf.getStaticRoutes().add(srBoth);
    StaticRoute srJustInterface = StaticRoute.builder().setNetwork(Prefix.parse("10.0.2.0/24")).setNextHopInterface(i.getName()).build();
    vrf.getStaticRoutes().add(srJustInterface);
    BdpEngine engine = new BdpEngine(new MockBdpSettings(), new BatfishLogger(BatfishLogger.LEVELSTR_DEBUG, false), (a, b) -> new AtomicInteger());
    Topology topology = new Topology(Collections.emptySortedSet());
    BdpDataPlane dp = engine.computeDataPlane(false, ImmutableMap.of(c.getName(), c), topology, Collections.emptySet(), new BdpAnswerElement());
    // generating fibs should not crash
    dp.getFibs();
}
Also used : StaticRoute(org.batfish.datamodel.StaticRoute) BdpAnswerElement(org.batfish.datamodel.answers.BdpAnswerElement) Configuration(org.batfish.datamodel.Configuration) BatfishLogger(org.batfish.common.BatfishLogger) InterfaceAddress(org.batfish.datamodel.InterfaceAddress) Ip(org.batfish.datamodel.Ip) RoutesByVrf(org.batfish.datamodel.collections.RoutesByVrf) Vrf(org.batfish.datamodel.Vrf) Topology(org.batfish.datamodel.Topology) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NetworkFactory(org.batfish.datamodel.NetworkFactory) Interface(org.batfish.datamodel.Interface) Test(org.junit.Test)

Aggregations

NetworkFactory (org.batfish.datamodel.NetworkFactory)15 Configuration (org.batfish.datamodel.Configuration)7 Interface (org.batfish.datamodel.Interface)7 Before (org.junit.Before)7 InterfaceAddress (org.batfish.datamodel.InterfaceAddress)6 StaticRoute (org.batfish.datamodel.StaticRoute)6 Vrf (org.batfish.datamodel.Vrf)6 Prefix (org.batfish.datamodel.Prefix)5 TreeMap (java.util.TreeMap)3 Warnings (org.batfish.common.Warnings)2 Ip (org.batfish.datamodel.Ip)2 OriginateVrf (org.batfish.z3.state.OriginateVrf)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 BatfishLogger (org.batfish.common.BatfishLogger)1 BgpProcess (org.batfish.datamodel.BgpProcess)1 BgpRoute (org.batfish.datamodel.BgpRoute)1 IpAccessList (org.batfish.datamodel.IpAccessList)1 IpAccessListLine (org.batfish.datamodel.IpAccessListLine)1 IpWildcard (org.batfish.datamodel.IpWildcard)1 SourceNat (org.batfish.datamodel.SourceNat)1