@Test public void testToInterface_inactive() { Interface vsIface = new Interface("swp1", CumulusInterfaceType.PHYSICAL, null, 1); vsIface.setDisabled(true); org.batfish.datamodel.Interface viIface = new CumulusNcluConfiguration().toInterface(vsIface); assertFalse(viIface.getActive()); }
private @Nonnull org.batfish.datamodel.Interface toInterface(Bond bond) { String name = bond.getName(); org.batfish.datamodel.Interface newIface = org.batfish.datamodel.Interface.builder() .setName(name) .setOwner(_c) .setType(InterfaceType.AGGREGATED) .build(); bond.getSlaves().forEach(slave -> _c.getAllInterfaces().get(slave).setChannelGroup(name)); newIface.setChannelGroupMembers(bond.getSlaves()); newIface.setDependencies( bond.getSlaves().stream() .map(slave -> new Dependency(slave, DependencyType.AGGREGATE)) .collect(ImmutableSet.toImmutableSet())); applyBridgeSettings(bond.getBridge(), newIface); newIface.setActive(true); if (!bond.getIpAddresses().isEmpty()) { newIface.setAddress(bond.getIpAddresses().get(0)); } newIface.setAllAddresses(bond.getIpAddresses()); newIface.setMlagId(bond.getClagId()); return newIface; }
CumulusNcluConfiguration extends VendorConfiguration implements CumulusNodeConfiguration { private @Nonnull org.batfish.datamodel.Interface toInterface(Bond bond) { String name = bond.getName(); org.batfish.datamodel.Interface newIface = org.batfish.datamodel.Interface.builder() .setName(name) .setOwner(_c) .setType(InterfaceType.AGGREGATED) .build(); bond.getSlaves().forEach(slave -> _c.getAllInterfaces().get(slave).setChannelGroup(name)); newIface.setChannelGroupMembers(bond.getSlaves()); newIface.setDependencies( bond.getSlaves().stream() .map(slave -> new Dependency(slave, DependencyType.AGGREGATE)) .collect(ImmutableSet.toImmutableSet())); applyBridgeSettings(bond.getBridge(), newIface); newIface.setActive(true); if (!bond.getIpAddresses().isEmpty()) { newIface.setAddress(bond.getIpAddresses().get(0)); } newIface.setAllAddresses(bond.getIpAddresses()); newIface.setMlagId(bond.getClagId()); return newIface; } }
CumulusNcluConfiguration extends VendorConfiguration implements CumulusNodeConfiguration { private @Nonnull org.batfish.datamodel.Interface toInterface(Bond bond) { String name = bond.getName(); org.batfish.datamodel.Interface newIface = org.batfish.datamodel.Interface.builder() .setName(name) .setOwner(_c) .setType(InterfaceType.AGGREGATED) .build(); bond.getSlaves().forEach(slave -> _c.getAllInterfaces().get(slave).setChannelGroup(name)); newIface.setChannelGroupMembers(bond.getSlaves()); newIface.setDependencies( bond.getSlaves().stream() .map(slave -> new Dependency(slave, DependencyType.AGGREGATE)) .collect(ImmutableSet.toImmutableSet())); applyBridgeSettings(bond.getBridge(), newIface); newIface.setActive(true); if (!bond.getIpAddresses().isEmpty()) { newIface.setAddress(bond.getIpAddresses().get(0)); } newIface.setAllAddresses(bond.getIpAddresses()); newIface.setMlagId(bond.getClagId()); return newIface; } CumulusNcluConfiguration(); }
CumulusNcluConfiguration extends VendorConfiguration implements CumulusNodeConfiguration { private @Nonnull org.batfish.datamodel.Interface toInterface(Bond bond) { String name = bond.getName(); org.batfish.datamodel.Interface newIface = org.batfish.datamodel.Interface.builder() .setName(name) .setOwner(_c) .setType(InterfaceType.AGGREGATED) .build(); bond.getSlaves().forEach(slave -> _c.getAllInterfaces().get(slave).setChannelGroup(name)); newIface.setChannelGroupMembers(bond.getSlaves()); newIface.setDependencies( bond.getSlaves().stream() .map(slave -> new Dependency(slave, DependencyType.AGGREGATE)) .collect(ImmutableSet.toImmutableSet())); applyBridgeSettings(bond.getBridge(), newIface); newIface.setActive(true); if (!bond.getIpAddresses().isEmpty()) { newIface.setAddress(bond.getIpAddresses().get(0)); } newIface.setAllAddresses(bond.getIpAddresses()); newIface.setMlagId(bond.getClagId()); return newIface; } 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 { private @Nonnull org.batfish.datamodel.Interface toInterface(Bond bond) { String name = bond.getName(); org.batfish.datamodel.Interface newIface = org.batfish.datamodel.Interface.builder() .setName(name) .setOwner(_c) .setType(InterfaceType.AGGREGATED) .build(); bond.getSlaves().forEach(slave -> _c.getAllInterfaces().get(slave).setChannelGroup(name)); newIface.setChannelGroupMembers(bond.getSlaves()); newIface.setDependencies( bond.getSlaves().stream() .map(slave -> new Dependency(slave, DependencyType.AGGREGATE)) .collect(ImmutableSet.toImmutableSet())); applyBridgeSettings(bond.getBridge(), newIface); newIface.setActive(true); if (!bond.getIpAddresses().isEmpty()) { newIface.setAddress(bond.getIpAddresses().get(0)); } newIface.setAllAddresses(bond.getIpAddresses()); newIface.setMlagId(bond.getClagId()); return newIface; } 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; }