@Test public void testConvertBridge() { CumulusInterfacesConfiguration interfaces = new CumulusInterfacesConfiguration(); interfaces.getInterfaces().put(BRIDGE_IFACE.getName(), BRIDGE_IFACE); InterfaceConverter converter = new InterfaceConverter(interfaces, _w); Bridge bridge = converter.convertBridge(); assertThat(bridge.getPorts(), equalTo(BRIDGE_IFACE.getBridgePorts())); assertThat(bridge.getPvid(), equalTo(BRIDGE_IFACE.getBridgeSettings().getPvid())); assertThat(bridge.getVids(), equalTo(BRIDGE_IFACE.getBridgeSettings().getVids())); }
public @Nullable Bridge convertBridge() { InterfacesInterface bridgeIface = _interfaces.getInterfaces().get(BRIDGE_NAME); if (bridgeIface == null) { return null; } Bridge bridge = new Bridge(); bridge.setPorts(firstNonNull(bridgeIface.getBridgePorts(), DEFAULT_BRIDGE_PORTS)); InterfaceBridgeSettings bridgeSettings = bridgeIface.getBridgeSettings(); if (bridgeSettings != null) { bridge.setVids(bridgeSettings.getVids()); bridge.setPvid(firstNonNull(bridgeSettings.getPvid(), DEFAULT_BRIDGE_PVID)); } return bridge; }
InterfaceConverter { public @Nullable Bridge convertBridge() { InterfacesInterface bridgeIface = _interfaces.getInterfaces().get(BRIDGE_NAME); if (bridgeIface == null) { return null; } Bridge bridge = new Bridge(); bridge.setPorts(firstNonNull(bridgeIface.getBridgePorts(), DEFAULT_BRIDGE_PORTS)); InterfaceBridgeSettings bridgeSettings = bridgeIface.getBridgeSettings(); if (bridgeSettings != null) { bridge.setVids(bridgeSettings.getVids()); bridge.setPvid(firstNonNull(bridgeSettings.getPvid(), DEFAULT_BRIDGE_PVID)); } return bridge; } }
InterfaceConverter { public @Nullable Bridge convertBridge() { InterfacesInterface bridgeIface = _interfaces.getInterfaces().get(BRIDGE_NAME); if (bridgeIface == null) { return null; } Bridge bridge = new Bridge(); bridge.setPorts(firstNonNull(bridgeIface.getBridgePorts(), DEFAULT_BRIDGE_PORTS)); InterfaceBridgeSettings bridgeSettings = bridgeIface.getBridgeSettings(); if (bridgeSettings != null) { bridge.setVids(bridgeSettings.getVids()); bridge.setPvid(firstNonNull(bridgeSettings.getPvid(), DEFAULT_BRIDGE_PVID)); } return bridge; } InterfaceConverter(CumulusInterfacesConfiguration interfaces, Warnings w); }
InterfaceConverter { public @Nullable Bridge convertBridge() { InterfacesInterface bridgeIface = _interfaces.getInterfaces().get(BRIDGE_NAME); if (bridgeIface == null) { return null; } Bridge bridge = new Bridge(); bridge.setPorts(firstNonNull(bridgeIface.getBridgePorts(), DEFAULT_BRIDGE_PORTS)); InterfaceBridgeSettings bridgeSettings = bridgeIface.getBridgeSettings(); if (bridgeSettings != null) { bridge.setVids(bridgeSettings.getVids()); bridge.setPvid(firstNonNull(bridgeSettings.getPvid(), DEFAULT_BRIDGE_PVID)); } return bridge; } 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 { public @Nullable Bridge convertBridge() { InterfacesInterface bridgeIface = _interfaces.getInterfaces().get(BRIDGE_NAME); if (bridgeIface == null) { return null; } Bridge bridge = new Bridge(); bridge.setPorts(firstNonNull(bridgeIface.getBridgePorts(), DEFAULT_BRIDGE_PORTS)); InterfaceBridgeSettings bridgeSettings = bridgeIface.getBridgeSettings(); if (bridgeSettings != null) { bridge.setVids(bridgeSettings.getVids()); bridge.setPvid(firstNonNull(bridgeSettings.getPvid(), DEFAULT_BRIDGE_PVID)); } return bridge; } 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; }