@Override public LocationSpecifier buildLocationSpecifier(Pattern pattern) { return new VrfNameRegexInterfaceLocationSpecifier(pattern); } }
public static LocationSpecifier from(@Nonnull InterfacesSpecifier ingressInterfaces) { switch (ingressInterfaces.getType()) { case DESC: return new DescriptionRegexInterfaceLocationSpecifier(ingressInterfaces.getRegex()); case NAME: return new NameRegexInterfaceLocationSpecifier(ingressInterfaces.getRegex()); case VRF: return new VrfNameRegexInterfaceLocationSpecifier(ingressInterfaces.getRegex()); default: throw new BatfishException( "Unexcepted InterfacesSpecifier type: " + ingressInterfaces.getType()); } }
@Test public void testVrfNameRegexInterfaceLocationSpecifierFactory() { assertThat( LocationSpecifierFactory.load( new VrfNameRegexInterfaceLocationSpecifierFactory().getName()), instanceOf(VrfNameRegexInterfaceLocationSpecifierFactory.class)); assertThat( new VrfNameRegexInterfaceLocationSpecifierFactory().getName(), equalTo(VrfNameRegexInterfaceLocationSpecifierFactory.NAME)); assertThat( new VrfNameRegexInterfaceLocationSpecifierFactory().buildLocationSpecifier(PATTERN_SRC), equalTo(new VrfNameRegexInterfaceLocationSpecifier(PATTERN))); } }