Added config app to read address config from json file
diff --git a/apps/config/pom.xml b/apps/config/pom.xml
new file mode 100644
index 0000000..9a2d540
--- /dev/null
+++ b/apps/config/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onlab.onos</groupId>
+        <artifactId>onos-apps</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-app-config</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>ONOS simple network configuration reader</description>
+
+    <dependencies>
+      <dependency>
+	<groupId>org.codehaus.jackson</groupId>
+	<artifactId>jackson-core-asl</artifactId>
+      </dependency>
+      <dependency>
+	<groupId>org.codehaus.jackson</groupId>
+	<artifactId>jackson-mapper-asl</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>com.fasterxml.jackson.core</groupId>
+        <artifactId>jackson-annotations</artifactId>
+        <version>2.4.2</version>
+        <scope>provided</scope>
+      </dependency>
+    </dependencies> 
+
+</project>
diff --git a/apps/config/src/main/java/org/onlab/onos/config/AddressConfiguration.java b/apps/config/src/main/java/org/onlab/onos/config/AddressConfiguration.java
new file mode 100644
index 0000000..580e950
--- /dev/null
+++ b/apps/config/src/main/java/org/onlab/onos/config/AddressConfiguration.java
@@ -0,0 +1,34 @@
+package org.onlab.onos.config;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * Object to store address configuration read from a JSON file.
+ */
+public class AddressConfiguration {
+
+    private List<AddressEntry> addresses;
+
+    /**
+     * Gets a list of addresses in the system.
+     *
+     * @return the list of addresses
+     */
+    public List<AddressEntry> getAddresses() {
+        return Collections.unmodifiableList(addresses);
+    }
+
+    /**
+     * Sets a list of addresses in the system.
+     *
+     * @param addresses the list of addresses
+     */
+    @JsonProperty("addresses")
+    public void setAddresses(List<AddressEntry> addresses) {
+        this.addresses = addresses;
+    }
+
+}
diff --git a/apps/config/src/main/java/org/onlab/onos/config/AddressEntry.java b/apps/config/src/main/java/org/onlab/onos/config/AddressEntry.java
new file mode 100644
index 0000000..318aebd
--- /dev/null
+++ b/apps/config/src/main/java/org/onlab/onos/config/AddressEntry.java
@@ -0,0 +1,53 @@
+package org.onlab.onos.config;
+
+import java.util.List;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+
+/**
+ * Represents a set of addresses bound to a port.
+ */
+public class AddressEntry {
+    private String dpid;
+    private short portNumber;
+    private List<IpPrefix> ipAddresses;
+    private MacAddress macAddress;
+
+    public String getDpid() {
+        return dpid;
+    }
+
+    @JsonProperty("dpid")
+    public void setDpid(String strDpid) {
+        this.dpid = strDpid;
+    }
+
+    public short getPortNumber() {
+        return portNumber;
+    }
+
+    @JsonProperty("port")
+    public void setPortNumber(short portNumber) {
+        this.portNumber = portNumber;
+    }
+
+    public List<IpPrefix> getIpAddresses() {
+        return ipAddresses;
+    }
+
+    @JsonProperty("ips")
+    public void setIpAddresses(List<IpPrefix> ipAddresses) {
+        this.ipAddresses = ipAddresses;
+    }
+
+    public MacAddress getMacAddress() {
+        return macAddress;
+    }
+
+    @JsonProperty("mac")
+    public void setMacAddress(MacAddress macAddress) {
+        this.macAddress = macAddress;
+    }
+}
diff --git a/apps/config/src/main/java/org/onlab/onos/config/NetworkConfigReader.java b/apps/config/src/main/java/org/onlab/onos/config/NetworkConfigReader.java
new file mode 100644
index 0000000..985c4a2
--- /dev/null
+++ b/apps/config/src/main/java/org/onlab/onos/config/NetworkConfigReader.java
@@ -0,0 +1,90 @@
+package org.onlab.onos.config;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.onlab.onos.net.ConnectPoint;
+import org.onlab.onos.net.DeviceId;
+import org.onlab.onos.net.PortNumber;
+import org.onlab.onos.net.host.HostAdminService;
+import org.onlab.onos.net.host.PortAddresses;
+import org.slf4j.Logger;
+
+import com.google.common.collect.Sets;
+
+/**
+ * Simple configuration module to read in supplementary network configuration
+ * from a file.
+ */
+@Component(immediate = true)
+public class NetworkConfigReader {
+
+    private final Logger log = getLogger(getClass());
+
+    private static final String DEFAULT_CONFIG_FILE = "config/addresses.json";
+    private String configFileName = DEFAULT_CONFIG_FILE;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected HostAdminService hostAdminService;
+
+    @Activate
+    protected void activate() {
+        log.info("Started network config reader");
+
+        log.info("Config file set to {}", configFileName);
+
+        AddressConfiguration config = readNetworkConfig();
+
+        if (config != null) {
+            for (AddressEntry entry : config.getAddresses()) {
+
+                ConnectPoint cp = new ConnectPoint(
+                        DeviceId.deviceId(dpidToUri(entry.getDpid())),
+                        PortNumber.portNumber(entry.getPortNumber()));
+
+                PortAddresses addresses = new PortAddresses(cp,
+                        Sets.newHashSet(entry.getIpAddresses()),
+                        entry.getMacAddress());
+
+                hostAdminService.bindAddressesToPort(addresses);
+            }
+        }
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        log.info("Stopped");
+    }
+
+    private AddressConfiguration readNetworkConfig() {
+        File configFile = new File(configFileName);
+
+        ObjectMapper mapper = new ObjectMapper();
+
+        try {
+            AddressConfiguration config =
+                    mapper.readValue(configFile, AddressConfiguration.class);
+
+            return config;
+        } catch (FileNotFoundException e) {
+            log.warn("Configuration file not found: {}", configFileName);
+        } catch (IOException e) {
+            log.error("Unable to read config from file:", e);
+        }
+
+        return null;
+    }
+
+    private static String dpidToUri(String dpid) {
+        return "of:" + dpid.replace(":", "");
+    }
+}
diff --git a/apps/config/src/main/java/org/onlab/onos/config/package-info.java b/apps/config/src/main/java/org/onlab/onos/config/package-info.java
new file mode 100644
index 0000000..514a47a
--- /dev/null
+++ b/apps/config/src/main/java/org/onlab/onos/config/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * Simple configuration module to read in supplementary network configuration
+ * from a file.
+ */
+package org.onlab.onos.config;
diff --git a/apps/config/src/main/resources/config.json b/apps/config/src/main/resources/config.json
new file mode 100644
index 0000000..ca4be83
--- /dev/null
+++ b/apps/config/src/main/resources/config.json
@@ -0,0 +1,21 @@
+{
+    "interfaces" : [
+	{
+	    "dpid" : "00:00:00:00:00:00:01",
+	    "port" : "1",
+	    "ips" : ["192.168.10.101/24"],
+	    "mac" : "00:00:00:11:22:33"
+	},
+	{
+	    "dpid" : "00:00:00:00:00:00:02",
+	    "port" : "1",
+	    "ips" : ["192.168.20.101/24", "192.168.30.101/24"]
+	},
+	{
+	    "dpid" : "00:00:00:00:00:00:03",
+	    "port" : "1",
+	    "ips" : ["10.1.0.1/16"],
+	    "mac" : "00:00:00:00:00:01"
+	}
+    ]
+}
diff --git a/apps/pom.xml b/apps/pom.xml
index de9faa7..995a8d6 100644
--- a/apps/pom.xml
+++ b/apps/pom.xml
@@ -20,6 +20,7 @@
         <module>tvue</module>
         <module>fwd</module>
         <module>foo</module>
