Pavlin Radoslavov
Committed by Gerrit Code Review

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
......@@ -28,6 +28,7 @@ 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;
......@@ -47,7 +48,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
* from a file.
*/
@Component(immediate = true)
public class NetworkConfigReader {
@Service
public class NetworkConfigReader implements NetworkConfigService {
private final Logger log = getLogger(getClass());
......
/*
* 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 {
}
......@@ -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>
......
......@@ -32,6 +32,7 @@ import org.onosproject.cluster.ControllerNode;
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 @@ public class SdnIp implements SdnIpService {
@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;
......