Creating drivers and *Programmable Classes for Tofino device
ONOS-6836 ONOS-6837 ONOS-6839
Change-Id: Iaf3dd8a08533877f66a177f6d529290c51b0675b
diff --git a/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/BarefootDriversLoader.java b/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/BarefootDriversLoader.java
new file mode 100644
index 0000000..f00b5ac
--- /dev/null
+++ b/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/BarefootDriversLoader.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.drivers.barefoot;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onosproject.net.driver.AbstractDriverLoader;
+import org.onosproject.net.pi.runtime.PiPipeconfService;
+
+/**
+ * Loader for P4Runtime device drivers.
+ */
+@Component(immediate = true)
+public class BarefootDriversLoader extends AbstractDriverLoader {
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected PiPipeconfService pipeconfService;
+
+ public BarefootDriversLoader() {
+ super("/barefoot-drivers.xml");
+ }
+
+ @Override
+ public void activate() {
+ pipeconfService.register(TofinoDefaultPipeconfFactory.get());
+ super.activate();
+ }
+
+ @Override
+ public void deactivate() {
+ pipeconfService.remove(TofinoDefaultPipeconfFactory.get().id());
+ super.deactivate();
+ }
+}
diff --git a/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/TofinoDefaultInterpreter.java b/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/TofinoDefaultInterpreter.java
new file mode 100644
index 0000000..ea3dfe0
--- /dev/null
+++ b/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/TofinoDefaultInterpreter.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.drivers.barefoot;
+
+import com.google.common.collect.ImmutableBiMap;
+import com.google.common.collect.ImmutableList;
+import org.onlab.packet.Ethernet;
+import org.onlab.util.ImmutableByteSequence;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Port;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.driver.AbstractHandlerBehaviour;
+import org.onosproject.net.flow.TrafficTreatment;
+import org.onosproject.net.flow.criteria.Criterion;
+import org.onosproject.net.flow.instructions.Instruction;
+import org.onosproject.net.flow.instructions.Instructions;
+import org.onosproject.net.packet.DefaultInboundPacket;
+import org.onosproject.net.packet.InboundPacket;
+import org.onosproject.net.packet.OutboundPacket;
+import org.onosproject.net.pi.model.PiPipelineInterpreter;
+import org.onosproject.net.pi.runtime.PiAction;
+import org.onosproject.net.pi.runtime.PiActionId;
+import org.onosproject.net.pi.runtime.PiActionParam;
+import org.onosproject.net.pi.runtime.PiActionParamId;
+import org.onosproject.net.pi.runtime.PiHeaderFieldId;
+import org.onosproject.net.pi.runtime.PiPacketMetadata;
+import org.onosproject.net.pi.runtime.PiPacketMetadataId;
+import org.onosproject.net.pi.runtime.PiPacketOperation;
+import org.onosproject.net.pi.runtime.PiTableId;
+
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+
+import static java.util.stream.Collectors.toList;
+import static org.onosproject.net.PortNumber.CONTROLLER;
+import static org.onosproject.net.PortNumber.FLOOD;
+import static org.onosproject.net.flow.instructions.Instruction.Type.OUTPUT;
+import static org.onosproject.net.pi.runtime.PiPacketOperation.Type.PACKET_OUT;
+
+/**
+ * Interpreter implementation for the default pipeconf.
+ */
+public class TofinoDefaultInterpreter extends AbstractHandlerBehaviour implements PiPipelineInterpreter {
+ private static final String TABLE0 = "table0";
+ private static final String SEND_TO_CPU = "send_to_cpu";
+ private static final String PORT = "port";
+ private static final String DROP = "_drop";
+ private static final String SET_EGRESS_PORT = "set_egress_port";
+ private static final String EGRESS_PORT = "egress_port";
+ private static final int PORT_NUMBER_BIT_WIDTH = 9;
+
+ private static final PiHeaderFieldId IN_PORT_ID = PiHeaderFieldId.of("ig_intr_md", "ingress_port");
+ private static final PiHeaderFieldId ETH_DST_ID = PiHeaderFieldId.of("ethernet", "dstAddr");
+ private static final PiHeaderFieldId ETH_SRC_ID = PiHeaderFieldId.of("ethernet", "srcAddr");
+ private static final PiHeaderFieldId ETH_TYPE_ID = PiHeaderFieldId.of("ethernet", "etherType");
+
+ private static final ImmutableBiMap<Criterion.Type, PiHeaderFieldId> CRITERION_MAP =
+ new ImmutableBiMap.Builder<Criterion.Type, PiHeaderFieldId>()
+ .put(Criterion.Type.IN_PORT, IN_PORT_ID)
+ .put(Criterion.Type.ETH_DST, ETH_DST_ID)
+ .put(Criterion.Type.ETH_SRC, ETH_SRC_ID)
+ .put(Criterion.Type.ETH_TYPE, ETH_TYPE_ID)
+ .build();
+
+ private static final ImmutableBiMap<Integer, PiTableId> TABLE_MAP = ImmutableBiMap.of(
+ 0, PiTableId.of(TABLE0));
+ public static final String INGRESS_PORT = "ingress_port";
+
+
+ @Override
+ public PiAction mapTreatment(TrafficTreatment treatment, PiTableId piTableId) throws PiInterpreterException {
+
+ if (treatment.allInstructions().size() == 0) {
+ // No instructions means drop for us.
+ return actionWithName(DROP);
+ } else if (treatment.allInstructions().size() > 1) {
+ // Otherwise, we understand treatments with only 1 instruction.
+ throw new PiPipelineInterpreter.PiInterpreterException("Treatment has multiple instructions");
+ }
+
+ Instruction instruction = treatment.allInstructions().get(0);
+
+ switch (instruction.type()) {
+ case OUTPUT:
+ Instructions.OutputInstruction outInstruction = (Instructions.OutputInstruction) instruction;
+ PortNumber port = outInstruction.port();
+ if (!port.isLogical()) {
+ return PiAction.builder()
+ .withId(PiActionId.of(SET_EGRESS_PORT))
+ .withParameter(new PiActionParam(PiActionParamId.of(PORT),
+ ImmutableByteSequence.copyFrom(port.toLong())))
+ .build();
+ } else if (port.equals(CONTROLLER)) {
+ return actionWithName(SEND_TO_CPU);
+ } else {
+ throw new PiInterpreterException("Egress on logical port not supported: " + port);
+ }
+ case NOACTION:
+ return actionWithName(DROP);
+ default:
+ throw new PiInterpreterException("Instruction type not supported: " + instruction.type().name());
+ }
+ }
+
+ @Override
+ public Collection<PiPacketOperation> mapOutboundPacket(OutboundPacket packet)
+ throws PiInterpreterException {
+ TrafficTreatment treatment = packet.treatment();
+
+ // default.p4 supports only OUTPUT instructions.
+ List<Instructions.OutputInstruction> outInstructions = treatment.allInstructions()
+ .stream()
+ .filter(i -> i.type().equals(OUTPUT))
+ .map(i -> (Instructions.OutputInstruction) i)
+ .collect(toList());
+
+ if (treatment.allInstructions().size() != outInstructions.size()) {
+ // There are other instructions that are not of type OUTPUT
+ throw new PiInterpreterException("Treatment not supported: " + treatment);
+ }
+
+ ImmutableList.Builder<PiPacketOperation> builder = ImmutableList.builder();
+ for (Instructions.OutputInstruction outInst : outInstructions) {
+ if (outInst.port().isLogical() && !outInst.port().equals(FLOOD)) {
+ throw new PiInterpreterException("Logical port not supported: " +
+ outInst.port());
+ } else if (outInst.port().equals(FLOOD)) {
+ //Since default.p4 does not support flood for each port of the device
+ // create a packet operation to send the packet out of that specific port
+ for (Port port : handler().get(DeviceService.class).getPorts(packet.sendThrough())) {
+ builder.add(createPiPacketOperation(packet.data(), port.number().toLong()));
+ }
+ } else {
+ builder.add(createPiPacketOperation(packet.data(), outInst.port().toLong()));
+ }
+ }
+ return builder.build();
+ }
+
+ @Override
+ public InboundPacket mapInboundPacket(DeviceId deviceId, PiPacketOperation packetIn)
+ throws PiInterpreterException {
+
+ //We are assuming that the packet is ethernet type
+ Ethernet ethPkt = new Ethernet();
+
+ ethPkt.deserialize(packetIn.data().asArray(), 0, packetIn.data().size());
+
+ //Returns the ingress port packet metadata
+ Optional<PiPacketMetadata> packetMetadata = packetIn.metadatas()
+ .stream().filter(metadata -> metadata.id().name().equals(INGRESS_PORT))
+ .findFirst();
+
+ if (packetMetadata.isPresent()) {
+
+ //Obtaining the ingress port as an immutable byte sequence
+ ImmutableByteSequence portByteSequence = packetMetadata.get().value();
+
+ //Converting immutableByteSequence to short
+ short s = portByteSequence.asReadOnlyBuffer().getShort();
+
+ ConnectPoint receivedFrom = new ConnectPoint(deviceId, PortNumber.portNumber(s));
+
+ //FIXME should be optimizable with .asReadOnlyBytebuffer
+ ByteBuffer rawData = ByteBuffer.wrap(packetIn.data().asArray());
+ return new DefaultInboundPacket(receivedFrom, ethPkt, rawData);
+
+ } else {
+ throw new PiInterpreterException("Can't get packet metadata for" + INGRESS_PORT);
+ }
+ }
+
+ private PiPacketOperation createPiPacketOperation(ByteBuffer data, long portNumber) throws PiInterpreterException {
+ //create the metadata
+ PiPacketMetadata metadata = createPacketMetadata(portNumber);
+
+ //Create the Packet operation
+ return PiPacketOperation.builder()
+ .withType(PACKET_OUT)
+ .withData(ImmutableByteSequence.copyFrom(data))
+ .withMetadatas(ImmutableList.of(metadata))
+ .build();
+ }
+
+ private PiPacketMetadata createPacketMetadata(long portNumber) throws PiInterpreterException {
+ ImmutableByteSequence portValue = ImmutableByteSequence.copyFrom(portNumber);
+ //FIXME remove hardcoded bitWidth and retrieve it from pipelineModel
+ try {
+ portValue = ImmutableByteSequence.fit(portValue, PORT_NUMBER_BIT_WIDTH);
+ } catch (ImmutableByteSequence.ByteSequenceTrimException e) {
+ throw new PiInterpreterException("Port number too big: {}" +
+ portNumber + " causes " + e.getMessage());
+ }
+ return PiPacketMetadata.builder()
+ .withId(PiPacketMetadataId.of(EGRESS_PORT))
+ .withValue(portValue)
+ .build();
+ }
+
+ /**
+ * Returns an action instance with no runtime parameters.
+ */
+ private PiAction actionWithName(String name) {
+ return PiAction.builder().withId(PiActionId.of(name)).build();
+ }
+
+ @Override
+ public Optional<PiHeaderFieldId> mapCriterionType(Criterion.Type type) {
+ return Optional.ofNullable(CRITERION_MAP.get(type));
+ }
+
+ @Override
+ public Optional<Criterion.Type> mapPiHeaderFieldId(PiHeaderFieldId headerFieldId) {
+ return Optional.ofNullable(CRITERION_MAP.inverse().get(headerFieldId));
+ }
+
+ @Override
+ public Optional<PiTableId> mapFlowRuleTableId(int flowRuleTableId) {
+ return Optional.ofNullable(TABLE_MAP.get(flowRuleTableId));
+ }
+
+ @Override
+ public Optional<Integer> mapPiTableId(PiTableId piTableId) {
+ return Optional.ofNullable(TABLE_MAP.inverse().get(piTableId));
+ }
+}
diff --git a/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/TofinoDefaultPipeconfFactory.java b/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/TofinoDefaultPipeconfFactory.java
new file mode 100644
index 0000000..0de3adc
--- /dev/null
+++ b/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/TofinoDefaultPipeconfFactory.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.drivers.barefoot;
+
+import org.onosproject.bmv2.model.Bmv2PipelineModelParser;
+import org.onosproject.driver.pipeline.DefaultSingleTablePipeline;
+import org.onosproject.net.behaviour.Pipeliner;
+import org.onosproject.net.pi.model.DefaultPiPipeconf;
+import org.onosproject.net.pi.model.PiPipeconf;
+import org.onosproject.net.pi.model.PiPipeconfId;
+import org.onosproject.net.pi.model.PiPipelineInterpreter;
+
+import java.net.URL;
+
+import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.BMV2_JSON;
+import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.TOFINO_CONTEXT_JSON;
+import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.P4_INFO_TEXT;
+import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.TOFINO_BIN;
+
+/**
+ * Factory of pipeconf implementation for the default.p4 program on Tofino.
+ */
+final class TofinoDefaultPipeconfFactory {
+
+ private static final String PIPECONF_ID = "tofino-default-pipeconf";
+ private static final String JSON_PATH = "/default.json";
+ private static final String CONTEXT_JSON_PATH = "/context.json";
+ private static final String TOFINO_PATH = "/tofino.bin";
+ private static final String P4INFO_PATH = "/default.p4info";
+
+ private static final PiPipeconf PIPECONF = buildPipeconf();
+
+ private TofinoDefaultPipeconfFactory() {
+ // Hides constructor.
+ }
+
+ static PiPipeconf get() {
+ return PIPECONF;
+ }
+
+ private static PiPipeconf buildPipeconf() {
+
+ final URL jsonUrl = TofinoDefaultPipeconfFactory.class.getResource(JSON_PATH);
+ final URL p4InfoUrl = TofinoDefaultPipeconfFactory.class.getResource(P4INFO_PATH);
+ final URL tofinoUrl = TofinoDefaultPipeconfFactory.class.getResource(TOFINO_PATH);
+ final URL contextUrl = TofinoDefaultPipeconfFactory.class.getResource(CONTEXT_JSON_PATH);
+
+ return DefaultPiPipeconf.builder()
+ .withId(new PiPipeconfId(PIPECONF_ID))
+ .withPipelineModel(Bmv2PipelineModelParser.parse(jsonUrl))
+ .addBehaviour(PiPipelineInterpreter.class, TofinoDefaultInterpreter.class)
+ .addBehaviour(Pipeliner.class, DefaultSingleTablePipeline.class)
+ .addExtension(P4_INFO_TEXT, p4InfoUrl)
+ .addExtension(BMV2_JSON, jsonUrl)
+ .addExtension(TOFINO_BIN, tofinoUrl)
+ .addExtension(TOFINO_CONTEXT_JSON, contextUrl)
+ .build();
+ }
+}
diff --git a/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/TofinoPipelineProgrammable.java b/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/TofinoPipelineProgrammable.java
new file mode 100644
index 0000000..3397254
--- /dev/null
+++ b/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/TofinoPipelineProgrammable.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.drivers.barefoot;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import org.apache.commons.io.IOUtils;
+import org.onlab.util.SharedExecutors;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.driver.AbstractHandlerBehaviour;
+import org.onosproject.net.pi.model.PiPipeconf;
+import org.onosproject.net.pi.model.PiPipeconf.ExtensionType;
+import org.onosproject.net.pi.model.PiPipelineProgrammable;
+import org.onosproject.p4runtime.api.P4RuntimeClient;
+import org.onosproject.p4runtime.api.P4RuntimeController;
+import org.slf4j.Logger;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Implementation of the PiPipelineProgrammable for BMv2.
+ */
+public class TofinoPipelineProgrammable extends AbstractHandlerBehaviour implements PiPipelineProgrammable {
+
+ private static final PiPipeconf DEFAULT_PIPECONF = TofinoDefaultPipeconfFactory.get();
+
+ private final Logger log = getLogger(getClass());
+
+ @Override
+ public CompletableFuture<Boolean> deployPipeconf(PiPipeconf pipeconf) {
+
+ CompletableFuture<Boolean> result = new CompletableFuture<>();
+
+ SharedExecutors.getPoolThreadExecutor().submit(() -> result.complete(doDeployConfig(pipeconf)));
+
+ return result;
+ }
+
+ private boolean doDeployConfig(PiPipeconf pipeconf) {
+
+ P4RuntimeController controller = handler().get(P4RuntimeController.class);
+
+ DeviceId deviceId = handler().data().deviceId();
+
+ if (!controller.hasClient(deviceId)) {
+ log.warn("Unable to find client for {}, aborting pipeconf deploy", deviceId);
+ return false;
+
+ }
+
+ P4RuntimeClient client = controller.getClient(deviceId);
+
+ //creating the ByteBuffer with all the needed elements to set the pipeline on the device
+ ByteBuffer pipelineBuffer = createPipelineBuffer(pipeconf,
+ ImmutableList.of(ExtensionType.TOFINO_BIN, ExtensionType.TOFINO_CONTEXT_JSON));
+
+ try {
+ if (!client.setPipelineConfig(pipeconf, pipelineBuffer).get()) {
+ log.warn("Unable to deploy pipeconf {} to {}", pipeconf.id(), deviceId);
+ return false;
+ }
+
+ // It would be more logical to have this performed at device handshake, but P4runtime would reject any
+ // command if a P4info has not been set first.
+ if (!client.initStreamChannel().get()) {
+ log.warn("Unable to init stream channel to {}.", deviceId);
+ return false;
+ }
+
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+
+ return true;
+ }
+
+ private ByteBuffer createPipelineBuffer(PiPipeconf pipeconf, List<ExtensionType> targetConfigExtTypes) {
+ if (targetConfigExtTypes == null || targetConfigExtTypes.isEmpty() || isNullOrEmpty(pipeconf.id().toString())) {
+
+ log.warn("Not enough information to deploy the Pipeconf {} on the switch {}, {}", pipeconf.id(),
+ targetConfigExtTypes);
+ } else {
+ List<ByteBuffer> buffers = Lists.newLinkedList();
+ //Name of the pipeconf.
+ //Appears to be an arbitrary name and unrelated to p4 program
+ String name = pipeconf.id().toString();
+ buffers.add(ByteBuffer.allocate(4 + name.length())
+ .order(ByteOrder.LITTLE_ENDIAN)
+ .putInt(name.length())
+ .put(name.getBytes(StandardCharsets.UTF_8)));
+
+ // Build buffers for all the extensions needed to deploy the pipeconf to Tofino
+ targetConfigExtTypes.forEach(targetConfigExtType -> {
+ if (!pipeconf.extension(targetConfigExtType).isPresent()) {
+ // FIXME this will break the expected data format; the resulting buffer will be invalid.
+ // FIXME Consider a stronger response here, like an exception.
+ log.warn("Missing extension {} in pipeconf {}", targetConfigExtType, pipeconf.id());
+ }
+ InputStream targetConfig = pipeconf.extension(targetConfigExtType).get();
+ try {
+ log.info("Setting extension {} in pipeconf {}", targetConfigExtType, pipeconf.id());
+ byte[] bin = IOUtils.toByteArray(targetConfig);
+ //length and byte of every extension
+ buffers.add(ByteBuffer.allocate(4 + bin.length)
+ .order(ByteOrder.LITTLE_ENDIAN)
+ .putInt(bin.length)
+ .put(bin));
+ } catch (IOException ex) {
+ // FIXME this will break the expected data format; the resulting buffer will be invalid.
+ // FIXME Consider a stronger response here, like an exception.
+ log.warn("Unable to load target-specific config for {}", ex.getMessage());
+ }
+ });
+
+ // Merge the buffers
+ int len = buffers.stream().mapToInt(Buffer::limit).sum();
+ ByteBuffer deviceData = ByteBuffer.allocate(len);
+ for (ByteBuffer b : buffers) {
+ deviceData.put((ByteBuffer) b.flip());
+ }
+ deviceData.flip(); // prepare for reading
+ return deviceData.asReadOnlyBuffer();
+ }
+ return null;
+ }
+
+ @Override
+ public Optional<PiPipeconf> getDefaultPipeconf() {
+ return Optional.of(DEFAULT_PIPECONF);
+ }
+}
diff --git a/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/package-info.java b/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/package-info.java
new file mode 100644
index 0000000..e2302b1
--- /dev/null
+++ b/drivers/barefoot/src/main/java/org/onosproject/drivers/barefoot/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Package for barefoot device drivers.
+ */
+package org.onosproject.drivers.barefoot;
\ No newline at end of file