Moving flow rule test to app-samples repo
git clone https://gerrit.onosproject.org/onos-app-samples
Change-Id: I786fb5795d732b4bea53f50cfe1d137c2df262b8
diff --git a/apps/test/pom.xml b/apps/test/pom.xml
index 2766171..f3b717e 100644
--- a/apps/test/pom.xml
+++ b/apps/test/pom.xml
@@ -36,7 +36,6 @@
<module>intent-perf</module>
<module>messaging-perf</module>
<module>demo</module>
- <module>samples</module>
<module>distributed-primitives</module>
</modules>
diff --git a/apps/test/samples/pom.xml b/apps/test/samples/pom.xml
deleted file mode 100644
index 5446732..0000000
--- a/apps/test/samples/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?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.
- -->
-<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-apps-test</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>onos-app-samples</artifactId>
- <packaging>bundle</packaging>
-
- <description>Flow throughput test application</description>
-
- <properties>
- <onos.app.name>org.onosproject.flowrule</onos.app.name>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.console</artifactId>
- </dependency>
- <!-- Required for javadoc generation -->
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- </dependencies>
-
-
-
-</project>
diff --git a/apps/test/samples/src/main/java/org/onosproject/flowrule/AppTestService.java b/apps/test/samples/src/main/java/org/onosproject/flowrule/AppTestService.java
deleted file mode 100644
index ebe8391..0000000
--- a/apps/test/samples/src/main/java/org/onosproject/flowrule/AppTestService.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.onosproject.flowrule;
-
-/**
- * Applications test service.
- */
-public interface AppTestService {
-
-}
diff --git a/apps/test/samples/src/main/java/org/onosproject/flowrule/dispatch/FlowRuleTest.java b/apps/test/samples/src/main/java/org/onosproject/flowrule/dispatch/FlowRuleTest.java
deleted file mode 100644
index ccfc067..0000000
--- a/apps/test/samples/src/main/java/org/onosproject/flowrule/dispatch/FlowRuleTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.onosproject.flowrule.dispatch;
-
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.device.DeviceService;
-import org.onosproject.net.flow.DefaultFlowRule;
-import org.onosproject.net.flow.FlowRule;
-import org.onosproject.net.flow.FlowRuleExtPayLoad;
-import org.onosproject.net.flow.FlowRuleService;
-import org.slf4j.Logger;
-
-/**
- * third party flow rule test code.
- */
-public class FlowRuleTest {
-
- private final Logger log = getLogger(getClass());
- protected FlowRuleService flowRuleService;
- protected DeviceService deviceService;
- private ApplicationId appId;
- private FlowRule[] flowSet = new DefaultFlowRule[10];
- private DeviceId deviceId;
- private static final String FILE_NAME = "/src/main/resource/org/onosproject/flowrule/resource/flowrule.txt";
-
- /**
- * Creates a flow rule test object.
- * @param flowRuleService service for injecting flow rules into the environment
- * @param deviceService service for interacting with the inventory of infrastructure devices
- * @param appId application identifier
- */
- public FlowRuleTest(FlowRuleService flowRuleService,
- DeviceService deviceService, ApplicationId appId) {
- this.flowRuleService = flowRuleService;
- this.deviceService = deviceService;
- this.deviceId = deviceService.getAvailableDevices().iterator().next().id();
- this.appId = appId;
- loadFile();
- }
-
- private void loadFile() {
- String relativelyPath = System.getProperty("user.dir");
- File flowFile = new File(relativelyPath + FILE_NAME);
- BufferedReader br = null;
- try {
- FileReader in = new FileReader(flowFile);
- br = new BufferedReader(in);
- FlowRule rule = null;
- int i = 0;
- String flow = "";
- while ((flow = br.readLine()) != null) {
- rule = buildFlowRule(flow);
- flowSet[i++] = rule;
- }
- } catch (IOException e) {
- log.info("file does not exist.");
- } finally {
- if (br != null) {
- try {
- br.close();
- } catch (IOException e) {
- log.info("nothing");
- }
- }
- }
- }
-
- private FlowRule buildFlowRule(String flow) {
- FlowRuleExtPayLoad payLoad = FlowRuleExtPayLoad.flowRuleExtPayLoad(flow
- .getBytes());
- FlowRule flowRule = new DefaultFlowRule(deviceId, null, null, 0, appId,
- 0, false, payLoad);
- return flowRule;
- }
-
- /**
- * Apply flow rules to specific devices.
- */
- public void applyFlowRules() {
- flowRuleService.applyFlowRules(flowSet);
- }
-
- /**
- * Remove flow rules from specific devices.
- */
- public void removeFlowRules() {
- flowRuleService.removeFlowRules(flowSet);
- }
-
-}
diff --git a/apps/test/samples/src/main/java/org/onosproject/flowrule/dispatch/package-info.java b/apps/test/samples/src/main/java/org/onosproject/flowrule/dispatch/package-info.java
deleted file mode 100644
index 213dbe9..0000000
--- a/apps/test/samples/src/main/java/org/onosproject/flowrule/dispatch/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2014-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.
- */
-
-/**
- * Provide for specific functional test script. e.g. flow rule subsystem extension.
- * You can create a new class to test other functions.
- */
-package org.onosproject.flowrule.dispatch;
\ No newline at end of file
diff --git a/apps/test/samples/src/main/java/org/onosproject/flowrule/impl/AppTestManager.java b/apps/test/samples/src/main/java/org/onosproject/flowrule/impl/AppTestManager.java
deleted file mode 100644
index 6836a95..0000000
--- a/apps/test/samples/src/main/java/org/onosproject/flowrule/impl/AppTestManager.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.onosproject.flowrule.impl;
-
-import static org.slf4j.LoggerFactory.getLogger;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.apache.felix.scr.annotations.Service;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.flowrule.AppTestService;
-import org.onosproject.flowrule.dispatch.FlowRuleTest;
-import org.onosproject.net.device.DeviceService;
-import org.onosproject.net.flow.FlowRuleService;
-import org.slf4j.Logger;
-
-/**
- * Test for a application.
- */
-@Component(immediate = true)
-@Service
-public class AppTestManager implements AppTestService {
-
- private static final String APP_TEST = "org.onosproject.apptest";
- private final Logger log = getLogger(getClass());
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected FlowRuleService flowRuleService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected DeviceService deviceService;
- private ApplicationId appId;
- FlowRuleTest flowRule;
-
- @Activate
- protected void activate() {
- log.info("APP-TEST started");
- appId = coreService.registerApplication(APP_TEST);
- flowRule = new FlowRuleTest(flowRuleService, deviceService, appId);
- flowRule.applyFlowRules();
- }
-
- @Deactivate
- protected void deactivate() {
- flowRule.removeFlowRules();
- log.info("APP-TEST Stopped");
- }
-}
diff --git a/apps/test/samples/src/main/java/org/onosproject/flowrule/impl/package-info.java b/apps/test/samples/src/main/java/org/onosproject/flowrule/impl/package-info.java
deleted file mode 100644
index 743d863..0000000
--- a/apps/test/samples/src/main/java/org/onosproject/flowrule/impl/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2014-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.
- */
-
-/**
- * Test for flow rule subsystem extension.
- * Also used to test other functions, but it need be extended.
- */
-package org.onosproject.flowrule.impl;
diff --git a/apps/test/samples/src/main/java/org/onosproject/flowrule/package-info.java b/apps/test/samples/src/main/java/org/onosproject/flowrule/package-info.java
deleted file mode 100644
index 806a91f..0000000
--- a/apps/test/samples/src/main/java/org/onosproject/flowrule/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2014-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.
- */
-
-/**
- * Test for flow rule subsystem extension.
- * Now it has no APIs, Maybe it can add other methods in future.
- */
-package org.onosproject.flowrule;
diff --git a/apps/test/samples/src/main/resource/org/onosproject/flowrule/resource/flowrule.txt b/apps/test/samples/src/main/resource/org/onosproject/flowrule/resource/flowrule.txt
deleted file mode 100644
index ec1bc01..0000000
--- a/apps/test/samples/src/main/resource/org/onosproject/flowrule/resource/flowrule.txt
+++ /dev/null
@@ -1 +0,0 @@
-050e009000000000000000000000000000000000000000000701000000000000000000000000000000000000000000020001001080001702010180001902010200040030000000000000001000000006000000000000000000130008001300000019001080001a0101000000000000000002000000000000000000000000000100000000000000010001000003000000
\ No newline at end of file
diff --git a/apps/test/samples/src/main/resource/org/onosproject/flowrule/resource/package-info.java b/apps/test/samples/src/main/resource/org/onosproject/flowrule/resource/package-info.java
deleted file mode 100644
index d8cfd99..0000000
--- a/apps/test/samples/src/main/resource/org/onosproject/flowrule/resource/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2014-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.
- */
-
-/**
- * applications live here.
- */
-package org.onosproject.flowrule.resource;
\ No newline at end of file