added FlowObjectiveService to act as an objective manager between applications and drivers
Change-Id: I4dc44db8bafae8a55b7663895c87b1b08645637f
diff --git a/drivers/pom.xml b/drivers/pom.xml
index a4db521..8538f4a 100644
--- a/drivers/pom.xml
+++ b/drivers/pom.xml
@@ -49,12 +49,21 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr.annotations</artifactId>
+ </dependency>
+
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
diff --git a/drivers/src/main/java/org/onosproject/driver/pipeline/DefaultDrivers.java b/drivers/src/main/java/org/onosproject/driver/pipeline/DefaultDrivers.java
new file mode 100644
index 0000000..e42e346
--- /dev/null
+++ b/drivers/src/main/java/org/onosproject/driver/pipeline/DefaultDrivers.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onosproject.net.driver.DriverAdminService;
+import org.onosproject.net.driver.DriverProvider;
+import org.onosproject.net.driver.XmlDriverLoader;
+import org.apache.felix.scr.annotations.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+/**
+ * Bootstrap for built in drivers.
+ */
+@Component(immediate = true)
+public class DefaultDrivers {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected DriverAdminService driverService;
+
+ private DriverProvider provider;
+
+ @Activate
+ protected void activate() {
+ XmlDriverLoader xmlDriverLoader =
+ new XmlDriverLoader(getClass().getClassLoader());
+ try {
+ provider = xmlDriverLoader.loadDrivers(
+ getClass().getResourceAsStream("/default.xml"));
+ driverService.registerProvider(
+ provider);
+ } catch (IOException e) {
+ log.warn("Unable to load drivers");
+ }
+
+ log.info("Started");
+ }
+
+ @Deactivate
+ protected void deactivate() {
+ driverService.unregisterProvider(provider);
+ log.info("Stopped");
+ }
+
+
+}
diff --git a/drivers/src/main/java/org/onosproject/driver/pipeline/DefaultSingleTablePipeline.java b/drivers/src/main/java/org/onosproject/driver/pipeline/DefaultSingleTablePipeline.java
index 8516697..48114ab 100644
--- a/drivers/src/main/java/org/onosproject/driver/pipeline/DefaultSingleTablePipeline.java
+++ b/drivers/src/main/java/org/onosproject/driver/pipeline/DefaultSingleTablePipeline.java
@@ -20,6 +20,7 @@
import org.onosproject.core.DefaultGroupId;
import org.onosproject.net.DeviceId;
import org.onosproject.net.behaviour.Pipeliner;
+import org.onosproject.net.driver.DriverData;
import org.onosproject.net.flow.DefaultFlowRule;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.FlowRuleOperations;
@@ -28,6 +29,7 @@
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flowobjective.FilteringObjective;
import org.onosproject.net.flowobjective.ForwardingObjective;
+import org.onosproject.net.flowobjective.NextObjective;
import org.slf4j.Logger;
import java.util.Collection;
@@ -106,4 +108,14 @@
}));
return future;
}
+
+ @Override
+ public Future<Boolean> next(Collection<NextObjective> nextObjectives) {
+ throw new UnsupportedOperationException("Single table does not next hop.");
+ }
+
+ @Override
+ public void setData(DriverData data) {
+
+ }
}
diff --git a/drivers/src/main/resources/default.xml b/drivers/src/main/resources/default.xml
new file mode 100644
index 0000000..6626412
--- /dev/null
+++ b/drivers/src/main/resources/default.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<drivers>
+ <driver name="default" manufacturer="ON.Lab" hwVersion="0.0.1" swVersion="0.0.1">
+ <behaviour api="org.onosproject.net.behaviour.Pipeliner"
+ impl="org.onosproject.driver.pipeline.DefaultSingleTablePipeline"/>
+ </driver>
+</drivers>
\ No newline at end of file