Test: Changes to cord-tester to make it work with latest ONOS relocating apps to opencord.
For _now_, keep prebuilt versions of cord apps since remote installation for opencord doesn't seem to work.
Also make the ciena cordigmp app compatible with latest ONOS.
Change test cases as well.

Change-Id: Ic8792eb4ee36afc4fc153bde993d0ef9f1d9a040
diff --git a/src/test/apps/ciena-cordigmp/pom.xml b/src/test/apps/ciena-cordigmp/pom.xml
index 058b8f8..45b710a 100644
--- a/src/test/apps/ciena-cordigmp/pom.xml
+++ b/src/test/apps/ciena-cordigmp/pom.xml
@@ -17,25 +17,42 @@
 <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/xsd/maven-4.0.0.xsd">

     <modelVersion>4.0.0</modelVersion>

 

+        <parent>

+        <groupId>org.onosproject</groupId>

+        <artifactId>onos</artifactId>

+        <version>1.6.0-rc2</version>

+        <relativePath></relativePath>

+    </parent>

+

     <groupId>org.ciena.cordigmp</groupId>

     <artifactId>ciena-cordigmp</artifactId>

-    <version>1.0-SNAPSHOT</version>

+    <version>2.0-SNAPSHOT</version>

     <packaging>bundle</packaging>

 

+          <repositories>

+        <repository>

+          <id>oss-staging</id>

+          <name>OSS Staging</name>

+          <url>https://oss.sonatype.org/content/groups/staging</url>

+        </repository>

+      </repositories>

+

     <description>Ciena CORD IGMP for OVS</description>

     <url>http://onosproject.org</url>

 

     <properties>

         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

-        <onos.version>1.6.0-SNAPSHOT</onos.version>

+        <onos.version>1.6.0-rc2</onos.version>

         <onos.app.name>org.ciena.cordigmp</onos.app.name>

         <onos.app.title>Ciena IGMP for OVS</onos.app.title>

         <onos.app.origin>Ciena Inc.</onos.app.origin>

         <onos.app.category>default</onos.app.category>

         <onos.app.url>http://onosproject.org</onos.app.url>

         <onos.app.readme>ONOS OSGi bundle archetype.</onos.app.readme>

+        <onos.app.requires>org.opencord.config</onos.app.requires>

     </properties>

 

+

     <dependencies>

         <dependency>

             <groupId>org.onosproject</groupId>

@@ -50,9 +67,9 @@
         </dependency>

 

         <dependency>

-            <groupId>org.onosproject</groupId>

-            <artifactId>onos-cord-config</artifactId>

-            <version>${onos.version}</version>

+            <groupId>org.opencord</groupId>

+            <artifactId>cord-config</artifactId>

+            <version>1.0-SNAPSHOT</version>

         </dependency>

 

         <dependency>

@@ -63,14 +80,6 @@
         </dependency>

 

         <dependency>

-            <groupId>org.onosproject</groupId>

-            <artifactId>onos-api</artifactId>

-            <version>${onos.version}</version>

-            <scope>test</scope>

-            <classifier>tests</classifier>

-        </dependency>

-

-        <dependency>

             <groupId>org.apache.felix</groupId>

             <artifactId>org.apache.felix.scr.annotations</artifactId>

             <version>1.9.12</version>

@@ -86,12 +95,26 @@
             <groupId>org.osgi</groupId>

             <artifactId>org.osgi.compendium</artifactId>

             <version>5.0.0</version>

-        </dependency>

-        <dependency>

+      </dependency>

+

+              <dependency>

             <groupId>org.onosproject</groupId>

-            <artifactId>onos-app-olt-api</artifactId>

+            <artifactId>onlab-misc</artifactId>

             <version>${onos.version}</version>

         </dependency>

+

+        <dependency>

+            <groupId>org.onosproject</groupId>

+            <artifactId>onos-incubator-api</artifactId>

+            <version>${onos.version}</version>

+        </dependency>

+

+        <dependency>

+            <groupId>org.onosproject</groupId>

+            <artifactId>onos-core-common</artifactId>

+            <version>${onos.version}</version>

+        </dependency>

+

     </dependencies>

 

     <build>

