@Test public void testGenerateCrossZoneCallsLayer2() { Vsys vsys = new Vsys(VSYS_NAME); Zone fromZone = new Zone(FROM_ZONE_NAME, vsys); fromZone.setType(Type.LAYER2); fromZone.getInterfaceNames().add(SRC_INTERFACE_NAME); vsys.getZones().put(FROM_ZONE_NAME, fromZone); assertEquals( generateCrossZoneCalls( fromZone, new Zone(TO_ZONE_NAME, vsys), ImmutableList.of(), ImmutableList.of(vsys)) .count(), 0L); }
@VisibleForTesting static @Nonnull Stream<ExprAclLine> generateCrossZoneCalls( Zone fromZone, Zone toZone, Collection<Vsys> sharedGateways, Collection<Vsys> virtualSystems) { Vsys vsys = fromZone.getVsys(); assert vsys == toZone.getVsys(); switch (fromZone.getType()) { case EXTERNAL: return generateCrossZoneCallsFromExternal(fromZone, toZone, sharedGateways, virtualSystems); case LAYER3: return generateCrossZoneCallsFromLayer3(fromZone, toZone); default: return Stream.of(); } }
PaloAltoConfiguration extends VendorConfiguration { @VisibleForTesting static @Nonnull Stream<ExprAclLine> generateCrossZoneCalls( Zone fromZone, Zone toZone, Collection<Vsys> sharedGateways, Collection<Vsys> virtualSystems) { Vsys vsys = fromZone.getVsys(); assert vsys == toZone.getVsys(); switch (fromZone.getType()) { case EXTERNAL: return generateCrossZoneCallsFromExternal(fromZone, toZone, sharedGateways, virtualSystems); case LAYER3: return generateCrossZoneCallsFromLayer3(fromZone, toZone); default: return Stream.of(); } } }
PaloAltoConfiguration extends VendorConfiguration { @VisibleForTesting static @Nonnull Stream<ExprAclLine> generateCrossZoneCalls( Zone fromZone, Zone toZone, Collection<Vsys> sharedGateways, Collection<Vsys> virtualSystems) { Vsys vsys = fromZone.getVsys(); assert vsys == toZone.getVsys(); switch (fromZone.getType()) { case EXTERNAL: return generateCrossZoneCallsFromExternal(fromZone, toZone, sharedGateways, virtualSystems); case LAYER3: return generateCrossZoneCallsFromLayer3(fromZone, toZone); default: return Stream.of(); } } PaloAltoConfiguration(); }
PaloAltoConfiguration extends VendorConfiguration { @VisibleForTesting static @Nonnull Stream<ExprAclLine> generateCrossZoneCalls( Zone fromZone, Zone toZone, Collection<Vsys> sharedGateways, Collection<Vsys> virtualSystems) { Vsys vsys = fromZone.getVsys(); assert vsys == toZone.getVsys(); switch (fromZone.getType()) { case EXTERNAL: return generateCrossZoneCallsFromExternal(fromZone, toZone, sharedGateways, virtualSystems); case LAYER3: return generateCrossZoneCallsFromLayer3(fromZone, toZone); default: return Stream.of(); } } PaloAltoConfiguration(); void addHostnameMapping(String deviceId, String hostname); List<CryptoProfile> getCryptoProfiles(); CryptoProfile getCryptoProfileOrCreate(String name, CryptoProfile.Type cpType); @Override String getHostname(); @Nullable DeviceGroup getDeviceGroup(String name); DeviceGroup getOrCreateDeviceGroup(String name); Template getOrCreateTemplate(String name); TemplateStack getOrCreateTemplateStack(String name); SortedMap<String, Interface> getInterfaces(); Ip getMgmtIfaceAddress(); Ip getMgmtIfaceGateway(); Ip getMgmtIfaceNetmask(); @Nonnull SortedMap<String, Vsys> getSharedGateways(); @Nullable Template getTemplate(String name); SortedMap<String, VirtualRouter> getVirtualRouters(); SortedMap<String, Vsys> getVirtualSystems(); void setDnsServerPrimary(String dnsServerPrimary); void setDnsServerSecondary(String dnsServerSecondary); @Override void setHostname(String hostname); void setMgmtIfaceAddress(Ip ip); void setMgmtIfaceGateway(Ip ip); void setMgmtIfaceNetmask(Ip ip); void setNtpServerPrimary(String ntpServerPrimary); void setNtpServerSecondary(String ntpServerSecondary); @Override void setVendor(ConfigurationFormat format); static String computeObjectName(String vsysName, String objectName); static String computeObjectName(@Nullable Vsys vsys, String objectName); static String computeOutgoingFilterName(String interfaceOrZoneName); static String computePacketPolicyName(Zone zone); @VisibleForTesting static String computeServiceGroupMemberAclName(
      String vsysName, String serviceGroupMemberName); @VisibleForTesting List<PaloAltoConfiguration> getManagedConfigurations(); @Override List<Configuration> toVendorIndependentConfigurations(); @Nullable Vsys getPanorama(); @Nullable Vsys getShared(); void setPanorama(@Nullable Vsys panorama); void setShared(@Nullable Vsys shared); }
