Java Code Examples for org.onosproject.net.pi.model.DefaultPiPipeconf#Builder
The following examples show how to use
org.onosproject.net.pi.model.DefaultPiPipeconf#Builder .
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: FabricPipeconfLoader.java From onos with Apache License 2.0 | 6 votes |
private PiPipeconf bmv2Pipeconf(String profile, String platform) throws FileNotFoundException { final URL bmv2JsonUrl = this.getClass().getResource(format( P4C_RES_BASE_PATH + BMV2_JSON, profile, BMV2, platform)); final URL p4InfoUrl = this.getClass().getResource(format( P4C_RES_BASE_PATH + P4INFO_TXT, profile, BMV2, platform)); final URL cpuPortUrl = this.getClass().getResource(format( P4C_RES_BASE_PATH + CPU_PORT_TXT, profile, BMV2, platform)); checkFileExists(bmv2JsonUrl, BMV2_JSON); checkFileExists(p4InfoUrl, P4INFO_TXT); checkFileExists(cpuPortUrl, CPU_PORT_TXT); final DefaultPiPipeconf.Builder builder = DefaultPiPipeconf.builder() .withId(makePipeconfId(platform, profile)) .addBehaviour(PortStatisticsDiscovery.class, FabricPortStatisticsDiscovery.class) .addExtension(PiPipeconf.ExtensionType.BMV2_JSON, bmv2JsonUrl); return build(builder, profile, p4InfoUrl, cpuPortUrl); }
Example 2
Source File: FabricPipeconfLoader.java From onos with Apache License 2.0 | 6 votes |
private PiPipeconf spectrumPipeconf(String profile, String platform) throws FileNotFoundException { final URL spectrumBinUrl = this.getClass().getResource(format( P4C_RES_BASE_PATH + SPECTRUM_BIN, profile, SPECTRUM, platform)); final URL p4InfoUrl = this.getClass().getResource(format( P4C_RES_BASE_PATH + P4INFO_TXT, profile, SPECTRUM, platform)); final URL cpuPortUrl = this.getClass().getResource(format( P4C_RES_BASE_PATH + CPU_PORT_TXT, profile, SPECTRUM, platform)); checkFileExists(spectrumBinUrl, SPECTRUM_BIN); checkFileExists(p4InfoUrl, P4INFO_TXT); checkFileExists(cpuPortUrl, CPU_PORT_TXT); final DefaultPiPipeconf.Builder builder = DefaultPiPipeconf.builder() .withId(makePipeconfId(platform, profile)) .addExtension(PiPipeconf.ExtensionType.SPECTRUM_BIN, spectrumBinUrl); return build(builder, profile, p4InfoUrl, cpuPortUrl); }
Example 3
Source File: FabricPipeconfManager.java From onos with Apache License 2.0 | 5 votes |
static PiPipeconf build( DefaultPiPipeconf.Builder pipeconfBuilder, String profileName, URL p4InfoUrl, URL cpuPortUrl) { checkNotNull(pipeconfBuilder, "pipeconfBuilder cannot be null"); checkArgument(profileName != null && !profileName.isEmpty(), "profileName cannot be null or empty"); checkNotNull(p4InfoUrl, "p4InfoUrl cannot be null (check if file exists)"); checkNotNull(cpuPortUrl, "cpuPortUrl cannot be null (check if file exists)"); pipeconfBuilder .withPipelineModel(parseP4Info(p4InfoUrl)) .addBehaviour(PiPipelineInterpreter.class, FabricInterpreter.class) .addBehaviour(Pipeliner.class, FabricPipeliner.class) .addExtension(PiPipeconf.ExtensionType.P4_INFO_TEXT, p4InfoUrl) .addExtension(PiPipeconf.ExtensionType.CPU_PORT_TXT, cpuPortUrl); // Add IntProgrammable behaviour for INT-enabled profiles. if (profileName.endsWith(INT_PROFILE_SUFFIX) || profileName.endsWith(FULL_PROFILE_SUFFIX)) { pipeconfBuilder.addBehaviour(IntProgrammable.class, FabricIntProgrammable.class); } // Add BngProgrammable behavior for BNG-enabled pipelines. if (profileName.endsWith(BNG_PROFILE_SUFFIX)) { pipeconfBuilder.addBehaviour(BngProgrammable.class, FabricBngProgrammable.class); } return pipeconfBuilder.build(); }
Example 4
Source File: FabricPipeconfManager.java From onos with Apache License 2.0 | 4 votes |
@Override public PiPipeconf buildFabricPipeconf( DefaultPiPipeconf.Builder builder, String profile, URL p4InfoUrl, URL cpuPortUrl) { return build(builder, profile, p4InfoUrl, cpuPortUrl); }
Example 5
Source File: FabricPipeconfService.java From onos with Apache License 2.0 | 2 votes |
/** * Builds a pipeconf for fabric.p4. * <p> * This method expects as input a pipeconf builder already populated with * the pipeconf ID (i.e., {@link DefaultPiPipeconf.Builder#withId}) and * target-specific extensions (i.e., {@link DefaultPiPipeconf.Builder#addExtension}. * The implementation takes care of adding all the necessary behavior * implementations specific to fabric.p4, depending on the profile name, * e.g., adding INT-related behaviors for fabric-int profile). * <p> * Finally, the implementation takes care of parsing the given P4Info file * (in text format) as pipeconf pipeline model, and setting the pipeconf CPU * port to the one contained in the given file URL. * * @param builder pipeconf builder already populated with ID and * target-specific extensions * @param profile fabric.p4 profile name * @param p4InfoUrl URL to P4Info file in text format * @param cpuPortUrl URL to txt file containing the CPU port * @return pipeconf instance */ PiPipeconf buildFabricPipeconf(DefaultPiPipeconf.Builder builder, String profile, URL p4InfoUrl, URL cpuPortUrl);