diff --git a/cli/src/main/java/org/onosproject/cli/net/ResourcesCommand.java b/cli/src/main/java/org/onosproject/cli/net/ResourcesCommand.java
index 1cc0463..0a6e6a4 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ResourcesCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ResourcesCommand.java
@@ -34,6 +34,7 @@
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.PortNumber;
 import org.onosproject.net.TributarySlot;
+import org.onosproject.net.newresource.ContinuousResource;
 import org.onosproject.net.newresource.Resource;
 import org.onosproject.net.newresource.ResourceService;
 
@@ -112,10 +113,10 @@
                 return;
             }
 
-            if (resource instanceof Resource.Continuous) {
+            if (resource instanceof ContinuousResource) {
                 print("%s%s: %f", Strings.repeat(" ", level),
                                   resource.last(),
-                                  ((Resource.Continuous) resource).value());
+                                  ((ContinuousResource) resource).value());
                 // Continuous resource is terminal node, stop here
                 return;
             } else {
@@ -144,7 +145,7 @@
         List<Resource> nonAggregatable = new ArrayList<>();
 
         for (Resource r : children) {
-            if (r instanceof Resource.Continuous) {
+            if (r instanceof ContinuousResource) {
                 // non-aggregatable terminal node
                 nonAggregatable.add(r);
             } else if (aggregatableTypes.contains(r.last().getClass())) {
diff --git a/core/api/src/main/java/org/onosproject/net/newresource/ContinuousResource.java b/core/api/src/main/java/org/onosproject/net/newresource/ContinuousResource.java
new file mode 100644
index 0000000..b0573dc
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/newresource/ContinuousResource.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.newresource;
+
+import com.google.common.annotations.Beta;
+
+import java.util.Objects;
+
+/**
+ * Represents a resource path which specifies a resource which can be measured
+ * as continuous value. Bandwidth of a link is an example of the resource.
+ * <p>
+ * Note: This class is exposed to the public, but intended to be used in the resource API
+ * implementation only. It is not for resource API user.
+ */
+@Beta
+// TODO: consider how to restrict the visibility
+public final class ContinuousResource extends Resource {
+    private final double value;
+
+    ContinuousResource(ResourceId id, double value) {
+        super(id);
+        this.value = value;
+    }
+
+    /**
+     * The user of this methods must receive the return value as Double or double.
+     * Otherwise, this methods throws an exception.
+     *
+     * @param <T> type of the return value
+     * @return the volume of this resource
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public <T> T volume() {
+        return (T) Double.valueOf(value);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id(), value);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || getClass() != obj.getClass()) {
+            return false;
+        }
+        final ContinuousResource other = (ContinuousResource) obj;
+        return Objects.equals(this.id(), other.id())
+                && Objects.equals(this.value, other.value);
+    }
+
+    /**
+     * Returns the value of the resource amount.
+     *
+     * @return the value of the resource amount
+     */
+    // FIXME: overlapping a purpose with volume()
+    public double value() {
+        return value;
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/newresource/ContinuousResourceId.java b/core/api/src/main/java/org/onosproject/net/newresource/ContinuousResourceId.java
new file mode 100644
index 0000000..cd25a92
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/newresource/ContinuousResourceId.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.newresource;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * ResourceId for {@link ContinuousResource}
+ *
+ * Note: This class is exposed to the public, but intended to be used in the resource API
+ * implementation only. It is not for resource API user.
+ */
+@Beta
+// TODO: consider how to restrict the visibility
+public final class ContinuousResourceId extends ResourceId {
+    // for printing purpose only (used in toString() implementation)
+    private final String name;
+
+    ContinuousResourceId(ImmutableList<Object> components, String name) {
+        super(components);
+        this.name = checkNotNull(name);
+    }
+
+    @Override
+    public String toString() {
+        // due to performance consideration, the value might need to be stored in a field
+        return ImmutableList.builder()
+                .addAll(components.subList(0, components.size() - 1))
+                .add(name)
+                .build().toString();
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/newresource/DiscreteResource.java b/core/api/src/main/java/org/onosproject/net/newresource/DiscreteResource.java
new file mode 100644
index 0000000..9efbbd1
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/newresource/DiscreteResource.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.newresource;
+
+import com.google.common.annotations.Beta;
+
+import java.util.Objects;
+
+/**
+ * Represents a resource path which specifies a resource which can be measured
+ * as a discrete unit. A VLAN ID and a MPLS label of a link are examples of the resource.
+ * <p>
+ * Note: This class is exposed to the public, but intended to be used in the resource API
+ * implementation only. It is not for resource API user.
+ * </p>
+ */
+@Beta
+// TODO: consider how to restrict the visibility
+public final class DiscreteResource extends Resource {
+    protected DiscreteResource() {
+        super();
+    }
+
+    DiscreteResource(ResourceId id) {
+        super(id);
+    }
+
+    /**
+     * The user of this methods must receive the return value as the correct type.
+     * Otherwise, this methods throws an exception.
+     *
+     * @param <T> type of the return value
+     * @return the volume of this resource
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    // TODO: consider receiving Class<T> as an argument. Which approach is convenient?
+    public <T> T volume() {
+        return (T) last();
+    }
+
+    @Override
+    public int hashCode() {
+        // the value returing from volume() is excluded due to optimization
+        return id().hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || getClass() != obj.getClass()) {
+            return false;
+        }
+        final DiscreteResource other = (DiscreteResource) obj;
+        // the value returing from volume() is excluded due to optimization
+        return Objects.equals(this.id(), other.id());
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/newresource/DiscreteResourceId.java b/core/api/src/main/java/org/onosproject/net/newresource/DiscreteResourceId.java
new file mode 100644
index 0000000..cf9d334
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/newresource/DiscreteResourceId.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.newresource;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+
+/**
+ * ResourceId for {@link DiscreteResource}.
+ *
+ * Note: This class is exposed to the public, but intended to be used in the resource API
+ * implementation only. It is not for resource API user.
+ */
+@Beta
+// TODO: consider how to restrict the visibility
+public final class DiscreteResourceId extends ResourceId {
+    DiscreteResourceId(ImmutableList<Object> components) {
+        super(components);
+    }
+
+    DiscreteResourceId() {
+        super();
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/newresource/Resource.java b/core/api/src/main/java/org/onosproject/net/newresource/Resource.java
index 1b05d94..1dadcc2 100644
--- a/core/api/src/main/java/org/onosproject/net/newresource/Resource.java
+++ b/core/api/src/main/java/org/onosproject/net/newresource/Resource.java
@@ -21,7 +21,6 @@
 import org.onosproject.net.PortNumber;
 
 import java.util.List;
-import java.util.Objects;
 import java.util.Optional;
 
 import static com.google.common.base.Preconditions.checkArgument;
@@ -47,13 +46,13 @@
 @Beta
 public abstract class Resource {
 
-    private final Discrete parent;
+    private final DiscreteResource parent;
     private final ResourceId id;
 
-    public static final Discrete ROOT = new Discrete();
+    public static final DiscreteResource ROOT = new DiscreteResource();
 
     public static Resource discrete(DeviceId device) {
-        return new Discrete(ResourceId.discrete(device));
+        return new DiscreteResource(ResourceId.discrete(device));
     }
 
     /**
@@ -64,7 +63,7 @@
      * @return resource path instance
      */
     public static Resource discrete(DeviceId device, Object... components) {
-        return new Discrete(ResourceId.discrete(device, components));
+        return new DiscreteResource(ResourceId.discrete(device, components));
     }
 
     /**
@@ -76,7 +75,7 @@
      * @return resource path instance
      */
     public static Resource discrete(DeviceId device, PortNumber port, Object... components) {
-        return new Discrete(ResourceId.discrete(device, port, components));
+        return new DiscreteResource(ResourceId.discrete(device, port, components));
     }
 
     /**
@@ -93,7 +92,7 @@
         checkArgument(components.length > 0,
                 "Length of components must be greater thant 0, but " + components.length);
 
-        return new Continuous(ResourceId.continuous(device, components), value);
+        return new ContinuousResource(ResourceId.continuous(device, components), value);
     }
 
     /**
@@ -108,7 +107,7 @@
      * @return resource path instance
      */
     public static Resource continuous(double value, DeviceId device, PortNumber port, Object... components) {
-        return new Continuous(ResourceId.continuous(device, port, components), value);
+        return new ContinuousResource(ResourceId.continuous(device, port, components), value);
     }
 
     /**
@@ -123,12 +122,12 @@
         if (id.components.size() == 1) {
             this.parent = ROOT;
         } else {
-            this.parent = new Discrete(id.parent());
+            this.parent = new DiscreteResource(id.parent());
         }
     }
 
     // for serialization
-    private Resource() {
+    protected Resource() {
         this.parent = null;
         this.id = ResourceId.ROOT;
     }
@@ -157,7 +156,7 @@
      * @return the parent resource path of this instance.
      * If there is no parent, empty instance will be returned.
      */
-    public Optional<Discrete> parent() {
+    public Optional<DiscreteResource> parent() {
         return Optional.ofNullable(parent);
     }
 
@@ -169,9 +168,9 @@
      * @return a child resource path
      */
     public Resource child(Object child) {
-        checkState(this instanceof Discrete);
+        checkState(this instanceof DiscreteResource);
 
-        return new Discrete(id().child(child));
+        return new DiscreteResource(id().child(child));
     }
 
     /**
@@ -183,9 +182,9 @@
      * @return a child resource path
      */
     public Resource child(Object child, double value) {
-        checkState(this instanceof Discrete);
+        checkState(this instanceof DiscreteResource);
 
-        return new Continuous(id.child(child), value);
+        return new ContinuousResource(id.child(child), value);
     }
 
     /**
@@ -218,114 +217,4 @@
                 .toString();
     }
 
-    /**
-     * Represents a resource path which specifies a resource which can be measured
-     * as a discrete unit. A VLAN ID and a MPLS label of a link are examples of the resource.
-     * <p>
-     * Note: This class is exposed to the public, but intended to be used in the resource API
-     * implementation only. It is not for resource API user.
-     * </p>
-     */
-    @Beta
-    public static final class Discrete extends Resource {
-        private Discrete() {
-            super();
-        }
-
-        private Discrete(ResourceId id) {
-            super(id);
-        }
-
-        /**
-         * The user of this methods must receive the return value as the correct type.
-         * Otherwise, this methods throws an exception.
-         *
-         * @param <T> type of the return value
-         * @return the volume of this resource
-         */
-        @SuppressWarnings("unchecked")
-        @Override
-        // TODO: consider receiving Class<T> as an argument. Which approach is convenient?
-        public <T> T volume() {
-            return (T) last();
-        }
-
-        @Override
-        public int hashCode() {
-            // the value returing from volume() is excluded due to optimization
-            return id().hashCode();
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj == null || getClass() != obj.getClass()) {
-                return false;
-            }
-            final Discrete other = (Discrete) obj;
-            // the value returing from volume() is excluded due to optimization
-            return Objects.equals(this.id(), other.id());
-        }
-    }
-
-    /**
-     * Represents a resource path which specifies a resource which can be measured
-     * as continuous value. Bandwidth of a link is an example of the resource.
-     * <p>
-     * Note: This class is exposed to the public, but intended to be used in the resource API
-     * implementation only. It is not for resource API user.
-     */
-    @Beta
-    public static final class Continuous extends Resource {
-        private final double value;
-
-        private Continuous(ResourceId id, double value) {
-            super(id);
-            this.value = value;
-        }
-
-        /**
-         * The user of this methods must receive the return value as Double or double.
-         * Otherwise, this methods throws an exception.
-         *
-         * @param <T> type of the return value
-         * @return the volume of this resource
-         */
-        @SuppressWarnings("unchecked")
-        @Override
-        public <T> T volume() {
-            return (T) Double.valueOf(value);
-        }
-
-        @Override
-        public int hashCode() {
-            return Objects.hash(id(), value);
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj == null || getClass() != obj.getClass()) {
-                return false;
-            }
-            final Continuous other = (Continuous) obj;
-            return Objects.equals(this.id(), other.id())
-                    && Objects.equals(this.value, other.value);
-        }
-
-        /**
-         * Returns the value of the resource amount.
-         *
-         * @return the value of the resource amount
-         */
-        // FIXME: overlapping a purpose with volume()
-        public double value() {
-            return value;
-        }
-    }
-
 }
diff --git a/core/api/src/main/java/org/onosproject/net/newresource/ResourceId.java b/core/api/src/main/java/org/onosproject/net/newresource/ResourceId.java
index 1be737e..93c4472 100644
--- a/core/api/src/main/java/org/onosproject/net/newresource/ResourceId.java
+++ b/core/api/src/main/java/org/onosproject/net/newresource/ResourceId.java
@@ -33,19 +33,19 @@
  */
 @Beta
 public abstract class ResourceId {
-    static final ResourceId ROOT = new Discrete();
+    static final ResourceId ROOT = new DiscreteResourceId();
 
     final ImmutableList<Object> components;
 
     static ResourceId discrete(DeviceId device, Object... components) {
-        return new Discrete(ImmutableList.builder()
+        return new DiscreteResourceId(ImmutableList.builder()
                 .add(device)
                 .add(components)
                 .build());
     }
 
     static ResourceId discrete(DeviceId device, PortNumber port, Object... components) {
-        return new Discrete(ImmutableList.builder()
+        return new DiscreteResourceId(ImmutableList.builder()
                 .add(device)
                 .add(port)
                 .add(components)
@@ -72,17 +72,17 @@
     }
 
     private static ResourceId continuous(ImmutableList.Builder<Object> parentComponents, Class<?> last) {
-        return new Continuous(parentComponents
+        return new ContinuousResourceId(parentComponents
                 .add(last.getCanonicalName())
                 .build(), last.getSimpleName());
     }
 
-    private ResourceId(ImmutableList<Object> components) {
+    protected ResourceId(ImmutableList<Object> components) {
         this.components = checkNotNull(components);
     }
 
     // for serializer
-    private ResourceId() {
+    protected ResourceId() {
         this.components = ImmutableList.of();
     }
 
@@ -91,27 +91,27 @@
         if (components.size() == 1) {
             return ROOT;
         } else {
-            return new Discrete(components.subList(0, components.size() - 1));
+            return new DiscreteResourceId(components.subList(0, components.size() - 1));
         }
     }
 
     /**
      * Returns a resource ID of a child of this resource based on the specified object.
      * If the argument is an instance of {@link Class}, this method returns an instance of
-     * {@link Continuous}. Otherwise, it returns an instance of {@link Discrete}
-     * This method only work when the receiver is {@link Discrete}. Otherwise,
+     * {@link ContinuousResourceId}. Otherwise, it returns an instance of {@link DiscreteResourceId}
+     * This method only work when the receiver is {@link DiscreteResourceId}. Otherwise,
      * this method throws an exception.
      *
      * @param child the last component of the child
      * @return a child resource ID
      */
     public ResourceId child(Object child) {
-        checkState(this instanceof Discrete);
+        checkState(this instanceof DiscreteResourceId);
 
         if (child instanceof Class<?>) {
             return continuous(ImmutableList.builder().addAll(components), (Class<?>) child);
         } else {
-            return new Discrete(ImmutableList.builder()
+            return new DiscreteResourceId(ImmutableList.builder()
                     .addAll(components)
                     .add(child)
                     .build());
@@ -140,44 +140,4 @@
         return components.toString();
     }
 
-    /**
-     * ResourceId for {@link Resource.Discrete}.
-     *
-     * Note: This class is exposed to the public, but intended to be used in the resource API
-     * implementation only. It is not for resource API user.
-     */
-    public static final class Discrete extends ResourceId {
-        private Discrete(ImmutableList<Object> components) {
-            super(components);
-        }
-
-        private Discrete() {
-            super();
-        }
-    }
-
-    /**
-     * ResourceId for {@link Resource.Continuous}
-     *
-     * Note: This class is exposed to the public, but intended to be used in the resource API
-     * implementation only. It is not for resource API user.
-     */
-    public static final class Continuous extends ResourceId {
-        // for printing purpose only (used in toString() implementation)
-        private final String name;
-
-        private Continuous(ImmutableList<Object> components, String name) {
-            super(components);
-            this.name = checkNotNull(name);
-        }
-
-        @Override
-        public String toString() {
-            // due to performance consideration, the value might need to be stored in a field
-            return ImmutableList.builder()
-                    .addAll(components.subList(0, components.size() - 1))
-                    .add(name)
-                    .build().toString();
-        }
-    }
 }
diff --git a/core/store/dist/src/main/java/org/onosproject/store/newresource/impl/ConsistentResourceStore.java b/core/store/dist/src/main/java/org/onosproject/store/newresource/impl/ConsistentResourceStore.java
index bc72cf7..758b933 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/newresource/impl/ConsistentResourceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/newresource/impl/ConsistentResourceStore.java
@@ -25,6 +25,8 @@
 import org.apache.felix.scr.annotations.Service;
 import org.onlab.util.GuavaCollectors;
 import org.onlab.util.Tools;
+import org.onosproject.net.newresource.ContinuousResource;
+import org.onosproject.net.newresource.DiscreteResource;
 import org.onosproject.net.newresource.ResourceAllocation;
 import org.onosproject.net.newresource.ResourceConsumer;
 import org.onosproject.net.newresource.ResourceEvent;
@@ -83,13 +85,13 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected StorageService service;
 
-    private ConsistentMap<Resource.Discrete, ResourceConsumer> discreteConsumers;
+    private ConsistentMap<DiscreteResource, ResourceConsumer> discreteConsumers;
     private ConsistentMap<ResourceId, ContinuousResourceAllocation> continuousConsumers;
-    private ConsistentMap<Resource.Discrete, Set<Resource>> childMap;
+    private ConsistentMap<DiscreteResource, Set<Resource>> childMap;
 
     @Activate
     public void activate() {
-        discreteConsumers = service.<Resource.Discrete, ResourceConsumer>consistentMapBuilder()
+        discreteConsumers = service.<DiscreteResource, ResourceConsumer>consistentMapBuilder()
                 .withName(DISCRETE_CONSUMER_MAP)
                 .withSerializer(SERIALIZER)
                 .build();
@@ -97,7 +99,7 @@
                 .withName(CONTINUOUS_CONSUMER_MAP)
                 .withSerializer(SERIALIZER)
                 .build();
-        childMap = service.<Resource.Discrete, Set<Resource>>consistentMapBuilder()
+        childMap = service.<DiscreteResource, Set<Resource>>consistentMapBuilder()
                 .withName(CHILD_MAP)
                 .withSerializer(SERIALIZER)
                 .build();
@@ -110,16 +112,16 @@
     @Override
     public List<ResourceConsumer> getConsumers(Resource resource) {
         checkNotNull(resource);
-        checkArgument(resource instanceof Resource.Discrete || resource instanceof Resource.Continuous);
+        checkArgument(resource instanceof DiscreteResource || resource instanceof ContinuousResource);
 
-        if (resource instanceof Resource.Discrete) {
-            return getConsumer((Resource.Discrete) resource);
+        if (resource instanceof DiscreteResource) {
+            return getConsumer((DiscreteResource) resource);
         } else {
-            return getConsumer((Resource.Continuous) resource);
+            return getConsumer((ContinuousResource) resource);
         }
     }
 
-    private List<ResourceConsumer> getConsumer(Resource.Discrete resource) {
+    private List<ResourceConsumer> getConsumer(DiscreteResource resource) {
         Versioned<ResourceConsumer> consumer = discreteConsumers.get(resource);
         if (consumer == null) {
             return ImmutableList.of();
@@ -128,7 +130,7 @@
         return ImmutableList.of(consumer.value());
     }
 
-    private List<ResourceConsumer> getConsumer(Resource.Continuous resource) {
+    private List<ResourceConsumer> getConsumer(ContinuousResource resource) {
         Versioned<ContinuousResourceAllocation> allocations = continuousConsumers.get(resource.id());
         if (allocations == null) {
             return ImmutableList.of();
@@ -150,15 +152,15 @@
         TransactionContext tx = service.transactionContextBuilder().build();
         tx.begin();
 
-        TransactionalMap<Resource.Discrete, Set<Resource>> childTxMap =
+        TransactionalMap<DiscreteResource, Set<Resource>> childTxMap =
                 tx.getTransactionalMap(CHILD_MAP, SERIALIZER);
 
-        Map<Resource.Discrete, List<Resource>> resourceMap = resources.stream()
+        Map<DiscreteResource, List<Resource>> resourceMap = resources.stream()
                 .filter(x -> x.parent().isPresent())
                 .collect(Collectors.groupingBy(x -> x.parent().get()));
 
-        for (Map.Entry<Resource.Discrete, List<Resource>> entry: resourceMap.entrySet()) {
-            Optional<Resource.Discrete> child = lookup(childTxMap, entry.getKey());
+        for (Map.Entry<DiscreteResource, List<Resource>> entry: resourceMap.entrySet()) {
+            Optional<DiscreteResource> child = lookup(childTxMap, entry.getKey());
             if (!child.isPresent()) {
                 return abortTransaction(tx);
             }
@@ -186,25 +188,25 @@
         TransactionContext tx = service.transactionContextBuilder().build();
         tx.begin();
 
-        TransactionalMap<Resource.Discrete, Set<Resource>> childTxMap =
+        TransactionalMap<DiscreteResource, Set<Resource>> childTxMap =
                 tx.getTransactionalMap(CHILD_MAP, SERIALIZER);
-        TransactionalMap<Resource.Discrete, ResourceConsumer> discreteConsumerTxMap =
+        TransactionalMap<DiscreteResource, ResourceConsumer> discreteConsumerTxMap =
                 tx.getTransactionalMap(DISCRETE_CONSUMER_MAP, SERIALIZER);
         TransactionalMap<ResourceId, ContinuousResourceAllocation> continuousConsumerTxMap =
                 tx.getTransactionalMap(CONTINUOUS_CONSUMER_MAP, SERIALIZER);
 
         // Extract Discrete instances from resources
-        Map<Resource.Discrete, List<Resource>> resourceMap = resources.stream()
+        Map<DiscreteResource, List<Resource>> resourceMap = resources.stream()
                 .filter(x -> x.parent().isPresent())
                 .collect(Collectors.groupingBy(x -> x.parent().get()));
 
         // even if one of the resources is allocated to a consumer,
         // all unregistrations are regarded as failure
-        for (Map.Entry<Resource.Discrete, List<Resource>> entry: resourceMap.entrySet()) {
+        for (Map.Entry<DiscreteResource, List<Resource>> entry: resourceMap.entrySet()) {
             boolean allocated = entry.getValue().stream().anyMatch(x -> {
-                if (x instanceof Resource.Discrete) {
-                    return discreteConsumerTxMap.get((Resource.Discrete) x) != null;
-                } else if (x instanceof Resource.Continuous) {
+                if (x instanceof DiscreteResource) {
+                    return discreteConsumerTxMap.get((DiscreteResource) x) != null;
+                } else if (x instanceof ContinuousResource) {
                     ContinuousResourceAllocation allocations = continuousConsumerTxMap.get(x.id());
                     return allocations != null && !allocations.allocations().isEmpty();
                 } else {
@@ -239,31 +241,31 @@
         TransactionContext tx = service.transactionContextBuilder().build();
         tx.begin();
 
-        TransactionalMap<Resource.Discrete, Set<Resource>> childTxMap =
+        TransactionalMap<DiscreteResource, Set<Resource>> childTxMap =
                 tx.getTransactionalMap(CHILD_MAP, SERIALIZER);
-        TransactionalMap<Resource.Discrete, ResourceConsumer> discreteConsumerTxMap =
+        TransactionalMap<DiscreteResource, ResourceConsumer> discreteConsumerTxMap =
                 tx.getTransactionalMap(DISCRETE_CONSUMER_MAP, SERIALIZER);
         TransactionalMap<ResourceId, ContinuousResourceAllocation> continuousConsumerTxMap =
                 tx.getTransactionalMap(CONTINUOUS_CONSUMER_MAP, SERIALIZER);
 
         for (Resource resource: resources) {
-            if (resource instanceof Resource.Discrete) {
+            if (resource instanceof DiscreteResource) {
                 if (!lookup(childTxMap, resource).isPresent()) {
                     return abortTransaction(tx);
                 }
 
-                ResourceConsumer oldValue = discreteConsumerTxMap.put((Resource.Discrete) resource, consumer);
+                ResourceConsumer oldValue = discreteConsumerTxMap.put((DiscreteResource) resource, consumer);
                 if (oldValue != null) {
                     return abortTransaction(tx);
                 }
-            } else if (resource instanceof Resource.Continuous) {
-                Optional<Resource.Continuous> continuous = lookup(childTxMap, (Resource.Continuous) resource);
+            } else if (resource instanceof ContinuousResource) {
+                Optional<ContinuousResource> continuous = lookup(childTxMap, (ContinuousResource) resource);
                 if (!continuous.isPresent()) {
                     return abortTransaction(tx);
                 }
 
                 ContinuousResourceAllocation allocations = continuousConsumerTxMap.get(continuous.get().id());
-                if (!hasEnoughResource(continuous.get(), (Resource.Continuous) resource, allocations)) {
+                if (!hasEnoughResource(continuous.get(), (ContinuousResource) resource, allocations)) {
                     return abortTransaction(tx);
                 }
 
@@ -287,7 +289,7 @@
         TransactionContext tx = service.transactionContextBuilder().build();
         tx.begin();
 
-        TransactionalMap<Resource.Discrete, ResourceConsumer> discreteConsumerTxMap =
+        TransactionalMap<DiscreteResource, ResourceConsumer> discreteConsumerTxMap =
                 tx.getTransactionalMap(DISCRETE_CONSUMER_MAP, SERIALIZER);
         TransactionalMap<ResourceId, ContinuousResourceAllocation> continuousConsumerTxMap =
                 tx.getTransactionalMap(CONTINUOUS_CONSUMER_MAP, SERIALIZER);
@@ -298,18 +300,18 @@
             Resource resource = resourceIte.next();
             ResourceConsumer consumer = consumerIte.next();
 
-            if (resource instanceof Resource.Discrete) {
+            if (resource instanceof DiscreteResource) {
                 // if this single release fails (because the resource is allocated to another consumer,
                 // the whole release fails
-                if (!discreteConsumerTxMap.remove((Resource.Discrete) resource, consumer)) {
+                if (!discreteConsumerTxMap.remove((DiscreteResource) resource, consumer)) {
                     return abortTransaction(tx);
                 }
-            } else if (resource instanceof Resource.Continuous) {
-                Resource.Continuous continuous = (Resource.Continuous) resource;
+            } else if (resource instanceof ContinuousResource) {
+                ContinuousResource continuous = (ContinuousResource) resource;
                 ContinuousResourceAllocation allocation = continuousConsumerTxMap.get(continuous.id());
                 ImmutableList<ResourceAllocation> newAllocations = allocation.allocations().stream()
                         .filter(x -> !(x.consumer().equals(consumer) &&
-                                ((Resource.Continuous) x.resource()).value() == continuous.value()))
+                                ((ContinuousResource) x.resource()).value() == continuous.value()))
                         .collect(GuavaCollectors.toImmutableList());
 
                 if (!continuousConsumerTxMap.replace(continuous.id(), allocation,
@@ -325,7 +327,7 @@
     @Override
     public boolean isAvailable(Resource resource) {
         checkNotNull(resource);
-        checkArgument(resource instanceof Resource.Discrete || resource instanceof Resource.Continuous);
+        checkArgument(resource instanceof DiscreteResource || resource instanceof ContinuousResource);
 
         // check if it's registered or not.
         Versioned<Set<Resource>> v = childMap.get(resource.parent().get());
@@ -333,15 +335,15 @@
             return false;
         }
 
-        if (resource instanceof Resource.Discrete) {
+        if (resource instanceof DiscreteResource) {
             // check if already consumed
-            return getConsumer((Resource.Discrete) resource).isEmpty();
+            return getConsumer((DiscreteResource) resource).isEmpty();
         } else {
-            Resource.Continuous requested = (Resource.Continuous) resource;
-            Resource.Continuous registered = v.value().stream()
+            ContinuousResource requested = (ContinuousResource) resource;
+            ContinuousResource registered = v.value().stream()
                     .filter(c -> c.id().equals(resource.id()))
                     .findFirst()
-                    .map(c -> (Resource.Continuous) c)
+                    .map(c -> (ContinuousResource) c)
                     .get();
             if (registered.value() < requested.value()) {
                 // Capacity < requested, can never satisfy
@@ -352,7 +354,7 @@
         }
     }
 
-    private boolean isAvailable(Resource.Continuous resource) {
+    private boolean isAvailable(ContinuousResource resource) {
         Versioned<ContinuousResourceAllocation> allocation = continuousConsumers.get(resource.id());
         if (allocation == null) {
             // no allocation (=no consumer) full registered resources available
@@ -368,11 +370,11 @@
 
         // NOTE: getting all entries may become performance bottleneck
         // TODO: revisit for better backend data structure
-        Stream<Resource.Discrete> discreteStream = discreteConsumers.entrySet().stream()
+        Stream<DiscreteResource> discreteStream = discreteConsumers.entrySet().stream()
                 .filter(x -> x.getValue().value().equals(consumer))
                 .map(Map.Entry::getKey);
 
-        Stream<Resource.Continuous> continuousStream = continuousConsumers.values().stream()
+        Stream<ContinuousResource> continuousStream = continuousConsumers.values().stream()
                 .flatMap(x -> x.value().allocations().stream()
                         .map(y -> Maps.immutableEntry(x.value().original(), y)))
                 .filter(x -> x.getValue().consumer().equals(consumer))
@@ -384,12 +386,12 @@
     @Override
     public Collection<Resource> getChildResources(Resource parent) {
         checkNotNull(parent);
-        if (!(parent instanceof Resource.Discrete)) {
+        if (!(parent instanceof DiscreteResource)) {
             // only Discrete resource can have child resource
             return ImmutableList.of();
         }
 
-        Versioned<Set<Resource>> children = childMap.get((Resource.Discrete) parent);
+        Versioned<Set<Resource>> children = childMap.get((DiscreteResource) parent);
         if (children == null) {
             return ImmutableList.of();
         }
@@ -401,23 +403,23 @@
     public <T> Collection<Resource> getAllocatedResources(Resource parent, Class<T> cls) {
         checkNotNull(parent);
         checkNotNull(cls);
-        checkArgument(parent instanceof Resource.Discrete);
+        checkArgument(parent instanceof DiscreteResource);
 
-        Versioned<Set<Resource>> children = childMap.get((Resource.Discrete) parent);
+        Versioned<Set<Resource>> children = childMap.get((DiscreteResource) parent);
         if (children == null) {
             return ImmutableList.of();
         }
 
-        Stream<Resource.Discrete> discrete = children.value().stream()
+        Stream<DiscreteResource> discrete = children.value().stream()
                 .filter(x -> x.last().getClass().equals(cls))
-                .filter(x -> x instanceof Resource.Discrete)
-                .map(x -> (Resource.Discrete) x)
+                .filter(x -> x instanceof DiscreteResource)
+                .map(x -> (DiscreteResource) x)
                 .filter(discreteConsumers::containsKey);
 
-        Stream<Resource.Continuous> continuous = children.value().stream()
+        Stream<ContinuousResource> continuous = children.value().stream()
                 .filter(x -> x.id().equals(parent.id().child(cls)))
-                .filter(x -> x instanceof Resource.Continuous)
-                .map(x -> (Resource.Continuous) x)
+                .filter(x -> x instanceof ContinuousResource)
+                .map(x -> (ContinuousResource) x)
                 .filter(x -> continuousConsumers.containsKey(x.id()))
                 .filter(x -> continuousConsumers.get(x.id()) != null)
                 .filter(x -> !continuousConsumers.get(x.id()).value().allocations().isEmpty());
@@ -438,7 +440,7 @@
 
     // Appends the specified ResourceAllocation to the existing values stored in the map
     private boolean appendValue(TransactionalMap<ResourceId, ContinuousResourceAllocation> map,
-                                Resource.Continuous original, ResourceAllocation value) {
+                                ContinuousResource original, ResourceAllocation value) {
         ContinuousResourceAllocation oldValue = map.putIfAbsent(original.id(),
                 new ContinuousResourceAllocation(original, ImmutableList.of(value)));
         if (oldValue == null) {
@@ -521,7 +523,7 @@
      */
     // Naive implementation, which traverses all elements in the list
     private <T extends Resource> Optional<T> lookup(
-            TransactionalMap<Resource.Discrete, Set<Resource>> map, T resource) {
+            TransactionalMap<DiscreteResource, Set<Resource>> map, T resource) {
         // if it is root, always returns itself
         if (!resource.parent().isPresent()) {
             return Optional.of(resource);
@@ -549,17 +551,17 @@
      * @param allocation current allocation of the resource
      * @return true if there is enough resource volume. Otherwise, false.
      */
-    private boolean hasEnoughResource(Resource.Continuous original,
-                                      Resource.Continuous request,
+    private boolean hasEnoughResource(ContinuousResource original,
+                                      ContinuousResource request,
                                       ContinuousResourceAllocation allocation) {
         if (allocation == null) {
             return request.value() <= original.value();
         }
 
         double allocated = allocation.allocations().stream()
-                .filter(x -> x.resource() instanceof Resource.Continuous)
-                .map(x -> (Resource.Continuous) x.resource())
-                .mapToDouble(Resource.Continuous::value)
+                .filter(x -> x.resource() instanceof ContinuousResource)
+                .map(x -> (ContinuousResource) x.resource())
+                .mapToDouble(ContinuousResource::value)
                 .sum();
         double left = original.value() - allocated;
         return request.value() <= left;
@@ -567,16 +569,16 @@
 
     // internal use only
     private static final class ContinuousResourceAllocation {
-        private final Resource.Continuous original;
+        private final ContinuousResource original;
         private final ImmutableList<ResourceAllocation> allocations;
 
-        private ContinuousResourceAllocation(Resource.Continuous original,
+        private ContinuousResourceAllocation(ContinuousResource original,
                                              ImmutableList<ResourceAllocation> allocations) {
             this.original = original;
             this.allocations = allocations;
         }
 
-        private Resource.Continuous original() {
+        private ContinuousResource original() {
             return original;
         }
 
diff --git a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
index 592350f..21f78c9 100644
--- a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
+++ b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
@@ -172,6 +172,10 @@
 import org.onosproject.net.intent.constraint.WaypointConstraint;
 import org.onosproject.net.link.DefaultLinkDescription;
 import org.onosproject.net.meter.MeterId;
+import org.onosproject.net.newresource.ContinuousResource;
+import org.onosproject.net.newresource.ContinuousResourceId;
+import org.onosproject.net.newresource.DiscreteResource;
+import org.onosproject.net.newresource.DiscreteResourceId;
 import org.onosproject.net.newresource.ResourceAllocation;
 import org.onosproject.net.newresource.ResourceId;
 import org.onosproject.net.newresource.Resource;
@@ -434,11 +438,11 @@
                     BandwidthResourceAllocation.class,
                     LambdaResourceAllocation.class,
                     Resource.class,
-                    Resource.Discrete.class,
-                    Resource.Continuous.class,
+                    DiscreteResource.class,
+                    ContinuousResource.class,
                     ResourceId.class,
-                    ResourceId.Discrete.class,
-                    ResourceId.Continuous.class,
+                    DiscreteResourceId.class,
+                    ContinuousResourceId.class,
                     ResourceAllocation.class,
                     // Constraints
                     LambdaConstraint.class,
