Add priority to Intents

Change-Id: Ibe63356f5b15a6aa6ca7731dba3382c3317a95ec
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/HostToHostIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/HostToHostIntentCompiler.java
index df8ef04..60306b2 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/HostToHostIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/HostToHostIntentCompiler.java
@@ -98,7 +98,8 @@
         TrafficSelector selector = builder(intent.selector())
                 .matchEthSrc(src.mac()).matchEthDst(dst.mac()).build();
         return new PathIntent(intent.appId(), selector, intent.treatment(),
-                              path, intent.constraints());
+                              path, intent.constraints(),
+                              intent.priority());
     }
 
 }
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompiler.java
index b4889f4..6403019 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompiler.java
@@ -89,12 +89,14 @@
             }
         }
 
+        Set<ConnectPoint> egress = ImmutableSet.of(intent.egressPoint());
         Intent result = new LinkCollectionIntent(intent.appId(),
                                                  intent.selector(), intent.treatment(),
                                                  Sets.newHashSet(links.values()),
                                                  intent.ingressPoints(),
                                                  ImmutableSet.of(intent.egressPoint()),
-                                                 Collections.emptyList());
+                                                 Collections.emptyList(),
+                                                 intent.priority());
         return Arrays.asList(result);
     }
 
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompiler.java
index 9371586..0f897a4 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompiler.java
@@ -93,7 +93,8 @@
                                     PointToPointIntent intent) {
         return new PathIntent(intent.appId(),
                               intent.selector(), intent.treatment(), path,
-                              intent.constraints());
+                              intent.constraints(),
+                              intent.priority());
     }
 
 }
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompiler.java
index 8360820..4b2260e 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompiler.java
@@ -70,7 +70,9 @@
                                                  intent.selector(),
                                                  intent.treatment(), links,
                                                  ImmutableSet.of(intent.ingressPoint()),
-                                                 intent.egressPoints(), Collections.emptyList());
+                                                 intent.egressPoints(),
+                                                 Collections.emptyList(),
+                                                 intent.priority());
 
         return Arrays.asList(result);
     }
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/TwoWayP2PIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/TwoWayP2PIntentCompiler.java
index 6c5b7f3..af603d5 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/TwoWayP2PIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/TwoWayP2PIntentCompiler.java
@@ -51,11 +51,11 @@
                 new PointToPointIntent(intent.appId(), intent.key(),
                                        intent.selector(), intent.treatment(),
                                        intent.one(), intent.two(),
-                                       intent.constraints()),
+                                       intent.constraints(), Intent.DEFAULT_INTENT_PRIORITY),
                 new PointToPointIntent(intent.appId(), intent.key(),
                                        intent.selector(), intent.treatment(),
                                        intent.two(), intent.one(),
-                                       intent.constraints()));
+                                       intent.constraints(), Intent.DEFAULT_INTENT_PRIORITY));
 
     }
 }
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/installer/LinkCollectionIntentInstaller.java b/core/net/src/main/java/org/onosproject/net/intent/impl/installer/LinkCollectionIntentInstaller.java
index 54ff5fc..e715b87 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/installer/LinkCollectionIntentInstaller.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/installer/LinkCollectionIntentInstaller.java
@@ -186,7 +186,7 @@
                 treatment = intentTreatment;
             }
             FlowRule rule = new DefaultFlowRule(deviceId,
-                selector, treatment, 123, appId,
+                selector, treatment, intent.priority(), appId,
                 new DefaultGroupId((short) (intent.id().fingerprint() & 0xffff)),
                 0, true);
             result.add(new FlowRuleOperation(rule, operation));
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/installer/MplsPathIntentInstaller.java b/core/net/src/main/java/org/onosproject/net/intent/impl/installer/MplsPathIntentInstaller.java
index dbe9233..bb38fa5 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/installer/MplsPathIntentInstaller.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/installer/MplsPathIntentInstaller.java
@@ -280,7 +280,7 @@
                                             deviceId,
                                             selector,
                                             treat,
-                                            123, // FIXME 123
+                                            intent.priority(),
                                             appId,
                                             0,
                                             true);
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/installer/PathIntentInstaller.java b/core/net/src/main/java/org/onosproject/net/intent/impl/installer/PathIntentInstaller.java
index 5230736..7a06024 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/installer/PathIntentInstaller.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/installer/PathIntentInstaller.java
@@ -99,7 +99,7 @@
                     .setOutput(link.src().port()).build();
 
             FlowRule rule = new DefaultFlowRule(link.src().deviceId(),
-                    builder.build(), treatment, 123, //FIXME 123
+                    builder.build(), treatment, intent.priority(),
                     appId,
                     new DefaultGroupId((short) (intent.id().fingerprint() & 0xffff)),
                     0, true);
@@ -127,7 +127,7 @@
                     (links.hasNext() ? builder() : builder(intent.treatment()))
                             .setOutput(link.src().port()).build();
             FlowRule rule = new DefaultFlowRule(link.src().deviceId(),
-                    builder.build(), treatment, 123, appId,
+                    builder.build(), treatment, intent.priority(), appId,
                     new DefaultGroupId((short) (intent.id().fingerprint() & 0xffff)),
                     0, true);
             rules.add(new FlowRuleOperation(rule, FlowRuleOperation.Type.REMOVE));