diff --git a/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/CordIgmp.java b/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/CordIgmp.java
index 2029a4a..37f223c 100644
--- a/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/CordIgmp.java
+++ b/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/CordIgmp.java
@@ -15,7 +15,6 @@
  */
 package org.ciena.cordigmp;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Multiset;
 import com.google.common.collect.ConcurrentHashMultiset;
@@ -50,32 +49,24 @@
 import org.onosproject.net.flow.FlowEntry;
 import org.onosproject.net.flow.DefaultFlowEntry;
 import org.onosproject.net.flow.FlowRuleService;
-import org.onosproject.net.flowobjective.DefaultNextObjective;
 import org.onosproject.net.flowobjective.FlowObjectiveService;
-import org.onosproject.net.flowobjective.NextObjective;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.net.flowobjective.ObjectiveContext;
-import org.onosproject.net.flowobjective.ObjectiveError;
 import org.onosproject.net.mcast.McastEvent;
 import org.onosproject.net.mcast.McastListener;
 import org.onosproject.net.mcast.McastRoute;
 import org.onosproject.net.mcast.McastRouteInfo;
 import org.onosproject.net.mcast.MulticastRouteService;
-import org.onosproject.cordconfig.access.AccessDeviceConfig;
-import org.onosproject.cordconfig.access.AccessDeviceData;
+import org.opencord.cordconfig.access.AccessDeviceConfig;
+import org.opencord.cordconfig.access.AccessDeviceData;
 import org.osgi.service.component.ComponentContext;
 import org.onosproject.net.PortNumber;
 import org.onlab.packet.IPv4;
 import org.slf4j.Logger;
 
-import java.io.IOException;
 import java.util.Dictionary;
-import java.util.List;
 import java.util.Map;
 import java.util.Collection;
 import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import static com.google.common.base.Preconditions.checkNotNull;
@@ -130,7 +121,7 @@
 
     //Count of group joins
     private Multiset<IpAddress> cordIgmpCountTable = ConcurrentHashMultiset.create();
-    
+
     //TODO: move this to distributed atomic long
     private AtomicInteger channels = new AtomicInteger(0);
 
@@ -195,10 +186,10 @@
 
         CordIgmpTranslateConfig cordIgmpTranslateConfig = networkConfig.getConfig(appId, CordIgmpTranslateConfig.class);
 
-        if(cordIgmpTranslateConfig != null) {
+        if (cordIgmpTranslateConfig != null) {
             Collection<McastPorts> translations = cordIgmpTranslateConfig.getCordIgmpTranslations();
-            for(McastPorts port: translations) {
-                cordIgmpTranslateTable.put(port.group(), 
+            for (McastPorts port: translations) {
+                cordIgmpTranslateTable.put(port.group(),
                                            port.portPair());
             }
         }
@@ -282,14 +273,14 @@
             }
         }
     }
