@Test public void testJsonSerialization() throws IOException { DisjunctionChain dc = new DisjunctionChain(ImmutableList.of(BooleanExprs.TRUE)); assertThat(BatfishObjectMapper.clone(dc, DisjunctionChain.class), equalTo(dc)); }
@Test public void testJsonSerialization() throws IOException { ExtendedCommunity ec = new ExtendedCommunity(123L); assertThat(BatfishObjectMapper.clone(ec, ExtendedCommunity.class), equalTo(ec)); }
@Test public void testJsonSerialization() throws IOException { RibId ribId = new RibId("h", "v", "r"); assertThat(BatfishObjectMapper.clone(ribId, RibId.class), equalTo(ribId)); } }
@Test public void testJsonSerialization() throws IOException { MatchProtocol mp = new MatchProtocol(RoutingProtocol.STATIC); assertThat(BatfishObjectMapper.clone(mp, MatchProtocol.class), equalTo(mp)); }
@Test public void testJsonSerialization() throws IOException { MlagPropertiesQuestion q = new MlagPropertiesQuestion("nodes", "mlags"); assertThat(BatfishObjectMapper.clone(q, MlagPropertiesQuestion.class), equalTo(q)); } }
@Test public void testJsonSerialization() throws IOException { ConjunctionChain cc = new ConjunctionChain(ImmutableList.of(BooleanExprs.TRUE)); assertThat(BatfishObjectMapper.clone(cc, ConjunctionChain.class), equalTo(cc)); }
@Test public void testJsonSerialization() throws IOException { ConnectedRoute cr = new ConnectedRoute(Prefix.parse("1.1.1.0/24"), "Ethernet0"); assertThat(BatfishObjectMapper.clone(cr, ConnectedRoute.class), equalTo(cr)); }
@Test public void testJsonSerialization() throws IOException { RibId rib1 = new RibId("hostname", "vrfname", "ribname"); RibId exportRib = new RibId("hostname", "vrfname", "exportRib"); RibGroup rg = new RibGroup("name", ImmutableList.of(rib1), "policy1", exportRib); assertThat(BatfishObjectMapper.clone(rg, RibGroup.class), equalTo(rg)); } }
@Test public void testClone() throws IOException { InterfaceLocation orig = new InterfaceLocation("foo", "bar"); assertThat(orig, equalTo(BatfishObjectMapper.clone(orig, new TypeReference<Location>() {}))); } }
@Test public void testJsonSerialization() throws IOException { LocalRoute lr = new LocalRoute(new InterfaceAddress("1.1.1.1/24"), "Ethernet0"); assertThat(BatfishObjectMapper.clone(lr, LocalRoute.class), equalTo(lr)); }
@Test public void testSerialization() throws IOException { PacketHeaderConstraints phc = PacketHeaderConstraints.builder() .setIpProtocols(ImmutableSet.of(IpProtocol.TCP, IpProtocol.UDP)) .setDstIp("1.1.1.1") .setDstPorts(IntegerSpace.PORTS) .build(); // test (de)serialization PacketHeaderConstraints phcDup = BatfishObjectMapper.clone(phc, PacketHeaderConstraints.class); assertThat(phc, equalTo(phcDup)); }
@Test public void testJackson() throws IOException { FlowDiff fd = new FlowDiff(PROP_DST_IP, "old", "new"); assertEquals(BatfishObjectMapper.clone(fd, FlowDiff.class), fd); } }
@Test public void testSerialization() throws IOException { OspfNode node = new OspfNode("a", "i", Ip.parse("1.2.3.4")); assertThat(BatfishObjectMapper.clone(node, OspfNode.class), equalTo(node)); } }
@Test public void testJsonSerialization() throws IOException { GeneratedRoute gr = GeneratedRoute.builder().setNetwork(Prefix.parse("1.1.1.0/24")).setMetric(1L).build(); assertThat(BatfishObjectMapper.clone(gr, GeneratedRoute.class), equalTo(gr)); }
@Test public void testJsonSerialization() throws IOException { Mlag m = Mlag.builder() .setId("ID") .setPeerAddress(Ip.parse("1.1.1.1")) .setLocalInterface("Ethernet1") .build(); assertThat(BatfishObjectMapper.clone(m, Mlag.class), equalTo(m)); } }
@Test public void serializationTest() throws IOException { AnswerSummary summary = new AnswerSummary("notes1", 21, 23, 42); // The summary should survive cloning through JSON. AnswerSummary summaryAfter = BatfishObjectMapper.clone(summary, AnswerSummary.class); assertThat(summaryAfter.getNotes(), equalTo("notes1")); assertThat(summaryAfter.getNumFailed(), equalTo(21)); assertThat(summaryAfter.getNumPassed(), equalTo(23)); assertThat(summaryAfter.getNumResults(), equalTo(42)); } }
@Test public void testSerialization() throws IOException { OspfEdge edge = new OspfEdge(new OspfNode("a", "i", Ip.ZERO), new OspfNode("b", "j", Ip.MAX)); assertThat(BatfishObjectMapper.clone(edge, OspfEdge.class), equalTo(edge)); } }
@Test public void testJsonSerialization() throws IOException { BgpRoute br = BgpRoute.builder() .setNetwork(Prefix.parse("1.1.1.0/24")) .setOriginatorIp(Ip.parse("1.1.1.1")) .setOriginType(OriginType.IGP) .setProtocol(RoutingProtocol.BGP) .build(); assertThat(BatfishObjectMapper.clone(br, BgpRoute.class), equalTo(br)); }
@Test public void testJsonSerialization() throws IOException { SortedSet<Ip> bumTransportIps = ImmutableSortedSet.of(Ip.parse("2.2.2.2"), Ip.parse("2.2.2.3")); VniSettings vs = VniSettings.builder() .setBumTransportIps(bumTransportIps) .setBumTransportMethod(BumTransportMethod.UNICAST_FLOOD_GROUP) .setSourceAddress(Ip.parse("1.2.3.4")) .setUdpPort(2345) .setVlan(7) .setVni(10007) .build(); assertThat(BatfishObjectMapper.clone(vs, VniSettings.class), equalTo(vs)); }
@Test public void checkJsonSerialization() throws IOException { StaticRoute sr = StaticRoute.builder() .setNextHopIp(Ip.parse("192.168.1.1")) .setNetwork(Prefix.ZERO) .setNextHopInterface("Ethernet0") .setAdministrativeCost(1) .setTag(0) .setMetric(123) .build(); assertThat(BatfishObjectMapper.clone(sr, StaticRoute.class), equalTo(sr)); }