[ONOS-4387] Support for multiple selectors in mp2sp intents

Changes:
- Adds extension to mp2sp intents;
- Adds extension to linkcollection intents;
- Adds extension to mp2sp compiler;
- Adds extension to linkcollection compiler;
- Adds unit tests for both mp2sp and linkcollection intents;

Change-Id: I673c2b660d2364c510b1b3050ed3626ad2f37bda
diff --git a/core/api/src/test/java/org/onosproject/net/intent/MultiPointToSinglePointIntentTest.java b/core/api/src/test/java/org/onosproject/net/intent/MultiPointToSinglePointIntentTest.java
index 9061418..115af4a 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/MultiPointToSinglePointIntentTest.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/MultiPointToSinglePointIntentTest.java
@@ -13,9 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.onosproject.net.intent;
 
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
 import static org.junit.Assert.assertEquals;
 import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
@@ -42,6 +45,39 @@
         assertEquals("incorrect egress", P2, intent.egressPoint());
     }
 
+    @Rule
+    public ExpectedException wrongMultiple = ExpectedException.none();
+
+    @Test
+    public void multipleSelectors() {
+
+        MultiPointToSinglePointIntent intent = createFirstMultiple();
+        assertEquals("incorrect id", APPID, intent.appId());
+        assertEquals("incorrect match", MATCH, intent.selector());
+        assertEquals("incorrect ingress", PS1, intent.ingressPoints());
+        assertEquals("incorrect egress", P2, intent.egressPoint());
+        assertEquals("incorrect selectors", MATCHES, intent.ingressSelectors());
+
+        intent = createSecondMultiple();
+        assertEquals("incorrect id", APPID, intent.appId());
+        assertEquals("incorrect match", VLANMATCH1, intent.selector());
+        assertEquals("incorrect ingress", PS1, intent.ingressPoints());
+        assertEquals("incorrect egress", P2, intent.egressPoint());
+        assertEquals("incorrect selectors", MATCHES, intent.ingressSelectors());
+
+        intent = createThirdMultiple();
+        assertEquals("incorrect id", APPID, intent.appId());
+        assertEquals("incorrect match", MATCH, intent.selector());
+        assertEquals("incorrect ingress", PS1, intent.ingressPoints());
+        assertEquals("incorrect egress", P2, intent.egressPoint());
+        assertEquals("incorrect selectors", VLANMATCHES, intent.ingressSelectors());
+
+        wrongMultiple.expect(IllegalArgumentException.class);
+        wrongMultiple.expectMessage("Selector and Multiple Selectors are both set");
+        intent = createWrongMultiple();
+    }
+
+
     @Override
     protected MultiPointToSinglePointIntent createOne() {
         return MultiPointToSinglePointIntent.builder()
@@ -63,4 +99,49 @@
                 .egressPoint(P1)
                 .build();
     }
+
+    protected MultiPointToSinglePointIntent createFirstMultiple() {
+        return MultiPointToSinglePointIntent.builder()
+                .appId(APPID)
+                .selector(MATCH)
+                .treatment(NOP)
+                .ingressPoints(PS1)
+                .egressPoint(P2)
+                .selectors(MATCHES)
+                .build();
+    }
+
+    protected MultiPointToSinglePointIntent createSecondMultiple() {
+        return MultiPointToSinglePointIntent.builder()
+                .appId(APPID)
+                .selector(VLANMATCH1)
+                .treatment(NOP)
+                .ingressPoints(PS1)
+                .egressPoint(P2)
+                .selectors(MATCHES)
+                .build();
+    }
+
+    protected MultiPointToSinglePointIntent createThirdMultiple() {
+        return MultiPointToSinglePointIntent.builder()
+                .appId(APPID)
+                .selector(MATCH)
+                .treatment(NOP)
+                .ingressPoints(PS1)
+                .egressPoint(P2)
+                .selectors(VLANMATCHES)
+                .build();
+    }
+
+    protected MultiPointToSinglePointIntent createWrongMultiple() {
+        return MultiPointToSinglePointIntent.builder()
+                .appId(APPID)
+                .selector(VLANMATCH1)
+                .treatment(NOP)
+                .ingressPoints(PS1)
+                .egressPoint(P2)
+                .selectors(VLANMATCHES)
+                .build();
+    }
+
 }