Inherit Intent Key on compilation

- Added Intent#key() method description
- Inherit key field from parent Intent during Intent
  compilation process
- Added assertion to existing unit tests

Change-Id: Iff85c5ec448b3f378957b7a20af865ad96cc3216
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompilerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompilerTest.java
index cb13c68..eec242c 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompilerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompilerTest.java
@@ -37,7 +37,6 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -150,6 +149,7 @@
             assertThat(linkIntent.links(), linksHasPath("h7", "h8"));
             assertThat(linkIntent.links(), linksHasPath("h8", "egress"));
         }
+        assertThat("key is inherited", resultIntent.key(), is(intent.key()));
     }
 
     /**
@@ -182,6 +182,7 @@
             assertThat(linkIntent.links(), linksHasPath("inner2", "egress1"));
             assertThat(linkIntent.links(), linksHasPath("inner2", "egress2"));
         }
+        assertThat("key is inherited", resultIntent.key(), is(intent.key()));
     }
 
     /**
@@ -215,6 +216,7 @@
             }
             assertThat(linkIntent.links(), linksHasPath(ingress, "n1"));
         }
+        assertThat("key is inherited", resultIntent.key(), is(intent.key()));
     }
 
     /**
@@ -245,6 +247,7 @@
             assertThat(linkIntent.links(), linksHasPath("i1", "i2"));
             assertThat(linkIntent.links(), linksHasPath("i1", "i3"));
         }
+        assertThat("key is inherited", resultIntent.key(), is(intent.key()));
     }
 
     /**
@@ -291,6 +294,7 @@
             assertThat("Link collection egress points do not match base intent",
                        linkIntent.filteredEgressPoints().equals(intent.filteredEgressPoints()));
         }
+        assertThat("key is inherited", resultIntent.key(), is(intent.key()));
 
     }
 
@@ -342,6 +346,7 @@
                        linkIntent.filteredEgressPoints().equals(intent.filteredEgressPoints()));
             assertThat(linkIntent.selector(), is(ipPrefixSelector));
         }
+        assertThat("key is inherited", resultIntent.key(), is(intent.key()));
 
     }
 }