[SEBA-870] Bump ONOS to 2.2.1 and build with Java 11

Change-Id: Iefb2cb709734c8802207769d842ca4e4542766e1
diff --git a/pom.xml b/pom.xml
index 9fb771b..523fd0b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,26 +22,24 @@
     <parent>
         <groupId>org.onosproject</groupId>
         <artifactId>onos-dependencies</artifactId>
-        <version>1.13.9-rc4</version>
-        <relativePath></relativePath>
+        <version>2.2.1-b2</version>
     </parent>
 
     <groupId>org.opencord</groupId>
     <artifactId>mcast</artifactId>
-    <version>1.5.0-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <description>CORD Multicast application</description>
 
     <properties>
         <onos.app.name>org.opencord.mcast</onos.app.name>
-        <onos.version>1.13.9-rc4</onos.version>
         <onos.app.category>Traffic Steering</onos.app.category>
         <onos.app.title>CORD Multicast App</onos.app.title>
         <onos.app.url>http://opencord.org</onos.app.url>
         <onos.app.requires>org.opencord.config</onos.app.requires>
-        <cord.config.version>1.4.0</cord.config.version>
-        <olt.api.version>1.4.0</olt.api.version>
+        <cord.config.version>2.0.0-SNAPSHOT</cord.config.version>
+        <olt.api.version>4.0.0-SNAPSHOT</olt.api.version>
     </properties>
 
     <dependencies>
@@ -49,68 +47,39 @@
             <groupId>org.onosproject</groupId>
             <artifactId>onlab-osgi</artifactId>
             <version>${onos.version}</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.onosproject</groupId>
             <artifactId>onos-api</artifactId>
             <version>${onos.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-core-serializers</artifactId>
+            <version>${onos.version}</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.opencord</groupId>
             <artifactId>cord-config</artifactId>
             <version>${cord.config.version}</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.onosproject</groupId>
             <artifactId>onos-apps-mcast-api</artifactId>
             <version>${onos.version}</version>
+            <scope>provided</scope>
         </dependency>
     </dependencies>
 
     <build>
         <plugins>
             <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <version>4.1.0</version>
-                <extensions>true</extensions>
-                <inherited>true</inherited>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.8.0</version>
-                <configuration>
-                    <release>11</release>
-                </configuration>
-            </plugin>
-            <plugin>
                 <groupId>org.onosproject</groupId>
                 <artifactId>onos-maven-plugin</artifactId>
-                <version>1.11</version>
-                <executions>
-                    <execution>
-                        <id>cfg</id>
-                        <phase>generate-resources</phase>
-                        <goals>
-                            <goal>cfg</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>swagger</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>swagger</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>app</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>app</goal>
-                        </goals>
-                    </execution>
-                </executions>
             </plugin>
         </plugins>
     </build>
@@ -130,7 +99,6 @@
                 <checksumPolicy>fail</checksumPolicy>
             </releases>
         </repository>
-
         <repository>
             <id>snapshots</id>
             <url>https://oss.sonatype.org/content/repositories/snapshots</url>
diff --git a/src/main/java/org/opencord/cordmcast/CordMcast.java b/src/main/java/org/opencord/cordmcast/CordMcast.java
index 3bb4d72..cd3f3bb 100644
--- a/src/main/java/org/opencord/cordmcast/CordMcast.java
+++ b/src/main/java/org/opencord/cordmcast/CordMcast.java
@@ -18,13 +18,12 @@
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Sets;
 import org.apache.commons.lang3.tuple.ImmutablePair;
-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.Modified;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Modified;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
 import org.onlab.packet.Ethernet;
 import org.onlab.packet.IpAddress;
 import org.onlab.packet.VlanId;
@@ -88,6 +87,10 @@
 import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
 import static org.onlab.util.Tools.get;
 import static org.onlab.util.Tools.groupedThreads;
+import static org.opencord.cordmcast.OsgiPropertyConstants.DEFAULT_VLAN_ENABLED;
+import static org.opencord.cordmcast.OsgiPropertyConstants.DEFAULT_PRIORITY;
+import static org.opencord.cordmcast.OsgiPropertyConstants.PRIORITY;
+import static org.opencord.cordmcast.OsgiPropertyConstants.VLAN_ENABLED;
 import static org.slf4j.LoggerFactory.getLogger;
 
 
@@ -96,7 +99,11 @@
  * events on the multicast rib and provisioning groups to program multicast
  * flows on the dataplane.
  */
-@Component(immediate = true)
+@Component(immediate = true,
+        property = {
+        VLAN_ENABLED + ":Boolean=" + DEFAULT_VLAN_ENABLED,
+        PRIORITY + ":Integer=" + DEFAULT_PRIORITY,
+})
 public class CordMcast {
     private static final String APP_NAME = "org.opencord.cordmcast";
 
@@ -104,42 +111,38 @@
 
     private static final int DEFAULT_PRIORITY = 500;
     private static final short DEFAULT_MCAST_VLAN = 4000;
-    private static final boolean DEFAULT_VLAN_ENABLED = true;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected MulticastRouteService mcastService;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected FlowObjectiveService flowObjectiveService;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected CoreService coreService;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected ComponentConfigService componentConfigService;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected CordConfigService cordConfigService;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected NetworkConfigRegistry networkConfig;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected FlowRuleService flowRuleService;
-
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected StorageService storageService;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected MastershipService mastershipService;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     public DeviceService deviceService;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     private ClusterService clusterService;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     private LeadershipService leadershipService;
 
     protected McastListener listener = new InternalMulticastListener();
@@ -152,12 +155,14 @@
     private ApplicationId coreAppId;
     private short mcastVlan = DEFAULT_MCAST_VLAN;
 
-    @Property(name = "vlanEnabled", boolValue = DEFAULT_VLAN_ENABLED,
-            label = "Use vlan for multicast traffic?")
+    /**
+     * Whether to use VLAN for multicast traffic.
+     **/
     private boolean vlanEnabled = DEFAULT_VLAN_ENABLED;
 
-    @Property(name = "priority", intValue = DEFAULT_PRIORITY,
-            label = "Priority for multicast rules")
+    /**
+     * Priority for multicast rules.
+     **/
     private int priority = DEFAULT_PRIORITY;
 
     private static final Class<McastConfig> CORD_MCAST_CONFIG_CLASS =
diff --git a/src/main/java/org/opencord/cordmcast/OsgiPropertyConstants.java b/src/main/java/org/opencord/cordmcast/OsgiPropertyConstants.java
new file mode 100644
index 0000000..0910d94
--- /dev/null
+++ b/src/main/java/org/opencord/cordmcast/OsgiPropertyConstants.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2019-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.opencord.cordmcast;
+
+/**
+ * Constants for default values of configurable properties.
+ */
+public final class OsgiPropertyConstants {
+
+    private OsgiPropertyConstants() {
+    }
+
+    public static final String VLAN_ENABLED = "vlanEnabled";
+    public static final boolean DEFAULT_VLAN_ENABLED = true;
+
+    public static final String PRIORITY = "priority";
+    public static final int DEFAULT_PRIORITY = 500;
+}