@Test public void resolveOutFilter() { assertThat( new InterfaceSpecifierFilterSpecifier(Type.OUT_FILTER, new NameInterfaceSpecifier("eth0")) .resolve(_nodeName, _ctxt), equalTo(ImmutableSet.of(_filter2))); }
@Override public Set<IpAccessList> resolve(String node, SpecifierContext ctxt) { Map<String, Interface> ifaces = ctxt.getConfigs().get(node).getAllInterfaces(); return _interfaceSpecifier.resolve(ImmutableSet.of(node), ctxt).stream() .map(NodeInterfacePair::getInterface) .map(ifaces::get) .map( iface -> _type == Type.IN_FILTER ? iface.getIncomingFilter() : iface.getOutgoingFilter()) .filter(Objects::nonNull) .collect(ImmutableSet.toImmutableSet()); }
InterfaceSpecifierFilterSpecifier implements FilterSpecifier { @Override public Set<IpAccessList> resolve(String node, SpecifierContext ctxt) { Map<String, Interface> ifaces = ctxt.getConfigs().get(node).getAllInterfaces(); return _interfaceSpecifier.resolve(ImmutableSet.of(node), ctxt).stream() .map(NodeInterfacePair::getInterface) .map(ifaces::get) .map( iface -> _type == Type.IN_FILTER ? iface.getIncomingFilter() : iface.getOutgoingFilter()) .filter(Objects::nonNull) .collect(ImmutableSet.toImmutableSet()); } }
InterfaceSpecifierFilterSpecifier implements FilterSpecifier { @Override public Set<IpAccessList> resolve(String node, SpecifierContext ctxt) { Map<String, Interface> ifaces = ctxt.getConfigs().get(node).getAllInterfaces(); return _interfaceSpecifier.resolve(ImmutableSet.of(node), ctxt).stream() .map(NodeInterfacePair::getInterface) .map(ifaces::get) .map( iface -> _type == Type.IN_FILTER ? iface.getIncomingFilter() : iface.getOutgoingFilter()) .filter(Objects::nonNull) .collect(ImmutableSet.toImmutableSet()); } InterfaceSpecifierFilterSpecifier(Type type, InterfaceSpecifier interfaceSpecifier); }
InterfaceSpecifierFilterSpecifier implements FilterSpecifier { @Override public Set<IpAccessList> resolve(String node, SpecifierContext ctxt) { Map<String, Interface> ifaces = ctxt.getConfigs().get(node).getAllInterfaces(); return _interfaceSpecifier.resolve(ImmutableSet.of(node), ctxt).stream() .map(NodeInterfacePair::getInterface) .map(ifaces::get) .map( iface -> _type == Type.IN_FILTER ? iface.getIncomingFilter() : iface.getOutgoingFilter()) .filter(Objects::nonNull) .collect(ImmutableSet.toImmutableSet()); } InterfaceSpecifierFilterSpecifier(Type type, InterfaceSpecifier interfaceSpecifier); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override Set<IpAccessList> resolve(String node, SpecifierContext ctxt); }
InterfaceSpecifierFilterSpecifier implements FilterSpecifier { @Override public Set<IpAccessList> resolve(String node, SpecifierContext ctxt) { Map<String, Interface> ifaces = ctxt.getConfigs().get(node).getAllInterfaces(); return _interfaceSpecifier.resolve(ImmutableSet.of(node), ctxt).stream() .map(NodeInterfacePair::getInterface) .map(ifaces::get) .map( iface -> _type == Type.IN_FILTER ? iface.getIncomingFilter() : iface.getOutgoingFilter()) .filter(Objects::nonNull) .collect(ImmutableSet.toImmutableSet()); } InterfaceSpecifierFilterSpecifier(Type type, InterfaceSpecifier interfaceSpecifier); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override Set<IpAccessList> resolve(String node, SpecifierContext ctxt);  }