Jonathan Hart | 039d2b1 | 2014-10-10 09:33:04 -0700 | [diff] [blame] | 1 | package org.onlab.onos.sdnip; |
| 2 | |
| 3 | import static org.slf4j.LoggerFactory.getLogger; |
| 4 | |
| 5 | import org.apache.felix.scr.annotations.Activate; |
| 6 | import org.apache.felix.scr.annotations.Component; |
| 7 | import org.apache.felix.scr.annotations.Deactivate; |
Jonathan Hart | dc711bd | 2014-10-15 11:24:23 -0700 | [diff] [blame^] | 8 | import org.apache.felix.scr.annotations.Reference; |
| 9 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 10 | import org.onlab.onos.net.host.HostService; |
| 11 | import org.onlab.onos.net.intent.IntentService; |
Jonathan Hart | bac07a0 | 2014-10-13 21:29:54 -0700 | [diff] [blame] | 12 | import org.onlab.onos.sdnip.config.SdnIpConfigReader; |
Jonathan Hart | 039d2b1 | 2014-10-10 09:33:04 -0700 | [diff] [blame] | 13 | import org.slf4j.Logger; |
| 14 | |
| 15 | /** |
| 16 | * Placeholder SDN-IP component. |
| 17 | */ |
| 18 | @Component(immediate = true) |
| 19 | public class SdnIp { |
| 20 | |
| 21 | private final Logger log = getLogger(getClass()); |
| 22 | |
Jonathan Hart | dc711bd | 2014-10-15 11:24:23 -0700 | [diff] [blame^] | 23 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 24 | protected IntentService intentService; |
| 25 | |
| 26 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 27 | protected HostService hostService; |
| 28 | |
Jonathan Hart | bac07a0 | 2014-10-13 21:29:54 -0700 | [diff] [blame] | 29 | private SdnIpConfigReader config; |
Jonathan Hart | dc711bd | 2014-10-15 11:24:23 -0700 | [diff] [blame^] | 30 | private PeerConnectivity peerConnectivity; |
Jonathan Hart | bac07a0 | 2014-10-13 21:29:54 -0700 | [diff] [blame] | 31 | |
Jonathan Hart | 039d2b1 | 2014-10-10 09:33:04 -0700 | [diff] [blame] | 32 | @Activate |
| 33 | protected void activate() { |
| 34 | log.debug("SDN-IP started"); |
Jonathan Hart | bac07a0 | 2014-10-13 21:29:54 -0700 | [diff] [blame] | 35 | |
| 36 | config = new SdnIpConfigReader(); |
| 37 | config.init(); |
Jonathan Hart | dc711bd | 2014-10-15 11:24:23 -0700 | [diff] [blame^] | 38 | |
| 39 | InterfaceService interfaceService = new HostServiceBasedInterfaceService(hostService); |
| 40 | |
| 41 | peerConnectivity = new PeerConnectivity(config, interfaceService, intentService); |
| 42 | peerConnectivity.start(); |
| 43 | |
Jonathan Hart | 039d2b1 | 2014-10-10 09:33:04 -0700 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | @Deactivate |
| 47 | protected void deactivate() { |
| 48 | log.info("Stopped"); |
| 49 | } |
| 50 | } |