@Test public void testToBuilder() { TopologyContext.Builder builder = TopologyContext.builder(); MutableValueGraph<BgpPeerConfigId, BgpSessionProperties> bgpTopology = ValueGraphBuilder.directed().build(); bgpTopology.addNode(new BgpPeerConfigId("a", "b", "c")); MutableNetwork<EigrpNeighborConfigId, EigrpEdge> eigrpTopology = NetworkBuilder.directed().build(); eigrpTopology.addNode(new EigrpNeighborConfigId(1L, "a", "b", "c")); MutableValueGraph<IpsecPeerConfigId, IpsecSession> ipsecTopology = ValueGraphBuilder.directed().allowsSelfLoops(false).build(); ipsecTopology.putEdgeValue( new IpsecPeerConfigId("a", "b"), new IpsecPeerConfigId("c", "d"), IpsecSession.builder().build()); MutableNetwork<IsisNode, IsisEdge> isisTopology = NetworkBuilder.directed().build(); isisTopology.addNode(new IsisNode("a", "b")); MutableValueGraph<OspfNeighborConfigId, OspfSessionProperties> ospfTopology = ValueGraphBuilder.directed().build(); ospfTopology.addNode( new OspfNeighborConfigId( "a", "b", "c", "d", ConcreteInterfaceAddress.parse("192.0.2.0/31"))); MutableGraph<VxlanNode> vxlanTopology = GraphBuilder.undirected().allowsSelfLoops(false).build(); vxlanTopology.addNode(new VxlanNode("a", 5)); builder .setBgpTopology(new BgpTopology(bgpTopology)) .setEigrpTopology(new EigrpTopology(eigrpTopology)) .setIsisTopology(new IsisTopology(isisTopology)) .setIpsecTopology(new IpsecTopology(ipsecTopology)) .setLayer1LogicalTopology( Optional.of(new Layer1Topology(ImmutableList.of(new Layer1Edge("a", "b", "c", "d"))))) .setLayer2Topology( Optional.of( Layer2Topology.fromDomains( ImmutableList.of(ImmutableSet.of(new Layer2Node("a", "b", 5)))))) .setLayer3Topology(new Topology(ImmutableSortedSet.of(Edge.of("a", "b", "c", "d")))) .setOspfTopology(new OspfTopology(ospfTopology)) .setRawLayer1PhysicalTopology( Optional.of(new Layer1Topology(ImmutableList.of(new Layer1Edge("a", "b", "c", "d"))))) .setTunnelTopology( TunnelTopology.builder() .add(NodeInterfacePair.of("n1", "i1"), NodeInterfacePair.of("n2", "i2")) .build()) .setVxlanTopology(new VxlanTopology(vxlanTopology)); assertThat(builder.build(), equalTo(builder.build().toBuilder().build())); }
public @Nonnull Builder toBuilder() { return builder() .setBgpTopology(_bgpTopology) .setEigrpTopology(_eigrpTopology) .setIpsecTopology(_ipsecTopology) .setIsisTopology(_isisTopology) .setLayer1LogicalTopology(_layer1LogicalTopology) .setLayer2Topology(_layer2Topology) .setLayer3Topology(_layer3Topology) .setOspfTopology(_ospfTopology) .setRawLayer1PhysicalTopology(_rawLayer1PhysicalTopology) .setTunnelTopology(_tunnelTopology) .setVxlanTopology(_vxlanTopology); }
TopologyContext implements TopologyContainer { public @Nonnull Builder toBuilder() { return builder() .setBgpTopology(_bgpTopology) .setEigrpTopology(_eigrpTopology) .setIpsecTopology(_ipsecTopology) .setIsisTopology(_isisTopology) .setLayer1LogicalTopology(_layer1LogicalTopology) .setLayer2Topology(_layer2Topology) .setLayer3Topology(_layer3Topology) .setOspfTopology(_ospfTopology) .setRawLayer1PhysicalTopology(_rawLayer1PhysicalTopology) .setTunnelTopology(_tunnelTopology) .setVxlanTopology(_vxlanTopology); } }
TopologyContext implements TopologyContainer { public @Nonnull Builder toBuilder() { return builder() .setBgpTopology(_bgpTopology) .setEigrpTopology(_eigrpTopology) .setIpsecTopology(_ipsecTopology) .setIsisTopology(_isisTopology) .setLayer1LogicalTopology(_layer1LogicalTopology) .setLayer2Topology(_layer2Topology) .setLayer3Topology(_layer3Topology) .setOspfTopology(_ospfTopology) .setRawLayer1PhysicalTopology(_rawLayer1PhysicalTopology) .setTunnelTopology(_tunnelTopology) .setVxlanTopology(_vxlanTopology); } private  TopologyContext(
      BgpTopology bgpTopology,
      EigrpTopology eigrpTopology,
      IpsecTopology ipsecTopology,
      IsisTopology isisTopology,
      Optional<Layer1Topology> layer1LogicalTopology,
      Optional<Layer2Topology> layer2Topology,
      Topology layer3Topology,
      OspfTopology ospfTopology,
      Optional<Layer1Topology> rawLayer1PhysicalTopology,
      TunnelTopology tunnelTopology,
      VxlanTopology vxlanTopology); }
