@Override public Boolean visitInterfaceLocation(InterfaceLocation interfaceLocation) { return interfaceLocation.getNodeName().equals(node); } };
@Override public Optional<StateExpr> visitInterfaceLocation( @Nonnull InterfaceLocation interfaceLocation) { Configuration config = _configs.get(interfaceLocation.getNodeName()); if (config == null) { return Optional.empty(); } Interface iface = config.getAllInterfaces().get(interfaceLocation.getInterfaceName()); if (iface == null) { return Optional.empty(); } String vrf = iface.getVrfName(); return Optional.of(new OriginateVrf(interfaceLocation.getNodeName(), vrf)); } };
@Override public Void visitInterfaceLocation(@Nonnull InterfaceLocation interfaceLocation) { flowBuilder .setIngressInterface(null) .setIngressNode(interfaceLocation.getNodeName()) .setIngressVrf( interfaceVrf( interfaceLocation.getNodeName(), interfaceLocation.getInterfaceName())); return null; } });
@Override public IpSpace visitInterfaceLocation(InterfaceLocation interfaceLocation) { return _specifierContext.getInterfaceOwnedIps( interfaceLocation.getNodeName(), interfaceLocation.getInterfaceName()); } }
@Override public Location visitInterfaceLocation(InterfaceLocation interfaceLocation) { return new InterfaceLinkLocation( interfaceLocation.getNodeName(), interfaceLocation.getInterfaceName()); } });
@Override public IngressLocation visitInterfaceLocation(InterfaceLocation interfaceLocation) { String node = interfaceLocation.getNodeName(); String iface = interfaceLocation.getInterfaceName(); return IngressLocation.vrf(node, _configs.get(node).getAllInterfaces().get(iface).getVrfName()); } }
@Override public Void visitInterfaceLocation(@Nonnull InterfaceLocation interfaceLocation) { flowBuilder .setIngressInterface(null) .setIngressNode(interfaceLocation.getNodeName()) .setIngressVrf( c.getAllInterfaces() .get(interfaceLocation.getInterfaceName()) .getVrf() .getName()); return null; } });
/** Returns {@code true} iff the given {@link Location} is active (aka, interface is up). */ @VisibleForTesting static boolean isActive(Location l, Map<String, Configuration> configs) { NodeInterfacePair iface; if (l instanceof InterfaceLocation) { iface = new NodeInterfacePair( ((InterfaceLocation) l).getNodeName(), ((InterfaceLocation) l).getInterfaceName()); } else { assert l instanceof InterfaceLinkLocation; iface = new NodeInterfacePair( ((InterfaceLinkLocation) l).getNodeName(), ((InterfaceLinkLocation) l).getInterfaceName()); } return configs .get(iface.getHostname()) .getAllInterfaces() .get(iface.getInterface()) .getActive(); }