-    
+
     private void provisionFilterIgmp(DeviceId devId, boolean remove) {
         Boolean deviceStatus = deviceAvailability.get(devId);
-        if(deviceStatus != null) {
-            if(remove == false) {
+        if (deviceStatus != null) {
+            if (!remove) {
                 return;
             }
-        } else if(remove == true) {
+        } else if (remove) {
             return;
         }
         TrafficSelector.Builder igmp = DefaultTrafficSelector.builder()
@@ -304,14 +295,14 @@
         flowEntry.withTreatment(treatment.build());
         flowEntry.fromApp(appId);
         flowEntry.makePermanent();
-        if(remove == false) {
+        if (!remove) {
             deviceAvailability.put(devId, true);
             flowRuleService.applyFlowRules(flowEntry.build());
         } else {
             deviceAvailability.remove(devId);
             flowRuleService.removeFlowRules(flowEntry.build());
         }
-        log.warn("IGMP flow rule " + ( remove ? "removed" : "added" ) + " for device id " + devId);
+        log.warn("IGMP flow rule " + (remove ? "removed" : "added") + " for device id " + devId);
     }
 
     private class InternalDeviceListener implements DeviceListener {
@@ -325,7 +316,7 @@
                     provisionFilterIgmp(devId, false);
                     break;
                 case DEVICE_AVAILABILITY_CHANGED:
-                    if(deviceService.isAvailable(devId)) {
+                    if (deviceService.isAvailable(devId)) {
                         provisionFilterIgmp(devId, false);
                     } else {
                         provisionFilterIgmp(devId, true);
@@ -355,16 +346,16 @@
         }
         ConnectPoint loc = info.sink().get();
         AccessDeviceData oltInfo = oltData.get(loc.deviceId());
-        if(oltInfo != null) {
+        if (oltInfo != null) {
             log.warn("Ignoring deprovisioning mcast route for OLT device: " + loc.deviceId());
             return;
         }
         final IgmpPortPair portPair = cordIgmpTranslateTable.get(info.route().group());
-        if(portPair == null) {
+        if (portPair == null) {
             log.warn("Ignoring unprovisioning for group " + info.route().group() + " with no port map");
             return;
         }
-        if(cordIgmpCountTable.remove(info.route().group(), 1) <= 1) {
+        if (cordIgmpCountTable.remove(info.route().group(), 1) <= 1) {
             //Remove flow for last channel leave
             final PortNumber inPort = PortNumber.portNumber(portPair.inputPort());
             final PortNumber outPort = PortNumber.portNumber(portPair.outputPort());
@@ -391,16 +382,16 @@
         checkNotNull(sink, "Sink cannot be null");
 
         AccessDeviceData oltInfo = oltData.get(sink.deviceId());
-        if(oltInfo != null) {
+        if (oltInfo != null) {
             log.warn("Ignoring provisioning mcast route for OLT device: " + sink.deviceId());
             return;
-        } 
+        }
         final IgmpPortPair portPair = cordIgmpTranslateTable.get(route.group());
-        if(portPair == null) {
+        if (portPair == null) {
             log.warn("Ports for Group " + route.group() + " not found in cord igmp map. Skipping provisioning.");
             return;
         }
-        if(cordIgmpCountTable.count(route.group()) == 0) {
+        if (cordIgmpCountTable.count(route.group()) == 0) {
             //First group entry. Provision the flows
             final PortNumber inPort = PortNumber.portNumber(portPair.inputPort());
             final PortNumber outPort = PortNumber.portNumber(portPair.outputPort());
@@ -438,7 +429,7 @@
                             cordIgmpTranslateTable.clear();
                             cordIgmpCountTable.clear();
                             config.getCordIgmpTranslations().forEach(
-                                                                     mcastPorts -> cordIgmpTranslateTable.put(mcastPorts.group(), mcastPorts.portPair()));
+                                mcastPorts -> cordIgmpTranslateTable.put(mcastPorts.group(), mcastPorts.portPair()));
                         }
                     }
                     break;
diff --git a/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/CordIgmpTranslateConfig.java b/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/CordIgmpTranslateConfig.java
index e55cf11..ae46216 100644
--- a/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/CordIgmpTranslateConfig.java
+++ b/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/CordIgmpTranslateConfig.java
@@ -41,7 +41,7 @@
                 return false;
             }
 
-            if (!(isIpAddress((ObjectNode) node, GROUP, FieldPresence.MANDATORY) && 
+            if (!(isIpAddress((ObjectNode) node, GROUP, FieldPresence.MANDATORY) &&
                   node.get(INPUT_PORT).isInt() && node.get(OUTPUT_PORT).isInt())) {
                 return false;
             }
diff --git a/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/McastPorts.java b/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/McastPorts.java
index e0cd622..1ea76a1 100644
--- a/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/McastPorts.java
+++ b/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/McastPorts.java
@@ -22,8 +22,8 @@
 import static com.google.common.base.MoreObjects.toStringHelper;
 import static com.google.common.base.Preconditions.checkNotNull;
 
-/**
- * An entity representing a multicast group and its input and output ports
+/*
+ * An entity representing a multicast group and its input and output ports.
  */
 @Beta
 public class McastPorts {
diff --git a/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/package-info.java b/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/package-info.java
new file mode 100644
index 0000000..75494c5
--- /dev/null
+++ b/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/package-info.java
@@ -0,0 +1,8 @@
+/**
+ * Ciena application for cord tester to provision flows with ovs.
+ * This is required as OVS onos driver does not support multi-table inserts.
+ * This application takes a port pair configuration per group to provision flows.
+ * To be used in simulation environments with subscriber tests.
+ * On the target, cordmcast app should be used.
+ */
+package org.ciena.cordigmp;