Application manages the IP layer topology information - Interfaces

Change-Id: Ie1dea035674ee98583e98a82cca7e33ab0858b92
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/DefaultInterfaceDescription.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/DefaultInterfaceDescription.java
new file mode 100644
index 0000000..c7e413d
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/DefaultInterfaceDescription.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2014 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.iptopology.api.device;
+
+import com.google.common.base.MoreObjects;
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.Ip4Address;
+import org.onosproject.iptopology.api.InterfaceIdentifier;
+import org.onosproject.net.AbstractDescription;
+import org.onosproject.net.SparseAnnotations;
+
+/**
+ * Default implementation of immutable Interface description.
+ */
+public class DefaultInterfaceDescription extends AbstractDescription
+        implements InterfaceDescription {
+
+    private final InterfaceIdentifier intfId;
+    private final Ip4Address ipv4Address;
+    private final Ip6Address ipv6Address;
+
+
+
+    /**
+     * Creates an interface description using the supplied information.
+     *
+     * @param intfId        interface identifier
+     * @param ipv4Address   ipv4 address of an interface
+     * @param ipv6Address   ipv6 address of an interface
+     * @param annotations   optional key/value annotations map
+     */
+    public DefaultInterfaceDescription(InterfaceIdentifier intfId, Ip4Address ipv4Address,
+                                  Ip6Address ipv6Address, SparseAnnotations...annotations) {
+        super(annotations);
+        this.intfId = intfId;
+        this.ipv4Address = ipv4Address;
+        this.ipv6Address = ipv6Address;
+    }
+
+    /**
+     * Default constructor for serialization.
+     */
+    private DefaultInterfaceDescription() {
+        this.intfId = null;
+        this.ipv4Address = null;
+        this.ipv6Address = null;
+    }
+
+    /**
+     * Creates an interface description using the supplied information.
+     *
+     * @param base        InterfaceDescription to get basic information from
+     * @param annotations optional key/value annotations map
+     */
+    public DefaultInterfaceDescription(InterfaceDescription base,
+                                  SparseAnnotations annotations) {
+        this(base.intfId(), base.ipv4Address(), base.ipv6Address(), annotations);
+    }
+
+    @Override
+    public InterfaceIdentifier intfId() {
+        return intfId;
+    }
+
+    @Override
+    public Ip4Address ipv4Address() {
+        return ipv4Address;
+    }
+
+    @Override
+    public Ip6Address ipv6Address() {
+        return ipv6Address; }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("intfId", intfId)
+                .add("ipv4Address", ipv4Address)
+                .add("ipv6Address", ipv6Address)
+                .add("annotations", annotations())
+                .toString();
+    }
+
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/DefaultIpDeviceDescription.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/DefaultIpDeviceDescription.java
new file mode 100644
index 0000000..889e48a
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/DefaultIpDeviceDescription.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2014-2015 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.iptopology.api.device;
+
+import org.onosproject.iptopology.api.DeviceTed;
+import org.onosproject.iptopology.api.IpDeviceIdentifier;
+import org.onosproject.net.AbstractDescription;
+import org.onosproject.net.SparseAnnotations;
+
+import java.net.URI;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onosproject.iptopology.api.IpDevice.Type;
+
+/**
+ * Default implementation of immutable device description entity.
+ */
+public class DefaultIpDeviceDescription extends AbstractDescription
+        implements IpDeviceDescription {
+    private final URI uri;
+    private final Type type;
+    private final IpDeviceIdentifier deviceIdentifier;
+    private final DeviceTed deviceTed;
+
+    /**
+     * Creates an ip device description using the supplied information.
+     *
+     * @param uri               device URI
+     * @param type              device type
+     * @param deviceIdentifier  device manufacturer
+     * @param deviceTed         device Traffic Engineering parameters
+     * @param annotations  optional key/value annotations map
+     */
+    public DefaultIpDeviceDescription(URI uri, Type type, IpDeviceIdentifier deviceIdentifier,
+                                    DeviceTed deviceTed, SparseAnnotations... annotations) {
+        super(annotations);
+        this.uri = checkNotNull(uri, "Device URI cannot be null");
+        this.type = checkNotNull(type, "Device type cannot be null");
+        this.deviceIdentifier = deviceIdentifier;
+        this.deviceTed = deviceTed;
+    }
+
+    /**
+     * Creates an ip device description using the supplied information.
+     * @param base IpDeviceDescription to basic information
+     * @param annotations Annotations to use.
+     */
+    public DefaultIpDeviceDescription(IpDeviceDescription base, SparseAnnotations... annotations) {
+        this(base.deviceURI(), base.type(), base.deviceIdentifier(),
+             base.deviceTed(), annotations);
+    }
+
+    /**
+     * Creates an ip device description using the supplied information.
+     * @param base IpDeviceDescription to basic information (except for type)
+     * @param type device type
+     * @param annotations Annotations to use.
+     */
+    public DefaultIpDeviceDescription(IpDeviceDescription base, Type type, SparseAnnotations... annotations) {
+        this(base.deviceURI(), type, base.deviceIdentifier(),
+                base.deviceTed(), annotations);
+    }
+
+    @Override
+    public URI deviceURI() {
+        return uri;
+    }
+
+    @Override
+    public Type type() {
+        return type;
+    }
+
+    @Override
+    public IpDeviceIdentifier deviceIdentifier() {
+        return deviceIdentifier;
+    }
+
+    @Override
+    public DeviceTed deviceTed() {
+        return deviceTed;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("uri", uri)
+                .add("type", type)
+                .add("devid", deviceIdentifier)
+                .add("devTed", deviceTed)
+                .toString();
+    }
+
+    /**
+     * Default constructor for serialization.
+     */
+    private DefaultIpDeviceDescription() {
+        this.uri = null;
+        this.type = null;
+        this.deviceIdentifier = null;
+        this.deviceTed = null;
+    }
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/DefaultPrefixDescription.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/DefaultPrefixDescription.java
new file mode 100644
index 0000000..36cc14a
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/DefaultPrefixDescription.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2014 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.iptopology.api.device;
+
+import com.google.common.base.MoreObjects;
+import org.onosproject.iptopology.api.PrefixIdentifier;
+import org.onosproject.iptopology.api.PrefixTed;
+import org.onosproject.net.AbstractDescription;
+import org.onosproject.net.SparseAnnotations;
+
+/**
+ * Default implementation of immutable Prefix description.
+ */
+public class DefaultPrefixDescription extends AbstractDescription
+        implements PrefixDescription {
+
+    private final PrefixIdentifier prefixIdentifier;
+    private final PrefixTed prefixTed;
+
+
+    /**
+     * Creates prefix description using the supplied information.
+     *
+     * @param prefixIdentifier prefix identifier
+     * @param prefixTed        prefix traffic engineering parameters
+     * @param annotations      optional key/value annotations map
+     */
+    public DefaultPrefixDescription(PrefixIdentifier prefixIdentifier, PrefixTed prefixTed,
+                                  SparseAnnotations...annotations) {
+        super(annotations);
+        this.prefixIdentifier = prefixIdentifier;
+        this.prefixTed = prefixTed;
+    }
+
+    /**
+     * Default constructor for serialization.
+     */
+    private DefaultPrefixDescription() {
+        this.prefixIdentifier = null;
+        this.prefixTed = null;
+    }
+
+    /**
+     * Creates prefix description using the supplied information.
+     *
+     * @param base        PrefixDescription to get basic information from
+     * @param annotations optional key/value annotations map
+     */
+    public DefaultPrefixDescription(PrefixDescription base,
+                                  SparseAnnotations annotations) {
+        this(base.prefixIdentifier(), base.prefixTed(), annotations);
+    }
+
+    @Override
+    public PrefixIdentifier prefixIdentifier() {
+        return prefixIdentifier;
+    }
+
+    @Override
+    public PrefixTed prefixTed() {
+        return prefixTed;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("prefixIdentifier", prefixIdentifier)
+                .add("prefixTed", prefixTed)
+                .add("annotations", annotations())
+                .toString();
+    }
+
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/InterfaceDescription.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/InterfaceDescription.java
new file mode 100644
index 0000000..6e7804d
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/InterfaceDescription.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2014 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.iptopology.api.device;
+
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip6Address;
+import org.onosproject.iptopology.api.InterfaceIdentifier;
+import org.onosproject.net.Description;
+
+
+/**
+ * Information about an interface.
+ */
+public interface InterfaceDescription extends Description {
+
+    /**
+     * Returns the IPv4 Address of an interface.
+     *
+     * @return ipv4 address
+     */
+    Ip4Address ipv4Address();
+
+    /**
+     * Returns the IPv6 Address of an interface.
+     *
+     * @return ipv6 address
+     */
+    Ip6Address ipv6Address();
+
+
+    /**
+     * Returns the interface id of the interface.
+     *
+     * @return interface identifier
+     */
+    InterfaceIdentifier intfId();
+
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceDescription.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceDescription.java
new file mode 100644
index 0000000..c0a4391
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceDescription.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2014-2015 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.iptopology.api.device;
+
+import org.onosproject.iptopology.api.DeviceTed;
+import org.onosproject.iptopology.api.IpDevice;
+import org.onosproject.iptopology.api.IpDeviceIdentifier;
+import org.onosproject.net.Description;
+
+
+import java.net.URI;
+
+/**
+ * Carrier of immutable information about an ip device.
+ */
+public interface IpDeviceDescription extends Description {
+
+    /**
+     * Protocol/provider specific URI that can be used to encode the identity
+     * information required to communicate with the ip device externally, e.g.
+     * datapath ID.
+     *
+     * @return provider specific URI for the ip device
+     */
+    URI deviceURI();
+
+    /**
+     * Returns the type of the ip device. For ex: Psuedo or actual
+     *
+     * @return type of the device
+     */
+    IpDevice.Type type();
+
+    /**
+     * Returns the device identifier details.
+     *
+     * @return identifier of the device
+     */
+    IpDeviceIdentifier deviceIdentifier();
+
+    /**
+     * Returns the traffic engineering parameters of the device.
+     *
+     * @return traffic engineering parameters of the device
+     */
+    DeviceTed deviceTed();
+
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceEvent.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceEvent.java
new file mode 100644
index 0000000..07f263e
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceEvent.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2014-2015 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.iptopology.api.device;
+
+import org.joda.time.LocalDateTime;
+import org.onosproject.event.AbstractEvent;
+import org.onosproject.iptopology.api.DeviceIntf;
+import org.onosproject.iptopology.api.DevicePrefix;
+import org.onosproject.iptopology.api.IpDevice;
+
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Describes ip device event.
+ */
+public class IpDeviceEvent extends AbstractEvent<IpDeviceEvent.Type, IpDevice> {
+
+    private final DeviceIntf devInterface;
+    private final DevicePrefix devicePrefix;
+
+    /**
+     * Type of device events.
+     */
+    public enum Type {
+        /**
+         * Signifies that a new device has been detected.
+         */
+        DEVICE_ADDED,
+
+        /**
+         * Signifies that some device attributes have changed; excludes
+         * availability changes.
+         */
+        DEVICE_UPDATED,
+
+        /**
+         * Signifies that a device has been removed.
+         */
+        DEVICE_REMOVED,
+
+        /**
+         * Signifies that an interface has been added.
+         */
+        INTERFACE_ADDED,
+
+        /**
+         * Signifies that an interface has been updated.
+         */
+        INTERFACE_UPDATED,
+
+        /**
+         * Signifies that an interface has been removed.
+         */
+        INTERFACE_REMOVED,
+
+        /**
+         * Signifies that a prefix has been added.
+         */
+        PREFIX_ADDED,
+
+        /**
+         * Signifies that a prefix has been updated.
+         */
+        PREFIX_UPDATED,
+
+        /**
+         * Signifies that a prefix has been removed.
+         */
+        PREFIX_REMOVED,
+
+    }
+
+    /**
+     * Creates an event of a given type and for the specified ip device.
+     *
+     * @param type   device event type
+     * @param device event device subject
+     */
+    public IpDeviceEvent(Type type, IpDevice device) {
+        this(type, device, null, null);
+    }
+
+    /**
+     * Creates an event of a given type and for the specified device and interface.
+     *
+     * @param type   device event type
+     * @param device event device subject
+     * @param devInterface   optional interface subject
+     */
+    public IpDeviceEvent(Type type, IpDevice device, DeviceIntf devInterface) {
+        this(type, device, devInterface, null);
+    }
+
+    /**
+     * Creates an event of a given type and for the specified device and interface.
+     *
+     * @param type   device event type
+     * @param device event device subject
+     * @param devicePrefix   optional prefix subject
+     */
+    public IpDeviceEvent(Type type, IpDevice device, DevicePrefix devicePrefix) {
+        this(type, device, null, devicePrefix);
+    }
+
+
+    /**
+     * Creates an event of a given type and for the specified device, interface and prefix.
+     *
+     * @param type   device event type
+     * @param device event device subject
+     * @param devInterface   optional interface subject
+     * @param devicePrefix   optional prefix subject
+     */
+    public IpDeviceEvent(Type type, IpDevice device, DeviceIntf devInterface,  DevicePrefix devicePrefix) {
+        super(type, device);
+        this.devInterface = devInterface;
+        this.devicePrefix = devicePrefix;
+    }
+
+
+    /**
+     * Creates an event of a given type and for the specified device, interface and time.
+     *
+     * @param type   device event type
+     * @param device event device subject
+     * @param devInterface   optional interface subject
+     * @param devicePrefix   optional prefix subject
+     * @param time   occurrence time
+     */
+
+    public IpDeviceEvent(Type type, IpDevice device, DeviceIntf devInterface,  DevicePrefix devicePrefix, long time) {
+        super(type, device, time);
+        this.devInterface = devInterface;
+        this.devicePrefix = devicePrefix;
+    }
+
+
+    /**
+     * Returns the interface subject.
+     *
+     * @return interface subject or null if the event is not interface specific.
+     */
+    public DeviceIntf deviceInterface() {
+        return devInterface;
+    }
+
+    /**
+     * Returns the prefix subject.
+     *
+     * @return prefix subject or null if the event is not prefix specific.
+     */
+    public DevicePrefix prefix() {
+        return devicePrefix;
+    }
+
+    @Override
+    public String toString() {
+        if (devInterface == null || devicePrefix == null) {
+            return super.toString();
+        }
+        return toStringHelper(this)
+                .add("time", new LocalDateTime(time()))
+                .add("type", type())
+                .add("subject", subject())
+                .add("interface", devInterface)
+                .add("prefix", devicePrefix)
+                .toString();
+     }
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceListener.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceListener.java
new file mode 100644
index 0000000..cd40c40
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceListener.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2014 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.iptopology.api.device;
+
+import org.onosproject.event.EventListener;
+
+/**
+ * Entity capable of receiving ip device related events.
+ */
+public interface IpDeviceListener extends EventListener<IpDeviceEvent> {
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceProvider.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceProvider.java
new file mode 100644
index 0000000..67502eb
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceProvider.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2014 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.iptopology.api.device;
+
+import org.onosproject.net.provider.Provider;
+
+/**
+ * Abstraction of a ip device information provider.
+ */
+public interface IpDeviceProvider extends Provider {
+    // Currently there is none to set some information into the network
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceProviderRegistry.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceProviderRegistry.java
new file mode 100644
index 0000000..74b2741
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceProviderRegistry.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2014 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.iptopology.api.device;
+
+import org.onosproject.net.provider.ProviderRegistry;
+
+/**
+ * Abstraction of a ip device provider registry.
+ */
+public interface IpDeviceProviderRegistry
+        extends ProviderRegistry<IpDeviceProvider, IpDeviceProviderService> {
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceProviderService.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceProviderService.java
new file mode 100644
index 0000000..f84b8b7
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceProviderService.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2014-2015 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.iptopology.api.device;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.provider.ProviderService;
+
+import java.util.List;
+
+/**
+ * Service through which ip device providers can inject ip device information into
+ * the core.
+ */
+public interface IpDeviceProviderService extends ProviderService<IpDeviceProvider> {
+
+    /**
+     * Signals the core that an ip device is added or updated with IP topology information.
+     *
+     * @param deviceId device identifier
+     * @param deviceDescription information about network ip device
+     */
+    void addOrUpdateIpDevice(DeviceId deviceId, IpDeviceDescription deviceDescription);
+
+    /**
+     * Signals the core that an ip device is removed.
+     *
+     * @param deviceId identity of the ip device to be removed
+     */
+    void removeIpDevice(DeviceId deviceId);
+
+    /**
+     * Sends information about all interfaces of a device. It is up to the core to
+     * determine what has changed.
+     *
+     * @param deviceId         identity of the ip device
+     * @param interfaceDescriptions list of device interfaces
+     */
+    void updateInterfaces(DeviceId deviceId, List<InterfaceDescription> interfaceDescriptions);
+
+    /**
+     * signals interfaces of a device is deleted.
+     *
+     * @param deviceId         identity of the ip device
+     * @param interfaceDescriptions list of device interfaces
+     */
+    void removeInterfaces(DeviceId deviceId, List<InterfaceDescription> interfaceDescriptions);
+
+    /**
+     * Sends information about all ip prefix of a device. It is up to the core to
+     * determine what has changed.
+     *
+     * @param deviceId         identity of the ip device
+     * @param prefixDescriptions list of device ip prefixes
+     */
+    void updatePrefixes(DeviceId deviceId, List<PrefixDescription> prefixDescriptions);
+
+    /**
+     * signals ip prefix of a device is deleted.
+     *
+     * @param deviceId         identity of the ip device
+     * @param prefixDescriptions list of device ip prefixes
+     */
+    void removePrefixes(DeviceId deviceId, List<PrefixDescription> prefixDescriptions);
+
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceService.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceService.java
new file mode 100644
index 0000000..4b126eb
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceService.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2014-2015 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.iptopology.api.device;
+
+import org.onosproject.event.ListenerService;
+import org.onosproject.iptopology.api.DeviceIntf;
+import org.onosproject.iptopology.api.DevicePrefix;
+import org.onosproject.iptopology.api.InterfaceIdentifier;
+import org.onosproject.iptopology.api.IpDevice;
+import org.onosproject.net.DeviceId;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip6Address;
+
+import java.util.List;
+
+/**
+ * Service for interacting with the inventory of ip devices.
+ */
+public interface IpDeviceService
+    extends ListenerService<IpDeviceEvent, IpDeviceListener> {
+
+    /**
+     * Returns the number of ip devices known to the system.
+     *
+     * @return number of infrastructure devices
+     */
+    int getIpDeviceCount();
+
+    /**
+     * Returns a collection of the currently known ip
+     * devices.
+     *
+     * @return collection of devices
+     */
+    Iterable<IpDevice> getIpDevices();
+
+    /**
+     * Returns a collection of the currently known ip
+     * devices by device type.
+     *
+     * @param type device type
+     * @return collection of devices
+     */
+    Iterable<IpDevice> getIpDevices(IpDevice.Type type);
+
+
+    /**
+     * Returns the ip device with the specified identifier.
+     *
+     * @param deviceId device identifier
+     * @return device or null if one with the given identifier is not known
+     */
+    IpDevice getIpDevice(DeviceId deviceId);
+
+    /**
+     * Returns the list of interfaces associated with the device.
+     *
+     * @param deviceId device identifier
+     * @return list of device interfaces
+     */
+    List<DeviceIntf> getInterfaces(DeviceId deviceId);
+
+    /**
+     * Returns the interface with the specified ipv4 address and hosted by the given device.
+     *
+     * @param deviceId   device identifier
+     * @param ipv4Address ipv4 address
+     * @return device interface
+     */
+    DeviceIntf getInterface(DeviceId deviceId, Ip4Address ipv4Address);
+
+    /**
+     * Returns the interface with the specified ipv6 address and hosted by the given device.
+     *
+     * @param deviceId   device identifier
+     * @param ipv6Address ipv6 address
+     * @return device interface
+     */
+    DeviceIntf getInterface(DeviceId deviceId, Ip6Address ipv6Address);
+
+    /**
+     * Returns the interface with the specified interface id and hosted by the given device.
+     *
+     * @param deviceId   device identifier
+     * @param intfId interface id
+     * @return device interface
+     */
+    DeviceIntf getInterface(DeviceId deviceId, InterfaceIdentifier intfId);
+
+    /**
+     * Returns the list of ip prefix associated with the device.
+     *
+     * @param deviceId device identifier
+     * @return list of device prefixes
+     */
+    List<DevicePrefix> getPrefixes(DeviceId deviceId);
+
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceStore.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceStore.java
new file mode 100644
index 0000000..db1dd42
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceStore.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2014-2015 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.iptopology.api.device;
+
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip6Address;
+import org.onosproject.iptopology.api.DevicePrefix;
+import org.onosproject.iptopology.api.InterfaceIdentifier;
+import org.onosproject.iptopology.api.IpDevice;
+import org.onosproject.iptopology.api.DeviceIntf;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.store.Store;
+
+import java.util.List;
+
+/**
+ * Manages inventory of ip devices; not intended for direct use.
+ */
+public interface IpDeviceStore extends Store<IpDeviceEvent, IpDeviceStoreDelegate> {
+
+    /**
+     * Returns the number of ip devices known to the system.
+     *
+     * @return number of ip devices
+     */
+    int getIpDeviceCount();
+
+    /**
+     * Returns an iterable collection of all ip devices known to the system.
+     *
+     * @return ip device collection
+     */
+    Iterable<IpDevice> getIpDevices();
+
+
+    /**
+     * Returns an ip device with the specified identifier.
+     *
+     * @param deviceId device identifier
+     * @return ip device
+     */
+    IpDevice getIpDevice(DeviceId deviceId);
+
+    /**
+     * Creates a new infrastructure ip device, or updates an existing one using
+     * the supplied device description.
+     *
+     * @param providerId        provider identifier
+     * @param deviceId          device identifier
+     * @param deviceDescription device description
+     * @return ready to send event describing what occurred; null if no change
+     */
+    IpDeviceEvent createOrUpdateIpDevice(ProviderId providerId, DeviceId deviceId,
+                                     IpDeviceDescription deviceDescription);
+
+    /**
+     * Administratively removes the specified ip device from the store.
+     *
+     * @param deviceId device to be removed
+     * @return null if no such ip device
+     */
+    IpDeviceEvent removeIpDevice(DeviceId deviceId);
+
+    /**
+     * Updates the interface of the specified ip device using the given
+     * list of interface descriptions. The list is assumed to be comprehensive.
+     *
+     * @param providerId            provider identifier
+     * @param deviceId              ip device identifier
+     * @param interfaceDescriptions list of interface descriptions
+     * @return ready to send events describing what occurred; empty list if no change
+     */
+    List<IpDeviceEvent> updateInterfaces(ProviderId providerId, DeviceId deviceId,
+                                  List<InterfaceDescription> interfaceDescriptions);
+
+    /**
+     * Administratively removes the specified interface from the store.
+     *
+     * @param deviceId device of the interfaces to be removed
+     * @param interfaceDescriptions list of interface descriptions
+     * @return ready to send events describing what occurred.
+     */
+    List<IpDeviceEvent> removeInterfaces(DeviceId deviceId, List<InterfaceDescription> interfaceDescriptions);
+
+    /**
+     * Returns the list of interfaces that belong to the specified device.
+     *
+     * @param deviceId device identifier
+     * @return list of device interfaces
+     */
+    List<DeviceIntf> getInterfaces(DeviceId deviceId);
+
+    /**
+     * Returns the specified device interface.
+     *
+     * @param deviceId    device identifier
+     * @param ipv4Address ipv4 address of the interface
+     * @return device interface
+     */
+    DeviceIntf getInterface(DeviceId deviceId, Ip4Address ipv4Address);
+
+    /**
+     * Returns the specified device interface.
+     *
+     * @param deviceId    device identifier
+     * @param ipv6Address ipv6 address of the interface
+     * @return device interface
+     */
+    DeviceIntf getInterface(DeviceId deviceId, Ip6Address ipv6Address);
+
+    /**
+     * Returns the specified device interface.
+     *
+     * @param deviceId    device identifier
+     * @param intfId      interface identifier of the interface
+     * @return device interface
+     */
+    DeviceIntf getInterface(DeviceId deviceId, InterfaceIdentifier intfId);
+
+    /**
+     * Updates the prefix information of the specified ip device using the given
+     * list of prefix descriptions. The list is assumed to be comprehensive.
+     *
+     * @param providerId           provider identifier
+     * @param deviceId             ip device identifier
+     * @param prefixDescriptions   list of prefix descriptions
+     * @return ready to send events describing what occurred; empty list if no change
+     */
+    List<IpDeviceEvent>  updatePrefixes(ProviderId providerId, DeviceId deviceId,
+                                        List<PrefixDescription> prefixDescriptions);
+
+    /**
+     * Administratively removes the specified prefix from the store.
+     *
+     * @param deviceId device of the prefix to be removed
+     * @param prefixDescriptions list of prefix descriptions
+     * @return ready to send events describing what occurred.
+     */
+    List<IpDeviceEvent> removePrefixes(DeviceId deviceId, List<PrefixDescription> prefixDescriptions);
+
+    /**
+     * Returns the list of prefixes that belong to the specified device.
+     *
+     * @param deviceId device identifier
+     * @return list of device prefixes
+     */
+    List<DevicePrefix> getPrefixes(DeviceId deviceId);
+
+}
+
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceStoreDelegate.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceStoreDelegate.java
new file mode 100644
index 0000000..14efe06
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceStoreDelegate.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2014 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.iptopology.api.device;
+
+import org.onosproject.store.StoreDelegate;
+
+/**
+ * Infrastructure ip topology store delegate abstraction.
+ */
+public interface IpDeviceStoreDelegate extends StoreDelegate<IpDeviceEvent> {
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/PrefixDescription.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/PrefixDescription.java
new file mode 100644
index 0000000..eb1ece3
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/PrefixDescription.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2014 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.iptopology.api.device;
+
+import org.onosproject.iptopology.api.PrefixIdentifier;
+import org.onosproject.iptopology.api.PrefixTed;
+import org.onosproject.net.Description;
+
+/**
+ * Information about a prefix.
+ */
+public interface PrefixDescription extends Description {
+
+    /**
+     * Returns the prefix identifier.
+     *
+     * @return prefix identifier
+     */
+    PrefixIdentifier prefixIdentifier();
+
+    /**
+     * Returns the prefix Traffic Engineering parameters.
+     *
+     * @return prefix Traffic Engineering parameters
+     */
+    PrefixTed prefixTed();
+
+}
diff --git a/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/package-info.java b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/package-info.java
new file mode 100644
index 0000000..5e4e29b
--- /dev/null
+++ b/apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2014 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.
+ */
+
+/**
+ * Ip device model &amp; related services API definitions.
+ */
+package org.onosproject.iptopology.api.device;