Fix LinkCollectionCompiler duplicate flow rules problem

Use outputPorts.keys() might generate duplicate flow rules.
Use keySet() can fix this problem.

Change-Id: I8c1c47ccb8835c174b639cf4a5e94c1c1b36484d
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java
index 735ea7f..1f22429 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java
@@ -81,7 +81,7 @@
         computePorts(intent, inputPorts, outputPorts);
 
         List<FlowRule> rules = new ArrayList<>();
-        for (DeviceId deviceId: outputPorts.keys()) {
+        for (DeviceId deviceId: outputPorts.keySet()) {
             rules.addAll(createRules(intent, deviceId, inputPorts.get(deviceId), outputPorts.get(deviceId)));
         }
         return Collections.singletonList(new FlowRuleIntent(appId, rules, intent.resources()));
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompilerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompilerTest.java
index 43524da..ae39fdd 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompilerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompilerTest.java
@@ -358,7 +358,7 @@
         assertThat(compiled, hasSize(1));
 
         Collection<FlowRule> rules = ((FlowRuleIntent) compiled.get(0)).flowRules();
-        assertThat(rules, hasSize((linksMultiple.size() + intentMultipleTreatments.egressPoints().size())));
+        assertThat(rules, hasSize(2));
 
         Set<FlowRule> d3Rules = rules
                 .parallelStream()
@@ -424,7 +424,7 @@
 
 
         Collection<FlowRule> rules = ((FlowRuleIntent) compiled.get(0)).flowRules();
-        assertThat(rules, hasSize((linksMultiple2.size() + intentMultipleTreatments2.egressPoints().size())));
+        assertThat(rules, hasSize(4));
 
 
         Set<FlowRule> d2Rules = rules