Initial sketch and implementaion of Objectives.

These objective will be used to provide a layer of abstraction
that isolates applications for device pipeline details.

initial objective support

Change-Id: I019302822421f0fe1f508f2f7527d91578e30116

initial implemetation of a simple pipeline behaviour

Change-Id: Id0d9167896c717d05cda90e1524fc24c76e9fc9b

initial implementation of objectives

Change-Id: I768fa2020308d5feb95eaaff355aa511b323beca
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java b/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java
index 9867622..9ff808a 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java
@@ -25,6 +25,12 @@
     public final IpAddress ip;
     public final int tcpPort;
 
+    /**
+     * Information for contacting the controller.
+     *
+     * @param ip the ip address
+     * @param tcpPort the tcp port
+     */
     public ControllerInfo(IpAddress ip, int tcpPort) {
         this.ip = ip;
         this.tcpPort = tcpPort;
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/Pipeliner.java b/core/api/src/main/java/org/onosproject/net/behaviour/Pipeliner.java
new file mode 100644
index 0000000..6d35adf
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/Pipeliner.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.net.behaviour;
+
+import org.onlab.osgi.ServiceDirectory;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.flowobjective.FilteringObjective;
+import org.onosproject.net.flowobjective.ForwardingObjective;
+
+import java.util.Collection;
+import java.util.concurrent.Future;
+
+/**
+ * Behaviour for handling various pipelines.
+ */
+public interface Pipeliner {
+
+    /**
+     * Injecting the service directory into the driver.
+     *
+     * @param deviceId the deviceId
+     * @param serviceDirectory the service directory.
+     */
+    void init(DeviceId deviceId, ServiceDirectory serviceDirectory);
+
+    /**
+     * Installs the filtering rules onto the device.
+     *
+     * @param filters the collection of filters
+     * @return a future indicating the success of the operation
+     */
+     Future<Boolean> filter(Collection<FilteringObjective> filters);
+
+    /**
+     * Installs the forwarding rules onto the device.
+     *
+     * @param forwardings the collection of forwarding objectives
+     * @return a future indicating the success of the operation
+     */
+    Future<Boolean> forward(Collection<ForwardingObjective> forwardings);
+
+}
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java
new file mode 100644
index 0000000..4c1b71f
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.net.flowobjective;
+
+import com.google.common.collect.ImmutableList;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.flow.criteria.Criterion;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Default implementation of a filtering objective.
+ */
+public final class DefaultFilteringObjective implements FilteringObjective {
+
+
+    private final Criterion key;
+    private final boolean permanent;
+    private final int timeout;
+    private final ApplicationId appId;
+    private final int priority;
+    private final List<Criterion> conditions;
+    private final int id;
+    private final Operation op;
+
+    private DefaultFilteringObjective(Criterion key, boolean permanent, int timeout,
+                                      ApplicationId appId, int priority,
+                                      List<Criterion> conditions, Operation op) {
+        this.key = key;
+        this.permanent = permanent;
+        this.timeout = timeout;
+        this.appId = appId;
+        this.priority = priority;
+        this.conditions = conditions;
+        this.op = op;
+
+        this.id = Objects.hash(key, conditions, permanent,
+                               timeout, appId, priority);
+    }
+
+
+    @Override
+    public Criterion key() {
+        return key;
+    }
+
+    @Override
+    public Collection<Criterion> conditions() {
+        return conditions;
+    }
+
+    @Override
+    public int id() {
+        return id;
+    }
+
+    @Override
+    public int priority() {
+        return priority;
+    }
+
+    @Override
+    public ApplicationId appId() {
+        return appId;
+    }
+
+    @Override
+    public int timeout() {
+        return timeout;
+    }
+
+    @Override
+    public boolean permanent() {
+        return permanent;
+    }
+
+    @Override
+    public Operation op() {
+        return op;
+    }
+
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+
+    public static final class Builder implements FilteringObjective.Builder {
+        private final ImmutableList.Builder<Criterion> listBuilder
+                = ImmutableList.builder();
+
+        private Criterion key;
+        private boolean permanent = DEFAULT_PERMANENT;
+        private int timeout = DEFAULT_TIMEOUT;
+        private ApplicationId appId;
+        private int priority = DEFAULT_PRIORITY;
+
+        @Override
+        public Builder addCondition(Criterion criterion) {
+            listBuilder.add(criterion);
+            return this;
+        }
+
+        @Override
+        public Builder withKey(Criterion criterion) {
+            key = criterion;
+            return this;
+        }
+
+        @Override
+        public Builder makeTemporary(int timeout) {
+            this.timeout = timeout;
+            permanent = false;
+            return this;
+        }
+
+        @Override
+        public Builder makePermanent() {
+            permanent = true;
+            return this;
+        }
+
+        @Override
+        public Builder fromApp(ApplicationId appId) {
+            this.appId = appId;
+            return this;
+        }
+
+        @Override
+        public Builder withPriority(int priority) {
+            this.priority = priority;
+            return this;
+        }
+
+        @Override
+        public FilteringObjective add() {
+            List<Criterion> conditions = listBuilder.build();
+            checkNotNull(key, "Must have a key.");
+            checkArgument(!conditions.isEmpty(), "Must have at least one condition.");
+            checkNotNull(appId, "Must supply an application id");
+
+            return new DefaultFilteringObjective(key, permanent, timeout,
+                                                appId, priority, conditions,
+                                                Operation.ADD);
+
+        }
+
+        @Override
+        public FilteringObjective remove() {
+            List<Criterion> conditions = listBuilder.build();
+            checkNotNull(key, "Must have a key.");
+            checkArgument(!conditions.isEmpty(), "Must have at least one condition.");
+            checkNotNull(appId, "Must supply an application id");
+
+            return new DefaultFilteringObjective(key, permanent, timeout,
+                                                 appId, priority, conditions,
+                                                 Operation.REMOVE);
+
+        }
+
+
+    }
+
+}
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java
new file mode 100644
index 0000000..d110e07
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.net.flowobjective;
+
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.flow.TrafficTreatment;
+
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Default implementation of a forwarding objective.
+ */
+public final class DefaultForwardingObjective implements ForwardingObjective {
+
+    private final TrafficSelector selector;
+    private final Flag flag;
+    private final boolean permanent;
+    private final int timeout;
+    private final ApplicationId appId;
+    private final int priority;
+    private final int nextId;
+    private final TrafficTreatment treatment;
+    private final Operation op;
+
+    private final int id;
+
+    private DefaultForwardingObjective(TrafficSelector selector,
+                                      Flag flag, boolean permanent,
+                                      int timeout, ApplicationId appId,
+                                      int priority, int nextId,
+                                      TrafficTreatment treatment, Operation op) {
+        this.selector = selector;
+        this.flag = flag;
+        this.permanent = permanent;
+        this.timeout = timeout;
+        this.appId = appId;
+        this.priority = priority;
+        this.nextId = nextId;
+        this.treatment = treatment;
+        this.op = op;
+
+        this.id = Objects.hash(selector, flag, permanent,
+                               timeout, appId, priority, nextId,
+                               treatment, op);
+    }
+
+
+    @Override
+    public TrafficSelector selector() {
+        return selector;
+    }
+
+    @Override
+    public Integer nextId() {
+        return nextId;
+    }
+
+    @Override
+    public TrafficTreatment treatment() {
+        return treatment;
+    }
+
+
+    @Override
+    public Flag flag() {
+        return flag;
+    }
+
+    @Override
+    public int id() {
+        return id;
+    }
+
+    @Override
+    public int priority() {
+        return priority;
+    }
+
+    @Override
+    public ApplicationId appId() {
+        return appId;
+    }
+
+    @Override
+    public int timeout() {
+        return timeout;
+    }
+
+    @Override
+    public boolean permanent() {
+        return permanent;
+    }
+
+    @Override
+    public Operation op() {
+        return op;
+    }
+
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    public static final class Builder implements ForwardingObjective.Builder {
+
+        private TrafficSelector selector;
+        private Flag flag;
+        private boolean permanent = DEFAULT_PERMANENT;
+        private int timeout = DEFAULT_TIMEOUT;
+        private int priority = DEFAULT_PRIORITY;
+        private ApplicationId appId;
+        private Integer nextId;
+        private TrafficTreatment treatment;
+
+        @Override
+        public Builder withSelector(TrafficSelector selector) {
+            this.selector = selector;
+            return this;
+        }
+
+        @Override
+        public Builder nextStep(int nextId) {
+            this.nextId = nextId;
+            return this;
+        }
+
+        @Override
+        public Builder withTreatment(TrafficTreatment treatment) {
+            this.treatment = treatment;
+            return this;
+        }
+
+        @Override
+        public Builder withFlag(Flag flag) {
+            this.flag = flag;
+            return this;
+        }
+
+        @Override
+        public Builder makeTemporary(int timeout) {
+            this.timeout = timeout;
+            this.permanent = false;
+            return this;
+        }
+
+        @Override
+        public Builder makePermanent() {
+            this.permanent = true;
+            return this;
+        }
+
+        @Override
+        public Builder fromApp(ApplicationId appId) {
+            this.appId = appId;
+            return this;
+        }
+
+        @Override
+        public Builder withPriority(int priority) {
+            this.priority = priority;
+            return this;
+        }
+
+        @Override
+        public ForwardingObjective add() {
+            checkNotNull(selector, "Must have a selector");
+            checkNotNull(flag, "A flag must be set");
+            checkArgument(nextId != null && treatment != null, "Must supply at " +
+                    "least a treatment and/or a nextId");
+            checkNotNull(appId, "Must supply an application id");
+            return new DefaultForwardingObjective(selector, flag, permanent,
+                                                  timeout, appId, priority,
+                                                  nextId, treatment, Operation.ADD);
+        }
+
+        @Override
+        public ForwardingObjective remove() {
+            checkNotNull(selector, "Must have a selector");
+            checkNotNull(flag, "A flag must be set");
+            checkArgument(nextId != null && treatment != null, "Must supply at " +
+                    "least a treatment and/or a nextId");
+            checkNotNull(appId, "Must supply an application id");
+            return new DefaultForwardingObjective(selector, flag, permanent,
+                                                   timeout, appId, priority,
+                                                   nextId, treatment, Operation.REMOVE);
+        }
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java
new file mode 100644
index 0000000..4ab79ff
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.net.flowobjective;
+
+import com.google.common.collect.ImmutableList;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.flow.TrafficTreatment;
+
+import java.util.Collection;
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Default implementation of a next objective.
+ */
+public final class DefaultNextObjective implements NextObjective {
+
+    private final List<TrafficTreatment> treatments;
+    private final ApplicationId appId;
+    private final Type type;
+    private final Integer id;
+
+    private DefaultNextObjective(Integer id, List<TrafficTreatment> treatments,
+                                ApplicationId appId, Type type) {
+        this.treatments = treatments;
+        this.appId = appId;
+        this.type = type;
+        this.id = id;
+    }
+
+    @Override
+    public Collection<TrafficTreatment> next() {
+        return treatments;
+    }
+
+    @Override
+    public Type type() {
+        return type;
+    }
+
+    @Override
+    public int id() {
+        return id;
+    }
+
+    @Override
+    public int priority() {
+        return 0;
+    }
+
+    @Override
+    public ApplicationId appId() {
+        return appId;
+    }
+
+    @Override
+    public int timeout() {
+        return 0;
+    }
+
+    @Override
+    public boolean permanent() {
+        return false;
+    }
+
+    @Override
+    public Operation op() {
+        throw new UnsupportedOperationException("Next Objective has no operation");
+    }
+
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    public static final class Builder implements NextObjective.Builder {
+
+        private ApplicationId appId;
+        private Type type;
+        private Integer id;
+
+        private final ImmutableList.Builder<TrafficTreatment> listBuilder
+                = ImmutableList.builder();
+
+
+
+        @Override
+        public NextObjective.Builder withId(int nextId) {
+            this.id = nextId;
+            return this;
+        }
+
+        @Override
+        public Builder withType(Type type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public Builder addTreatment(TrafficTreatment treatment) {
+            listBuilder.add(treatment);
+            return this;
+        }
+
+        /**
+         * Noop. This method has no effect.
+         *
+         * @param timeout a timeout
+         * @return a next objective builder
+         */
+        @Override
+        public Builder makeTemporary(int timeout) {
+            return this;
+        }
+
+        /**
+         * Noop. This method has no effect.
+         *
+         * @return a next objective builder
+         */
+        @Override
+        public Builder makePermanent() {
+            return this;
+        }
+
+        @Override
+        public Builder fromApp(ApplicationId appId) {
+            this.appId = appId;
+            return this;
+        }
+
+        /**
+         * Noop. This method has no effect.
+         *
+         * @param priority an integer
+         * @return a next objective builder
+         */
+        @Override
+        public Builder withPriority(int priority) {
+            return this;
+        }
+
+        @Override
+        public NextObjective build() {
+            List<TrafficTreatment> treatments = listBuilder.build();
+            checkNotNull(appId, "Must supply an application id");
+            checkNotNull(id, "id cannot be null");
+            checkNotNull(type, "The type cannot be null");
+            checkArgument(!treatments.isEmpty(), "Must have at least one treatment");
+
+            return new DefaultNextObjective(id, treatments, appId, type);
+        }
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java
new file mode 100644
index 0000000..93f62ac9
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.net.flowobjective;
+
+import org.onosproject.net.flow.criteria.Criterion;
+
+import java.util.Collection;
+
+/**
+ * Represents a filtering flow objective. Each filter is mapping
+ * from a criterion to a collection of criteria. The mapping will
+ * be used by a device driver to construct the actual flow rules to
+ * be installed on the device.
+ */
+public interface FilteringObjective extends Objective {
+
+    /**
+     * Represents filtering key used in this filter.
+     *
+     * @return a criterion
+     */
+    Criterion key();
+
+    /**
+     * The set of conditions the filter must provision at the device.
+     *
+     * @return a collection of criteria
+     */
+    Collection<Criterion> conditions();
+
+    /**
+     * Builder of Filtering objective entities.
+     */
+    public interface Builder extends Objective.Builder {
+
+        /**
+         * Add a filtering condition.
+         *
+         * @param criterion new criterion
+         * @return a filtering builder
+         */
+        public Builder addCondition(Criterion criterion);
+
+        /**
+         * Add a filtering key.
+         *
+         * @param criterion new criterion
+         * @return a filtering builder.
+         */
+        public Builder withKey(Criterion criterion);
+
+        /**
+         * Builds the filtering objective that will be added.
+         *
+         * @return a filtering objective
+         */
+        public FilteringObjective add();
+
+        /**
+         * Builds the filtering objective that will be removed.
+         *
+         * @return a filtering objective.
+         */
+        public FilteringObjective remove();
+
+
+    }
+
+}
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/ForwardingObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/ForwardingObjective.java
new file mode 100644
index 0000000..4fecc54
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/ForwardingObjective.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.net.flowobjective;
+
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.flow.TrafficTreatment;
+
+/**
+ * Represents a description of which types of traffic need to
+ * be forwarded through the device. A forwarding objective may
+ * in multiple rules at the device.
+ */
+public interface ForwardingObjective extends Objective {
+
+    /**
+     * Represents whether this objective is monolithic or
+     * may be broken down into parts.
+     */
+    enum Flag {
+        /**
+         * A decomposable objective.
+         */
+        SPECIFIC,
+
+        /**
+         * A monolithic objective.
+         */
+        VERSATILE
+    }
+
+    /**
+     * Obtain the selector for this objective.
+     *
+     * @return a traffic selector
+     */
+    TrafficSelector selector();
+
+    /**
+     * Obtain the traffic treatment for this objective. Mutually exclusive with
+     * 'treatment'.
+     *
+     * @return an integer
+     */
+    Integer nextId();
+
+    /**
+     * A traffic treatment for this forwarding objective. Mutually exclusive
+     * with a nextId.
+     *
+     * @return a traffic treatment
+     */
+    TrafficTreatment treatment();
+
+    /**
+     * Obtain the type of this objective.
+     *
+     * @return a flag type
+     */
+    Flag flag();
+
+    /**
+     * A forwarding objective builder.
+     */
+    public interface Builder extends Objective.Builder {
+
+        /**
+         * Assigns a selector to the forwarding objective.
+         *
+         * @param selector a traffic selector
+         * @return a forwarding objective builder
+         */
+        public Builder withSelector(TrafficSelector selector);
+
+        /**
+         * Assigns a next step to the forwarding objective.
+         *
+         * @param nextId a next objective id.
+         * @return a forwarding objective builder
+         */
+        public Builder nextStep(int nextId);
+
+        /**
+         * Assigns the treatment for this forwarding objective.
+         *
+         * @param treatment a traffic treatment
+         * @return a forwarding objective
+         */
+        public Builder withTreatment(TrafficTreatment treatment);
+
+        /**
+         * Assigns the flag to the forwarding objective.
+         *
+         * @param flag a flag
+         * @return a forwarding objective builder
+         */
+        public Builder withFlag(Flag flag);
+
+        /**
+         * Builds the forwarding objective that will be added.
+         *
+         * @return a forwarding objective
+         */
+        public ForwardingObjective add();
+
+        /**
+         * Builds the forwarding objective that will be removed.
+         *
+         * @return a forwarding objective.
+         */
+        public ForwardingObjective remove();
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/NextObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/NextObjective.java
new file mode 100644
index 0000000..52e79ee
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/NextObjective.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.net.flowobjective;
+
+import org.onosproject.net.flow.TrafficTreatment;
+
+import java.util.Collection;
+
+/**
+ * Represents a nexthop which will be translated by a driver
+ * into the appropriate group or actions needed to implement
+ * the function.
+ */
+public interface NextObjective extends Objective {
+
+    /**
+     * Represents the type of next phase to build.
+     */
+    enum Type {
+        /**
+         * A hashed packet processing.
+         */
+        HASHED,
+
+        /**
+         * Broadcast packet process.
+         */
+        BROADCAST,
+
+        /**
+         * Failover handling.
+         */
+        FAILOVER,
+
+        /**
+         * Simple processing. Could be a group or a treatment.
+         */
+        SIMPLE
+    }
+
+    /**
+     * The collection of treatments that need to be applied to a set of traffic.
+     *
+     * @return a collection of traffic treatments
+     */
+    Collection<TrafficTreatment> next();
+
+    /**
+     * The type of operation that will be applied to the traffic using the collection
+     * of treatments.
+     *
+     * @return a type
+     */
+    Type type();
+
+    /**
+     * A next step builder.
+     */
+    public interface Builder extends Objective.Builder {
+
+        /**
+         * Specifies the id for this next objective.
+         *
+         * @param nextId an integer
+         * @return a next objective builder
+         */
+        public Builder withId(int nextId);
+
+        /**
+         * Sets the type of next step.
+         *
+         * @param type a type
+         * @return a next step builder
+         */
+        public Builder withType(Type type);
+
+        /**
+         * Adds a treatment to this next step.
+         *
+         * @param treatment a traffic treatment
+         * @return a next step builder
+         */
+        public Builder addTreatment(TrafficTreatment treatment);
+
+        /**
+         * Builds a next step.
+         *
+         * @return a next step
+         */
+        public NextObjective build();
+
+    }
+
+}
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/Objective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/Objective.java
new file mode 100644
index 0000000..3971b03
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/Objective.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.net.flowobjective;
+
+import org.onosproject.core.ApplicationId;
+
+/**
+ * Base representation of an flow description.
+ */
+public interface Objective {
+
+    static final boolean DEFAULT_PERMANENT = true;
+    static final int DEFAULT_TIMEOUT = 0;
+    static final int DEFAULT_PRIORITY = 32768;
+
+    /**
+     * Type of operation.
+     */
+    enum Operation {
+        /**
+         * Adds the objective.
+         */
+        ADD,
+
+        /**
+         * Removes the objective.
+         */
+        REMOVE
+    }
+
+    /**
+     * An identifier for this objective.
+     *
+     * @return an integer
+     */
+    int id();
+
+    /**
+     * The priority for this objective.
+     *
+     * @return an integer
+     */
+    int priority();
+
+    /**
+     * The application which applied this objective.
+     *
+     * @return an application id
+     */
+    ApplicationId appId();
+
+    /**
+     * The timeout for this objective.
+     *
+     * @return an integer
+     */
+    int timeout();
+
+    /**
+     * Whether this objective is permanent.
+     *
+     * @return a boolean
+     */
+    boolean permanent();
+
+    /**
+     * The type of operation for this objective.
+     *
+     * @return an operation
+     */
+    Operation op();
+
+    /**
+     * An objective builder.
+     */
+    public interface Builder {
+        /**
+         * Makes the filtering objective temporary.
+         *
+         * @param timeout a timeout
+         * @return an objective builder
+         */
+        public Builder makeTemporary(int timeout);
+
+        /**
+         * Makes the filtering objective permanent.
+         *
+         * @return an objective builder
+         */
+        public Builder makePermanent();
+
+        /**
+         * Specifies the application which applied the filter.
+         *
+         * @param appId an application id
+         * @return an objective builder
+         */
+        public Builder fromApp(ApplicationId appId);
+
+        /**
+         * Sets the priority for this objective.
+         *
+         * @param priority an integer
+         * @return an objective builder
+         */
+        public Builder withPriority(int priority);
+    }
+
+}
diff --git a/drivers/pom.xml b/drivers/pom.xml
new file mode 100644
index 0000000..a4db521
--- /dev/null
+++ b/drivers/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2014 Open Networking Laboratory
+  ~
+  ~ 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos</artifactId>
+        <version>1.2.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-drivers</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>ONOS Default Device Drivers</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+
+        </plugins>
+    </build>
+</project>
diff --git a/drivers/src/main/java/org/onosproject/driver/pipeline/DefaultSingleTablePipeline.java b/drivers/src/main/java/org/onosproject/driver/pipeline/DefaultSingleTablePipeline.java
new file mode 100644
index 0000000..8516697
--- /dev/null
+++ b/drivers/src/main/java/org/onosproject/driver/pipeline/DefaultSingleTablePipeline.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.driver.pipeline;
+
+import com.google.common.util.concurrent.SettableFuture;
+import org.onlab.osgi.ServiceDirectory;
+import org.onosproject.core.DefaultGroupId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.behaviour.Pipeliner;
+import org.onosproject.net.flow.DefaultFlowRule;
+import org.onosproject.net.flow.FlowRule;
+import org.onosproject.net.flow.FlowRuleOperations;
+import org.onosproject.net.flow.FlowRuleOperationsContext;
+import org.onosproject.net.flow.FlowRuleService;
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.flowobjective.FilteringObjective;
+import org.onosproject.net.flowobjective.ForwardingObjective;
+import org.slf4j.Logger;
+
+import java.util.Collection;
+import java.util.concurrent.Future;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Simple single table pipeline abstraction.
+ */
+public class DefaultSingleTablePipeline implements Pipeliner {
+
+    private final Logger log = getLogger(getClass());
+
+    private ServiceDirectory serviceDirectory;
+    private FlowRuleService flowRuleService;
+    private DeviceId deviceId;
+
+    @Override
+    public void init(DeviceId deviceId, ServiceDirectory serviceDirectory) {
+        this.serviceDirectory = serviceDirectory;
+        this.deviceId = deviceId;
+
+        flowRuleService = serviceDirectory.get(FlowRuleService.class);
+
+    }
+
+    @Override
+    public Future<Boolean> filter(Collection<FilteringObjective> filters) {
+        throw new UnsupportedOperationException("Single table does not filter.");
+    }
+
+    @Override
+    public Future<Boolean> forward(Collection<ForwardingObjective> forwardings) {
+        FlowRuleOperations.Builder flowBuilder = FlowRuleOperations.builder();
+        forwardings.forEach(fwd -> {
+            if (fwd.flag() != ForwardingObjective.Flag.VERSATILE) {
+                throw new UnsupportedOperationException(
+                        "Only VERSATILE is supported.");
+            }
+
+            TrafficSelector selector = fwd.selector();
+
+            FlowRule rule = new DefaultFlowRule(deviceId, selector,
+                                                fwd.treatment(),
+                                                fwd.priority(), fwd.appId(),
+                                                new DefaultGroupId(fwd.id()),
+                                                fwd.timeout(), fwd.permanent());
+
+            switch (fwd.op()) {
+
+                case ADD:
+                    flowBuilder.add(rule);
+                    break;
+                case REMOVE:
+                    flowBuilder.remove(rule);
+                    break;
+                default:
+                log.warn("Unknown operation {}", fwd.op());
+            }
+
+        });
+
+        SettableFuture<Boolean> future = SettableFuture.create();
+
+        flowRuleService.apply(flowBuilder.build(new FlowRuleOperationsContext() {
+            @Override
+            public void onSuccess(FlowRuleOperations ops) {
+                future.set(true);
+            }
+
+            @Override
+            public void onError(FlowRuleOperations ops) {
+                future.set(false);
+            }
+        }));
+        return future;
+    }
+}
diff --git a/pom.xml b/pom.xml
index 6594c4e..7316ac8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,6 +44,7 @@
         <module>web</module>
         <module>cli</module>
         <module>providers</module>
+        <module>drivers</module>
         <module>openflow</module>
         <module>apps</module>
         <module>features</module>