TopologyContext implements TopologyContainer { public @Nonnull Builder toBuilder() { return builder() .setBgpTopology(_bgpTopology) .setEigrpTopology(_eigrpTopology) .setIpsecTopology(_ipsecTopology) .setIsisTopology(_isisTopology) .setLayer1LogicalTopology(_layer1LogicalTopology) .setLayer2Topology(_layer2Topology) .setLayer3Topology(_layer3Topology) .setOspfTopology(_ospfTopology) .setRawLayer1PhysicalTopology(_rawLayer1PhysicalTopology) .setTunnelTopology(_tunnelTopology) .setVxlanTopology(_vxlanTopology); } private  TopologyContext(
      BgpTopology bgpTopology,
      EigrpTopology eigrpTopology,
      IpsecTopology ipsecTopology,
      IsisTopology isisTopology,
      Optional<Layer1Topology> layer1LogicalTopology,
      Optional<Layer2Topology> layer2Topology,
      Topology layer3Topology,
      OspfTopology ospfTopology,
      Optional<Layer1Topology> rawLayer1PhysicalTopology,
      TunnelTopology tunnelTopology,
      VxlanTopology vxlanTopology); static @Nonnull Builder builder(); @Override @Nonnull BgpTopology getBgpTopology(); @Override @Nonnull EigrpTopology getEigrpTopology(); @Nonnull IpsecTopology getIpsecTopology(); @Override @Nonnull IsisTopology getIsisTopology(); @Nonnull Optional<Layer1Topology> getLayer1LogicalTopology(); @Override @Nonnull Optional<Layer2Topology> getLayer2Topology(); @Override @Nonnull Topology getLayer3Topology(); @Override @Nonnull OspfTopology getOspfTopology(); @Nonnull Optional<Layer1Topology> getRawLayer1PhysicalTopology(); @Override @Nonnull VxlanTopology getVxlanTopology(); @Override @Nonnull TunnelTopology getTunnelTopology(); @Override boolean equals(@Nullable Object obj); @Override int hashCode(); @Nonnull Builder toBuilder(); }
TopologyContext implements TopologyContainer { public @Nonnull Builder toBuilder() { return builder() .setBgpTopology(_bgpTopology) .setEigrpTopology(_eigrpTopology) .setIpsecTopology(_ipsecTopology) .setIsisTopology(_isisTopology) .setLayer1LogicalTopology(_layer1LogicalTopology) .setLayer2Topology(_layer2Topology) .setLayer3Topology(_layer3Topology) .setOspfTopology(_ospfTopology) .setRawLayer1PhysicalTopology(_rawLayer1PhysicalTopology) .setTunnelTopology(_tunnelTopology) .setVxlanTopology(_vxlanTopology); } private  TopologyContext(
      BgpTopology bgpTopology,
      EigrpTopology eigrpTopology,
      IpsecTopology ipsecTopology,
      IsisTopology isisTopology,
      Optional<Layer1Topology> layer1LogicalTopology,
      Optional<Layer2Topology> layer2Topology,
      Topology layer3Topology,
      OspfTopology ospfTopology,
      Optional<Layer1Topology> rawLayer1PhysicalTopology,
      TunnelTopology tunnelTopology,
      VxlanTopology vxlanTopology); static @Nonnull Builder builder(); @Override @Nonnull BgpTopology getBgpTopology(); @Override @Nonnull EigrpTopology getEigrpTopology(); @Nonnull IpsecTopology getIpsecTopology(); @Override @Nonnull IsisTopology getIsisTopology(); @Nonnull Optional<Layer1Topology> getLayer1LogicalTopology(); @Override @Nonnull Optional<Layer2Topology> getLayer2Topology(); @Override @Nonnull Topology getLayer3Topology(); @Override @Nonnull OspfTopology getOspfTopology(); @Nonnull Optional<Layer1Topology> getRawLayer1PhysicalTopology(); @Override @Nonnull VxlanTopology getVxlanTopology(); @Override @Nonnull TunnelTopology getTunnelTopology(); @Override boolean equals(@Nullable Object obj); @Override int hashCode(); @Nonnull Builder toBuilder();  }