PaloAltoConfiguration extends VendorConfiguration { @VisibleForTesting static @Nonnull Stream<ExprAclLine> generateCrossZoneCalls( Zone fromZone, Zone toZone, Collection<Vsys> sharedGateways, Collection<Vsys> virtualSystems) { Vsys vsys = fromZone.getVsys(); assert vsys == toZone.getVsys(); switch (fromZone.getType()) { case EXTERNAL: return generateCrossZoneCallsFromExternal(fromZone, toZone, sharedGateways, virtualSystems); case LAYER3: return generateCrossZoneCallsFromLayer3(fromZone, toZone); default: return Stream.of(); } } PaloAltoConfiguration(); void addHostnameMapping(String deviceId, String hostname); List<CryptoProfile> getCryptoProfiles(); CryptoProfile getCryptoProfileOrCreate(String name, CryptoProfile.Type cpType); @Override String getHostname(); @Nullable DeviceGroup getDeviceGroup(String name); DeviceGroup getOrCreateDeviceGroup(String name); Template getOrCreateTemplate(String name); TemplateStack getOrCreateTemplateStack(String name); SortedMap<String, Interface> getInterfaces(); Ip getMgmtIfaceAddress(); Ip getMgmtIfaceGateway(); Ip getMgmtIfaceNetmask(); @Nonnull SortedMap<String, Vsys> getSharedGateways(); @Nullable Template getTemplate(String name); SortedMap<String, VirtualRouter> getVirtualRouters(); SortedMap<String, Vsys> getVirtualSystems(); void setDnsServerPrimary(String dnsServerPrimary); void setDnsServerSecondary(String dnsServerSecondary); @Override void setHostname(String hostname); void setMgmtIfaceAddress(Ip ip); void setMgmtIfaceGateway(Ip ip); void setMgmtIfaceNetmask(Ip ip); void setNtpServerPrimary(String ntpServerPrimary); void setNtpServerSecondary(String ntpServerSecondary); @Override void setVendor(ConfigurationFormat format); static String computeObjectName(String vsysName, String objectName); static String computeObjectName(@Nullable Vsys vsys, String objectName); static String computeOutgoingFilterName(String interfaceOrZoneName); static String computePacketPolicyName(Zone zone); @VisibleForTesting static String computeServiceGroupMemberAclName(
      String vsysName, String serviceGroupMemberName); @VisibleForTesting List<PaloAltoConfiguration> getManagedConfigurations(); @Override List<Configuration> toVendorIndependentConfigurations(); @Nullable Vsys getPanorama(); @Nullable Vsys getShared(); void setPanorama(@Nullable Vsys panorama); void setShared(@Nullable Vsys shared); static final String CATCHALL_APPLICATION_NAME; static final String CATCHALL_ENDPOINT_NAME; static final String CATCHALL_ZONE_NAME; static final String DEFAULT_VSYS_NAME; static final String NULL_VRF_NAME; static final String PANORAMA_VSYS_NAME; static final String SHARED_VSYS_NAME; }