Add keys to intents

- use Key class rather than String for intent keys
- add CLI option to specify a string key
- add key field to constructors for connectivity intents
- translate id into a key if no key is specified

Change-Id: I69ffbad93bc3daddf06a67cb0cffa2130e781b37
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddHostToHostIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddHostToHostIntentCommand.java
index 22bc137..eb5161b 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddHostToHostIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddHostToHostIntentCommand.java
@@ -54,7 +54,8 @@
         TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
         List<Constraint> constraints = buildConstraints();
 
-        HostToHostIntent intent = new HostToHostIntent(appId(), oneId, twoId,
+        HostToHostIntent intent = new HostToHostIntent(appId(), key(),
+                                                       oneId, twoId,
                                                        selector, treatment,
                                                        constraints);
         service.submit(intent);
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java
index 868fc7a..69feb35 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java
@@ -72,7 +72,8 @@
         TrafficTreatment treatment = buildTrafficTreatment();
         List<Constraint> constraints = buildConstraints();
 
-        Intent intent = new MultiPointToSinglePointIntent(appId(), selector, treatment,
+        Intent intent = new MultiPointToSinglePointIntent(appId(), key(),
+                                                          selector, treatment,
                                                           ingressPoints, egress,
                                                           constraints);
         service.submit(intent);
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddOpticalIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddOpticalIntentCommand.java
index a70550e..c743575 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddOpticalIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddOpticalIntentCommand.java
@@ -56,7 +56,7 @@
         PortNumber egressPortNumber = portNumber(getPortNumber(egressDeviceString));
         ConnectPoint egress = new ConnectPoint(egressDeviceId, egressPortNumber);
 
-        Intent intent = new OpticalConnectivityIntent(appId(), ingress, egress);
+        Intent intent = new OpticalConnectivityIntent(appId(), key(), ingress, egress);
         service.submit(intent);
         print("Optical intent submitted:\n%s", intent.toString());
     }
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddPointToPointIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddPointToPointIntentCommand.java
index 2f50856..980acfe 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddPointToPointIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddPointToPointIntentCommand.java
@@ -15,9 +15,6 @@
  */
 package org.onosproject.cli.net;
 
-import static org.onosproject.net.DeviceId.deviceId;
-import static org.onosproject.net.PortNumber.portNumber;
-
 import java.util.List;
 
 import org.apache.karaf.shell.commands.Argument;
@@ -32,6 +29,9 @@
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.PointToPointIntent;
 
+import static org.onosproject.net.DeviceId.deviceId;
+import static org.onosproject.net.PortNumber.portNumber;
+
 /**
  * Installs point-to-point connectivity intents.
  */
@@ -67,8 +67,10 @@
 
         List<Constraint> constraints = buildConstraints();
 
-        Intent intent = new PointToPointIntent(appId(), selector, treatment,
-                                               ingress, egress, constraints);
+        Intent intent = new PointToPointIntent(appId(),
+                key(),
+                selector, treatment,
+                ingress, egress, constraints);
         service.submit(intent);
         print("Point to point intent submitted:\n%s", intent.toString());
     }
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddSinglePointToMultiPointIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddSinglePointToMultiPointIntentCommand.java
index 8d962a6..74704d0 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddSinglePointToMultiPointIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddSinglePointToMultiPointIntentCommand.java
@@ -71,13 +71,15 @@
         TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
         List<Constraint> constraints = buildConstraints();
 
-        SinglePointToMultiPointIntent intent = new SinglePointToMultiPointIntent(
-                                                                                 appId(),
-                                                                                 selector,
-                                                                                 treatment,
-                                                                                 ingressPoint,
-                                                                                 egressPoints,
-                                                                                 constraints);
+        SinglePointToMultiPointIntent intent =
+                new SinglePointToMultiPointIntent(
+                        appId(),
+                        key(),
+                        selector,
+                        treatment,
+                        ingressPoint,
+                        egressPoints,
+                        constraints);
         service.submit(intent);
         print("Single point to multipoint intent submitted:\n%s", intent.toString());
     }
diff --git a/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
index d0633e6..a8a28e2 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
@@ -28,6 +28,7 @@
 import org.onosproject.net.flow.TrafficSelector;
 import org.onosproject.net.flow.TrafficTreatment;
 import org.onosproject.net.intent.Constraint;
