Committed by
Gerrit Code Review
CORD-77 Dynamic Access Agent Config
This commit depends on https://gerrit.opencord.org/#/c/56/ Change-Id: I6084621c36046ae8b6262cab52c49825d3e0d0d1
Showing
9 changed files
with
317 additions
and
18 deletions
| ... | @@ -2,12 +2,18 @@ COMPILE_DEPS = [ | ... | @@ -2,12 +2,18 @@ COMPILE_DEPS = [ |
| 2 | '//lib:CORE_DEPS', | 2 | '//lib:CORE_DEPS', |
| 3 | '//lib:org.apache.karaf.shell.console', | 3 | '//lib:org.apache.karaf.shell.console', |
| 4 | '//lib:javax.ws.rs-api', | 4 | '//lib:javax.ws.rs-api', |
| 5 | + '//lib:cord-config', | ||
| 5 | '//cli:onos-cli', | 6 | '//cli:onos-cli', |
| 6 | '//core/store/serializers:onos-core-serializers', | 7 | '//core/store/serializers:onos-core-serializers', |
| 7 | '//incubator/api:onos-incubator-api', | 8 | '//incubator/api:onos-incubator-api', |
| 8 | '//utils/rest:onlab-rest', | 9 | '//utils/rest:onlab-rest', |
| 9 | ] | 10 | ] |
| 10 | 11 | ||
| 12 | +BUNDLES = [ | ||
| 13 | + '//apps/segmentrouting:onos-apps-segmentrouting', | ||
| 14 | + '//lib:cord-config' | ||
| 15 | +] | ||
| 16 | + | ||
| 11 | TEST_DEPS = [ | 17 | TEST_DEPS = [ |
| 12 | '//lib:TEST_ADAPTERS', | 18 | '//lib:TEST_ADAPTERS', |
| 13 | ] | 19 | ] |
| ... | @@ -21,5 +27,6 @@ onos_app ( | ... | @@ -21,5 +27,6 @@ onos_app ( |
| 21 | title = 'Segment Routing App', | 27 | title = 'Segment Routing App', |
| 22 | category = 'Traffic Steering', | 28 | category = 'Traffic Steering', |
| 23 | url = 'http://onosproject.org', | 29 | url = 'http://onosproject.org', |
| 30 | + included_bundles = BUNDLES, | ||
| 24 | description = 'Segment routing application.', | 31 | description = 'Segment routing application.', |
| 25 | ) | 32 | ) | ... | ... |
apps/segmentrouting/app.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!-- | ||
| 3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
| 4 | + ~ | ||
| 5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 6 | + ~ you may not use this file except in compliance with the License. | ||
| 7 | + ~ You may obtain a copy of the License at | ||
| 8 | + ~ | ||
| 9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| 10 | + ~ | ||
| 11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
| 12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| 13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 14 | + ~ See the License for the specific language governing permissions and | ||
| 15 | + ~ limitations under the License. | ||
| 16 | + --> | ||
| 17 | +<app name="org.onosproject.segmentrouting" origin="ON.Lab" version="${project.version}" | ||
| 18 | + title="Segment Routing App" category="Traffic Steering" url="http://onosproject.org" | ||
| 19 | + featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features" | ||
| 20 | + features="${project.artifactId}" apps=""> | ||
| 21 | + <description>${project.description}</description> | ||
| 22 | + <artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact> | ||
| 23 | + <!-- TODO: Replace this with variable --> | ||
| 24 | + <artifact>mvn:org.opencord/cord-config/1.0-SNAPSHOT</artifact> | ||
| 25 | +</app> |
apps/segmentrouting/features.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
| 2 | +<!-- | ||
| 3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
| 4 | + ~ | ||
| 5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 6 | + ~ you may not use this file except in compliance with the License. | ||
| 7 | + ~ You may obtain a copy of the License at | ||
| 8 | + ~ | ||
| 9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| 10 | + ~ | ||
| 11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
| 12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| 13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 14 | + ~ See the License for the specific language governing permissions and | ||
| 15 | + ~ limitations under the License. | ||
| 16 | + --> | ||
| 17 | +<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}"> | ||
| 18 | + <feature name="${project.artifactId}" version="${project.version}" | ||
| 19 | + description="${project.description}"> | ||
| 20 | + <feature>onos-api</feature> | ||
| 21 | + <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle> | ||
| 22 | + <!-- TODO: Replace this with variable --> | ||
| 23 | + <bundle>mvn:org.opencord/cord-config/1.0-SNAPSHOT</bundle> | ||
| 24 | + </feature> | ||
| 25 | +</features> |
| ... | @@ -31,11 +31,6 @@ | ... | @@ -31,11 +31,6 @@ |
| 31 | <description>Segment routing application</description> | 31 | <description>Segment routing application</description> |
| 32 | 32 | ||
| 33 | <properties> | 33 | <properties> |
| 34 | - <onos.app.name>org.onosproject.segmentrouting</onos.app.name> | ||
| 35 | - <onos.app.title>Segment Routing App</onos.app.title> | ||
| 36 | - <onos.app.category>Traffic Steering</onos.app.category> | ||
| 37 | - <onos.app.url>http://onosproject.org</onos.app.url> | ||
| 38 | - <onos.app.readme>Segment routing application.</onos.app.readme> | ||
| 39 | <web.context>/onos/segmentrouting</web.context> | 34 | <web.context>/onos/segmentrouting</web.context> |
| 40 | <api.version>1.0.0</api.version> | 35 | <api.version>1.0.0</api.version> |
| 41 | <api.title>ONOS Segment Routing REST API</api.title> | 36 | <api.title>ONOS Segment Routing REST API</api.title> |
| ... | @@ -71,6 +66,12 @@ | ... | @@ -71,6 +66,12 @@ |
| 71 | <version>${project.version}</version> | 66 | <version>${project.version}</version> |
| 72 | </dependency> | 67 | </dependency> |
| 73 | <dependency> | 68 | <dependency> |
| 69 | + <groupId>org.opencord</groupId> | ||
| 70 | + <artifactId>cord-config</artifactId> | ||
| 71 | + <!-- TODO: Replace this with variable --> | ||
| 72 | + <version>1.0-SNAPSHOT</version> | ||
| 73 | + </dependency> | ||
| 74 | + <dependency> | ||
| 74 | <groupId>javax.ws.rs</groupId> | 75 | <groupId>javax.ws.rs</groupId> |
| 75 | <artifactId>javax.ws.rs-api</artifactId> | 76 | <artifactId>javax.ws.rs-api</artifactId> |
| 76 | <version>2.0.1</version> | 77 | <version>2.0.1</version> | ... | ... |
| 1 | +/* | ||
| 2 | + * Copyright 2016-present 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 | + | ||
| 17 | +package org.onosproject.segmentrouting; | ||
| 18 | + | ||
| 19 | +import com.google.common.collect.ImmutableSet; | ||
| 20 | +import org.onlab.packet.Ip4Prefix; | ||
| 21 | +import org.onlab.packet.MacAddress; | ||
| 22 | +import org.onlab.packet.VlanId; | ||
| 23 | +import org.onosproject.net.ConnectPoint; | ||
| 24 | +import org.onosproject.net.DefaultHost; | ||
| 25 | +import org.onosproject.net.DeviceId; | ||
| 26 | +import org.onosproject.net.Host; | ||
| 27 | +import org.onosproject.net.HostId; | ||
| 28 | +import org.onosproject.net.HostLocation; | ||
| 29 | +import org.onosproject.net.provider.ProviderId; | ||
| 30 | +import org.opencord.cordconfig.CordConfigEvent; | ||
| 31 | +import org.opencord.cordconfig.access.AccessAgentData; | ||
| 32 | +import org.slf4j.Logger; | ||
| 33 | +import org.slf4j.LoggerFactory; | ||
| 34 | + | ||
| 35 | +import java.util.Optional; | ||
| 36 | + | ||
| 37 | +/** | ||
| 38 | + * Handles access agent config event which is required for CORD integration. | ||
| 39 | + */ | ||
| 40 | +public class CordConfigHandler { | ||
| 41 | + private static Logger log = LoggerFactory.getLogger(CordConfigHandler.class); | ||
| 42 | + private final SegmentRoutingManager srManager; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Constructs the CordConfigHandler. | ||
| 46 | + * | ||
| 47 | + * @param srManager Segment Routing manager | ||
| 48 | + */ | ||
| 49 | + public CordConfigHandler(SegmentRoutingManager srManager) { | ||
| 50 | + this.srManager = srManager; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * Read initial access agent config for given device. | ||
| 55 | + * | ||
| 56 | + * @param deviceId ID of the device to be initialized | ||
| 57 | + */ | ||
| 58 | + public void init(DeviceId deviceId) { | ||
| 59 | + // Try to read access agent config | ||
| 60 | + Optional<AccessAgentData> accessAgent = | ||
| 61 | + srManager.cordConfigService.getAccessAgent(deviceId); | ||
| 62 | + | ||
| 63 | + if (!accessAgent.isPresent()) { | ||
| 64 | + log.debug("No access agent config on {}. Skip.", deviceId); | ||
| 65 | + return; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + processAccessAgentAdded(accessAgent.get()); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + // TODO javadoc | ||
| 72 | + protected void processAccessAgentAddedEvent(CordConfigEvent event) { | ||
| 73 | + log.debug("processAccessAgentAdded: {}, {}", event.subject(), event.prevSubject()); | ||
| 74 | + processAccessAgentAdded((AccessAgentData) event.subject()); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + protected void processAccessAgentUpdatedEvent(CordConfigEvent event) { | ||
| 78 | + log.debug("processAccessAgentUpdated: {}, {}", event.subject(), event.prevSubject()); | ||
| 79 | + processAccessAgentRemoved((AccessAgentData) event.prevSubject()); | ||
| 80 | + processAccessAgentAdded((AccessAgentData) event.subject()); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + protected void processAccessAgentRemovedEvent(CordConfigEvent event) { | ||
| 84 | + log.debug("processAccessAgentRemoved: {}, {}", event.subject(), event.prevSubject()); | ||
| 85 | + processAccessAgentRemoved((AccessAgentData) event.prevSubject()); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + protected void processAccessAgentAdded(AccessAgentData accessAgentData) { | ||
| 89 | + if (!srManager.mastershipService.isLocalMaster(accessAgentData.deviceId())) { | ||
| 90 | + log.debug("Not the master of {}. Abort.", accessAgentData.deviceId()); | ||
| 91 | + return; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + // Do not proceed if vtn location is missing | ||
| 95 | + if (!accessAgentData.getVtnLocation().isPresent()) { | ||
| 96 | + log.warn("accessAgentData does not contain vtn location. Abort."); | ||
| 97 | + return; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + MacAddress agentMac = accessAgentData.getAgentMac(); | ||
| 101 | + ConnectPoint agentLocation = accessAgentData.getVtnLocation().get(); | ||
| 102 | + | ||
| 103 | + // Do not proceed if agent port doesn't have subnet configured | ||
| 104 | + Ip4Prefix agentSubnet = srManager.deviceConfiguration | ||
| 105 | + .getPortSubnet(agentLocation.deviceId(), agentLocation.port()); | ||
| 106 | + if (agentSubnet == null) { | ||
| 107 | + log.warn("Agent port does not have subnet configuration. Abort."); | ||
| 108 | + return; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + // Add host information for agent | ||
| 112 | + log.info("push host info for agent {}", agentMac); | ||
| 113 | + srManager.hostHandler.processHostAdded(createHost(agentMac, agentLocation)); | ||
| 114 | + | ||
| 115 | + accessAgentData.getOltMacInfo().forEach((connectPoint, macAddress) -> { | ||
| 116 | + // Do not proceed if olt port has subnet configured | ||
| 117 | + Ip4Prefix oltSubnet = srManager.deviceConfiguration | ||
| 118 | + .getPortSubnet(connectPoint.deviceId(), connectPoint.port()); | ||
| 119 | + if (oltSubnet != null) { | ||
| 120 | + log.warn("OLT port has subnet configuration. Abort."); | ||
| 121 | + return; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + // Add olt to the subnet of agent | ||
| 125 | + log.info("push subnet for olt {}", agentSubnet); | ||
| 126 | + srManager.deviceConfiguration.addSubnet(connectPoint, agentSubnet); | ||
| 127 | + srManager.routingRulePopulator.populateRouterMacVlanFilters(connectPoint.deviceId()); | ||
| 128 | + | ||
| 129 | + // Add host information for olt | ||
| 130 | + log.info("push host info for olt {}", macAddress); | ||
| 131 | + srManager.hostHandler.processHostAdded(createHost(macAddress, connectPoint)); | ||
| 132 | + }); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + protected void processAccessAgentRemoved(AccessAgentData accessAgentData) { | ||
| 136 | + if (!srManager.mastershipService.isLocalMaster(accessAgentData.deviceId())) { | ||
| 137 | + log.debug("Not the master of {}. Abort.", accessAgentData.deviceId()); | ||
| 138 | + return; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + // Do not proceed if vtn location is missing | ||
| 142 | + if (!accessAgentData.getVtnLocation().isPresent()) { | ||
| 143 | + log.warn("accessAgentData does not contain vtn location. Abort."); | ||
| 144 | + return; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + MacAddress agentMac = accessAgentData.getAgentMac(); | ||
| 148 | + ConnectPoint agentLocation = accessAgentData.getVtnLocation().get(); | ||
| 149 | + | ||
| 150 | + // Do not proceed if olt port doesn't have subnet configured | ||
| 151 | + Ip4Prefix agentSubnet = srManager.deviceConfiguration | ||
| 152 | + .getPortSubnet(agentLocation.deviceId(), agentLocation.port()); | ||
| 153 | + if (agentSubnet == null) { | ||
| 154 | + log.warn("Agent port does not have subnet configuration. Abort."); | ||
| 155 | + return; | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + // Remove host information for agent | ||
| 159 | + log.info("delete host info for agent {}", agentMac); | ||
| 160 | + srManager.hostHandler.processHostRemoved(createHost(agentMac, agentLocation)); | ||
| 161 | + | ||
| 162 | + accessAgentData.getOltMacInfo().forEach((connectPoint, macAddress) -> { | ||
| 163 | + // Do not proceed if agent port doesn't have subnet configured | ||
| 164 | + Ip4Prefix oltSubnet = srManager.deviceConfiguration | ||
| 165 | + .getPortSubnet(connectPoint.deviceId(), connectPoint.port()); | ||
| 166 | + if (oltSubnet == null) { | ||
| 167 | + log.warn("OLT port does not have subnet configuration. Abort."); | ||
| 168 | + return; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + // Remove host information for olt | ||
| 172 | + log.info("delete host info for olt {}", macAddress); | ||
| 173 | + srManager.hostHandler.processHostRemoved(createHost(macAddress, connectPoint)); | ||
| 174 | + | ||
| 175 | + // Remove olt to the subnet of agent | ||
| 176 | + log.info("delete subnet for olt {}", agentSubnet); | ||
| 177 | + srManager.deviceConfiguration.removeSubnet(connectPoint, agentSubnet); | ||
| 178 | + srManager.routingRulePopulator.populateRouterMacVlanFilters(connectPoint.deviceId()); | ||
| 179 | + }); | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + private Host createHost(MacAddress macAddress, ConnectPoint location) { | ||
| 183 | + return new DefaultHost( | ||
| 184 | + new ProviderId("host", "org.onosproject.segmentrouting"), | ||
| 185 | + HostId.hostId(macAddress), | ||
| 186 | + macAddress, | ||
| 187 | + VlanId.NONE, | ||
| 188 | + new HostLocation(location, System.currentTimeMillis()), | ||
| 189 | + ImmutableSet.of()); | ||
| 190 | + } | ||
| 191 | +} |
| ... | @@ -71,15 +71,15 @@ public class HostHandler { | ... | @@ -71,15 +71,15 @@ public class HostHandler { |
| 71 | if (!deviceId.equals(devId)) { | 71 | if (!deviceId.equals(devId)) { |
| 72 | return; | 72 | return; |
| 73 | } | 73 | } |
| 74 | - processHostAddedEventInternal(host); | 74 | + processHostAdded(host); |
| 75 | }); | 75 | }); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | protected void processHostAddedEvent(HostEvent event) { | 78 | protected void processHostAddedEvent(HostEvent event) { |
| 79 | - processHostAddedEventInternal(event.subject()); | 79 | + processHostAdded(event.subject()); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | - private void processHostAddedEventInternal(Host host) { | 82 | + protected void processHostAdded(Host host) { |
| 83 | MacAddress mac = host.mac(); | 83 | MacAddress mac = host.mac(); |
| 84 | VlanId vlanId = host.vlan(); | 84 | VlanId vlanId = host.vlan(); |
| 85 | HostLocation location = host.location(); | 85 | HostLocation location = host.location(); |
| ... | @@ -116,15 +116,19 @@ public class HostHandler { | ... | @@ -116,15 +116,19 @@ public class HostHandler { |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | protected void processHostRemoveEvent(HostEvent event) { | 118 | protected void processHostRemoveEvent(HostEvent event) { |
| 119 | - MacAddress mac = event.subject().mac(); | 119 | + processHostRemoved(event.subject()); |
| 120 | - VlanId vlanId = event.subject().vlan(); | 120 | + } |
| 121 | - HostLocation location = event.subject().location(); | 121 | + |
| 122 | + protected void processHostRemoved(Host host) { | ||
| 123 | + MacAddress mac = host.mac(); | ||
| 124 | + VlanId vlanId = host.vlan(); | ||
| 125 | + HostLocation location = host.location(); | ||
| 122 | DeviceId deviceId = location.deviceId(); | 126 | DeviceId deviceId = location.deviceId(); |
| 123 | PortNumber port = location.port(); | 127 | PortNumber port = location.port(); |
| 124 | - Set<IpAddress> ips = event.subject().ipAddresses(); | 128 | + Set<IpAddress> ips = host.ipAddresses(); |
| 125 | log.debug("Host {}/{} is removed from {}:{}", mac, vlanId, deviceId, port); | 129 | log.debug("Host {}/{} is removed from {}:{}", mac, vlanId, deviceId, port); |
| 126 | 130 | ||
| 127 | - if (accepted(event.subject())) { | 131 | + if (accepted(host)) { |
| 128 | // Revoke bridging table entry | 132 | // Revoke bridging table entry |
| 129 | ForwardingObjective.Builder fob = | 133 | ForwardingObjective.Builder fob = |
| 130 | hostFwdObjBuilder(deviceId, mac, vlanId, port); | 134 | hostFwdObjBuilder(deviceId, mac, vlanId, port); |
| ... | @@ -133,9 +137,9 @@ public class HostHandler { | ... | @@ -133,9 +137,9 @@ public class HostHandler { |
| 133 | return; | 137 | return; |
| 134 | } | 138 | } |
| 135 | ObjectiveContext context = new DefaultObjectiveContext( | 139 | ObjectiveContext context = new DefaultObjectiveContext( |
| 136 | - (objective) -> log.debug("Host rule for {} revoked", event.subject()), | 140 | + (objective) -> log.debug("Host rule for {} revoked", host), |
| 137 | (objective, error) -> | 141 | (objective, error) -> |
| 138 | - log.warn("Failed to revoke host rule for {}: {}", event.subject(), error)); | 142 | + log.warn("Failed to revoke host rule for {}: {}", host, error)); |
| 139 | flowObjectiveService.forward(deviceId, fob.remove(context)); | 143 | flowObjectiveService.forward(deviceId, fob.remove(context)); |
| 140 | 144 | ||
| 141 | // Revoke IP table entry | 145 | // Revoke IP table entry | ... | ... |
| ... | @@ -82,6 +82,9 @@ import org.onosproject.store.service.EventuallyConsistentMap; | ... | @@ -82,6 +82,9 @@ import org.onosproject.store.service.EventuallyConsistentMap; |
| 82 | import org.onosproject.store.service.EventuallyConsistentMapBuilder; | 82 | import org.onosproject.store.service.EventuallyConsistentMapBuilder; |
| 83 | import org.onosproject.store.service.StorageService; | 83 | import org.onosproject.store.service.StorageService; |
| 84 | import org.onosproject.store.service.WallClockTimestamp; | 84 | import org.onosproject.store.service.WallClockTimestamp; |
| 85 | +import org.opencord.cordconfig.CordConfigEvent; | ||
| 86 | +import org.opencord.cordconfig.CordConfigListener; | ||
| 87 | +import org.opencord.cordconfig.CordConfigService; | ||
| 85 | import org.slf4j.Logger; | 88 | import org.slf4j.Logger; |
| 86 | import org.slf4j.LoggerFactory; | 89 | import org.slf4j.LoggerFactory; |
| 87 | 90 | ||
| ... | @@ -147,6 +150,9 @@ public class SegmentRoutingManager implements SegmentRoutingService { | ... | @@ -147,6 +150,9 @@ public class SegmentRoutingManager implements SegmentRoutingService { |
| 147 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 150 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 148 | protected TopologyService topologyService; | 151 | protected TopologyService topologyService; |
| 149 | 152 | ||
| 153 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
| 154 | + protected CordConfigService cordConfigService; | ||
| 155 | + | ||
| 150 | protected ArpHandler arpHandler = null; | 156 | protected ArpHandler arpHandler = null; |
| 151 | protected IcmpHandler icmpHandler = null; | 157 | protected IcmpHandler icmpHandler = null; |
| 152 | protected IpHandler ipHandler = null; | 158 | protected IpHandler ipHandler = null; |
| ... | @@ -163,11 +169,13 @@ public class SegmentRoutingManager implements SegmentRoutingService { | ... | @@ -163,11 +169,13 @@ public class SegmentRoutingManager implements SegmentRoutingService { |
| 163 | private AppConfigHandler appCfgHandler = null; | 169 | private AppConfigHandler appCfgHandler = null; |
| 164 | protected XConnectHandler xConnectHandler = null; | 170 | protected XConnectHandler xConnectHandler = null; |
| 165 | private McastHandler mcastHandler = null; | 171 | private McastHandler mcastHandler = null; |
| 166 | - private HostHandler hostHandler = null; | 172 | + protected HostHandler hostHandler = null; |
| 173 | + private CordConfigHandler cordConfigHandler = null; | ||
| 167 | private InternalEventHandler eventHandler = new InternalEventHandler(); | 174 | private InternalEventHandler eventHandler = new InternalEventHandler(); |
| 168 | private final InternalHostListener hostListener = new InternalHostListener(); | 175 | private final InternalHostListener hostListener = new InternalHostListener(); |
| 169 | private final InternalConfigListener cfgListener = new InternalConfigListener(this); | 176 | private final InternalConfigListener cfgListener = new InternalConfigListener(this); |
| 170 | private final InternalMcastListener mcastListener = new InternalMcastListener(); | 177 | private final InternalMcastListener mcastListener = new InternalMcastListener(); |
| 178 | + private final InternalCordConfigListener cordConfigListener = new InternalCordConfigListener(); | ||
| 171 | 179 | ||
| 172 | private ScheduledExecutorService executorService = Executors | 180 | private ScheduledExecutorService executorService = Executors |
| 173 | .newScheduledThreadPool(1); | 181 | .newScheduledThreadPool(1); |
| ... | @@ -324,6 +332,7 @@ public class SegmentRoutingManager implements SegmentRoutingService { | ... | @@ -324,6 +332,7 @@ public class SegmentRoutingManager implements SegmentRoutingService { |
| 324 | xConnectHandler = new XConnectHandler(this); | 332 | xConnectHandler = new XConnectHandler(this); |
| 325 | mcastHandler = new McastHandler(this); | 333 | mcastHandler = new McastHandler(this); |
| 326 | hostHandler = new HostHandler(this); | 334 | hostHandler = new HostHandler(this); |
| 335 | + cordConfigHandler = new CordConfigHandler(this); | ||
| 327 | 336 | ||
| 328 | cfgService.addListener(cfgListener); | 337 | cfgService.addListener(cfgListener); |
| 329 | cfgService.registerConfigFactory(deviceConfigFactory); | 338 | cfgService.registerConfigFactory(deviceConfigFactory); |
| ... | @@ -335,6 +344,7 @@ public class SegmentRoutingManager implements SegmentRoutingService { | ... | @@ -335,6 +344,7 @@ public class SegmentRoutingManager implements SegmentRoutingService { |
| 335 | linkService.addListener(linkListener); | 344 | linkService.addListener(linkListener); |
| 336 | deviceService.addListener(deviceListener); | 345 | deviceService.addListener(deviceListener); |
| 337 | multicastRouteService.addListener(mcastListener); | 346 | multicastRouteService.addListener(mcastListener); |
| 347 | + cordConfigService.addListener(cordConfigListener); | ||
| 338 | 348 | ||
| 339 | // Request ARP packet-in | 349 | // Request ARP packet-in |
| 340 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); | 350 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); |
| ... | @@ -379,6 +389,7 @@ public class SegmentRoutingManager implements SegmentRoutingService { | ... | @@ -379,6 +389,7 @@ public class SegmentRoutingManager implements SegmentRoutingService { |
| 379 | linkService.removeListener(linkListener); | 389 | linkService.removeListener(linkListener); |
| 380 | deviceService.removeListener(deviceListener); | 390 | deviceService.removeListener(deviceListener); |
| 381 | multicastRouteService.removeListener(mcastListener); | 391 | multicastRouteService.removeListener(mcastListener); |
| 392 | + cordConfigService.removeListener(cordConfigListener); | ||
| 382 | 393 | ||
| 383 | processor = null; | 394 | processor = null; |
| 384 | linkListener = null; | 395 | linkListener = null; |
| ... | @@ -394,7 +405,6 @@ public class SegmentRoutingManager implements SegmentRoutingService { | ... | @@ -394,7 +405,6 @@ public class SegmentRoutingManager implements SegmentRoutingService { |
| 394 | log.info("Stopped"); | 405 | log.info("Stopped"); |
| 395 | } | 406 | } |
| 396 | 407 | ||
| 397 | - | ||
| 398 | @Override | 408 | @Override |
| 399 | public List<Tunnel> getTunnels() { | 409 | public List<Tunnel> getTunnels() { |
| 400 | return tunnelHandler.getTunnels(); | 410 | return tunnelHandler.getTunnels(); |
| ... | @@ -818,6 +828,7 @@ public class SegmentRoutingManager implements SegmentRoutingService { | ... | @@ -818,6 +828,7 @@ public class SegmentRoutingManager implements SegmentRoutingService { |
| 818 | if (mastershipService.isLocalMaster(deviceId)) { | 828 | if (mastershipService.isLocalMaster(deviceId)) { |
| 819 | hostHandler.readInitialHosts(deviceId); | 829 | hostHandler.readInitialHosts(deviceId); |
| 820 | xConnectHandler.init(deviceId); | 830 | xConnectHandler.init(deviceId); |
| 831 | + cordConfigHandler.init(deviceId); | ||
| 821 | DefaultGroupHandler groupHandler = groupHandlerMap.get(deviceId); | 832 | DefaultGroupHandler groupHandler = groupHandlerMap.get(deviceId); |
| 822 | groupHandler.createGroupsFromSubnetConfig(); | 833 | groupHandler.createGroupsFromSubnetConfig(); |
| 823 | routingRulePopulator.populateSubnetBroadcastRule(deviceId); | 834 | routingRulePopulator.populateSubnetBroadcastRule(deviceId); |
| ... | @@ -1000,4 +1011,26 @@ public class SegmentRoutingManager implements SegmentRoutingService { | ... | @@ -1000,4 +1011,26 @@ public class SegmentRoutingManager implements SegmentRoutingService { |
| 1000 | } | 1011 | } |
| 1001 | } | 1012 | } |
| 1002 | } | 1013 | } |
| 1014 | + | ||
| 1015 | + private class InternalCordConfigListener implements CordConfigListener { | ||
| 1016 | + @Override | ||
| 1017 | + public void event(CordConfigEvent event) { | ||
| 1018 | + switch (event.type()) { | ||
| 1019 | + case ACCESS_AGENT_ADDED: | ||
| 1020 | + cordConfigHandler.processAccessAgentAddedEvent(event); | ||
| 1021 | + break; | ||
| 1022 | + case ACCESS_AGENT_UPDATED: | ||
| 1023 | + cordConfigHandler.processAccessAgentUpdatedEvent(event); | ||
| 1024 | + break; | ||
| 1025 | + case ACCESS_AGENT_REMOVED: | ||
| 1026 | + cordConfigHandler.processAccessAgentRemovedEvent(event); | ||
| 1027 | + break; | ||
| 1028 | + case ACCESS_DEVICE_ADDED: | ||
| 1029 | + case ACCESS_DEVICE_UPDATED: | ||
| 1030 | + case ACCESS_DEVICE_REMOVED: | ||
| 1031 | + default: | ||
| 1032 | + break; | ||
| 1033 | + } | ||
| 1034 | + } | ||
| 1035 | + } | ||
| 1003 | } | 1036 | } | ... | ... |
| 1 | -# ***** This file was auto-generated at Wed Jun 01 16:54:27 PDT 2016. Do not edit this file manually. ***** | 1 | +# ***** This file was auto-generated at Wed Jun 15 12:09:22 PDT 2016. Do not edit this file manually. ***** |
| 2 | osgi_feature_group( | 2 | osgi_feature_group( |
| 3 | name = 'COMPILE', | 3 | name = 'COMPILE', |
| 4 | visibility = ['PUBLIC'], | 4 | visibility = ['PUBLIC'], |
| ... | @@ -1022,6 +1022,15 @@ remote_jar ( | ... | @@ -1022,6 +1022,15 @@ remote_jar ( |
| 1022 | ) | 1022 | ) |
| 1023 | 1023 | ||
| 1024 | remote_jar ( | 1024 | remote_jar ( |
| 1025 | + name = 'cord-config', | ||
| 1026 | + out = 'cord-config-1.0-20160615.190726-9.jar', | ||
| 1027 | + url = 'https://oss.sonatype.org/content/repositories/snapshots/org/opencord/cord-config/1.0-SNAPSHOT/cord-config-1.0-20160615.190726-9.jar', | ||
| 1028 | + sha1 = '790bc0cf8ffe3f872370dd197cf225e76d93002d', | ||
| 1029 | + maven_coords = 'org.opencord:cord-config:1.0-SNAPSHOT', | ||
| 1030 | + visibility = [ 'PUBLIC' ], | ||
| 1031 | +) | ||
| 1032 | + | ||
| 1033 | +remote_jar ( | ||
| 1025 | name = 'openstack4j-core', | 1034 | name = 'openstack4j-core', |
| 1026 | out = 'openstack4j-core-2.11.jar', | 1035 | out = 'openstack4j-core-2.11.jar', |
| 1027 | url = 'mvn:org.pacesys:openstack4j-core:jar:2.11', | 1036 | url = 'mvn:org.pacesys:openstack4j-core:jar:2.11', | ... | ... |
| ... | @@ -200,6 +200,10 @@ | ... | @@ -200,6 +200,10 @@ |
| 200 | "uri": "mvn:com.btisystems.mibbler.mibs:rfc:1.0-SNAPSHOT", | 200 | "uri": "mvn:com.btisystems.mibbler.mibs:rfc:1.0-SNAPSHOT", |
| 201 | "repo": "https://oss.sonatype.org/content/repositories/snapshots" | 201 | "repo": "https://oss.sonatype.org/content/repositories/snapshots" |
| 202 | }, | 202 | }, |
| 203 | + "cord-config": { | ||
| 204 | + "uri": "mvn:org.opencord:cord-config:1.0-SNAPSHOT", | ||
| 205 | + "repo": "https://oss.sonatype.org/content/repositories/snapshots" | ||
| 206 | + }, | ||
| 203 | // Openstack4j related jars | 207 | // Openstack4j related jars |
| 204 | "openstack4j-core": "mvn:org.pacesys:openstack4j-core:2.11", | 208 | "openstack4j-core": "mvn:org.pacesys:openstack4j-core:2.11", |
| 205 | "openstack4j-http-connector": "mvn:org.pacesys.openstack4j.connectors:openstack4j-http-connector:2.11", | 209 | "openstack4j-http-connector": "mvn:org.pacesys.openstack4j.connectors:openstack4j-http-connector:2.11", | ... | ... |
-
Please register or login to post a comment