@Test public void testSanityCheckEigrpDistributeListAbsentFilter() { Configuration c = _nf.configurationBuilder() .setHostname("conf") .setConfigurationFormat(ConfigurationFormat.CISCO_IOS) .build(); CiscoConfiguration oldConfig = new CiscoConfiguration(); oldConfig.setWarnings(_warnings); DistributeList distributeList = new DistributeList("filter", DistributeListFilterType.ACCESS_LIST); assertFalse(sanityCheckEigrpDistributeList(c, distributeList, oldConfig)); assertThat( oldConfig.getWarnings().getRedFlagWarnings().iterator().next().getText(), equalTo( "distribute-list refers an undefined access-list `filter`, it will not filter anything")); }
static boolean sanityCheckEigrpDistributeList( @Nonnull Configuration c, @Nonnull DistributeList distributeList, @Nonnull CiscoConfiguration vsConfig) { if (distributeList.getFilterType() == DistributeListFilterType.ACCESS_LIST && vsConfig.getExtendedAcls().containsKey(distributeList.getFilterName())) { vsConfig .getWarnings() .redFlag( String.format( "Extended access lists are not supported in EIGRP distribute-lists: %s", distributeList.getFilterName())); return false; } else if (!c.getRouteFilterLists().containsKey(distributeList.getFilterName())) { vsConfig .getWarnings() .redFlag( String.format( "distribute-list refers an undefined access-list `%s`, it will not filter anything", distributeList.getFilterName())); return false; } return true; }
CiscoConversions { static boolean sanityCheckEigrpDistributeList( @Nonnull Configuration c, @Nonnull DistributeList distributeList, @Nonnull CiscoConfiguration vsConfig) { if (distributeList.getFilterType() == DistributeListFilterType.ACCESS_LIST && vsConfig.getExtendedAcls().containsKey(distributeList.getFilterName())) { vsConfig .getWarnings() .redFlag( String.format( "Extended access lists are not supported in EIGRP distribute-lists: %s", distributeList.getFilterName())); return false; } else if (!c.getRouteFilterLists().containsKey(distributeList.getFilterName())) { vsConfig .getWarnings() .redFlag( String.format( "distribute-list refers an undefined access-list `%s`, it will not filter anything", distributeList.getFilterName())); return false; } return true; } }
CiscoConversions { static boolean sanityCheckEigrpDistributeList( @Nonnull Configuration c, @Nonnull DistributeList distributeList, @Nonnull CiscoConfiguration vsConfig) { if (distributeList.getFilterType() == DistributeListFilterType.ACCESS_LIST && vsConfig.getExtendedAcls().containsKey(distributeList.getFilterName())) { vsConfig .getWarnings() .redFlag( String.format( "Extended access lists are not supported in EIGRP distribute-lists: %s", distributeList.getFilterName())); return false; } else if (!c.getRouteFilterLists().containsKey(distributeList.getFilterName())) { vsConfig .getWarnings() .redFlag( String.format( "distribute-list refers an undefined access-list `%s`, it will not filter anything", distributeList.getFilterName())); return false; } return true; } private  CiscoConversions(); }
CiscoConversions { static boolean sanityCheckEigrpDistributeList( @Nonnull Configuration c, @Nonnull DistributeList distributeList, @Nonnull CiscoConfiguration vsConfig) { if (distributeList.getFilterType() == DistributeListFilterType.ACCESS_LIST && vsConfig.getExtendedAcls().containsKey(distributeList.getFilterName())) { vsConfig .getWarnings() .redFlag( String.format( "Extended access lists are not supported in EIGRP distribute-lists: %s", distributeList.getFilterName())); return false; } else if (!c.getRouteFilterLists().containsKey(distributeList.getFilterName())) { vsConfig .getWarnings() .redFlag( String.format( "distribute-list refers an undefined access-list `%s`, it will not filter anything", distributeList.getFilterName())); return false; } return true; } private  CiscoConversions(); static CommunityList toCommunityList(StandardCommunityList scList); }
CiscoConversions { static boolean sanityCheckEigrpDistributeList( @Nonnull Configuration c, @Nonnull DistributeList distributeList, @Nonnull CiscoConfiguration vsConfig) { if (distributeList.getFilterType() == DistributeListFilterType.ACCESS_LIST && vsConfig.getExtendedAcls().containsKey(distributeList.getFilterName())) { vsConfig .getWarnings() .redFlag( String.format( "Extended access lists are not supported in EIGRP distribute-lists: %s", distributeList.getFilterName())); return false; } else if (!c.getRouteFilterLists().containsKey(distributeList.getFilterName())) { vsConfig .getWarnings() .redFlag( String.format( "distribute-list refers an undefined access-list `%s`, it will not filter anything", distributeList.getFilterName())); return false; } return true; } private  CiscoConversions(); static CommunityList toCommunityList(StandardCommunityList scList);  }