Removed config app that used to read addresses.json configuration.

Change-Id: I3b371831b0914e4ec99eb5b9d53053c5618e5f8e
diff --git a/apps/bgprouter/app.xml b/apps/bgprouter/app.xml
index c85e469..2fc47be 100644
--- a/apps/bgprouter/app.xml
+++ b/apps/bgprouter/app.xml
@@ -22,5 +22,4 @@
     <artifact>mvn:${project.groupId}/onos-app-routing-api/${project.version}</artifact>
     <artifact>mvn:${project.groupId}/onos-app-routing/${project.version}</artifact>
     <artifact>mvn:${project.groupId}/onos-app-proxyarp/${project.version}</artifact>
-    <artifact>mvn:${project.groupId}/onos-app-config/${project.version}</artifact>
 </app>
diff --git a/apps/bgprouter/features.xml b/apps/bgprouter/features.xml
index 3457321..c91a7f1 100644
--- a/apps/bgprouter/features.xml
+++ b/apps/bgprouter/features.xml
@@ -20,7 +20,6 @@
              description="${project.description}">
         <feature>onos-api</feature>
         <bundle>mvn:${project.groupId}/onos-app-routing-api/${project.version}</bundle>
-        <bundle>mvn:${project.groupId}/onos-app-config/${project.version}</bundle>
         <bundle>mvn:${project.groupId}/onos-app-proxyarp/${project.version}</bundle>
         <bundle>mvn:${project.groupId}/onos-app-bgprouter/${project.version}</bundle>
         <bundle>mvn:${project.groupId}/onos-app-routing/${project.version}</bundle>
diff --git a/apps/bgprouter/pom.xml b/apps/bgprouter/pom.xml
index 1bbe115..decdf5c 100644
--- a/apps/bgprouter/pom.xml
+++ b/apps/bgprouter/pom.xml
@@ -60,12 +60,6 @@
 
         <dependency>
             <groupId>org.onosproject</groupId>
-            <artifactId>onos-app-config</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.onosproject</groupId>
             <artifactId>onos-app-proxyarp</artifactId>
             <version>${project.version}</version>
         </dependency>
