Fix startup dependency between features onos-app-config and onos-app-sdnip:
 * Expose NetworkConfigReader as a service - NetworkConfigService
 * Add reference within SdnIp to NetworkConfigService

This fixes bug ONOS-735

Change-Id: I85cdd0ce0a4f6293e8a5633bddd140a23ecddc10
diff --git a/apps/config/src/main/java/org/onosproject/config/NetworkConfigReader.java b/apps/config/src/main/java/org/onosproject/config/NetworkConfigReader.java
index 1868a70..ccdb7a6 100644
--- a/apps/config/src/main/java/org/onosproject/config/NetworkConfigReader.java
+++ b/apps/config/src/main/java/org/onosproject/config/NetworkConfigReader.java
@@ -28,6 +28,7 @@
 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;
@@ -47,7 +48,8 @@
  * from a file.
  */
 @Component(immediate = true)
-public class NetworkConfigReader {
+@Service
+public class NetworkConfigReader implements NetworkConfigService {
 
     private final Logger log = getLogger(getClass());
 
diff --git a/apps/config/src/main/java/org/onosproject/config/NetworkConfigService.java b/apps/config/src/main/java/org/onosproject/config/NetworkConfigService.java
new file mode 100644
index 0000000..9fcb436
--- /dev/null
+++ b/apps/config/src/main/java/org/onosproject/config/NetworkConfigService.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+public interface NetworkConfigService {
+}
diff --git a/apps/sdnip/pom.xml b/apps/sdnip/pom.xml
index 09a3a48..920b5e5 100644
--- a/apps/sdnip/pom.xml
+++ b/apps/sdnip/pom.xml
@@ -96,6 +96,12 @@
     </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>
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java
index 2b95129..a910950 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java
@@ -32,6 +32,7 @@
 import org.onosproject.cluster.LeadershipEvent;
 import org.onosproject.cluster.LeadershipEventListener;
 import org.onosproject.cluster.LeadershipService;
+import org.onosproject.config.NetworkConfigService;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
 import org.onosproject.net.host.HostService;
@@ -68,6 +69,14 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected LeadershipService leadershipService;
 
+    //
+    // NOTE: Unused reference - needed to guarentee that the
+    // NetworkConfigReader component is activated and the network configuration
+    // is read.
+    //
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigService networkConfigService;
+
     private static final int DEFAULT_BGP_PORT = 2000;
     private int bgpPort;