@JsonCreator private static RibGroup create( @Nullable @JsonProperty(PROP_NAME) String name, @Nullable @JsonProperty(PROP_RIB_IDS) List<RibId> ribIds, @Nullable @JsonProperty(PROP_IMPORT_POLICY) String importPolicy, @Nullable @JsonProperty(PROP_EXPORT_RIB) RibId exportRib) { checkArgument(name != null, "RibGroup: missing %s", PROP_NAME); checkArgument(ribIds != null, "RibGroup: missing %s", PROP_RIB_IDS); checkArgument(importPolicy != null, "RibGroup: missing %s", PROP_IMPORT_POLICY); return new RibGroup(name, ribIds, importPolicy, exportRib); }
@Test public void testEquals() { RibId rib1 = new RibId("hostname", "vrfname", "ribname"); RibId rib2 = new RibId("hostname", "vrfname", "secondaryRib"); RibId exportRib = new RibId("hostname", "vrfname", "exportRib"); new EqualsTester() .addEqualityGroup( new RibGroup("name", ImmutableList.of(rib1), "policy1", exportRib), new RibGroup("name", ImmutableList.of(rib1), "policy1", exportRib)) .addEqualityGroup( new RibGroup("differentName", ImmutableList.of(rib1), "policy1", exportRib)) .addEqualityGroup(new RibGroup("name", ImmutableList.of(rib2), "policy2", exportRib)) .addEqualityGroup(new RibGroup("name", ImmutableList.of(rib2), "policy1", rib1)) .testEquals(); }
@Test public void testJavaSerialization() { 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(SerializationUtils.clone(rg), equalTo(rg)); }
@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)); } }
ImmutableList.of(Statements.ReturnFalse.toStaticStatement())))) .build(); return new org.batfish.datamodel.dataplane.rib.RibGroup( rg.getName(), importRibs, policyName, exportRib);