@Override public Environment getEnvironment() { SortedSet<Edge> edgeBlackList = getEdgeBlacklist(); SortedSet<NodeInterfacePair> interfaceBlackList = getInterfaceBlacklist(); SortedSet<String> nodeBlackList = getNodeBlacklist(); // TODO: add bgp tables and external announcements as well return new Environment( _settings.getSnapshotName(), edgeBlackList, interfaceBlackList, nodeBlackList, null, null, null); }
@Test public void testToString() { Environment e = new Environment( "testrig", Sets.newTreeSet(), Sets.newTreeSet(), Sets.newTreeSet(), Maps.newTreeMap(), Maps.newTreeMap(), Sets.newTreeSet()); assertThat( e.toString(), equalTo( "Environment{testrigName=testrig, " + "edgeBlacklist=[], interfaceBlacklist=[], " + "nodeBlacklist=[], bgpTables={}, routingTables={}, " + "externalBgpAnnouncements=[]}")); } }
FlowHistory buildFlowHistory( String testrigName, Collection<String> sourceRouters, Encoder encoder, Map<String, Boolean> reach) { FlowHistory flowHistory = new FlowHistory(); for (String source : sourceRouters) { Boolean sourceVar = reach.get(source); if (!sourceVar) { Tuple<Flow, FlowTrace> tup = buildFlowTrace(encoder, source); SortedSet<Edge> failedLinks = buildFailedLinks(encoder); SortedSet<BgpAdvertisement> envRoutes = buildEnvRoutingTable(encoder); Environment baseEnv = new Environment(testrigName, failedLinks, null, null, null, null, envRoutes); flowHistory.addFlowTrace(tup.getFirst(), "BASE", baseEnv, tup.getSecond()); } } return flowHistory; }
SortedSet<BgpAdvertisement> envRoutesBase = buildEnvRoutingTable(encoder2); Environment baseEnv = new Environment(testRigName, failedLinksBase, null, null, null, null, envRoutesBase); Environment failedEnv = new Environment( testRigName + "-with-delta", failedLinksDiff,
@Test public void flowHistoryToRow() { Set<FlowTrace> traces = ImmutableSet.of( new FlowTrace(FlowDisposition.ACCEPTED, ImmutableList.of(), "notes1"), new FlowTrace(FlowDisposition.DENIED_OUT, ImmutableList.of(), "notes2")); Flow flow = Flow.builder().setTag("tag").setIngressNode("node").setDstIp(Ip.parse("1.1.1.1")).build(); FlowHistoryInfo historyInfo = new FlowHistoryInfo( flow, ImmutableMap.of("env", new Environment(null, null, null, null, null, null, null)), ImmutableMap.of("env", traces)); Row row = TracerouteAnswerer.flowHistoryToRow(historyInfo); assertThat( row, equalTo( Row.of( TracerouteAnswerer.COL_FLOW, flow, TracerouteAnswerer.COL_TRACES, historyInfo.getPaths().values().stream().findAny()))); } }
10)); Environment e = new Environment( "testrig", Sets.newTreeSet(),
Environment environment = new Environment(null, null, null, null, null, null, null);