@Test public void testPaloAlto() { String rancid = "!RANCID-CONTENT-TYPE: paloalto\n!\nstructure {"; String rancid2 = "#RANCID-CONTENT-TYPE: paloalto\n!\nstructure {"; String panorama = "deviceconfig {\n system {\n panorama-server 1.2.3.4;\n }\n}"; String sendPanorama = "alarm {\n informational {\n send-to-panorama yes;\n }\n}"; String deviceConfig = "deviceconfig {\n system {\n blah;\n }\n}"; String flatRancid = "!RANCID-CONTENT-TYPE: paloalto\n!\n"; String flatRancid2 = "#RANCID-CONTENT-TYPE: paloalto\n!\n"; String flatPanorama = "set deviceconfig system panorama-server 1.2.3.4\n}"; String flatSendPanorama = "set alarm informational send-to-panorama yes\n"; String flatDeviceConfig = "set deviceconfig system blah\n"; String flattened = "####BATFISH FLATTENED PALO ALTO CONFIG####\n"; for (String fileText : ImmutableList.of(rancid, rancid2, panorama, sendPanorama, deviceConfig)) { assertThat(identifyConfigurationFormat(fileText), equalTo(PALO_ALTO_NESTED)); } for (String fileText : ImmutableList.of( flatRancid, flatRancid2, flatPanorama, flatSendPanorama, flatDeviceConfig, flattened)) { assertThat(identifyConfigurationFormat(fileText), equalTo(PALO_ALTO)); } }
public static ConfigurationFormat identifyConfigurationFormat(String fileText) { return new VendorConfigurationFormatDetector(fileText).identifyConfigurationFormat(); }
VendorConfigurationFormatDetector { public static ConfigurationFormat identifyConfigurationFormat(String fileText) { return new VendorConfigurationFormatDetector(fileText).identifyConfigurationFormat(); } }
VendorConfigurationFormatDetector { public static ConfigurationFormat identifyConfigurationFormat(String fileText) { return new VendorConfigurationFormatDetector(fileText).identifyConfigurationFormat(); } private  VendorConfigurationFormatDetector(String fileText); }
VendorConfigurationFormatDetector { public static ConfigurationFormat identifyConfigurationFormat(String fileText) { return new VendorConfigurationFormatDetector(fileText).identifyConfigurationFormat(); } private  VendorConfigurationFormatDetector(String fileText); static ConfigurationFormat identifyConfigurationFormat(String fileText); }
VendorConfigurationFormatDetector { public static ConfigurationFormat identifyConfigurationFormat(String fileText) { return new VendorConfigurationFormatDetector(fileText).identifyConfigurationFormat(); } private  VendorConfigurationFormatDetector(String fileText); static ConfigurationFormat identifyConfigurationFormat(String fileText); static final String BATFISH_FLATTENED_JUNIPER_HEADER; static final String BATFISH_FLATTENED_PALO_ALTO_HEADER; static final String BATFISH_FLATTENED_VYOS_HEADER; }