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 [Merged from master] Change-Id: I85cdd0ce0a4f6293e8a5633bddd140a23ecddc10
Showing
4 changed files
with
43 additions
and
4 deletions
| ... | @@ -28,15 +28,16 @@ import org.apache.felix.scr.annotations.Component; | ... | @@ -28,15 +28,16 @@ import org.apache.felix.scr.annotations.Component; |
| 28 | import org.apache.felix.scr.annotations.Deactivate; | 28 | import org.apache.felix.scr.annotations.Deactivate; |
| 29 | import org.apache.felix.scr.annotations.Reference; | 29 | import org.apache.felix.scr.annotations.Reference; |
| 30 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 30 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 31 | +import org.apache.felix.scr.annotations.Service; | ||
| 32 | +import org.onlab.packet.IpAddress; | ||
| 33 | +import org.onlab.packet.IpPrefix; | ||
| 34 | +import org.onlab.packet.MacAddress; | ||
| 31 | import org.onosproject.net.ConnectPoint; | 35 | import org.onosproject.net.ConnectPoint; |
| 32 | import org.onosproject.net.DeviceId; | 36 | import org.onosproject.net.DeviceId; |
| 33 | import org.onosproject.net.PortNumber; | 37 | import org.onosproject.net.PortNumber; |
| 34 | import org.onosproject.net.host.HostAdminService; | 38 | import org.onosproject.net.host.HostAdminService; |
| 35 | import org.onosproject.net.host.InterfaceIpAddress; | 39 | import org.onosproject.net.host.InterfaceIpAddress; |
| 36 | import org.onosproject.net.host.PortAddresses; | 40 | import org.onosproject.net.host.PortAddresses; |
| 37 | -import org.onlab.packet.IpAddress; | ||
| 38 | -import org.onlab.packet.IpPrefix; | ||
| 39 | -import org.onlab.packet.MacAddress; | ||
| 40 | import org.slf4j.Logger; | 41 | import org.slf4j.Logger; |
| 41 | 42 | ||
| 42 | import com.fasterxml.jackson.databind.ObjectMapper; | 43 | import com.fasterxml.jackson.databind.ObjectMapper; |
| ... | @@ -46,7 +47,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; | ... | @@ -46,7 +47,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; |
| 46 | * from a file. | 47 | * from a file. |
| 47 | */ | 48 | */ |
| 48 | @Component(immediate = true) | 49 | @Component(immediate = true) |
| 49 | -public class NetworkConfigReader { | 50 | +@Service |
| 51 | +public class NetworkConfigReader implements NetworkConfigService { | ||
| 50 | 52 | ||
| 51 | private final Logger log = getLogger(getClass()); | 53 | private final Logger log = getLogger(getClass()); |
| 52 | 54 | ... | ... |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.config; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * Service interface exported by the Network Configuration. | ||
| 20 | + */ | ||
| 21 | +public interface NetworkConfigService { | ||
| 22 | +} |
| ... | @@ -96,6 +96,12 @@ | ... | @@ -96,6 +96,12 @@ |
| 96 | </dependency> | 96 | </dependency> |
| 97 | 97 | ||
| 98 | <dependency> | 98 | <dependency> |
| 99 | + <groupId>org.onosproject</groupId> | ||
| 100 | + <artifactId>onos-app-config</artifactId> | ||
| 101 | + <version>${project.version}</version> | ||
| 102 | + </dependency> | ||
| 103 | + | ||
| 104 | + <dependency> | ||
| 99 | <groupId>org.apache.karaf.shell</groupId> | 105 | <groupId>org.apache.karaf.shell</groupId> |
| 100 | <artifactId>org.apache.karaf.shell.console</artifactId> | 106 | <artifactId>org.apache.karaf.shell.console</artifactId> |
| 101 | </dependency> | 107 | </dependency> | ... | ... |
| ... | @@ -32,6 +32,7 @@ import org.onosproject.cluster.ControllerNode; | ... | @@ -32,6 +32,7 @@ import org.onosproject.cluster.ControllerNode; |
| 32 | import org.onosproject.cluster.LeadershipEvent; | 32 | import org.onosproject.cluster.LeadershipEvent; |
| 33 | import org.onosproject.cluster.LeadershipEventListener; | 33 | import org.onosproject.cluster.LeadershipEventListener; |
| 34 | import org.onosproject.cluster.LeadershipService; | 34 | import org.onosproject.cluster.LeadershipService; |
| 35 | +import org.onosproject.config.NetworkConfigService; | ||
| 35 | import org.onosproject.core.ApplicationId; | 36 | import org.onosproject.core.ApplicationId; |
| 36 | import org.onosproject.core.CoreService; | 37 | import org.onosproject.core.CoreService; |
| 37 | import org.onosproject.net.host.HostService; | 38 | import org.onosproject.net.host.HostService; |
| ... | @@ -68,6 +69,14 @@ public class SdnIp implements SdnIpService { | ... | @@ -68,6 +69,14 @@ public class SdnIp implements SdnIpService { |
| 68 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 69 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 69 | protected LeadershipService leadershipService; | 70 | protected LeadershipService leadershipService; |
| 70 | 71 | ||
| 72 | + // | ||
| 73 | + // NOTE: Unused reference - needed to guarentee that the | ||
| 74 | + // NetworkConfigReader component is activated and the network configuration | ||
| 75 | + // is read. | ||
| 76 | + // | ||
| 77 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
| 78 | + protected NetworkConfigService networkConfigService; | ||
| 79 | + | ||
| 71 | private static final int DEFAULT_BGP_PORT = 2000; | 80 | private static final int DEFAULT_BGP_PORT = 2000; |
| 72 | private int bgpPort; | 81 | private int bgpPort; |
| 73 | 82 | ... | ... |
-
Please register or login to post a comment