+	<module>config</module>
     </modules>
 
     <properties>
diff --git a/core/api/src/main/java/org/onlab/onos/net/host/PortAddresses.java b/core/api/src/main/java/org/onlab/onos/net/host/PortAddresses.java
index 7d22877..728d922 100644
--- a/core/api/src/main/java/org/onlab/onos/net/host/PortAddresses.java
+++ b/core/api/src/main/java/org/onlab/onos/net/host/PortAddresses.java
@@ -9,6 +9,8 @@
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 
+import com.google.common.base.MoreObjects;
+
 /**
  * Represents address information bound to a port.
  */
@@ -83,4 +85,13 @@
     public int hashCode() {
         return Objects.hash(connectPoint, ipAddresses, macAddress);
     }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+            .add("connect-point", connectPoint)
+            .add("ip-addresses", ipAddresses)
+            .add("mac-address", macAddress)
+            .toString();
+    }
 }
diff --git a/features/features.xml b/features/features.xml
index c32bc3d..c255bf2 100644
--- a/features/features.xml
+++ b/features/features.xml
@@ -19,6 +19,9 @@
         <bundle>mvn:de.javakaffee/kryo-serializers/0.27</bundle>
 
         <bundle>mvn:org.onlab.onos/onlab-nio/1.0.0-SNAPSHOT</bundle>
+
+	<bundle>mvn:org.codehaus.jackson/jackson-core-asl/1.9.13</bundle>
+	<bundle>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.13</bundle>
     </feature>
 
     <feature name="onos-thirdparty-web" version="1.0.0"
@@ -122,4 +125,10 @@
         <bundle>mvn:org.onlab.onos/onos-app-foo/1.0.0-SNAPSHOT</bundle>
     </feature>
 
+    <feature name="onos-app-config" version="1.0.0"
+             description="ONOS network config reader">
+        <feature>onos-api</feature>
+        <bundle>mvn:org.onlab.onos/onos-app-config/1.0.0-SNAPSHOT</bundle>
+    </feature>
+
 </features>
diff --git a/pom.xml b/pom.xml
index b98a9e5..5cf67de 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,6 +92,17 @@
                 <version>3.3.2</version>
             </dependency>
 
+	    <dependency>
+	      <groupId>org.codehaus.jackson</groupId>
+	      <artifactId>jackson-core-asl</artifactId>
+	      <version>1.9.13</version>
+	    </dependency>
+	    <dependency>
+	      <groupId>org.codehaus.jackson</groupId>
+	      <artifactId>jackson-mapper-asl</artifactId>
+	      <version>1.9.13</version>
+	    </dependency>
+
 
             <!-- Web related -->
             <dependency>