private void addNullRouteEdges() { for (Entry<String, List<StaticRoute>> entry : _nullStaticRoutes.entrySet()) { String router = entry.getKey(); List<StaticRoute> srs = entry.getValue(); for (StaticRoute sr : srs) { String name = sr.getNextHopInterface(); // Create null route interface Interface iface = new Interface(name); iface.setActive(true); iface.setAddress( new InterfaceAddress(sr.getNetwork().getStartIp(), sr.getNextHopIp().numSubnetBits())); iface.setBandwidth(0.); // Add static route to all static routes list Map<String, List<StaticRoute>> map = _staticRoutes.get(router); List<StaticRoute> routes = map.computeIfAbsent(name, k -> new ArrayList<>()); routes.add(sr); // Create and add graph edge for null route GraphEdge ge = new GraphEdge(iface, null, router, null, false, true); _allRealEdges.add(ge); _allEdges.add(ge); List<GraphEdge> edges = _edgeMap.computeIfAbsent(router, k -> new ArrayList<>()); edges.add(ge); } } }
private Interface createIbgpInterface(BgpActivePeerConfig n, String peer) { Interface iface = new Interface("iBGP-" + peer); iface.setActive(true); // TODO is this valid. iface.setAddress(new InterfaceAddress(n.getPeerAddress(), Prefix.MAX_PREFIX_LENGTH)); iface.setBandwidth(0.); return iface; }
private org.batfish.datamodel.Interface toInterface(Interface iface) { String name = iface.getName(); org.batfish.datamodel.Interface newIface = new org.batfish.datamodel.Interface(name, _c); newIface.setDeclaredNames(ImmutableSortedSet.of(name)); newIface.setActive(true); // TODO: may have to change newIface.setBandwidth(iface.getBandwidth()); newIface.setDescription(iface.getDescription()); InterfaceAddress address = iface.getAddress(); if (address != null) { newIface.setAddress(iface.getAddress()); } newIface.getAllAddresses().addAll(iface.getAllAddresses()); for (InterfaceAddress p : newIface.getAllAddresses()) { _ipToInterfaceMap.put(p.getIp(), newIface); } return newIface; }
Interface vpcIface = new Interface(vpcIfaceName, vpcConfigNode); InterfaceAddress vpcIfaceAddress = vpcLink.getSecond(); vpcIface.setAddress(vpcIfaceAddress); Utils.newInterface(vpcIfaceName, vpcConfigNode, vpcIfaceAddress);
newIface.setAddress(iface.getPrimaryAddress());
.getInterfaces() .put(remoteVpcIfaceName, remoteVpcIface); remoteVpcIface.setAddress(remoteVpcIfaceAddress); remoteVpcIface.getAllAddresses().add(remoteVpcIfaceAddress);
iface.setActive(_active); if (_address != null) { iface.setAddress(_address); allAddresses.add(_address);
newIface.setAddress(iface.getAddress()); allPrefixes.add(iface.getAddress());
newIface.setMtu(mtu); newIface.setAddress(iface.getAddress()); newIface.setAllAddresses(iface.getAllAddresses()); newIface.setActive(iface.getActive());