+import org.onosproject.net.intent.Key;
 import org.onosproject.net.intent.constraint.BandwidthConstraint;
 import org.onosproject.net.intent.constraint.LambdaConstraint;
 import org.onosproject.net.intent.constraint.LinkTypeConstraint;
@@ -81,6 +82,10 @@
             required = false, multiValued = false)
     private boolean lambda = false;
 
+    @Option(name = "-k", aliases = "--key", description = "Intent Key",
+            required = false, multiValued = false)
+    private String intentKey = null;
+
 
     // Treatments
     @Option(name = "--setEthSrc", description = "Rewrite Source MAC Address",
@@ -180,4 +185,19 @@
 
         return constraints;
     }
+
+    /**
+     * Creates a key for an intent based on command line arguments.  If a key
+     * has been specified, it is returned.  If no key is specified, null
+     * is returned.
+     *
+     * @return intent key if specified, null otherwise
+     */
+    protected Key key() {
+        Key key = null;
+        if (intentKey != null) {
+            key = Key.of(intentKey, appId());
+        }
+        return key;
+    }
 }
diff --git a/core/api/src/main/java/org/onosproject/net/intent/ConnectivityIntent.java b/core/api/src/main/java/org/onosproject/net/intent/ConnectivityIntent.java
index 50f639c..305d103 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/ConnectivityIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/ConnectivityIntent.java
@@ -61,7 +61,57 @@
                                  Collection<NetworkResource> resources,
                                  TrafficSelector selector,
                                  TrafficTreatment treatment) {
-        this(appId, resources, selector, treatment, Collections.emptyList());
+        this(appId, null, resources, selector, treatment, Collections.emptyList());
+    }
+
+    /**
+     * Creates a connectivity intent that matches on the specified selector
+     * and applies the specified treatment.
+     * <p>
+     * Path will be chosen without any constraints.
+     * </p>
+     *
+     * @param appId     application identifier
+     * @param key       intent key
+     * @param resources required network resources (optional)
+     * @param selector  traffic selector
+     * @param treatment treatment
+     * @throws NullPointerException if the selector or treatment is null
+     */
+    protected ConnectivityIntent(ApplicationId appId,
+                                 Key key,
+                                 Collection<NetworkResource> resources,
+                                 TrafficSelector selector,
+                                 TrafficTreatment treatment) {
+        this(appId, key, resources, selector, treatment, Collections.emptyList());
+    }
+
+    /**
+     * Creates a connectivity intent that matches on the specified selector
+     * and applies the specified treatment.
+     * <p>
+     * Path will be optimized based on the first constraint if one is given.
+     * </p>
+     *
+     * @param appId       application identifier
+     * @param key         explicit key to use for intent
+     * @param resources   required network resources (optional)
+     * @param selector    traffic selector
+     * @param treatment   treatment
+     * @param constraints optional prioritized list of constraints
+     * @throws NullPointerException if the selector or treatment is null
+     */
+
+    protected ConnectivityIntent(ApplicationId appId,
+                                 Key key,
+                                 Collection<NetworkResource> resources,
+                                 TrafficSelector selector,
+                                 TrafficTreatment treatment,
+                                 List<Constraint> constraints) {
+        super(appId, key, resources);
+        this.selector = checkNotNull(selector);
+        this.treatment = checkNotNull(treatment);
+        this.constraints = checkNotNull(constraints);
     }
 
     /**
@@ -78,12 +128,13 @@
      * @param constraints optional prioritized list of constraints
      * @throws NullPointerException if the selector or treatment is null
      */