diff --git a/apps/config/pom.xml b/apps/config/pom.xml
deleted file mode 100644
index 451215e..0000000
--- a/apps/config/pom.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  -->
-<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.onosproject</groupId>
-        <artifactId>onos-apps</artifactId>
-        <version>1.4.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>onos-app-config</artifactId>
-    <packaging>bundle</packaging>
-
-    <description>Network configuration application</description>
-
-    <properties>
-        <onos.app.name>org.onosproject.config</onos.app.name>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-databind</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-annotations</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.onosproject</groupId>
-            <artifactId>onlab-misc</artifactId>
-        </dependency>
-    </dependencies>
-
-</project>
diff --git a/apps/config/src/main/java/org/onosproject/config/AddressConfiguration.java b/apps/config/src/main/java/org/onosproject/config/AddressConfiguration.java
deleted file mode 100644
index e092586..0000000
--- a/apps/config/src/main/java/org/onosproject/config/AddressConfiguration.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.config;
-
-import java.util.Collections;
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.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/onosproject/config/AddressEntry.java b/apps/config/src/main/java/org/onosproject/config/AddressEntry.java
deleted file mode 100644
index 35fc443..0000000
--- a/apps/config/src/main/java/org/onosproject/config/AddressEntry.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.config;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.List;
-
-/**
- * Represents a set of addresses bound to a port.
- */
-public class AddressEntry {
-    private String dpid;
-    private long portNumber;
-    private List<String> ipAddresses;
-    private String macAddress;
-    private Short vlan;
-
-    public String getDpid() {
-        return dpid;
-    }
-
-    @JsonProperty("dpid")
-    public void setDpid(String strDpid) {
-        this.dpid = strDpid;
-    }
-
-    public long getPortNumber() {
-        return portNumber;
-    }
-
-    @JsonProperty("port")
-    public void setPortNumber(long portNumber) {
-        this.portNumber = portNumber;
-    }
-
-    public List<String> getIpAddresses() {
-        return ipAddresses;
-    }
-
-    @JsonProperty("ips")
-    public void setIpAddresses(List<String> strIps) {
-        this.ipAddresses = strIps;
-    }
-
-    public String getMacAddress() {
-        return macAddress;
-    }
-
-    @JsonProperty("mac")
-    public void setMacAddress(String macAddress) {
-        this.macAddress = macAddress;
-    }
-
-    public Short getVlan() {
-        return vlan;
-    }
-
-    @JsonProperty("vlan")
-    public void setVlan(short vlan) {
-        this.vlan = vlan;
-    }
-}
diff --git a/apps/config/src/main/java/org/onosproject/config/NetworkConfigReader.java b/apps/config/src/main/java/org/onosproject/config/NetworkConfigReader.java
deleted file mode 100644
index 4eb87b4..0000000
--- a/apps/config/src/main/java/org/onosproject/config/NetworkConfigReader.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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.config;
-
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
-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.apache.felix.scr.annotations.Service;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.host.HostAdminService;
-import org.onosproject.net.host.InterfaceIpAddress;
-import org.onosproject.net.host.PortAddresses;
-import org.slf4j.Logger;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * Simple configuration module to read in supplementary network configuration
- * from a file.
- */
-@Component(immediate = true)
-@Service
-public class NetworkConfigReader implements NetworkConfigService {
-
-    private final Logger log = getLogger(getClass());
-
-    // Current working is /opt/onos/apache-karaf-*
-    // TODO: Set the path to /opt/onos/config
-    private static final String CONFIG_DIR = "../config";
-    private static final String DEFAULT_CONFIG_FILE = "addresses.json";
-    private String configFileName = DEFAULT_CONFIG_FILE;
-
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected HostAdminService hostAdminService;
-
-    @Activate
-    protected void activate() {
-        AddressConfiguration config = readNetworkConfig();
-        if (config != null) {
-            applyNetworkConfig(config);
-        }
-        log.info("Started network config reader");
-    }
-
-    @Deactivate
-    protected void deactivate() {
-        log.info("Stopped");
-    }
-
-    /**
-     * Reads the network configuration.
-     *
-     * @return the network configuration on success, otherwise null
-     */
-    private AddressConfiguration readNetworkConfig() {
-        File configFile = new File(CONFIG_DIR, configFileName);
-        ObjectMapper mapper = new ObjectMapper();
-
-        try {
-            log.info("Loading config: {}", configFile.getAbsolutePath());
-            AddressConfiguration config =
-                    mapper.readValue(configFile, AddressConfiguration.class);
-
-            return config;
-        } catch (FileNotFoundException e) {
-            log.warn("Configuration file not found: {}", configFileName);
-        } catch (IOException e) {
-            log.error("Error loading configuration", e);
-        }
-
-        return null;
-    }
-
-    /**
-     * Applies the network configuration.
-     *
-     * @param config the network configuration to apply
-     */
-    private void applyNetworkConfig(AddressConfiguration config) {
-        for (AddressEntry entry : config.getAddresses()) {
-            ConnectPoint cp = new ConnectPoint(
-                        DeviceId.deviceId(dpidToUri(entry.getDpid())),
-                        PortNumber.portNumber(entry.getPortNumber()));
-
-            Set<InterfaceIpAddress> interfaceIpAddresses = new HashSet<>();
-            for (String strIp : entry.getIpAddresses()) {
-                // Get the IP address and the subnet mask length
-                try {
-                    String[] splits = strIp.split("/");
-                    if (splits.length != 2) {
-                        throw new IllegalArgumentException(
-                            "Invalid IP address and prefix length format");
-                    }
-                    // NOTE: IpPrefix will mask-out the bits after the prefix length.
-                    IpPrefix subnet = IpPrefix.valueOf(strIp);
-                    IpAddress addr = IpAddress.valueOf(splits[0]);
-                    InterfaceIpAddress ia =
-                        new InterfaceIpAddress(addr, subnet);
-                    interfaceIpAddresses.add(ia);
-                } catch (IllegalArgumentException e) {
-                    log.warn("Bad format for IP address in config: {}", strIp);
-                }
-            }
-
-            MacAddress macAddress = null;
-            if (entry.getMacAddress() != null) {
-                try {
-                    macAddress = MacAddress.valueOf(entry.getMacAddress());
-                } catch (IllegalArgumentException e) {
-                    log.warn("Bad format for MAC address in config: {}",
-                             entry.getMacAddress());
-                }
-            }
-
-            VlanId vlan = null;
-            if (entry.getVlan() == null) {
-                vlan = VlanId.NONE;
-            } else {
-                try {
-                    vlan = VlanId.vlanId(entry.getVlan());
-                } catch (IllegalArgumentException e) {
-                    log.warn("Bad format for VLAN id in config: {}",
-                             entry.getVlan());
-                    vlan = VlanId.NONE;
-                }
-            }
-
-            PortAddresses addresses = new PortAddresses(cp,
-                        interfaceIpAddresses, macAddress, vlan);
-            hostAdminService.bindAddressesToPort(addresses);
-        }
-    }
-
-    private static String dpidToUri(String dpid) {
-        return "of:" + dpid.replace(":", "");
-    }
-}
diff --git a/apps/config/src/main/java/org/onosproject/config/NetworkConfigService.java b/apps/config/src/main/java/org/onosproject/config/NetworkConfigService.java
deleted file mode 100644
index 1d9a895..0000000
--- a/apps/config/src/main/java/org/onosproject/config/NetworkConfigService.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 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.config;
-
-/**
- * Service interface exported by the Network Configuration.
- *
- * @deprecated in Drake; see org.onosproject.net.config
- */
-@Deprecated
-public interface NetworkConfigService {
-}
diff --git a/apps/config/src/main/java/org/onosproject/config/package-info.java b/apps/config/src/main/java/org/onosproject/config/package-info.java
deleted file mode 100644
index 6552f20..0000000
--- a/apps/config/src/main/java/org/onosproject/config/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Simple configuration module to read in supplementary network configuration
- * from a file.
- */
-package org.onosproject.config;
diff --git a/apps/config/src/main/resources/addresses.json b/apps/config/src/main/resources/addresses.json
deleted file mode 100644
index a88ed62..0000000
--- a/apps/config/src/main/resources/addresses.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
-    "addresses" : [
-	{
-	    "dpid" : "00:00:00:00:00:00:00:a3",
-	    "port" : "1",
-	    "ips" : ["192.168.10.101/24"],
-	    "mac" : "00:00:00:00:00:01",
-	    "vlan" : "1"
-	},
-	{
-	    "dpid" : "00:00:00:00:00:00:00:a5",
-	    "port" : "1",
-	    "ips" : ["192.168.20.101/24"],
-	    "mac" : "00:00:00:00:00:01",
-	    "vlan" : "2"
-	},
-	{
-	    "dpid" : "00:00:00:00:00:00:00:a2",
-	    "port" : "1",
-	    "ips" : ["192.168.30.101/24"],
-	    "mac" : "00:00:00:00:00:01"
-	},
-	{
-	    "dpid" : "00:00:00:00:00:00:00:a6",
-	    "port" : "1",
-	    "ips" : ["192.168.40.101/24"],
-	    "mac" : "00:00:00:00:00:01"
-	},
-	{
-	    "dpid" : "00:00:00:00:00:00:00:a4",
-	    "port" : "4",
-	    "ips" : ["192.168.60.101/24"],
-	    "mac" : "00:00:00:00:00:01"
-	}
-    ]
-}
diff --git a/apps/pom.xml b/apps/pom.xml
index 60a54fb..334c690 100644
--- a/apps/pom.xml
+++ b/apps/pom.xml
@@ -37,7 +37,6 @@
         <module>fwd</module>
         <module>mobility</module>
         <module>proxyarp</module>
-        <module>config</module>
         <module>sdnip</module>
         <module>optical</module>
         <module>metrics</module>
diff --git a/apps/sdnip/pom.xml b/apps/sdnip/pom.xml
index 66a2067..99314aa 100644
--- a/apps/sdnip/pom.xml
+++ b/apps/sdnip/pom.xml
@@ -69,12 +69,6 @@
         </dependency>
 
         <dependency>
-            <groupId>org.onosproject</groupId>
-            <artifactId>onos-app-config</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
             <groupId>org.apache.karaf.shell</groupId>
             <artifactId>org.apache.karaf.shell.console</artifactId>
         </dependency>