@Override protected Vrf featureValueOf(Interface actual) { return actual.getVrf(); } }
public @Nullable IsisProcess getIsisProcess(@Nonnull NetworkConfigurations nc) { Interface i = getInterface(nc); if (i == null) { return null; } return i.getVrf().getIsisProcess(); }
private String interfaceVrf(String node, String iface) { return _specifierContext .getConfigs() .get(node) .getAllInterfaces() .get(iface) .getVrf() .getName(); } }
/** Ensure that the interface is placed in VI {@link Configuration} and {@link Vrf} */ private void resolveInterfacePointers( String ifaceName, Interface iface, org.batfish.datamodel.Interface viIface) { Vrf vrf = viIface.getVrf(); String vrfName = vrf.getName(); _masterLogicalSystem.getRoutingInstances().get(vrfName).getInterfaces().put(ifaceName, iface); if (ifaceName.equals("irb")) { // there is no 'irb' interface; it is just a namespace with no inheritable parameters return; } _c.getAllInterfaces().put(ifaceName, viIface); vrf.getInterfaces().put(ifaceName, viIface); }
@Override public Void visitInterfaceLocation(@Nonnull InterfaceLocation interfaceLocation) { flowBuilder .setIngressInterface(null) .setIngressNode(interfaceLocation.getNodeName()) .setIngressVrf( c.getAllInterfaces() .get(interfaceLocation.getInterfaceName()) .getVrf() .getName()); return null; } });
for (Entry<String, org.batfish.datamodel.Interface> i : _c.getAllInterfaces().entrySet()) { org.batfish.datamodel.Interface iface = i.getValue(); if (iface.getVrf() == null) { orphanedInterfaces.put(iface.getName(), iface); iface.setVrf(nullVrf);
private boolean propagateOspfInterAreaRouteFromIntraAreaRoute( Configuration neighbor, OspfProcess neighborProc, OspfIntraAreaRoute neighborRoute, long incrementalCost, Interface neighborInterface, int adminCost, long linkAreaNum) { return OspfProtocolHelper.isOspfInterAreaFromIntraAreaPropagationAllowed( linkAreaNum, neighbor, neighborProc, neighborRoute, neighborInterface.getOspfArea()) && stageOspfInterAreaRoute( neighborRoute, neighborInterface.getVrf().getOspfProcess().getMaxMetricSummaryNetworks(), neighborInterface.getAddress().getIp(), incrementalCost, adminCost, linkAreaNum); }
FlowTraceHop lastHop = hopsSoFar.get(hopsSoFar.size() - 1); srcInterfaceName = lastHop.getEdge().getInt2(); vrfName = currentConfiguration.getAllInterfaces().get(srcInterfaceName).getVrf().getName();
boolean propagateOspfInterAreaRouteFromInterAreaRoute( OspfProcess proc, Configuration neighbor, OspfProcess neighborProc, OspfInterAreaRoute neighborRoute, long incrementalCost, Interface neighborInterface, int adminCost, long linkAreaNum) { return OspfProtocolHelper.isOspfInterAreaFromInterAreaPropagationAllowed( proc, linkAreaNum, neighbor, neighborProc, neighborRoute, neighborInterface.getOspfArea()) && stageOspfInterAreaRoute( neighborRoute, neighborInterface.getVrf().getOspfProcess().getMaxMetricSummaryNetworks(), neighborInterface.getAddress().getIp(), incrementalCost, adminCost, linkAreaNum); }
Configuration remoteNode = configurations.get(remoteHostname); Interface remoteIface = remoteNode.getAllInterfaces().get(remoteIfaceName); Vrf remoteVrf = remoteIface.getVrf(); String remoteVrfName = remoteVrf.getName(); RipProcess remoteProc = remoteVrf.getRipProcess();
continue; Vrf remoteVrf = remoteIface.getVrf(); String remoteVrfName = remoteVrf.getName(); OspfProcess remoteProc = remoteVrf.getOspfProcess();
Interface neighborInterface = neighbor.getConfiguration().getAllInterfaces().get(neighborNode.getInterfaceName()); OspfProcess neighborProc = neighborInterface.getVrf().getOspfProcess(); assert neighborProc != null; // invariant of edge existing.
@Test public void testInterfaceBuilder() { NetworkFactory nf = new NetworkFactory(); Interface.Builder ib = nf.interfaceBuilder(); Interface i1 = ib.build(); Interface i2 = ib.build(); Configuration c = nf.configurationBuilder().setConfigurationFormat(CONFIG_FORMAT).build(); Vrf vrf = nf.vrfBuilder().setOwner(c).build(); ib.setOwner(c); Interface i3 = ib.build(); ib.setVrf(vrf); Interface i4 = ib.build(); assertThat(i1.getName(), is(notNullValue())); assertThat(i1.getName(), not(equalTo(i2.getName()))); assertThat(c.getAllInterfaces(), not(hasKey(i1.getName()))); assertThat(i2.getName(), is(notNullValue())); assertThat(c.getAllInterfaces(), not(hasKey(i2.getName()))); assertThat(c.getAllInterfaces(), hasKey(i3.getName())); assertThat(i3.getOwner(), sameInstance(c)); assertThat(vrf.getInterfaces(), not(hasKey(i3.getName()))); assertThat(c.getAllInterfaces(), hasKey(i4.getName())); assertThat(vrf.getInterfaces(), hasKey(i4.getName())); assertThat(i4.getVrf(), sameInstance(vrf)); }