+
     protected ConnectivityIntent(ApplicationId appId,
                                  Collection<NetworkResource> resources,
                                  TrafficSelector selector,
                                  TrafficTreatment treatment,
                                  List<Constraint> constraints) {
-        super(appId, resources);
+        super(appId, null, resources);
         this.selector = checkNotNull(selector);
         this.treatment = checkNotNull(treatment);
         this.constraints = checkNotNull(constraints);
diff --git a/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java b/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
index 5550ffe..b965967 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
@@ -87,7 +87,26 @@
                             TrafficSelector selector,
                             TrafficTreatment treatment,
                             List<Constraint> constraints) {
-        super(appId, Collections.emptyList(), selector, treatment, constraints);
+        this(appId, null, one, two, selector, treatment, constraints);
+    }
+    /**
+     * Creates a new host-to-host intent with the supplied host pair.
+     *
+     * @param appId       application identifier
+     * @param key       intent key
+     * @param one         first host
+     * @param two         second host
+     * @param selector    action
+     * @param treatment   ingress port
+     * @param constraints optional prioritized list of path selection constraints
+     * @throws NullPointerException if {@code one} or {@code two} is null.
+     */
+    public HostToHostIntent(ApplicationId appId, Key key,
+                            HostId one, HostId two,
+                            TrafficSelector selector,
+                            TrafficTreatment treatment,
+                            List<Constraint> constraints) {
+        super(appId, key, Collections.emptyList(), selector, treatment, constraints);
 
         // TODO: consider whether the case one and two are same is allowed
         this.one = checkNotNull(one);
diff --git a/core/api/src/main/java/org/onosproject/net/intent/Intent.java b/core/api/src/main/java/org/onosproject/net/intent/Intent.java
index 6630ce9..4cca45d 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/Intent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/Intent.java
@@ -36,7 +36,7 @@
     private final IntentId id;
 
     private final ApplicationId appId;
-    private final String key; // TODO make this a class
+    private final Key key;
 
     private final Collection<NetworkResource> resources;
 
@@ -71,12 +71,12 @@
          * @param resources     required network resources (optional)
          */
     protected Intent(ApplicationId appId,
-                     String key,
+                     Key key,
                      Collection<NetworkResource> resources) {
         checkState(idGenerator != null, "Id generator is not bound.");
         this.id = IntentId.valueOf(idGenerator.getNewId());
         this.appId = checkNotNull(appId, "Application ID cannot be null");
-        this.key = (key != null) ? key : id.toString(); //FIXME
+        this.key = (key != null) ? key : Key.of(id.fingerprint(), appId);
         this.resources = checkNotNull(resources);
     }
 
@@ -156,7 +156,7 @@
         }
     }
 
-    public String key() {
+    public Key key() {
         return key;
     }
 }
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentData.java b/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
index 0f2bd84..3eea0d5 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
@@ -52,7 +52,7 @@
         return state;
     }
 
-    public String key() {
+    public Key key() {
         return intent.key();
     }
 
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentOperation.java b/core/api/src/main/java/org/onosproject/net/intent/IntentOperation.java
index 7eed841..ef16a69 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentOperation.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentOperation.java
@@ -73,7 +73,12 @@
         return intent.id();
     }
 
