Refactor connectivity intent creation to use builders

- Each connectivity intent now has only one constructor
- Intent constructors are now private for leaf classes and
  protected for classes that can be derived from
- Each intent class has a Builder class that accumulates
  parameters for intent creation
- Each intent class has a public static builder() method
  to create a builder
- Each Builder class has a build() method to create the
  intent from the accumulated parameters
- Added keys to a few intent types that were missing them
- Tightened up usage of checkNotNull(), taking advantage of
  the return value to save some lines of code
- Modified callers to use the builders instead of directly
  calling the constructors

Change-Id: I713185d5ecbadbf51f87ef7f68fec41102106c78
diff --git a/core/api/src/test/java/org/onosproject/net/intent/LinkCollectionIntentTest.java b/core/api/src/test/java/org/onosproject/net/intent/LinkCollectionIntentTest.java
index a9ae782..4263531 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/LinkCollectionIntentTest.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/LinkCollectionIntentTest.java
@@ -67,22 +67,26 @@
         final HashSet<Link> links1 = new HashSet<>();
         links1.add(link("src", 1, "dst", 2));
         final LinkCollectionIntent collectionIntent1 =
-                new LinkCollectionIntent(APP_ID,
-                        selector,
-                        treatment,
-                        links1,
-                        ingress,
-                        egress);
+                LinkCollectionIntent.builder()
+                        .appId(APP_ID)
+                        .selector(selector)
+                        .treatment(treatment)
+                        .links(links1)
+                        .ingressPoints(ImmutableSet.of(ingress))
+                        .egressPoints(ImmutableSet.of(egress))
+                        .build();
 
         final HashSet<Link> links2 = new HashSet<>();
         links2.add(link("src", 1, "dst", 3));
         final LinkCollectionIntent collectionIntent2 =
-                new LinkCollectionIntent(APP_ID,
-                        selector,
-                        treatment,
-                        links2,
-                        ingress,
-                        egress);
+                LinkCollectionIntent.builder()
+                        .appId(APP_ID)
+                        .selector(selector)
+                        .treatment(treatment)
+                        .links(links2)
+                        .ingressPoints(ImmutableSet.of(ingress))
+                        .egressPoints(ImmutableSet.of(egress))
+                        .build();
 
         new EqualsTester()
                 .addEqualityGroup(collectionIntent1)
@@ -98,12 +102,14 @@
         final HashSet<Link> links1 = new HashSet<>();
         links1.add(link("src", 1, "dst", 2));
         final LinkCollectionIntent collectionIntent =
-                new LinkCollectionIntent(APP_ID,
-                        selector,
-                        treatment,
-                        links1,
-                        ingress,
-                        egress);
+                LinkCollectionIntent.builder()
+                        .appId(APP_ID)
+                        .selector(selector)
+                        .treatment(treatment)
+                        .links(links1)
+                        .ingressPoints(ImmutableSet.of(ingress))
+                        .egressPoints(ImmutableSet.of(egress))
+                        .build();
 
         final Set<Link> createdLinks = collectionIntent.links();
         assertThat(createdLinks, hasSize(1));
@@ -128,14 +134,16 @@
         links1.add(link("src", 1, "dst", 2));
         constraints.add(new LambdaConstraint(Lambda.valueOf(23)));
         final LinkCollectionIntent collectionIntent =
-                new LinkCollectionIntent(APP_ID,
-                        selector,
-                        treatment,
-                        links1,
-                        ingress,
-                        egress,
-                        constraints,
-                        8888);
+                LinkCollectionIntent.builder()
+                        .appId(APP_ID)
+                        .selector(selector)
+                        .treatment(treatment)
+                        .links(links1)
+                        .ingressPoints(ImmutableSet.of(ingress))
+                        .egressPoints(ImmutableSet.of(egress))
+                        .constraints(constraints)
+                        .priority(8888)
+                        .build();
 
         final Set<Link> createdLinks = collectionIntent.links();
         assertThat(createdLinks, hasSize(1));
@@ -175,23 +183,27 @@
     protected Intent createOne() {
         HashSet<Link> links1 = new HashSet<>();
         links1.add(link("src", 1, "dst", 2));
-        return new LinkCollectionIntent(APP_ID,
-                                        selector,
-                                        treatment,
-                                        links1,
-                                        ingress,
-                                        egress);
+        return LinkCollectionIntent.builder()
+                .appId(APP_ID)
+                .selector(selector)
+                .treatment(treatment)
+                .links(links1)
+                .ingressPoints(ImmutableSet.of(ingress))
+                .egressPoints(ImmutableSet.of(egress))
+                .build();
     }
 
     @Override
     protected Intent createAnother() {
         HashSet<Link> links2 = new HashSet<>();
         links2.add(link("src", 1, "dst", 3));
-        return new LinkCollectionIntent(APP_ID,
-                                        selector,
-                                        treatment,
-                                        links2,
-                                        ingress,
-                                        egress);
+        return LinkCollectionIntent.builder()
+                .appId(APP_ID)
+                .selector(selector)
+                .treatment(treatment)
+                .links(links2)
+                .ingressPoints(ImmutableSet.of(ingress))
+                .egressPoints(ImmutableSet.of(egress))
+                .build();
     }
 }