@Test public void testConvertVlan() { Vlan vlan = convertVlan(VLAN_IFACE); assertThat(vlan.getName(), equalTo(VLAN_IFACE.getName())); assertThat(vlan.getAlias(), equalTo(VLAN_IFACE.getDescription())); assertThat(vlan.getAddresses(), equalTo(VLAN_IFACE.getAddresses())); assertThat(vlan.getAddressVirtuals(), equalTo(VLAN_IFACE.getAddressVirtuals())); assertThat(vlan.getVlanId(), equalTo(VLAN_IFACE.getVlanId())); assertThat(vlan.getVrf(), equalTo(VLAN_IFACE.getVrf())); }
@VisibleForTesting static Vlan convertVlan(InterfacesInterface iface) { checkArgument(isVlan(iface), "interfaces %s is not a vlan", iface.getName()); Vlan vlan = new Vlan(iface.getName()); vlan.setAlias(iface.getDescription()); vlan.getAddresses().addAll(firstNonNull(iface.getAddresses(), ImmutableList.of())); vlan.getAddressVirtuals().putAll(firstNonNull(iface.getAddressVirtuals(), ImmutableMap.of())); vlan.setVlanId(iface.getVlanId()); vlan.setVrf(iface.getVrf()); return vlan; }
InterfaceConverter { @VisibleForTesting static Vlan convertVlan(InterfacesInterface iface) { checkArgument(isVlan(iface), "interfaces %s is not a vlan", iface.getName()); Vlan vlan = new Vlan(iface.getName()); vlan.setAlias(iface.getDescription()); vlan.getAddresses().addAll(firstNonNull(iface.getAddresses(), ImmutableList.of())); vlan.getAddressVirtuals().putAll(firstNonNull(iface.getAddressVirtuals(), ImmutableMap.of())); vlan.setVlanId(iface.getVlanId()); vlan.setVrf(iface.getVrf()); return vlan; } }
InterfaceConverter { @VisibleForTesting static Vlan convertVlan(InterfacesInterface iface) { checkArgument(isVlan(iface), "interfaces %s is not a vlan", iface.getName()); Vlan vlan = new Vlan(iface.getName()); vlan.setAlias(iface.getDescription()); vlan.getAddresses().addAll(firstNonNull(iface.getAddresses(), ImmutableList.of())); vlan.getAddressVirtuals().putAll(firstNonNull(iface.getAddressVirtuals(), ImmutableMap.of())); vlan.setVlanId(iface.getVlanId()); vlan.setVrf(iface.getVrf()); return vlan; } InterfaceConverter(CumulusInterfacesConfiguration interfaces, Warnings w); }
InterfaceConverter { @VisibleForTesting static Vlan convertVlan(InterfacesInterface iface) { checkArgument(isVlan(iface), "interfaces %s is not a vlan", iface.getName()); Vlan vlan = new Vlan(iface.getName()); vlan.setAlias(iface.getDescription()); vlan.getAddresses().addAll(firstNonNull(iface.getAddresses(), ImmutableList.of())); vlan.getAddressVirtuals().putAll(firstNonNull(iface.getAddressVirtuals(), ImmutableMap.of())); vlan.setVlanId(iface.getVlanId()); vlan.setVrf(iface.getVrf()); return vlan; } InterfaceConverter(CumulusInterfacesConfiguration interfaces, Warnings w); Map<String, Bond> convertBonds(); @Nullable Bridge convertBridge(); Map<String, org.batfish.representation.cumulus.Interface> convertInterfaces(); Map<String, Vlan> convertVlans(); Map<String, Vrf> convertVrfs(); Map<String, Vxlan> convertVxlans(); @VisibleForTesting @Nullable static String getSuperInterfaceName(String ifaceName); @VisibleForTesting @Nullable static Integer getEncapsulationVlan(InterfacesInterface iface); static boolean isBond(InterfacesInterface iface); static boolean isVlan(InterfacesInterface iface); static boolean isVxlan(InterfacesInterface iface); static boolean isVrf(InterfacesInterface iface); static boolean isInterface(InterfacesInterface iface); }
InterfaceConverter { @VisibleForTesting static Vlan convertVlan(InterfacesInterface iface) { checkArgument(isVlan(iface), "interfaces %s is not a vlan", iface.getName()); Vlan vlan = new Vlan(iface.getName()); vlan.setAlias(iface.getDescription()); vlan.getAddresses().addAll(firstNonNull(iface.getAddresses(), ImmutableList.of())); vlan.getAddressVirtuals().putAll(firstNonNull(iface.getAddressVirtuals(), ImmutableMap.of())); vlan.setVlanId(iface.getVlanId()); vlan.setVrf(iface.getVrf()); return vlan; } InterfaceConverter(CumulusInterfacesConfiguration interfaces, Warnings w); Map<String, Bond> convertBonds(); @Nullable Bridge convertBridge(); Map<String, org.batfish.representation.cumulus.Interface> convertInterfaces(); Map<String, Vlan> convertVlans(); Map<String, Vrf> convertVrfs(); Map<String, Vxlan> convertVxlans(); @VisibleForTesting @Nullable static String getSuperInterfaceName(String ifaceName); @VisibleForTesting @Nullable static Integer getEncapsulationVlan(InterfacesInterface iface); static boolean isBond(InterfacesInterface iface); static boolean isVlan(InterfacesInterface iface); static boolean isVxlan(InterfacesInterface iface); static boolean isVrf(InterfacesInterface iface); static boolean isInterface(InterfacesInterface iface); @VisibleForTesting static final String BRIDGE_NAME; static final Set<String> DEFAULT_BRIDGE_PORTS; static final int DEFAULT_BRIDGE_PVID; }