-    public String key() {
+    /**
+     * Returns the key for this intent.
+     *
+     * @return key value
+     */
+    public Key key() {
         return intent.key();
     }
 
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentStore.java b/core/api/src/main/java/org/onosproject/net/intent/IntentStore.java
index 55892c3..e5942f1 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentStore.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentStore.java
@@ -92,7 +92,7 @@
      * @param key key
      * @return intent or null if not found
      */
-    default Intent getIntent(String key) { //FIXME remove when impl.
+    default Intent getIntent(Key key) { //FIXME remove when impl.
         return null;
     }
 
@@ -102,7 +102,7 @@
      * @param key key to look up
      * @return intent data object
      */
-    default IntentData getIntentData(String key) { //FIXME remove when impl.
+    default IntentData getIntentData(Key key) { //FIXME remove when impl.
         return null;
     }
 
diff --git a/core/api/src/main/java/org/onosproject/net/intent/Key.java b/core/api/src/main/java/org/onosproject/net/intent/Key.java
index eb3c4f8..44c36e0 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/Key.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/Key.java
@@ -32,7 +32,7 @@
     private final long hash;
     private static final HashFunction HASH_FN = Hashing.md5();
 
-    private Key(long hash) {
+    protected Key(long hash) {
         this.hash = hash;
     }
 
@@ -48,7 +48,7 @@
         return new LongKey(key, appId);
     }
 
-    private final static class StringKey extends Key {
+    private static final class StringKey extends Key {
 
         private final ApplicationId appId;
         private final String key;
@@ -87,7 +87,7 @@
         }
     }
 
-    private final static class LongKey extends Key {
+    private static final class LongKey extends Key {
 
         private final ApplicationId appId;
         private static long key;
diff --git a/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java b/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java
index f519dd4..7de52a5 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java
@@ -75,12 +75,13 @@
      *                                  not more than 1
      */
     public MultiPointToSinglePointIntent(ApplicationId appId,
+                                         Key key,
                                          TrafficSelector selector,
                                          TrafficTreatment treatment,
                                          Set<ConnectPoint> ingressPoints,
                                          ConnectPoint egressPoint,
                                          List<Constraint> constraints) {
-        super(appId, Collections.emptyList(), selector, treatment, constraints);
+        super(appId, key, Collections.emptyList(), selector, treatment, constraints);
 
         checkNotNull(ingressPoints);
         checkArgument(!ingressPoints.isEmpty(), "Ingress point set cannot be empty");
@@ -93,6 +94,30 @@
     }
 
     /**
+     * Creates a new multi-to-single point connectivity intent for the specified
+     * traffic selector and treatment.
+     *
+     * @param appId         application identifier
+     * @param selector      traffic selector
+     * @param treatment     treatment
+     * @param ingressPoints set of ports from which ingress traffic originates
+     * @param egressPoint   port to which traffic will egress
+     * @param constraints   constraints to apply to the intent
+     * @throws NullPointerException     if {@code ingressPoints} or
+     *                                  {@code egressPoint} is null.
+     * @throws IllegalArgumentException if the size of {@code ingressPoints} is
+     *                                  not more than 1
+     */
+    public MultiPointToSinglePointIntent(ApplicationId appId,
+                                         TrafficSelector selector,
+                                         TrafficTreatment treatment,
+                                         Set<ConnectPoint> ingressPoints,
+                                         ConnectPoint egressPoint,
+                                         List<Constraint> constraints) {
+        this(appId, null, selector, treatment, ingressPoints, egressPoint, constraints);
+    }
+
+    /**
      * Constructor for serializer.
      */
     protected MultiPointToSinglePointIntent() {
diff --git a/core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java b/core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java
index 332f430..676b712 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java
@@ -38,11 +38,28 @@
      */
     public OpticalConnectivityIntent(ApplicationId appId,
                                      ConnectPoint src, ConnectPoint dst) {
-        super(appId, Collections.emptyList());
+
+        this(appId, null, src, dst);
+    }
+
+    /**
+     * Creates an optical connectivity intent between the specified
+     * connection points.
+     *
+     * @param appId application identification
+     * @param key intent key
+     * @param src the source transponder port
+     * @param dst the destination transponder port
+     */
+    public OpticalConnectivityIntent(ApplicationId appId,
+                                     Key key,
+                                     ConnectPoint src, ConnectPoint dst) {
+        super(appId, key, Collections.emptyList());
         this.src = src;
         this.dst = dst;
     }
 
+
     /**
      * Constructor for serializer.
      */
diff --git a/core/api/src/main/java/org/onosproject/net/intent/PointToPointIntent.java b/core/api/src/main/java/org/onosproject/net/intent/PointToPointIntent.java
index 31d4337..3312587 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/PointToPointIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/PointToPointIntent.java
@@ -40,6 +40,37 @@
 
     /**
      * Creates a new point-to-point intent with the supplied ingress/egress
+     * ports and constraints.
+     *
+     * @param appId        application identifier
+     * @param key          key of the intent
+     * @param selector     traffic selector
+     * @param treatment    treatment
+     * @param ingressPoint ingress port
+     * @param egressPoint  egress port
+     * @param constraints  optional list of constraints
+     * @throws NullPointerException if {@code ingressPoint} or {@code egressPoints} is null.
+     */
+    public PointToPointIntent(ApplicationId appId,
+                              Key key,
+                              TrafficSelector selector,
+                              TrafficTreatment treatment,
+                              ConnectPoint ingressPoint,
+                              ConnectPoint egressPoint,
+                              List<Constraint> constraints) {
+        super(appId, key, Collections.emptyList(), selector, treatment, constraints);
+
+        checkNotNull(ingressPoint);
+        checkNotNull(egressPoint);
+        checkArgument(!ingressPoint.equals(egressPoint),
+                "ingress and egress should be different (ingress: %s, egress: %s)", ingressPoint, egressPoint);
+
+        this.ingressPoint = ingressPoint;
+        this.egressPoint = egressPoint;
+    }
+
+    /**
+     * Creates a new point-to-point intent with the supplied ingress/egress
      * ports and with built-in link type constraint to avoid optical links.
      *
      * @param appId        application identifier
@@ -53,7 +84,7 @@
                               TrafficTreatment treatment,
                               ConnectPoint ingressPoint,
                               ConnectPoint egressPoint) {
-        this(appId, selector, treatment, ingressPoint, egressPoint,
+        this(appId, null, selector, treatment, ingressPoint, egressPoint,
              ImmutableList.of(new LinkTypeConstraint(false, Link.Type.OPTICAL)));
     }
 
@@ -74,7 +105,7 @@
                               ConnectPoint ingressPoint,
                               ConnectPoint egressPoint,
                               List<Constraint> constraints) {
-        super(appId, Collections.emptyList(), selector, treatment, constraints);
+        super(appId, null, Collections.emptyList(), selector, treatment, constraints);
 
         checkNotNull(ingressPoint);
         checkNotNull(egressPoint);
diff --git a/core/api/src/main/java/org/onosproject/net/intent/SinglePointToMultiPointIntent.java b/core/api/src/main/java/org/onosproject/net/intent/SinglePointToMultiPointIntent.java
index 0de4ba4..03aca96 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/SinglePointToMultiPointIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/SinglePointToMultiPointIntent.java
@@ -54,13 +54,14 @@
     public SinglePointToMultiPointIntent(ApplicationId appId,
             TrafficSelector selector, TrafficTreatment treatment,
             ConnectPoint ingressPoint, Set<ConnectPoint> egressPoints) {
-        this(appId, selector, treatment, ingressPoint, egressPoints, Collections.emptyList());
+        this(appId, null, selector, treatment, ingressPoint, egressPoints, Collections.emptyList());
     }
 
     /**
      * Creates a new single-to-multi point connectivity intent.
      *
      * @param appId application identifier
+     * @param key intent key
      * @param selector traffic selector
      * @param treatment treatment
      * @param ingressPoint port on which traffic will ingress
@@ -72,10 +73,11 @@
      *             not more than 1
      */
     public SinglePointToMultiPointIntent(ApplicationId appId,
+            Key key,
             TrafficSelector selector, TrafficTreatment treatment,
             ConnectPoint ingressPoint, Set<ConnectPoint> egressPoints,
             List<Constraint> constraints) {
-        super(appId, Collections.emptyList(), selector, treatment, constraints);
+        super(appId, key, Collections.emptyList(), selector, treatment, constraints);
         checkNotNull(egressPoints);
         checkNotNull(ingressPoint);
         checkArgument(!egressPoints.isEmpty(), "Egress point set cannot be empty");
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentAccumulator.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentAccumulator.java
index 2a3e68d..e346613 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentAccumulator.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentAccumulator.java
@@ -19,6 +19,7 @@
 import org.onlab.util.AbstractAccumulator;
 import org.onosproject.net.intent.IntentBatchDelegate;
 import org.onosproject.net.intent.IntentData;
+import org.onosproject.net.intent.Key;
 
 import java.util.Collection;
 import java.util.List;
@@ -57,7 +58,7 @@
     }
 
     private Collection<IntentData> reduce(List<IntentData> ops) {
-        Map<String, IntentData> map = Maps.newHashMap();
+        Map<Key, IntentData> map = Maps.newHashMap();
         for (IntentData op : ops) {
             map.put(op.key(), op);
         }
diff --git a/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleIntentStore.java b/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleIntentStore.java
index 4b67421..6658eff 100644
--- a/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleIntentStore.java
+++ b/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleIntentStore.java
@@ -27,6 +27,7 @@
 import org.onosproject.net.intent.IntentEvent;
 import org.onosproject.net.intent.IntentStore;
 import org.onosproject.net.intent.IntentStoreDelegate;
+import org.onosproject.net.intent.Key;
 import org.onosproject.store.AbstractStore;
 import org.slf4j.Logger;
 
@@ -46,8 +47,8 @@
     private final Logger log = getLogger(getClass());
 
     // current state maps FIXME.. make this a IntentData map
-    private final Map<String, IntentData> current = Maps.newConcurrentMap();
-    private final Map<String, IntentData> pending = Maps.newConcurrentMap(); //String is "key"
+    private final Map<Key, IntentData> current = Maps.newConcurrentMap();
+    private final Map<Key, IntentData> pending = Maps.newConcurrentMap(); //String is "key"
 
     @Activate
     public void activate() {
@@ -72,7 +73,7 @@
     }
 
     @Override
-    public IntentData getIntentData(String key) {
+    public IntentData getIntentData(Key key) {
         return current.get(key);
     }