org.onosproject.p4runtime.model.P4InfoParserException Java Examples

The following examples show how to use org.onosproject.p4runtime.model.P4InfoParserException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PipeconfLoader.java    From ngsdn-tutorial with Apache License 2.0 5 votes vote down vote up
@Activate
public void activate() {
    // Registers the pipeconf at component activation.
    if (pipeconfService.getPipeconf(PIPECONF_ID).isPresent()) {
        // Remove first if already registered, to support reloading of the
        // pipeconf during the tutorial.
        pipeconfService.unregister(PIPECONF_ID);
    }
    removePipeconfDrivers();
    try {
        pipeconfService.register(buildPipeconf());
    } catch (P4InfoParserException e) {
        log.error("Unable to register " + PIPECONF_ID, e);
    }
}
 
Example #2
Source File: PipeconfLoader.java    From ngsdn-tutorial with Apache License 2.0 5 votes vote down vote up
private PiPipeconf buildPipeconf() throws P4InfoParserException {

        final URL p4InfoUrl = PipeconfLoader.class.getResource(P4INFO_PATH);
        final URL bmv2JsonUrlUrl = PipeconfLoader.class.getResource(BMV2_JSON_PATH);
        final PiPipelineModel pipelineModel = P4InfoParser.parse(p4InfoUrl);

        return DefaultPiPipeconf.builder()
                .withId(PIPECONF_ID)
                .withPipelineModel(pipelineModel)
                .addBehaviour(PiPipelineInterpreter.class, InterpreterImpl.class)
                .addBehaviour(Pipeliner.class, PipelinerImpl.class)
                .addExtension(P4_INFO_TEXT, p4InfoUrl)
                .addExtension(BMV2_JSON, bmv2JsonUrlUrl)
                .build();
    }
 
Example #3
Source File: PipeconfLoader.java    From onos-p4-tutorial with Apache License 2.0 5 votes vote down vote up
@Activate
public void activate() {
    // Registers the pipeconf at component activation.
    if (pipeconfService.getPipeconf(PIPECONF_ID).isPresent()) {
        // Remove first if already registered, to support reloading of the
        // pipeconf during the tutorial.
        pipeconfService.unregister(PIPECONF_ID);
    }
    removePipeconfDrivers();
    try {
        pipeconfService.register(buildPipeconf());
    } catch (P4InfoParserException e) {
        log.error("Unable to register " + PIPECONF_ID, e);
    }
}
 
Example #4
Source File: PipeconfLoader.java    From onos-p4-tutorial with Apache License 2.0 5 votes vote down vote up
private PiPipeconf buildPipeconf() throws P4InfoParserException {

        final URL p4InfoUrl = PipeconfLoader.class.getResource(P4INFO_PATH);
        final URL bmv2JsonUrlUrl = PipeconfLoader.class.getResource(BMV2_JSON_PATH);
        final PiPipelineModel pipelineModel = P4InfoParser.parse(p4InfoUrl);

        return DefaultPiPipeconf.builder()
                .withId(PIPECONF_ID)
                .withPipelineModel(pipelineModel)
                .addBehaviour(PiPipelineInterpreter.class, InterpreterImpl.class)
                .addBehaviour(Pipeliner.class, PipelinerImpl.class)
                .addExtension(P4_INFO_TEXT, p4InfoUrl)
                .addExtension(BMV2_JSON, bmv2JsonUrlUrl)
                .build();
    }
 
Example #5
Source File: PipeconfLoader.java    From onos-p4-tutorial with Apache License 2.0 5 votes vote down vote up
@Activate
public void activate() {
    // Registers the pipeconf at component activation.
    if (pipeconfService.getPipeconf(PIPECONF_ID).isPresent()) {
        // Remove first if already registered, to support reloading of the
        // pipeconf during the tutorial.
        pipeconfService.unregister(PIPECONF_ID);
    }
    removePipeconfDrivers();
    try {
        pipeconfService.register(buildPipeconf());
    } catch (P4InfoParserException e) {
        log.error("Unable to register " + PIPECONF_ID, e);
    }
}
 
Example #6
Source File: PipeconfLoader.java    From onos-p4-tutorial with Apache License 2.0 5 votes vote down vote up
private PiPipeconf buildPipeconf() throws P4InfoParserException {

        final URL p4InfoUrl = PipeconfLoader.class.getResource(P4INFO_PATH);
        final URL bmv2JsonUrlUrl = PipeconfLoader.class.getResource(BMV2_JSON_PATH);
        final PiPipelineModel pipelineModel = P4InfoParser.parse(p4InfoUrl);

        return DefaultPiPipeconf.builder()
                .withId(PIPECONF_ID)
                .withPipelineModel(pipelineModel)
                .addBehaviour(PiPipelineInterpreter.class, InterpreterImpl.class)
                .addBehaviour(Pipeliner.class, PipelinerImpl.class)
                .addExtension(P4_INFO_TEXT, p4InfoUrl)
                .addExtension(BMV2_JSON, bmv2JsonUrlUrl)
                .build();
    }
 
Example #7
Source File: FabricPipeconfManager.java    From onos with Apache License 2.0 5 votes vote down vote up
private static PiPipelineModel parseP4Info(URL p4InfoUrl) {
    try {
        return P4InfoParser.parse(p4InfoUrl);
    } catch (P4InfoParserException e) {
        // FIXME: propagate exception that can be handled by whoever is
        //  trying to build pipeconfs.
        throw new IllegalStateException(e);
    }
}
 
Example #8
Source File: PipeconfLoader.java    From onos with Apache License 2.0 5 votes vote down vote up
private static PiPipelineModel parseP4Info(URL p4InfoUrl) {
    try {
        return P4InfoParser.parse(p4InfoUrl);
    } catch (P4InfoParserException e) {
        throw new IllegalStateException(e);
    }
}
 
Example #9
Source File: PipeconfFactory.java    From onos with Apache License 2.0 5 votes vote down vote up
@Activate
public void activate() {
    // Registers the pipeconf at component activation.
    try {
        piPipeconfService.register(buildPipeconf());
    } catch (P4InfoParserException e) {
        log.error("Fail to register {} - Exception: {} - Cause: {}",
                PIPECONF_ID, e.getMessage(), e.getCause().getMessage());
    }
}
 
Example #10
Source File: PipeconfFactory.java    From onos with Apache License 2.0 5 votes vote down vote up
private PiPipeconf buildPipeconf() throws P4InfoParserException {

        final PiPipelineModel pipelineModel = P4InfoParser.parse(P4INFO_URL);

        return DefaultPiPipeconf.builder()
                .withId(PIPECONF_ID)
                .withPipelineModel(pipelineModel)
                .addBehaviour(PiPipelineInterpreter.class, PipelineInterpreterImpl.class)
                .addBehaviour(PortStatisticsDiscovery.class, PortStatisticsDiscoveryImpl.class)
                // Since mytunnel.p4 defines only 1 table, we re-use the existing single-table pipeliner.
                .addBehaviour(Pipeliner.class, DefaultSingleTablePipeline.class)
                .addExtension(P4_INFO_TEXT, P4INFO_URL)
                .addExtension(BMV2_JSON, BMV2_JSON_URL)
                .build();
    }