Search in sources :

Example 1 with RedFlagBatfishException

use of org.batfish.common.RedFlagBatfishException in project batfish by batfish.

the class CiscoControlPlaneExtractor method toInterfaceName.

private static String toInterfaceName(Interface_nameContext ctx) {
    String canonicalNamePrefix = CiscoConfiguration.getCanonicalInterfaceNamePrefix(ctx.name_prefix_alpha.getText());
    String name = canonicalNamePrefix;
    for (Token part : ctx.name_middle_parts) {
        name += part.getText();
    }
    if (ctx.range().range_list.size() != 1) {
        throw new RedFlagBatfishException("got interface range where single interface was expected: '" + ctx.getText() + "'");
    }
    name += ctx.range().getText();
    return name;
}
Also used : RedFlagBatfishException(org.batfish.common.RedFlagBatfishException) Token(org.antlr.v4.runtime.Token)

Aggregations

Token (org.antlr.v4.runtime.Token)1 RedFlagBatfishException (org.batfish.common.RedFlagBatfishException)1