@Test public void testPopulateLoopback() { Interface iface = new Interface("lo", CumulusInterfaceType.LOOPBACK, null, null); iface.getIpAddresses().add(ConcreteInterfaceAddress.parse("1.1.1.1/30")); Loopback loopback = new Loopback(); CumulusNcluConfiguration.populateLoInInterfacesToLoopback(iface, loopback); assertThat( loopback.getAddresses(), equalTo(ImmutableList.of(ConcreteInterfaceAddress.parse("1.1.1.1/30")))); }
@VisibleForTesting static void populateLoInInterfacesToLoopback(Interface iface, Loopback loopback) { checkArgument( iface.getType() == CumulusInterfaceType.LOOPBACK, String.format( "cannot populate interface with type %s to loopback", iface.getType().name())); loopback.getAddresses().addAll(iface.getIpAddresses()); }
CumulusNcluConfiguration extends VendorConfiguration implements CumulusNodeConfiguration { @VisibleForTesting static void populateLoInInterfacesToLoopback(Interface iface, Loopback loopback) { checkArgument( iface.getType() == CumulusInterfaceType.LOOPBACK, String.format( "cannot populate interface with type %s to loopback", iface.getType().name())); loopback.getAddresses().addAll(iface.getIpAddresses()); } }
CumulusNcluConfiguration extends VendorConfiguration implements CumulusNodeConfiguration { @VisibleForTesting static void populateLoInInterfacesToLoopback(Interface iface, Loopback loopback) { checkArgument( iface.getType() == CumulusInterfaceType.LOOPBACK, String.format( "cannot populate interface with type %s to loopback", iface.getType().name())); loopback.getAddresses().addAll(iface.getIpAddresses()); } CumulusNcluConfiguration(); }
CumulusNcluConfiguration extends VendorConfiguration implements CumulusNodeConfiguration { @VisibleForTesting static void populateLoInInterfacesToLoopback(Interface iface, Loopback loopback) { checkArgument( iface.getType() == CumulusInterfaceType.LOOPBACK, String.format( "cannot populate interface with type %s to loopback", iface.getType().name())); loopback.getAddresses().addAll(iface.getIpAddresses()); } CumulusNcluConfiguration(); @Override @Nullable String getVrfForVlan(@Nullable Integer bridgeAccessVlan); @Override @Nullable BgpProcess getBgpProcess(); @Nonnull Map<String, Bond> getBonds(); @Nonnull Bridge getBridge(); @Override @Nullable String getHostname(); @Nonnull Map<String, Interface> getInterfaces(); @Nonnull List<Ip> getIpv4Nameservers(); @Nonnull List<Ip6> getIpv6Nameservers(); @Nonnull Loopback getLoopback(); @Override @Nullable OspfProcess getOspfProcess(); @Override @Nonnull Map<String, RouteMap> getRouteMaps(); @Nonnull Set<StaticRoute> getStaticRoutes(); @Nonnull Map<String, Vlan> getVlans(); @Nonnull Map<String, Vrf> getVrfs(); @Override @Nonnull Map<String, Vxlan> getVxlans(); @Nonnull Map<String, IpAsPathAccessList> getIpAsPathAccessLists(); @Override @Nonnull Map<String, IpPrefixList> getIpPrefixLists(); @Override @Nonnull Map<String, IpCommunityList> getIpCommunityLists(); void setBgpProcess(@Nullable BgpProcess bgpProcess); @Override void setHostname(@Nullable String hostname); void setOspfProcess(@Nullable OspfProcess ospfProcess); @Override void setVendor(ConfigurationFormat format); void setBonds(@Nonnull Map<String, Bond> bonds); void setBridge(@Nonnull Bridge bridge); void setInterfaces(@Nonnull Map<String, Interface> interfaces); void setVlans(@Nonnull Map<String, Vlan> vlans); void setVrfs(@Nonnull Map<String, Vrf> vrfs); void setVxlans(Map<String, Vxlan> vxlans); @Override @Nonnull List<Configuration> toVendorIndependentConfigurations(); @Override @Nullable Vrf getVrf(String vrfName); @Override @Nonnull Map<String, InterfaceClagSettings> getClagSettings(); @Override Optional<OspfInterface> getOspfInterface(String ifaceName); }
CumulusNcluConfiguration extends VendorConfiguration implements CumulusNodeConfiguration { @VisibleForTesting static void populateLoInInterfacesToLoopback(Interface iface, Loopback loopback) { checkArgument( iface.getType() == CumulusInterfaceType.LOOPBACK, String.format( "cannot populate interface with type %s to loopback", iface.getType().name())); loopback.getAddresses().addAll(iface.getIpAddresses()); } CumulusNcluConfiguration(); @Override @Nullable String getVrfForVlan(@Nullable Integer bridgeAccessVlan); @Override @Nullable BgpProcess getBgpProcess(); @Nonnull Map<String, Bond> getBonds(); @Nonnull Bridge getBridge(); @Override @Nullable String getHostname(); @Nonnull Map<String, Interface> getInterfaces(); @Nonnull List<Ip> getIpv4Nameservers(); @Nonnull List<Ip6> getIpv6Nameservers(); @Nonnull Loopback getLoopback(); @Override @Nullable OspfProcess getOspfProcess(); @Override @Nonnull Map<String, RouteMap> getRouteMaps(); @Nonnull Set<StaticRoute> getStaticRoutes(); @Nonnull Map<String, Vlan> getVlans(); @Nonnull Map<String, Vrf> getVrfs(); @Override @Nonnull Map<String, Vxlan> getVxlans(); @Nonnull Map<String, IpAsPathAccessList> getIpAsPathAccessLists(); @Override @Nonnull Map<String, IpPrefixList> getIpPrefixLists(); @Override @Nonnull Map<String, IpCommunityList> getIpCommunityLists(); void setBgpProcess(@Nullable BgpProcess bgpProcess); @Override void setHostname(@Nullable String hostname); void setOspfProcess(@Nullable OspfProcess ospfProcess); @Override void setVendor(ConfigurationFormat format); void setBonds(@Nonnull Map<String, Bond> bonds); void setBridge(@Nonnull Bridge bridge); void setInterfaces(@Nonnull Map<String, Interface> interfaces); void setVlans(@Nonnull Map<String, Vlan> vlans); void setVrfs(@Nonnull Map<String, Vrf> vrfs); void setVxlans(Map<String, Vxlan> vxlans); @Override @Nonnull List<Configuration> toVendorIndependentConfigurations(); @Override @Nullable Vrf getVrf(String vrfName); @Override @Nonnull Map<String, InterfaceClagSettings> getClagSettings(); @Override Optional<OspfInterface> getOspfInterface(String ifaceName); @VisibleForTesting static final String CUMULUS_CLAG_DOMAIN_ID; @Nonnull
  static final LinkLocalAddress LINK_LOCAL_ADDRESS; }