Committed by
Gerrit Code Review
[ONOS] Cherry picked from master 1.7 till june 10
Change-Id: Ide60fa5f6bd61fdfbc6ae050b78603cd5f1c78d9
Showing
35 changed files
with
582 additions
and
244 deletions
... | @@ -35,6 +35,7 @@ import org.slf4j.Logger; | ... | @@ -35,6 +35,7 @@ import org.slf4j.Logger; |
35 | description = "Supports querying PCE path.") | 35 | description = "Supports querying PCE path.") |
36 | public class PceQueryPathCommand extends AbstractShellCommand { | 36 | public class PceQueryPathCommand extends AbstractShellCommand { |
37 | private final Logger log = getLogger(getClass()); | 37 | private final Logger log = getLogger(getClass()); |
38 | + public static final String COST_TYPE = "costType"; | ||
38 | 39 | ||
39 | @Option(name = "-i", aliases = "--id", description = "path-id", required = false, | 40 | @Option(name = "-i", aliases = "--id", description = "path-id", required = false, |
40 | multiValued = false) | 41 | multiValued = false) |
... | @@ -71,16 +72,16 @@ public class PceQueryPathCommand extends AbstractShellCommand { | ... | @@ -71,16 +72,16 @@ public class PceQueryPathCommand extends AbstractShellCommand { |
71 | * @param tunnel pce tunnel | 72 | * @param tunnel pce tunnel |
72 | */ | 73 | */ |
73 | void display(Tunnel tunnel) { | 74 | void display(Tunnel tunnel) { |
74 | - print("\npath-id : %d \n" + | 75 | + print("\npath-id : %s \n" + |
75 | "source : %s \n" + | 76 | "source : %s \n" + |
76 | "destination : %s \n" + | 77 | "destination : %s \n" + |
77 | - "path-type : %d \n" + | 78 | + "path-type : %s \n" + |
78 | "symbolic-path-name : %s \n" + | 79 | "symbolic-path-name : %s \n" + |
79 | "constraints: \n" + | 80 | "constraints: \n" + |
80 | - " cost : %d \n" + | 81 | + " cost : %s \n" + |
81 | - " bandwidth : %.2f", | 82 | + " bandwidth : %s", |
82 | tunnel.tunnelId().id(), tunnel.src().toString(), tunnel.dst().toString(), | 83 | tunnel.tunnelId().id(), tunnel.src().toString(), tunnel.dst().toString(), |
83 | - tunnel.type(), tunnel.tunnelName(), tunnel.path().cost(), | 84 | + tunnel.type().name(), tunnel.tunnelName(), tunnel.annotations().value(COST_TYPE), |
84 | tunnel.annotations().value(AnnotationKeys.BANDWIDTH)); | 85 | tunnel.annotations().value(AnnotationKeys.BANDWIDTH)); |
85 | } | 86 | } |
86 | } | 87 | } | ... | ... |
... | @@ -86,9 +86,10 @@ public class PceSetupPathCommand extends AbstractShellCommand { | ... | @@ -86,9 +86,10 @@ public class PceSetupPathCommand extends AbstractShellCommand { |
86 | LspType lspType = LspType.values()[type]; | 86 | LspType lspType = LspType.values()[type]; |
87 | 87 | ||
88 | // Add bandwidth | 88 | // Add bandwidth |
89 | - // bandwidth default data rate unit is in BPS | 89 | + // bandwidth default data rate unit is in MBPS, since bandwidth value in network config |
90 | + //stored in MPBS | ||
90 | if (bandwidth != 0.0) { | 91 | if (bandwidth != 0.0) { |
91 | - listConstrnt.add(BandwidthConstraint.of(bandwidth, DataRateUnit.valueOf("BPS"))); | 92 | + listConstrnt.add(BandwidthConstraint.of(bandwidth, DataRateUnit.valueOf("MBPS"))); |
92 | } | 93 | } |
93 | 94 | ||
94 | // Add cost | 95 | // Add cost | ... | ... |
... | @@ -893,9 +893,7 @@ public class PceManager implements PceService { | ... | @@ -893,9 +893,7 @@ public class PceManager implements PceService { |
893 | 893 | ||
894 | // Check whether device has SR-TE Capability | 894 | // Check whether device has SR-TE Capability |
895 | if (cfg.labelStackCap()) { | 895 | if (cfg.labelStackCap()) { |
896 | - if (!srTeHandler.allocateNodeLabel(deviceId, lsrId)) { | 896 | + srTeHandler.allocateNodeLabel(deviceId, lsrId); |
897 | - log.error("Node label allocation for a device id {} has failed.", deviceId.toString()); | ||
898 | - } | ||
899 | } | 897 | } |
900 | } | 898 | } |
901 | 899 | ||
... | @@ -974,10 +972,7 @@ public class PceManager implements PceService { | ... | @@ -974,10 +972,7 @@ public class PceManager implements PceService { |
974 | 972 | ||
975 | // Check whether device has SR-TE Capability | 973 | // Check whether device has SR-TE Capability |
976 | if (cfg.labelStackCap()) { | 974 | if (cfg.labelStackCap()) { |
977 | - if (!srTeHandler.allocateAdjacencyLabel(link)) { | 975 | + srTeHandler.allocateAdjacencyLabel(link); |
978 | - log.error("Unable to allocate adjacency label for a link {}.", link.toString()); | ||
979 | - return; | ||
980 | - } | ||
981 | } | 976 | } |
982 | 977 | ||
983 | return; | 978 | return; |
... | @@ -1209,16 +1204,13 @@ public class PceManager implements PceService { | ... | @@ -1209,16 +1204,13 @@ public class PceManager implements PceService { |
1209 | if (cfg.labelStackCap()) { | 1204 | if (cfg.labelStackCap()) { |
1210 | if (mastershipService.getLocalRole(deviceId) == MastershipRole.MASTER) { | 1205 | if (mastershipService.getLocalRole(deviceId) == MastershipRole.MASTER) { |
1211 | // Allocate node-label | 1206 | // Allocate node-label |
1212 | - if (!srTeHandler.allocateNodeLabel(deviceId, lsrId)) { | 1207 | + srTeHandler.allocateNodeLabel(deviceId, lsrId); |
1213 | - log.error("Node label allocation for a device id {} has failed.", deviceId.toString()); | ||
1214 | - } | ||
1215 | 1208 | ||
1216 | // Allocate adjacency label to links which are | 1209 | // Allocate adjacency label to links which are |
1217 | // originated from this specific device id | 1210 | // originated from this specific device id |
1218 | Set<Link> links = linkService.getDeviceEgressLinks(deviceId); | 1211 | Set<Link> links = linkService.getDeviceEgressLinks(deviceId); |
1219 | for (Link link : links) { | 1212 | for (Link link : links) { |
1220 | if (!srTeHandler.allocateAdjacencyLabel(link)) { | 1213 | if (!srTeHandler.allocateAdjacencyLabel(link)) { |
1221 | - log.debug("Unable to allocate adjacency labels for a link {}.", link.toString()); | ||
1222 | return; | 1214 | return; |
1223 | } | 1215 | } |
1224 | } | 1216 | } |
... | @@ -1240,40 +1232,42 @@ public class PceManager implements PceService { | ... | @@ -1240,40 +1232,42 @@ public class PceManager implements PceService { |
1240 | return false; | 1232 | return false; |
1241 | } | 1233 | } |
1242 | 1234 | ||
1243 | - Map<DeviceId, LabelResourceId> globalNodeLabelMap = pceStore.getGlobalNodeLabels(); | 1235 | + if (pceStore.getGlobalNodeLabel(deviceId) != null) { |
1236 | + Map<DeviceId, LabelResourceId> globalNodeLabelMap = pceStore.getGlobalNodeLabels(); | ||
1244 | 1237 | ||
1245 | - for (Entry<DeviceId, LabelResourceId> entry : globalNodeLabelMap.entrySet()) { | 1238 | + for (Entry<DeviceId, LabelResourceId> entry : globalNodeLabelMap.entrySet()) { |
1246 | 1239 | ||
1247 | - // Convert from DeviceId to TunnelEndPoint | 1240 | + // Convert from DeviceId to TunnelEndPoint |
1248 | - Device srcDevice = deviceService.getDevice(entry.getKey()); | 1241 | + Device srcDevice = deviceService.getDevice(entry.getKey()); |
1249 | 1242 | ||
1250 | - /* | 1243 | + /* |
1251 | - * If there is a slight difference in timing such that if device subsystem has removed the device but PCE | 1244 | + * If there is a slight difference in timing such that if device subsystem has removed the device but |
1252 | - * store still has it, just ignore such devices. | 1245 | + * PCE store still has it, just ignore such devices. |
1253 | - */ | 1246 | + */ |
1254 | - if (srcDevice == null) { | 1247 | + if (srcDevice == null) { |
1255 | - continue; | 1248 | + continue; |
1256 | - } | 1249 | + } |
1257 | 1250 | ||
1258 | - String srcLsrId = srcDevice.annotations().value(LSRID); | 1251 | + String srcLsrId = srcDevice.annotations().value(LSRID); |
1259 | - if (srcLsrId == null) { | 1252 | + if (srcLsrId == null) { |
1260 | - continue; | 1253 | + continue; |
1261 | - } | 1254 | + } |
1262 | 1255 | ||
1263 | - srTeHandler.advertiseNodeLabelRule(deviceId, | 1256 | + srTeHandler.advertiseNodeLabelRule(deviceId, |
1264 | - entry.getValue(), | 1257 | + entry.getValue(), |
1265 | - IpPrefix.valueOf(IpAddress.valueOf(srcLsrId), PREFIX_LENGTH), | 1258 | + IpPrefix.valueOf(IpAddress.valueOf(srcLsrId), PREFIX_LENGTH), |
1266 | - Objective.Operation.ADD, false); | 1259 | + Objective.Operation.ADD, false); |
1267 | - } | 1260 | + } |
1268 | 1261 | ||
1269 | - Map<Link, LabelResourceId> adjLabelMap = pceStore.getAdjLabels(); | 1262 | + Map<Link, LabelResourceId> adjLabelMap = pceStore.getAdjLabels(); |
1270 | - for (Entry<Link, LabelResourceId> entry : adjLabelMap.entrySet()) { | 1263 | + for (Entry<Link, LabelResourceId> entry : adjLabelMap.entrySet()) { |
1271 | - if (entry.getKey().src().deviceId().equals(deviceId)) { | 1264 | + if (entry.getKey().src().deviceId().equals(deviceId)) { |
1272 | - srTeHandler.installAdjLabelRule(deviceId, | 1265 | + srTeHandler.installAdjLabelRule(deviceId, |
1273 | - entry.getValue(), | 1266 | + entry.getValue(), |
1274 | - entry.getKey().src().port(), | 1267 | + entry.getKey().src().port(), |
1275 | - entry.getKey().dst().port(), | 1268 | + entry.getKey().dst().port(), |
1276 | - Objective.Operation.ADD); | 1269 | + Objective.Operation.ADD); |
1270 | + } | ||
1277 | } | 1271 | } |
1278 | } | 1272 | } |
1279 | 1273 | ||
... | @@ -1281,6 +1275,9 @@ public class PceManager implements PceService { | ... | @@ -1281,6 +1275,9 @@ public class PceManager implements PceService { |
1281 | LabelResourceId.labelResourceId(0), | 1275 | LabelResourceId.labelResourceId(0), |
1282 | IpPrefix.valueOf(END_OF_SYNC_IP_PREFIX), | 1276 | IpPrefix.valueOf(END_OF_SYNC_IP_PREFIX), |
1283 | Objective.Operation.ADD, true); | 1277 | Objective.Operation.ADD, true); |
1278 | + | ||
1279 | + log.debug("End of label DB sync for device {}", deviceId); | ||
1280 | + | ||
1284 | if (mastershipService.getLocalRole(specificDevice.id()) == MastershipRole.MASTER) { | 1281 | if (mastershipService.getLocalRole(specificDevice.id()) == MastershipRole.MASTER) { |
1285 | // Allocate node-label to this specific device. | 1282 | // Allocate node-label to this specific device. |
1286 | allocateNodeLabel(specificDevice); | 1283 | allocateNodeLabel(specificDevice); |
... | @@ -1304,6 +1301,7 @@ public class PceManager implements PceService { | ... | @@ -1304,6 +1301,7 @@ public class PceManager implements PceService { |
1304 | public void process(PacketContext context) { | 1301 | public void process(PacketContext context) { |
1305 | // Stop processing if the packet has been handled, since we | 1302 | // Stop processing if the packet has been handled, since we |
1306 | // can't do any more to it. | 1303 | // can't do any more to it. |
1304 | + log.debug("Received trigger for label DB sync."); | ||
1307 | if (context.isHandled()) { | 1305 | if (context.isHandled()) { |
1308 | return; | 1306 | return; |
1309 | } | 1307 | } | ... | ... |
... | @@ -28,7 +28,6 @@ import java.util.Set; | ... | @@ -28,7 +28,6 @@ import java.util.Set; |
28 | import org.onlab.packet.IpAddress; | 28 | import org.onlab.packet.IpAddress; |
29 | import org.onlab.packet.IpPrefix; | 29 | import org.onlab.packet.IpPrefix; |
30 | import org.onlab.packet.MplsLabel; | 30 | import org.onlab.packet.MplsLabel; |
31 | -import org.onlab.packet.TpPort; | ||
32 | import org.onosproject.core.ApplicationId; | 31 | import org.onosproject.core.ApplicationId; |
33 | import org.onosproject.incubator.net.resource.label.DefaultLabelResource; | 32 | import org.onosproject.incubator.net.resource.label.DefaultLabelResource; |
34 | import org.onosproject.incubator.net.resource.label.LabelResource; | 33 | import org.onosproject.incubator.net.resource.label.LabelResource; |
... | @@ -184,7 +183,7 @@ public final class PceccSrTeBeHandler { | ... | @@ -184,7 +183,7 @@ public final class PceccSrTeBeHandler { |
184 | 183 | ||
185 | // Check whether node-label was already configured for this specific device. | 184 | // Check whether node-label was already configured for this specific device. |
186 | if (pceStore.getGlobalNodeLabel(specificDeviceId) != null) { | 185 | if (pceStore.getGlobalNodeLabel(specificDeviceId) != null) { |
187 | - log.error("Node label was already configured for device {}.", specificDeviceId.toString()); | 186 | + log.debug("Node label was already configured for device {}.", specificDeviceId.toString()); |
188 | return false; | 187 | return false; |
189 | } | 188 | } |
190 | 189 | ||
... | @@ -228,12 +227,15 @@ public final class PceccSrTeBeHandler { | ... | @@ -228,12 +227,15 @@ public final class PceccSrTeBeHandler { |
228 | 227 | ||
229 | // Push to device | 228 | // Push to device |
230 | // Push label information of specificDeviceId to otherDevId in list and vice versa. | 229 | // Push label information of specificDeviceId to otherDevId in list and vice versa. |
231 | - advertiseNodeLabelRule(otherDevId, specificLabelId, | 230 | + if (!otherDevId.equals(specificDeviceId)) { |
232 | - IpPrefix.valueOf(IpAddress.valueOf(specificLsrId), PREFIX_LENGTH), | 231 | + advertiseNodeLabelRule(otherDevId, specificLabelId, |
233 | - Objective.Operation.ADD, false); | 232 | + IpPrefix.valueOf(IpAddress.valueOf(specificLsrId), PREFIX_LENGTH), |
234 | - advertiseNodeLabelRule(specificDeviceId, otherLabelId, | 233 | + Objective.Operation.ADD, false); |
235 | - IpPrefix.valueOf(IpAddress.valueOf(otherLsrId), PREFIX_LENGTH), | 234 | + |
236 | - Objective.Operation.ADD, false); | 235 | + advertiseNodeLabelRule(specificDeviceId, otherLabelId, |
236 | + IpPrefix.valueOf(IpAddress.valueOf(otherLsrId), PREFIX_LENGTH), | ||
237 | + Objective.Operation.ADD, false); | ||
238 | + } | ||
237 | } | 239 | } |
238 | 240 | ||
239 | return true; | 241 | return true; |
... | @@ -519,8 +521,8 @@ public final class PceccSrTeBeHandler { | ... | @@ -519,8 +521,8 @@ public final class PceccSrTeBeHandler { |
519 | TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder(); | 521 | TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder(); |
520 | 522 | ||
521 | selectorBuilder.matchMplsLabel(MplsLabel.mplsLabel(labelId.id().intValue())); | 523 | selectorBuilder.matchMplsLabel(MplsLabel.mplsLabel(labelId.id().intValue())); |
522 | - selectorBuilder.matchTcpSrc(TpPort.tpPort((int) srcPortNum.toLong())); | 524 | + selectorBuilder.matchIPSrc(IpPrefix.valueOf((int) srcPortNum.toLong(), 32)); |
523 | - selectorBuilder.matchTcpDst(TpPort.tpPort((int) dstPortNum.toLong())); | 525 | + selectorBuilder.matchIPDst(IpPrefix.valueOf((int) dstPortNum.toLong(), 32)); |
524 | 526 | ||
525 | TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 527 | TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); |
526 | 528 | ... | ... |
... | @@ -38,6 +38,7 @@ import org.onosproject.net.intent.constraint.BandwidthConstraint; | ... | @@ -38,6 +38,7 @@ import org.onosproject.net.intent.constraint.BandwidthConstraint; |
38 | import org.onosproject.net.DeviceId; | 38 | import org.onosproject.net.DeviceId; |
39 | import org.onosproject.net.Link; | 39 | import org.onosproject.net.Link; |
40 | import org.onosproject.net.resource.ResourceConsumer; | 40 | import org.onosproject.net.resource.ResourceConsumer; |
41 | +import org.onosproject.pce.pceservice.constraint.CapabilityConstraint; | ||
41 | import org.onosproject.pce.pceservice.constraint.CostConstraint; | 42 | import org.onosproject.pce.pceservice.constraint.CostConstraint; |
42 | import org.onosproject.pce.pceservice.TunnelConsumerId; | 43 | import org.onosproject.pce.pceservice.TunnelConsumerId; |
43 | import org.onosproject.pce.pceservice.LspType; | 44 | import org.onosproject.pce.pceservice.LspType; |
... | @@ -132,6 +133,8 @@ public class DistributedPceStore implements PceStore { | ... | @@ -132,6 +133,8 @@ public class DistributedPceStore implements PceStore { |
132 | CostConstraint.class, | 133 | CostConstraint.class, |
133 | CostConstraint.Type.class, | 134 | CostConstraint.Type.class, |
134 | BandwidthConstraint.class, | 135 | BandwidthConstraint.class, |
136 | + CapabilityConstraint.class, | ||
137 | + CapabilityConstraint.CapabilityType.class, | ||
135 | LspType.class) | 138 | LspType.class) |
136 | .build())) | 139 | .build())) |
137 | 140 | ||
... | @@ -216,19 +219,19 @@ public class DistributedPceStore implements PceStore { | ... | @@ -216,19 +219,19 @@ public class DistributedPceStore implements PceStore { |
216 | @Override | 219 | @Override |
217 | public LabelResourceId getGlobalNodeLabel(DeviceId id) { | 220 | public LabelResourceId getGlobalNodeLabel(DeviceId id) { |
218 | checkNotNull(id, DEVICE_ID_NULL); | 221 | checkNotNull(id, DEVICE_ID_NULL); |
219 | - return globalNodeLabelMap.get(id).value(); | 222 | + return globalNodeLabelMap.get(id) == null ? null : globalNodeLabelMap.get(id).value(); |
220 | } | 223 | } |
221 | 224 | ||
222 | @Override | 225 | @Override |
223 | public LabelResourceId getAdjLabel(Link link) { | 226 | public LabelResourceId getAdjLabel(Link link) { |
224 | checkNotNull(link, LINK_NULL); | 227 | checkNotNull(link, LINK_NULL); |
225 | - return adjLabelMap.get(link).value(); | 228 | + return adjLabelMap.get(link) == null ? null : adjLabelMap.get(link).value(); |
226 | } | 229 | } |
227 | 230 | ||
228 | @Override | 231 | @Override |
229 | public PceccTunnelInfo getTunnelInfo(TunnelId tunnelId) { | 232 | public PceccTunnelInfo getTunnelInfo(TunnelId tunnelId) { |
230 | checkNotNull(tunnelId, TUNNEL_ID_NULL); | 233 | checkNotNull(tunnelId, TUNNEL_ID_NULL); |
231 | - return tunnelInfoMap.get(tunnelId).value(); | 234 | + return tunnelInfoMap.get(tunnelId) == null ? null : tunnelInfoMap.get(tunnelId).value(); |
232 | } | 235 | } |
233 | 236 | ||
234 | @Override | 237 | @Override | ... | ... |
... | @@ -431,7 +431,6 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { | ... | @@ -431,7 +431,6 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { |
431 | lspTypeVal = LspType.SR_WITHOUT_SIGNALLING; | 431 | lspTypeVal = LspType.SR_WITHOUT_SIGNALLING; |
432 | break; | 432 | break; |
433 | default: | 433 | default: |
434 | - log.error("Invalid LSP type"); | ||
435 | break; | 434 | break; |
436 | } | 435 | } |
437 | 436 | ||
... | @@ -539,7 +538,6 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { | ... | @@ -539,7 +538,6 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { |
539 | costTypeVal = CostConstraint.Type.TE_COST; | 538 | costTypeVal = CostConstraint.Type.TE_COST; |
540 | break; | 539 | break; |
541 | default: | 540 | default: |
542 | - log.error("Invalid cost type"); | ||
543 | break; | 541 | break; |
544 | } | 542 | } |
545 | 543 | ||
... | @@ -660,12 +658,17 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { | ... | @@ -660,12 +658,17 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { |
660 | tunnelSet = tunnelService.queryTunnel(MPLS); | 658 | tunnelSet = tunnelService.queryTunnel(MPLS); |
661 | for (Tunnel tunnel : tunnelSet) { | 659 | for (Tunnel tunnel : tunnelSet) { |
662 | if (tunnel.path() == null) { | 660 | if (tunnel.path() == null) { |
663 | - log.info("path does not exist"); | 661 | + log.error("path does not exist"); |
664 | return; | 662 | return; |
665 | } | 663 | } |
666 | paths.add(tunnel.path()); | 664 | paths.add(tunnel.path()); |
667 | } | 665 | } |
668 | 666 | ||
667 | + if (tunnelSet.size() == 0) { | ||
668 | + log.warn("Tunnel does not exist"); | ||
669 | + return; | ||
670 | + } | ||
671 | + | ||
669 | ImmutableSet.Builder<Link> builder = ImmutableSet.builder(); | 672 | ImmutableSet.Builder<Link> builder = ImmutableSet.builder(); |
670 | allPathLinks = buildPaths(builder).build(); | 673 | allPathLinks = buildPaths(builder).build(); |
671 | hilightAndSendPaths(); | 674 | hilightAndSendPaths(); | ... | ... |
... | @@ -17,18 +17,28 @@ | ... | @@ -17,18 +17,28 @@ |
17 | package org.onosproject.pceweb; | 17 | package org.onosproject.pceweb; |
18 | 18 | ||
19 | 19 | ||
20 | +import java.util.HashMap; | ||
21 | +import java.util.Map; | ||
22 | +import java.util.Set; | ||
23 | + | ||
24 | +import org.onlab.util.Bandwidth; | ||
20 | import org.onosproject.net.AnnotationKeys; | 25 | import org.onosproject.net.AnnotationKeys; |
21 | import org.onosproject.net.Annotations; | 26 | import org.onosproject.net.Annotations; |
22 | import org.onosproject.net.Device; | 27 | import org.onosproject.net.Device; |
23 | import org.onosproject.net.DeviceId; | 28 | import org.onosproject.net.DeviceId; |
29 | +import org.onosproject.net.Link; | ||
24 | import org.onosproject.ui.UiTopoOverlay; | 30 | import org.onosproject.ui.UiTopoOverlay; |
25 | import org.onosproject.ui.topo.ButtonId; | 31 | import org.onosproject.ui.topo.ButtonId; |
26 | import org.onosproject.ui.topo.PropertyPanel; | 32 | import org.onosproject.ui.topo.PropertyPanel; |
27 | import org.onosproject.net.HostId; | 33 | import org.onosproject.net.HostId; |
28 | import org.onosproject.net.device.DeviceService; | 34 | import org.onosproject.net.device.DeviceService; |
35 | +import org.onosproject.net.link.LinkEvent; | ||
36 | +import org.onosproject.net.resource.ContinuousResource; | ||
37 | +import org.onosproject.net.resource.DiscreteResource; | ||
38 | +import org.onosproject.net.resource.Resource; | ||
39 | +import org.onosproject.net.resource.ResourceService; | ||
40 | +import org.onosproject.net.resource.Resources; | ||
29 | import org.onosproject.ui.topo.TopoConstants.CoreButtons; | 41 | import org.onosproject.ui.topo.TopoConstants.CoreButtons; |
30 | - | ||
31 | -import static org.onosproject.ui.topo.TopoConstants.Properties.*; | ||
32 | import org.onosproject.cli.AbstractShellCommand; | 42 | import org.onosproject.cli.AbstractShellCommand; |
33 | 43 | ||
34 | /** | 44 | /** |
... | @@ -42,7 +52,9 @@ public class PceWebTopovOverlay extends UiTopoOverlay { | ... | @@ -42,7 +52,9 @@ public class PceWebTopovOverlay extends UiTopoOverlay { |
42 | 52 | ||
43 | public static final String AS_NUMBER = "asNumber"; | 53 | public static final String AS_NUMBER = "asNumber"; |
44 | public static final String DOMAIN_IDENTIFIER = "domainIdentifier"; | 54 | public static final String DOMAIN_IDENTIFIER = "domainIdentifier"; |
45 | - public static final String ROUTING_UNIVERSE = "routingUniverse"; | 55 | + public static final String ABR_BIT = "abrBit"; |
56 | + public static final String ASBR_BIT = "externalBit"; | ||
57 | + public static final String TE_METRIC = "teCost"; | ||
46 | 58 | ||
47 | private static final ButtonId SRC_BUTTON = new ButtonId("src"); | 59 | private static final ButtonId SRC_BUTTON = new ButtonId("src"); |
48 | private static final ButtonId DST_BUTTON = new ButtonId("dst"); | 60 | private static final ButtonId DST_BUTTON = new ButtonId("dst"); |
... | @@ -77,34 +89,75 @@ public class PceWebTopovOverlay extends UiTopoOverlay { | ... | @@ -77,34 +89,75 @@ public class PceWebTopovOverlay extends UiTopoOverlay { |
77 | if (deviceService != null) { | 89 | if (deviceService != null) { |
78 | 90 | ||
79 | Device device = deviceService.getDevice(deviceId); | 91 | Device device = deviceService.getDevice(deviceId); |
80 | - Annotations annot = device.annotations(); | 92 | + Annotations annots = device.annotations(); |
81 | 93 | ||
82 | - String routerId = annot.value(AnnotationKeys.ROUTER_ID); | 94 | + String routerId = annots.value(AnnotationKeys.ROUTER_ID); |
83 | - String type = annot.value(AnnotationKeys.TYPE); | 95 | + String type = annots.value(AnnotationKeys.TYPE); |
84 | - String asNumber = annot.value(AS_NUMBER); | 96 | + String asNumber = annots.value(AS_NUMBER); |
85 | - String domain = annot.value(DOMAIN_IDENTIFIER); | 97 | + String domain = annots.value(DOMAIN_IDENTIFIER); |
86 | - String routingUnverse = annot.value(ROUTING_UNIVERSE); | 98 | + String abrStatus = annots.value(ABR_BIT); |
99 | + String asbrStatus = annots.value(ASBR_BIT); | ||
87 | 100 | ||
88 | if (type != null) { | 101 | if (type != null) { |
89 | pp.addProp("Type", type); | 102 | pp.addProp("Type", type); |
90 | } | 103 | } |
91 | - /* TBD: Router ID need to print | 104 | + |
92 | if (routerId != null) { | 105 | if (routerId != null) { |
93 | pp.addProp("Router-ID", routerId); | 106 | pp.addProp("Router-ID", routerId); |
94 | - } */ | ||
95 | - if (routingUnverse != null) { | ||
96 | - pp.addProp("Routing Universe", routingUnverse); | ||
97 | } | 107 | } |
108 | + | ||
98 | if (asNumber != null) { | 109 | if (asNumber != null) { |
99 | pp.addProp("AS Number", asNumber); | 110 | pp.addProp("AS Number", asNumber); |
100 | } | 111 | } |
112 | + | ||
101 | if (domain != null) { | 113 | if (domain != null) { |
102 | pp.addProp("Domain ID", domain); | 114 | pp.addProp("Domain ID", domain); |
103 | } | 115 | } |
116 | + | ||
117 | + if (abrStatus != null) { | ||
118 | + pp.addProp("ABR Role", abrStatus); | ||
119 | + } | ||
120 | + | ||
121 | + if (asbrStatus != null) { | ||
122 | + pp.addProp("ASBR Role", asbrStatus); | ||
123 | + } | ||
104 | } | 124 | } |
105 | } | 125 | } |
106 | 126 | ||
107 | @Override | 127 | @Override |
128 | + public Map<String, String> additionalLinkData(LinkEvent event) { | ||
129 | + Map<String, String> map = new HashMap<>(); | ||
130 | + Link link = event.subject(); | ||
131 | + | ||
132 | + map.put("Src port", link.src().port().toString()); | ||
133 | + map.put("Dst port", link.dst().port().toString()); | ||
134 | + map.put("Te metric", link.annotations().value(TE_METRIC)); | ||
135 | + | ||
136 | + ResourceService resService = AbstractShellCommand.get(ResourceService.class); | ||
137 | + DiscreteResource devResource = Resources.discrete(link.src().deviceId(), link.src().port()).resource(); | ||
138 | + if (resService == null) { | ||
139 | + log.warn("resource service does not exist "); | ||
140 | + return map; | ||
141 | + } | ||
142 | + | ||
143 | + if (devResource == null) { | ||
144 | + log.warn("Device resources does not exist "); | ||
145 | + return map; | ||
146 | + } | ||
147 | + Set<Resource> resources = resService.getAvailableResources(devResource.id(), Bandwidth.class); | ||
148 | + if (resources.isEmpty()) { | ||
149 | + log.warn("Bandwidth resources does not exist "); | ||
150 | + return map; | ||
151 | + } | ||
152 | + | ||
153 | + if (resources.iterator().next() instanceof ContinuousResource) { | ||
154 | + map.put("Bandwidth", ((ContinuousResource) resources.iterator().next()).toString()); | ||
155 | + } | ||
156 | + | ||
157 | + return map; | ||
158 | + } | ||
159 | + | ||
160 | + @Override | ||
108 | public void modifyHostDetails(PropertyPanel pp, HostId hostId) { | 161 | public void modifyHostDetails(PropertyPanel pp, HostId hostId) { |
109 | pp.addButton(SRC_BUTTON).addButton(DST_BUTTON); | 162 | pp.addButton(SRC_BUTTON).addButton(DST_BUTTON); |
110 | } | 163 | } | ... | ... |
... | @@ -96,9 +96,9 @@ | ... | @@ -96,9 +96,9 @@ |
96 | addAttribute('pce-cost-type-valname', 'pce-cost-type-te', 'TE', 'radio'); | 96 | addAttribute('pce-cost-type-valname', 'pce-cost-type-te', 'TE', 'radio'); |
97 | //Add the LSP type related inputs. | 97 | //Add the LSP type related inputs. |
98 | addAttribute('pce-lsp-type-name', 'pce-lsp-type', 'Lsp Type', 'checkbox'); | 98 | addAttribute('pce-lsp-type-name', 'pce-lsp-type', 'Lsp Type', 'checkbox'); |
99 | - addAttribute('pce-lsp-type-valname', 'pce-lsp-type-cr', 'WITH SIGNALLING', 'radio'); | 99 | + addAttribute('pce-lsp-type-valname', 'pce-lsp-type-cr', 'With signalling', 'radio'); |
100 | - addAttribute('pce-lsp-type-valname', 'pce-lsp-type-srbe', 'WITHOUT SR WITHOUT SIGNALLING', 'radio'); | 100 | + addAttribute('pce-lsp-type-valname', 'pce-lsp-type-srbe', 'Without SR without signalling', 'radio'); |
101 | - addAttribute('pce-lsp-type-valname', 'pce-lsp-type-srte', 'WITH SR WITHOUT SIGNALLING', 'radio'); | 101 | + addAttribute('pce-lsp-type-valname', 'pce-lsp-type-srte', 'With SR without signalling', 'radio'); |
102 | //Add the tunnel name | 102 | //Add the tunnel name |
103 | addAttribute('pce-tunnel-name', 'pce-tunnel-name-id', 'Tunnel Name', 'text'); | 103 | addAttribute('pce-tunnel-name', 'pce-tunnel-name-id', 'Tunnel Name', 'text'); |
104 | 104 | ||
... | @@ -182,12 +182,12 @@ | ... | @@ -182,12 +182,12 @@ |
182 | return content; | 182 | return content; |
183 | } | 183 | } |
184 | 184 | ||
185 | - function isChecked(viewId) { | 185 | + function isChecked(cboxId) { |
186 | - return d3.select('#' + viewId).property('checked'); | 186 | + return d3.select('#' + cboxId).property('checked'); |
187 | } | 187 | } |
188 | 188 | ||
189 | - function getCheckedValue(viewId) { | 189 | + function getCheckedValue(cboxId) { |
190 | - return d3.select('#' + viewId).property('value'); | 190 | + return d3.select('#' + cboxId).property('value'); |
191 | } | 191 | } |
192 | 192 | ||
193 | function showTunnelInformation(data) { | 193 | function showTunnelInformation(data) { |
... | @@ -198,25 +198,19 @@ | ... | @@ -198,25 +198,19 @@ |
198 | var tdString = '' ; | 198 | var tdString = '' ; |
199 | tunnelNameData.a.forEach( function (val, idx) { | 199 | tunnelNameData.a.forEach( function (val, idx) { |
200 | var tunnelName = isChecked('tunnel-id-'+idx); | 200 | var tunnelName = isChecked('tunnel-id-'+idx); |
201 | - if (tunnelName) | 201 | + if (tunnelName) { |
202 | - { | ||
203 | tdString = val; | 202 | tdString = val; |
204 | } | 203 | } |
205 | } ); | 204 | } ); |
206 | 205 | ||
207 | - if (tdString) { | 206 | + constraintsUpdateDialog(tdString); |
208 | - constraintsUpdateDialog(tdString); | ||
209 | - } else { | ||
210 | - $log.debug("No tunnel id is selected."); | ||
211 | - } | ||
212 | - | ||
213 | $log.debug('Dialog OK button clicked'); | 207 | $log.debug('Dialog OK button clicked'); |
214 | } | 208 | } |
215 | 209 | ||
216 | tds.openDialog() | 210 | tds.openDialog() |
217 | .setTitle('Available LSPs with selected device') | 211 | .setTitle('Available LSPs with selected device') |
218 | .addContent(createUserTextUpdate(data)) | 212 | .addContent(createUserTextUpdate(data)) |
219 | - .addOkChained(dOkUpdate, 'GOTO Selection of constraints') | 213 | + .addOkChained(dOkUpdate, 'OK') |
220 | .addCancel(dClose, 'Close') | 214 | .addCancel(dClose, 'Close') |
221 | .bindKeys(); | 215 | .bindKeys(); |
222 | } | 216 | } |
... | @@ -266,7 +260,7 @@ | ... | @@ -266,7 +260,7 @@ |
266 | .setTitle('Select constraints for update path') | 260 | .setTitle('Select constraints for update path') |
267 | .addContent(createUserTextUpdatePathEvent()) | 261 | .addContent(createUserTextUpdatePathEvent()) |
268 | .addCancel() | 262 | .addCancel() |
269 | - .addOk(dOkUpdateEvent, 'Update Path') // NOTE: NOT the "chained" version! | 263 | + .addOk(dOkUpdateEvent, 'OK') // NOTE: NOT the "chained" version! |
270 | .bindKeys(); | 264 | .bindKeys(); |
271 | 265 | ||
272 | } | 266 | } |
... | @@ -278,7 +272,7 @@ | ... | @@ -278,7 +272,7 @@ |
278 | tds.openDialog() | 272 | tds.openDialog() |
279 | .setTitle('Available Tunnels for remove') | 273 | .setTitle('Available Tunnels for remove') |
280 | .addContent(createUserTextRemove(data)) | 274 | .addContent(createUserTextRemove(data)) |
281 | - .addOk(dOkRemove, 'Remove') | 275 | + .addOk(dOkRemove, 'OK') |
282 | .addCancel(dClose, 'Close') | 276 | .addCancel(dClose, 'Close') |
283 | .bindKeys(); | 277 | .bindKeys(); |
284 | } | 278 | } | ... | ... |
... | @@ -168,6 +168,29 @@ | ... | @@ -168,6 +168,29 @@ |
168 | }, | 168 | }, |
169 | multi: function (selectOrder) { | 169 | multi: function (selectOrder) { |
170 | selectionCallback(selectOrder); | 170 | selectionCallback(selectOrder); |
171 | + }, | ||
172 | + modifylinkdata: function (data, extra) { | ||
173 | + $log.debug("Modify link data", data, extra); | ||
174 | + | ||
175 | + function sep() { | ||
176 | + data.propOrder.push('-'); | ||
177 | + } | ||
178 | + | ||
179 | + function add(key) { | ||
180 | + var val = extra[key]; | ||
181 | + if (val !== undefined) { | ||
182 | + data.propOrder.push(key); | ||
183 | + data.props[key] = val; | ||
184 | + } | ||
185 | + } | ||
186 | + | ||
187 | + sep(); | ||
188 | + add('Src port'); | ||
189 | + add('Dst port'); | ||
190 | + add('Te metric'); | ||
191 | + add('Bandwidth'); | ||
192 | + | ||
193 | + return data; | ||
171 | } | 194 | } |
172 | } | 195 | } |
173 | }; | 196 | }; | ... | ... |
... | @@ -70,7 +70,7 @@ public final class BgpDpid { | ... | @@ -70,7 +70,7 @@ public final class BgpDpid { |
70 | /* | 70 | /* |
71 | * Get iso node ID in specified string format. | 71 | * Get iso node ID in specified string format. |
72 | */ | 72 | */ |
73 | - private String isoNodeIdString(byte[] isoNodeId) { | 73 | + public String isoNodeIdString(byte[] isoNodeId) { |
74 | if (isoNodeId != null) { | 74 | if (isoNodeId != null) { |
75 | return String.format("%02x%02x.%02x%02x.%02x%02x", isoNodeId[0], isoNodeId[1], | 75 | return String.format("%02x%02x.%02x%02x.%02x%02x", isoNodeId[0], isoNodeId[1], |
76 | isoNodeId[2], isoNodeId[3], | 76 | isoNodeId[2], isoNodeId[3], | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.provider.pcep.tunnel.impl; | 16 | +package org.onosproject.pcep.controller; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Collection of keys for annotation for PCEP tunnels. | 19 | * Collection of keys for annotation for PCEP tunnels. | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.pcep.controller.impl; | 16 | +package org.onosproject.pcep.controller; |
17 | 17 | ||
18 | import org.onosproject.incubator.net.tunnel.Tunnel.State; | 18 | import org.onosproject.incubator.net.tunnel.Tunnel.State; |
19 | 19 | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.provider.pcep.tunnel.impl; | 16 | +package org.onosproject.pcep.controller; |
17 | 17 | ||
18 | import static org.slf4j.LoggerFactory.getLogger; | 18 | import static org.slf4j.LoggerFactory.getLogger; |
19 | 19 | ... | ... |
... | @@ -62,6 +62,8 @@ import org.onosproject.pcepio.types.PcepValueType; | ... | @@ -62,6 +62,8 @@ import org.onosproject.pcepio.types.PcepValueType; |
62 | import org.slf4j.Logger; | 62 | import org.slf4j.Logger; |
63 | import org.slf4j.LoggerFactory; | 63 | import org.slf4j.LoggerFactory; |
64 | 64 | ||
65 | +import static org.onosproject.pcep.controller.PcepSyncStatus.NOT_SYNCED; | ||
66 | + | ||
65 | /** | 67 | /** |
66 | * Channel handler deals with the pcc client connection and dispatches | 68 | * Channel handler deals with the pcc client connection and dispatches |
67 | * messages from client to the appropriate locations. | 69 | * messages from client to the appropriate locations. |
... | @@ -177,18 +179,23 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -177,18 +179,23 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler { |
177 | * The socket IP is stored in channel. | 179 | * The socket IP is stored in channel. |
178 | */ | 180 | */ |
179 | LinkedList<PcepValueType> optionalTlvs = pOpenmsg.getPcepOpenObject().getOptionalTlv(); | 181 | LinkedList<PcepValueType> optionalTlvs = pOpenmsg.getPcepOpenObject().getOptionalTlv(); |
180 | - for (PcepValueType optionalTlv : optionalTlvs) { | 182 | + if (optionalTlvs != null) { |
181 | - if (optionalTlv instanceof NodeAttributesTlv) { | 183 | + for (PcepValueType optionalTlv : optionalTlvs) { |
182 | - List<PcepValueType> subTlvs = ((NodeAttributesTlv) optionalTlv) | 184 | + if (optionalTlv instanceof NodeAttributesTlv) { |
183 | - .getllNodeAttributesSubTLVs(); | 185 | + List<PcepValueType> subTlvs = ((NodeAttributesTlv) optionalTlv) |
184 | - for (PcepValueType subTlv : subTlvs) { | 186 | + .getllNodeAttributesSubTLVs(); |
185 | - if (subTlv instanceof IPv4RouterIdOfLocalNodeSubTlv) { | 187 | + if (subTlvs == null) { |
186 | - h.thispccId = PccId.pccId(IpAddress | ||
187 | - .valueOf(((IPv4RouterIdOfLocalNodeSubTlv) subTlv).getInt())); | ||
188 | break; | 188 | break; |
189 | } | 189 | } |
190 | + for (PcepValueType subTlv : subTlvs) { | ||
191 | + if (subTlv instanceof IPv4RouterIdOfLocalNodeSubTlv) { | ||
192 | + h.thispccId = PccId.pccId(IpAddress | ||
193 | + .valueOf(((IPv4RouterIdOfLocalNodeSubTlv) subTlv).getInt())); | ||
194 | + break; | ||
195 | + } | ||
196 | + } | ||
197 | + break; | ||
190 | } | 198 | } |
191 | - break; | ||
192 | } | 199 | } |
193 | } | 200 | } |
194 | 201 | ||
... | @@ -228,6 +235,11 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -228,6 +235,11 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler { |
228 | h.pcepPacketStats); | 235 | h.pcepPacketStats); |
229 | //Get pc instance and set capabilities | 236 | //Get pc instance and set capabilities |
230 | h.pc.setCapability(h.capability); | 237 | h.pc.setCapability(h.capability); |
238 | + | ||
239 | + // Initilialize DB sync status. | ||
240 | + h.pc.setLspDbSyncStatus(NOT_SYNCED); | ||
241 | + h.pc.setLabelDbSyncStatus(NOT_SYNCED); | ||
242 | + | ||
231 | // set the status of pcc as connected | 243 | // set the status of pcc as connected |
232 | h.pc.setConnected(true); | 244 | h.pc.setConnected(true); |
233 | h.pc.setChannel(h.channel); | 245 | h.pc.setChannel(h.channel); |
... | @@ -253,6 +265,7 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -253,6 +265,7 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler { |
253 | log.debug("Keep alive time : " + keepAliveTimer); | 265 | log.debug("Keep alive time : " + keepAliveTimer); |
254 | 266 | ||
255 | //set the state handshake completion. | 267 | //set the state handshake completion. |
268 | + | ||
256 | h.sendKeepAliveMessage(); | 269 | h.sendKeepAliveMessage(); |
257 | h.pcepPacketStats.addOutPacket(); | 270 | h.pcepPacketStats.addOutPacket(); |
258 | h.setHandshakeComplete(true); | 271 | h.setHandshakeComplete(true); | ... | ... |
... | @@ -45,6 +45,7 @@ import org.onosproject.pcep.controller.PcepClient; | ... | @@ -45,6 +45,7 @@ import org.onosproject.pcep.controller.PcepClient; |
45 | import org.onosproject.pcep.controller.PcepClientController; | 45 | import org.onosproject.pcep.controller.PcepClientController; |
46 | import org.onosproject.pcep.controller.PcepClientListener; | 46 | import org.onosproject.pcep.controller.PcepClientListener; |
47 | import org.onosproject.pcep.controller.PcepEventListener; | 47 | import org.onosproject.pcep.controller.PcepEventListener; |
48 | +import org.onosproject.pcep.controller.PcepLspStatus; | ||
48 | import org.onosproject.pcep.controller.PcepNodeListener; | 49 | import org.onosproject.pcep.controller.PcepNodeListener; |
49 | import org.onosproject.pcep.controller.PcepPacketListener; | 50 | import org.onosproject.pcep.controller.PcepPacketListener; |
50 | import org.onosproject.pcep.controller.PcepSyncStatus; | 51 | import org.onosproject.pcep.controller.PcepSyncStatus; |
... | @@ -235,8 +236,10 @@ public class PcepClientControllerImpl implements PcepClientController { | ... | @@ -235,8 +236,10 @@ public class PcepClientControllerImpl implements PcepClientController { |
235 | ListIterator<PcepStateReport> listIterator = ((PcepReportMsg) msg).getStateReportList().listIterator(); | 236 | ListIterator<PcepStateReport> listIterator = ((PcepReportMsg) msg).getStateReportList().listIterator(); |
236 | while (listIterator.hasNext()) { | 237 | while (listIterator.hasNext()) { |
237 | PcepStateReport stateRpt = listIterator.next(); | 238 | PcepStateReport stateRpt = listIterator.next(); |
238 | - if (stateRpt.getLspObject().getSFlag()) { | 239 | + PcepLspObject lspObj = stateRpt.getLspObject(); |
240 | + if (lspObj.getSFlag()) { | ||
239 | if (pc.lspDbSyncStatus() != PcepSyncStatus.IN_SYNC) { | 241 | if (pc.lspDbSyncStatus() != PcepSyncStatus.IN_SYNC) { |
242 | + log.debug("LSP DB sync started for PCC {}", pc.getPccId().id().toString()); | ||
240 | // Initialize LSP DB sync and temporary cache. | 243 | // Initialize LSP DB sync and temporary cache. |
241 | pc.setLspDbSyncStatus(PcepSyncStatus.IN_SYNC); | 244 | pc.setLspDbSyncStatus(PcepSyncStatus.IN_SYNC); |
242 | pc.initializeSyncMsgList(pccId); | 245 | pc.initializeSyncMsgList(pccId); |
... | @@ -246,13 +249,16 @@ public class PcepClientControllerImpl implements PcepClientController { | ... | @@ -246,13 +249,16 @@ public class PcepClientControllerImpl implements PcepClientController { |
246 | 249 | ||
247 | // Don't send to provider as of now. | 250 | // Don't send to provider as of now. |
248 | continue; | 251 | continue; |
249 | - } else { | 252 | + } else if (lspObj.getPlspId() == 0) { |
250 | - if (pc.lspDbSyncStatus() == PcepSyncStatus.IN_SYNC) { | 253 | + if (pc.lspDbSyncStatus() == PcepSyncStatus.IN_SYNC |
254 | + || pc.lspDbSyncStatus() == PcepSyncStatus.NOT_SYNCED) { | ||
251 | // Set end of LSPDB sync. | 255 | // Set end of LSPDB sync. |
256 | + log.debug("LSP DB sync completed for PCC {}", pc.getPccId().id().toString()); | ||
252 | pc.setLspDbSyncStatus(PcepSyncStatus.SYNCED); | 257 | pc.setLspDbSyncStatus(PcepSyncStatus.SYNCED); |
253 | 258 | ||
254 | // Call packet provider to initiate label DB sync (only if PCECC capable). | 259 | // Call packet provider to initiate label DB sync (only if PCECC capable). |
255 | if (pc.capability().pceccCapability()) { | 260 | if (pc.capability().pceccCapability()) { |
261 | + log.debug("Trigger label DB sync for PCC {}", pc.getPccId().id().toString()); | ||
256 | pc.setLabelDbSyncStatus(IN_SYNC); | 262 | pc.setLabelDbSyncStatus(IN_SYNC); |
257 | for (PcepPacketListener l : pcepPacketListener) { | 263 | for (PcepPacketListener l : pcepPacketListener) { |
258 | l.sendPacketIn(pccId); | 264 | l.sendPacketIn(pccId); |
... | @@ -428,10 +434,16 @@ public class PcepClientControllerImpl implements PcepClientController { | ... | @@ -428,10 +434,16 @@ public class PcepClientControllerImpl implements PcepClientController { |
428 | } | 434 | } |
429 | 435 | ||
430 | List<PcepStateReport> syncStateRptList = pc.getSyncMsgList(pccId); | 436 | List<PcepStateReport> syncStateRptList = pc.getSyncMsgList(pccId); |
437 | + if (syncStateRptList == null) { | ||
438 | + // When there are no LSPs to sync, directly end-of-sync PCRpt will come and the | ||
439 | + // list will be null. | ||
440 | + syncStateRptList = Collections.EMPTY_LIST; | ||
441 | + } | ||
442 | + | ||
431 | Iterator<PcepStateReport> stateRptListIterator = syncStateRptList.iterator(); | 443 | Iterator<PcepStateReport> stateRptListIterator = syncStateRptList.iterator(); |
432 | 444 | ||
433 | // For every report, fetch PLSP id, local LSP id and symbolic path name from the message. | 445 | // For every report, fetch PLSP id, local LSP id and symbolic path name from the message. |
434 | - while (syncStateRptList.iterator().hasNext()) { | 446 | + while (stateRptListIterator.hasNext()) { |
435 | PcepStateReport stateRpt = stateRptListIterator.next(); | 447 | PcepStateReport stateRpt = stateRptListIterator.next(); |
436 | Tunnel tunnel = null; | 448 | Tunnel tunnel = null; |
437 | 449 | ... | ... |
... | @@ -73,7 +73,7 @@ public class PcepClientImpl implements PcepClientDriver { | ... | @@ -73,7 +73,7 @@ public class PcepClientImpl implements PcepClientDriver { |
73 | private byte sessionId; | 73 | private byte sessionId; |
74 | private PcepPacketStatsImpl pktStats; | 74 | private PcepPacketStatsImpl pktStats; |
75 | private Map<LspKey, Boolean> lspDelegationInfo; | 75 | private Map<LspKey, Boolean> lspDelegationInfo; |
76 | - private Map<PccId, List<PcepStateReport>> sycRptCache = new HashMap<>(); | 76 | + private Map<PccId, List<PcepStateReport>> syncRptCache = new HashMap<>(); |
77 | 77 | ||
78 | @Override | 78 | @Override |
79 | public void init(PccId pccId, PcepVersion pcepVersion, PcepPacketStats pktStats) { | 79 | public void init(PccId pccId, PcepVersion pcepVersion, PcepPacketStats pktStats) { |
... | @@ -267,24 +267,24 @@ public class PcepClientImpl implements PcepClientDriver { | ... | @@ -267,24 +267,24 @@ public class PcepClientImpl implements PcepClientDriver { |
267 | @Override | 267 | @Override |
268 | public void initializeSyncMsgList(PccId pccId) { | 268 | public void initializeSyncMsgList(PccId pccId) { |
269 | List<PcepStateReport> rptMsgList = new LinkedList<>(); | 269 | List<PcepStateReport> rptMsgList = new LinkedList<>(); |
270 | - sycRptCache.put(pccId, rptMsgList); | 270 | + syncRptCache.put(pccId, rptMsgList); |
271 | } | 271 | } |
272 | 272 | ||
273 | @Override | 273 | @Override |
274 | public List<PcepStateReport> getSyncMsgList(PccId pccId) { | 274 | public List<PcepStateReport> getSyncMsgList(PccId pccId) { |
275 | - return sycRptCache.get(pccId); | 275 | + return syncRptCache.get(pccId); |
276 | } | 276 | } |
277 | 277 | ||
278 | @Override | 278 | @Override |
279 | public void removeSyncMsgList(PccId pccId) { | 279 | public void removeSyncMsgList(PccId pccId) { |
280 | - sycRptCache.remove(pccId); | 280 | + syncRptCache.remove(pccId); |
281 | } | 281 | } |
282 | 282 | ||
283 | @Override | 283 | @Override |
284 | public void addSyncMsgToList(PccId pccId, PcepStateReport rptMsg) { | 284 | public void addSyncMsgToList(PccId pccId, PcepStateReport rptMsg) { |
285 | - List<PcepStateReport> rptMsgList = sycRptCache.get(pccId); | 285 | + List<PcepStateReport> rptMsgList = syncRptCache.get(pccId); |
286 | rptMsgList.add(rptMsg); | 286 | rptMsgList.add(rptMsg); |
287 | - sycRptCache.put(pccId, rptMsgList); | 287 | + syncRptCache.put(pccId, rptMsgList); |
288 | } | 288 | } |
289 | 289 | ||
290 | @Override | 290 | @Override | ... | ... |
... | @@ -80,7 +80,7 @@ public interface PcepBandwidthObject { | ... | @@ -80,7 +80,7 @@ public interface PcepBandwidthObject { |
80 | * | 80 | * |
81 | * @return bandwidth | 81 | * @return bandwidth |
82 | */ | 82 | */ |
83 | - int getBandwidth(); | 83 | + float getBandwidth(); |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Sets bandwidth value and return its builder. | 86 | * Sets bandwidth value and return its builder. |
... | @@ -88,7 +88,7 @@ public interface PcepBandwidthObject { | ... | @@ -88,7 +88,7 @@ public interface PcepBandwidthObject { |
88 | * @param iBandwidth bandwidth value | 88 | * @param iBandwidth bandwidth value |
89 | * @return Builder by setting bandwidth | 89 | * @return Builder by setting bandwidth |
90 | */ | 90 | */ |
91 | - Builder setBandwidth(int iBandwidth); | 91 | + Builder setBandwidth(float iBandwidth); |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * Sets P flag in Bandwidth object header and returns its builder. | 94 | * Sets P flag in Bandwidth object header and returns its builder. | ... | ... |
... | @@ -169,7 +169,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { | ... | @@ -169,7 +169,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { |
169 | private PcepObjectHeader bandwidthObjHeader; | 169 | private PcepObjectHeader bandwidthObjHeader; |
170 | private boolean bIsHeaderSet = false; | 170 | private boolean bIsHeaderSet = false; |
171 | 171 | ||
172 | - private int iBandwidth; | 172 | + private float iBandwidth; |
173 | private boolean bIsBandwidthSet = false; | 173 | private boolean bIsBandwidthSet = false; |
174 | 174 | ||
175 | private boolean bPFlag; | 175 | private boolean bPFlag; |
... | @@ -200,7 +200,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { | ... | @@ -200,7 +200,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { |
200 | } | 200 | } |
201 | 201 | ||
202 | @Override | 202 | @Override |
203 | - public int getBandwidth() { | 203 | + public float getBandwidth() { |
204 | return this.iBandwidth; | 204 | return this.iBandwidth; |
205 | } | 205 | } |
206 | 206 | ||
... | @@ -216,7 +216,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { | ... | @@ -216,7 +216,7 @@ public class PcepBandwidthObjectVer1 implements PcepBandwidthObject { |
216 | } | 216 | } |
217 | 217 | ||
218 | @Override | 218 | @Override |
219 | - public Builder setBandwidth(int iBandwidth) { | 219 | + public Builder setBandwidth(float iBandwidth) { |
220 | this.iBandwidth = iBandwidth; | 220 | this.iBandwidth = iBandwidth; |
221 | this.bIsBandwidthSet = true; | 221 | this.bIsBandwidthSet = true; |
222 | return this; | 222 | return this; | ... | ... |
... | @@ -20,9 +20,10 @@ import static org.onosproject.net.Device.Type.VIRTUAL; | ... | @@ -20,9 +20,10 @@ import static org.onosproject.net.Device.Type.VIRTUAL; |
20 | import static org.onosproject.incubator.net.resource.label.LabelResourceId.labelResourceId; | 20 | import static org.onosproject.incubator.net.resource.label.LabelResourceId.labelResourceId; |
21 | import static java.util.stream.Collectors.toList; | 21 | import static java.util.stream.Collectors.toList; |
22 | 22 | ||
23 | -import java.util.LinkedList; | 23 | +import java.util.ArrayList; |
24 | import java.util.List; | 24 | import java.util.List; |
25 | import java.util.Set; | 25 | import java.util.Set; |
26 | +import java.util.HashMap; | ||
26 | 27 | ||
27 | import org.onlab.packet.ChassisId; | 28 | import org.onlab.packet.ChassisId; |
28 | import org.onlab.packet.Ip4Address; | 29 | import org.onlab.packet.Ip4Address; |
... | @@ -74,6 +75,7 @@ import org.onosproject.net.Link; | ... | @@ -74,6 +75,7 @@ import org.onosproject.net.Link; |
74 | import org.onosproject.net.MastershipRole; | 75 | import org.onosproject.net.MastershipRole; |
75 | import org.onosproject.net.PortNumber; | 76 | import org.onosproject.net.PortNumber; |
76 | import org.onosproject.net.config.NetworkConfigService; | 77 | import org.onosproject.net.config.NetworkConfigService; |
78 | +import org.onosproject.net.config.basics.BandwidthCapacity; | ||
77 | import org.onosproject.net.device.DefaultDeviceDescription; | 79 | import org.onosproject.net.device.DefaultDeviceDescription; |
78 | import org.onosproject.net.device.DefaultPortDescription; | 80 | import org.onosproject.net.device.DefaultPortDescription; |
79 | import org.onosproject.net.device.DeviceDescription; | 81 | import org.onosproject.net.device.DeviceDescription; |
... | @@ -90,7 +92,6 @@ import org.onosproject.net.link.LinkProviderService; | ... | @@ -90,7 +92,6 @@ import org.onosproject.net.link.LinkProviderService; |
90 | import org.onosproject.net.link.LinkService; | 92 | import org.onosproject.net.link.LinkService; |
91 | import org.onosproject.net.provider.AbstractProvider; | 93 | import org.onosproject.net.provider.AbstractProvider; |
92 | import org.onosproject.net.provider.ProviderId; | 94 | import org.onosproject.net.provider.ProviderId; |
93 | -import org.onosproject.net.config.basics.BandwidthCapacity; | ||
94 | import org.slf4j.Logger; | 95 | import org.slf4j.Logger; |
95 | import org.slf4j.LoggerFactory; | 96 | import org.slf4j.LoggerFactory; |
96 | 97 | ||
... | @@ -160,6 +161,7 @@ public class BgpTopologyProvider extends AbstractProvider implements DeviceProvi | ... | @@ -160,6 +161,7 @@ public class BgpTopologyProvider extends AbstractProvider implements DeviceProvi |
160 | public static final int DELAY = 2; | 161 | public static final int DELAY = 2; |
161 | private LabelResourceId beginLabel = labelResourceId(5122); | 162 | private LabelResourceId beginLabel = labelResourceId(5122); |
162 | private LabelResourceId endLabel = labelResourceId(9217); | 163 | private LabelResourceId endLabel = labelResourceId(9217); |
164 | + private HashMap<DeviceId, List<PortDescription>> portMap = new HashMap<>(); | ||
163 | 165 | ||
164 | @Activate | 166 | @Activate |
165 | public void activate() { | 167 | public void activate() { |
... | @@ -243,13 +245,15 @@ public class BgpTopologyProvider extends AbstractProvider implements DeviceProvi | ... | @@ -243,13 +245,15 @@ public class BgpTopologyProvider extends AbstractProvider implements DeviceProvi |
243 | if (tlv.getType() == NodeDescriptors.IGP_ROUTERID_TYPE) { | 245 | if (tlv.getType() == NodeDescriptors.IGP_ROUTERID_TYPE) { |
244 | if (tlv instanceof IsIsPseudonode) { | 246 | if (tlv instanceof IsIsPseudonode) { |
245 | deviceType = VIRTUAL; | 247 | deviceType = VIRTUAL; |
246 | - newBuilder.set(AnnotationKeys.ROUTER_ID, new String(((IsIsPseudonode) tlv).getIsoNodeId())); | 248 | + newBuilder.set(AnnotationKeys.ROUTER_ID, nodeUri.isoNodeIdString(((IsIsPseudonode) tlv) |
249 | + .getIsoNodeId())); | ||
247 | } else if (tlv instanceof OspfPseudonode) { | 250 | } else if (tlv instanceof OspfPseudonode) { |
248 | deviceType = VIRTUAL; | 251 | deviceType = VIRTUAL; |
249 | newBuilder | 252 | newBuilder |
250 | .set(AnnotationKeys.ROUTER_ID, Integer.toString(((OspfPseudonode) tlv).getrouterID())); | 253 | .set(AnnotationKeys.ROUTER_ID, Integer.toString(((OspfPseudonode) tlv).getrouterID())); |
251 | } else if (tlv instanceof IsIsNonPseudonode) { | 254 | } else if (tlv instanceof IsIsNonPseudonode) { |
252 | - newBuilder.set(AnnotationKeys.ROUTER_ID, new String(((IsIsNonPseudonode) tlv).getIsoNodeId())); | 255 | + newBuilder.set(AnnotationKeys.ROUTER_ID, nodeUri.isoNodeIdString(((IsIsNonPseudonode) tlv) |
256 | + .getIsoNodeId())); | ||
253 | } else if (tlv instanceof OspfNonPseudonode) { | 257 | } else if (tlv instanceof OspfNonPseudonode) { |
254 | newBuilder.set(AnnotationKeys.ROUTER_ID, | 258 | newBuilder.set(AnnotationKeys.ROUTER_ID, |
255 | Integer.toString(((OspfNonPseudonode) tlv).getrouterID())); | 259 | Integer.toString(((OspfNonPseudonode) tlv).getrouterID())); |
... | @@ -284,14 +288,35 @@ public class BgpTopologyProvider extends AbstractProvider implements DeviceProvi | ... | @@ -284,14 +288,35 @@ public class BgpTopologyProvider extends AbstractProvider implements DeviceProvi |
284 | deviceProviderService.deviceDisconnected(deviceId); | 288 | deviceProviderService.deviceDisconnected(deviceId); |
285 | } | 289 | } |
286 | 290 | ||
291 | + private List<PortDescription> buildPortDescriptions(DeviceId deviceId, | ||
292 | + PortNumber portNumber) { | ||
293 | + | ||
294 | + List<PortDescription> portList; | ||
295 | + | ||
296 | + if (portMap.containsKey(deviceId)) { | ||
297 | + portList = portMap.get(deviceId); | ||
298 | + } else { | ||
299 | + portList = new ArrayList<>(); | ||
300 | + } | ||
301 | + if (portNumber != null) { | ||
302 | + PortDescription portDescriptions = new DefaultPortDescription(portNumber, true); | ||
303 | + portList.add(portDescriptions); | ||
304 | + } | ||
305 | + | ||
306 | + portMap.put(deviceId, portList); | ||
307 | + return portList; | ||
308 | + } | ||
309 | + | ||
287 | @Override | 310 | @Override |
288 | public void addLink(BgpLinkLsNlriVer4 linkNlri, PathAttrNlriDetails details) throws BgpParseException { | 311 | public void addLink(BgpLinkLsNlriVer4 linkNlri, PathAttrNlriDetails details) throws BgpParseException { |
289 | log.debug("Addlink {}", linkNlri.toString()); | 312 | log.debug("Addlink {}", linkNlri.toString()); |
290 | 313 | ||
291 | - if (linkProviderService == null) { | 314 | + LinkDescription linkDes = buildLinkDes(linkNlri, details, true); |
315 | + | ||
316 | + //If already link exists, return | ||
317 | + if (linkService.getLink(linkDes.src(), linkDes.dst()) != null || linkProviderService == null) { | ||
292 | return; | 318 | return; |
293 | } | 319 | } |
294 | - LinkDescription linkDes = buildLinkDes(linkNlri, details, true); | ||
295 | 320 | ||
296 | /* | 321 | /* |
297 | * Update link ports and configure bandwidth on source and destination port using networkConfig service | 322 | * Update link ports and configure bandwidth on source and destination port using networkConfig service |
... | @@ -302,13 +327,11 @@ public class BgpTopologyProvider extends AbstractProvider implements DeviceProvi | ... | @@ -302,13 +327,11 @@ public class BgpTopologyProvider extends AbstractProvider implements DeviceProvi |
302 | } | 327 | } |
303 | 328 | ||
304 | //Updating ports of the link | 329 | //Updating ports of the link |
305 | - List<PortDescription> srcPortDescriptions = new LinkedList<>(); | 330 | + deviceProviderService.updatePorts(linkDes.src().deviceId(), buildPortDescriptions(linkDes.src().deviceId(), |
306 | - srcPortDescriptions.add(new DefaultPortDescription(linkDes.src().port(), true)); | 331 | + linkDes.src().port())); |
307 | - deviceProviderService.updatePorts(linkDes.src().deviceId(), srcPortDescriptions); | ||
308 | 332 | ||
309 | - List<PortDescription> dstPortDescriptions = new LinkedList<>(); | 333 | + deviceProviderService.updatePorts(linkDes.dst().deviceId(), buildPortDescriptions(linkDes.dst().deviceId(), |
310 | - dstPortDescriptions.add(new DefaultPortDescription(linkDes.dst().port(), true)); | 334 | + linkDes.dst().port())); |
311 | - deviceProviderService.updatePorts(linkDes.dst().deviceId(), dstPortDescriptions); | ||
312 | 335 | ||
313 | linkProviderService.linkDetected(linkDes); | 336 | linkProviderService.linkDetected(linkDes); |
314 | } | 337 | } | ... | ... |
providers/bgpcep/app/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.bgpcep" origin="ON.Lab" version="${project.version}" | ||
18 | + category="Provider" url="http://onosproject.org" title="BGP PCEP Provider" | ||
19 | + featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features" | ||
20 | + features="${project.artifactId}"> | ||
21 | + <description>${project.description}</description> | ||
22 | + <artifact>mvn:${project.groupId}/onos-bgpio/${project.version}</artifact> | ||
23 | + <artifact>mvn:${project.groupId}/onos-bgp-api/${project.version}</artifact> | ||
24 | + <artifact>mvn:${project.groupId}/onos-bgp-ctl/${project.version}</artifact> | ||
25 | + <artifact>mvn:${project.groupId}/onos-pcepio/${project.version}</artifact> | ||
26 | + <artifact>mvn:${project.groupId}/onos-app-pcep-api/${project.version}</artifact> | ||
27 | + <artifact>mvn:${project.groupId}/onos-pcep-controller-api/${project.version}</artifact> | ||
28 | + <artifact>mvn:${project.groupId}/onos-bgp-provider-topology/${project.version}</artifact> | ||
29 | + <artifact>mvn:${project.groupId}/onos-bgp-provider-cfg/${project.version}</artifact> | ||
30 | + <artifact>mvn:${project.groupId}/onos-pcep-controller-impl/${project.version}</artifact> | ||
31 | + <artifact>mvn:${project.groupId}/onos-pcep-provider-topology/${project.version}</artifact> | ||
32 | + <artifact>mvn:${project.groupId}/onos-pcep-provider-tunnel/${project.version}</artifact> | ||
33 | + <artifact>mvn:${project.groupId}/onos-pcep-provider-packet/${project.version}</artifact> | ||
34 | + <artifact>mvn:${project.groupId}/onos-bgpcep-provider-flow/${project.version}</artifact> | ||
35 | + <artifact>mvn:${project.groupId}/onos-app-pce/${project.version}</artifact> | ||
36 | + <artifact>mvn:${project.groupId}/onos-app-pceweb/${project.version}</artifact> | ||
37 | +</app> |
providers/bgpcep/app/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}/onos-bgpio/${project.version}</bundle> | ||
22 | + <bundle>mvn:${project.groupId}/onos-bgp-api/${project.version}</bundle> | ||
23 | + <bundle>mvn:${project.groupId}/onos-bgp-ctl/${project.version}</bundle> | ||
24 | + <bundle>mvn:${project.groupId}/onos-pcep-controller-api/${project.version}</bundle> | ||
25 | + <bundle>mvn:${project.groupId}/onos-bgp-provider-topology/${project.version}</bundle> | ||
26 | + <bundle>mvn:${project.groupId}/onos-bgp-provider-cfg/${project.version}</bundle> | ||
27 | + <bundle>mvn:${project.groupId}/onos-pcepio/${project.version}</bundle> | ||
28 | + <bundle>mvn:${project.groupId}/onos-app-pcep-api/${project.version}</bundle> | ||
29 | + <bundle>mvn:${project.groupId}/onos-pcep-controller-impl/${project.version}</bundle> | ||
30 | + <bundle>mvn:${project.groupId}/onos-pcep-provider-topology/${project.version}</bundle> | ||
31 | + <bundle>mvn:${project.groupId}/onos-pcep-provider-tunnel/${project.version}</bundle> | ||
32 | + <bundle>mvn:${project.groupId}/onos-app-pce/${project.version}</bundle> | ||
33 | + <bundle>mvn:${project.groupId}/onos-app-pceweb/${project.version}</bundle> | ||
34 | + <bundle>mvn:${project.groupId}/onos-pcep-provider-packet/${project.version}</bundle> | ||
35 | + <bundle>mvn:${project.groupId}/onos-bgpcep-provider-flow/${project.version}</bundle> | ||
36 | + </feature> | ||
37 | +</features> |
providers/bgpcep/app/pom.xml
0 → 100644
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 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
17 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
18 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
19 | + <modelVersion>4.0.0</modelVersion> | ||
20 | + <parent> | ||
21 | + <groupId>org.onosproject</groupId> | ||
22 | + <artifactId>onos-bgpcep-providers</artifactId> | ||
23 | + <version>1.6.0-SNAPSHOT</version> | ||
24 | + <relativePath>../pom.xml</relativePath> | ||
25 | + </parent> | ||
26 | + | ||
27 | + <artifactId>onos-bgpcep-app</artifactId> | ||
28 | + <packaging>pom</packaging> | ||
29 | + <description>BGP PCEP protocol southbound providers</description> | ||
30 | + | ||
31 | + <dependencies> | ||
32 | + <dependency> | ||
33 | + <groupId>org.onosproject</groupId> | ||
34 | + <artifactId>onos-bgpio</artifactId> | ||
35 | + <version>${project.version}</version> | ||
36 | + </dependency> | ||
37 | + <dependency> | ||
38 | + <groupId>org.onosproject</groupId> | ||
39 | + <artifactId>onos-bgp-api</artifactId> | ||
40 | + <version>${project.version}</version> | ||
41 | + </dependency> | ||
42 | + <dependency> | ||
43 | + <groupId>org.onosproject</groupId> | ||
44 | + <artifactId>onos-bgp-ctl</artifactId> | ||
45 | + <version>${project.version}</version> | ||
46 | + </dependency> | ||
47 | + <dependency> | ||
48 | + <groupId>org.onosproject</groupId> | ||
49 | + <artifactId>onos-pcep-controller-api</artifactId> | ||
50 | + <version>${project.version}</version> | ||
51 | + </dependency> | ||
52 | + <dependency> | ||
53 | + <groupId>org.onosproject</groupId> | ||
54 | + <artifactId>onos-bgp-provider-cfg</artifactId> | ||
55 | + <version>${project.version}</version> | ||
56 | + </dependency> | ||
57 | + <dependency> | ||
58 | + <groupId>org.onosproject</groupId> | ||
59 | + <artifactId>onos-pcepio</artifactId> | ||
60 | + <version>${project.version}</version> | ||
61 | + </dependency> | ||
62 | + <dependency> | ||
63 | + <groupId>org.onosproject</groupId> | ||
64 | + <artifactId>onos-app-pcep-api</artifactId> | ||
65 | + <version>${project.version}</version> | ||
66 | + </dependency> | ||
67 | + <dependency> | ||
68 | + <groupId>org.onosproject</groupId> | ||
69 | + <artifactId>onos-pcep-controller-impl</artifactId> | ||
70 | + <version>${project.version}</version> | ||
71 | + </dependency> | ||
72 | + <dependency> | ||
73 | + <groupId>org.onosproject</groupId> | ||
74 | + <artifactId>onos-pcep-provider-topology</artifactId> | ||
75 | + <version>${project.version}</version> | ||
76 | + </dependency> | ||
77 | + <dependency> | ||
78 | + <groupId>org.onosproject</groupId> | ||
79 | + <artifactId>onos-pcep-provider-tunnel</artifactId> | ||
80 | + <version>${project.version}</version> | ||
81 | + </dependency> | ||
82 | + <dependency> | ||
83 | + <groupId>org.onosproject</groupId> | ||
84 | + <artifactId>onos-app-pce</artifactId> | ||
85 | + <version>${project.version}</version> | ||
86 | + </dependency> | ||
87 | + <dependency> | ||
88 | + <groupId>org.onosproject</groupId> | ||
89 | + <artifactId>onos-app-pceweb</artifactId> | ||
90 | + <version>${project.version}</version> | ||
91 | + </dependency> | ||
92 | + <dependency> | ||
93 | + <groupId>org.onosproject</groupId> | ||
94 | + <artifactId>onos-bgp-provider-topology</artifactId> | ||
95 | + <version>${project.version}</version> | ||
96 | + </dependency> | ||
97 | + <dependency> | ||
98 | + <groupId>org.onosproject</groupId> | ||
99 | + <artifactId>onos-pcep-provider-packet</artifactId> | ||
100 | + <version>${project.version}</version> | ||
101 | + </dependency> | ||
102 | + <dependency> | ||
103 | + <groupId>org.onosproject</groupId> | ||
104 | + <artifactId>onos-bgpcep-provider-flow</artifactId> | ||
105 | + <version>${project.version}</version> | ||
106 | + </dependency> | ||
107 | + </dependencies> | ||
108 | +</project> |
... | @@ -15,6 +15,9 @@ | ... | @@ -15,6 +15,9 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.provider.bgpcep.flow.impl; | 16 | package org.onosproject.provider.bgpcep.flow.impl; |
17 | 17 | ||
18 | +import java.util.ArrayList; | ||
19 | +import java.util.Collection; | ||
20 | +import java.util.Collections; | ||
18 | import java.util.LinkedList; | 21 | import java.util.LinkedList; |
19 | import java.util.List; | 22 | import java.util.List; |
20 | 23 | ||
... | @@ -28,7 +31,6 @@ import org.onlab.packet.IpAddress; | ... | @@ -28,7 +31,6 @@ import org.onlab.packet.IpAddress; |
28 | import org.onlab.packet.IpPrefix; | 31 | import org.onlab.packet.IpPrefix; |
29 | import org.onlab.packet.MplsLabel; | 32 | import org.onlab.packet.MplsLabel; |
30 | import org.onosproject.bgp.controller.BgpController; | 33 | import org.onosproject.bgp.controller.BgpController; |
31 | -import org.onosproject.cfg.ComponentConfigService; | ||
32 | import org.onosproject.core.ApplicationId; | 34 | import org.onosproject.core.ApplicationId; |
33 | import org.onosproject.incubator.net.resource.label.LabelResourceId; | 35 | import org.onosproject.incubator.net.resource.label.LabelResourceId; |
34 | import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint; | 36 | import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint; |
... | @@ -42,21 +44,24 @@ import org.onosproject.net.Link; | ... | @@ -42,21 +44,24 @@ import org.onosproject.net.Link; |
42 | import org.onosproject.net.Path; | 44 | import org.onosproject.net.Path; |
43 | import org.onosproject.net.PortNumber; | 45 | import org.onosproject.net.PortNumber; |
44 | import org.onosproject.net.device.DeviceService; | 46 | import org.onosproject.net.device.DeviceService; |
47 | +import org.onosproject.net.flow.CompletedBatchOperation; | ||
48 | +import org.onosproject.net.flow.DefaultFlowEntry; | ||
49 | +import org.onosproject.net.flow.FlowEntry; | ||
45 | import org.onosproject.net.flow.FlowRule; | 50 | import org.onosproject.net.flow.FlowRule; |
51 | +import org.onosproject.net.flow.FlowRuleBatchEntry; | ||
46 | import org.onosproject.net.flow.FlowRuleBatchOperation; | 52 | import org.onosproject.net.flow.FlowRuleBatchOperation; |
47 | import org.onosproject.net.flow.FlowRuleProvider; | 53 | import org.onosproject.net.flow.FlowRuleProvider; |
48 | import org.onosproject.net.flow.FlowRuleProviderRegistry; | 54 | import org.onosproject.net.flow.FlowRuleProviderRegistry; |
49 | import org.onosproject.net.flow.FlowRuleProviderService; | 55 | import org.onosproject.net.flow.FlowRuleProviderService; |
50 | import org.onosproject.net.flow.TrafficSelector; | 56 | import org.onosproject.net.flow.TrafficSelector; |
57 | +import org.onosproject.net.flow.FlowEntry.FlowEntryState; | ||
51 | import org.onosproject.net.flow.criteria.Criterion; | 58 | import org.onosproject.net.flow.criteria.Criterion; |
52 | import org.onosproject.net.flow.criteria.IPCriterion; | 59 | import org.onosproject.net.flow.criteria.IPCriterion; |
53 | import org.onosproject.net.flow.criteria.MetadataCriterion; | 60 | import org.onosproject.net.flow.criteria.MetadataCriterion; |
54 | import org.onosproject.net.flow.criteria.MplsBosCriterion; | 61 | import org.onosproject.net.flow.criteria.MplsBosCriterion; |
55 | import org.onosproject.net.flow.criteria.MplsCriterion; | 62 | import org.onosproject.net.flow.criteria.MplsCriterion; |
56 | import org.onosproject.net.flow.criteria.PortCriterion; | 63 | import org.onosproject.net.flow.criteria.PortCriterion; |
57 | -import org.onosproject.net.flow.criteria.TcpPortCriterion; | ||
58 | import org.onosproject.net.flow.criteria.TunnelIdCriterion; | 64 | import org.onosproject.net.flow.criteria.TunnelIdCriterion; |
59 | -import org.onosproject.net.flowobjective.Objective; | ||
60 | import org.onosproject.net.provider.AbstractProvider; | 65 | import org.onosproject.net.provider.AbstractProvider; |
61 | import org.onosproject.net.provider.ProviderId; | 66 | import org.onosproject.net.provider.ProviderId; |
62 | import org.onosproject.net.resource.ResourceService; | 67 | import org.onosproject.net.resource.ResourceService; |
... | @@ -81,13 +86,14 @@ import org.onosproject.pcepio.types.PcepLabelDownload; | ... | @@ -81,13 +86,14 @@ import org.onosproject.pcepio.types.PcepLabelDownload; |
81 | import org.onosproject.pcepio.types.PcepLabelMap; | 86 | import org.onosproject.pcepio.types.PcepLabelMap; |
82 | import org.onosproject.pcepio.types.PcepValueType; | 87 | import org.onosproject.pcepio.types.PcepValueType; |
83 | import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; | 88 | import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv; |
84 | -import org.onosproject.provider.pcep.tunnel.impl.SrpIdGenerators; | 89 | +import org.onosproject.pcep.controller.SrpIdGenerators; |
85 | -import org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys; | 90 | +import org.onosproject.pcep.controller.PcepAnnotationKeys; |
86 | import org.osgi.service.component.ComponentContext; | 91 | import org.osgi.service.component.ComponentContext; |
87 | import org.slf4j.Logger; | 92 | import org.slf4j.Logger; |
88 | 93 | ||
89 | import static org.onosproject.pcep.controller.PcepSyncStatus.IN_SYNC; | 94 | import static org.onosproject.pcep.controller.PcepSyncStatus.IN_SYNC; |
90 | import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED; | 95 | import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED; |
96 | +import static org.onosproject.net.flow.criteria.Criterion.Type.EXTENSION; | ||
91 | import static com.google.common.base.Preconditions.checkNotNull; | 97 | import static com.google.common.base.Preconditions.checkNotNull; |
92 | import static org.slf4j.LoggerFactory.getLogger; | 98 | import static org.slf4j.LoggerFactory.getLogger; |
93 | 99 | ||
... | @@ -104,9 +110,6 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -104,9 +110,6 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
104 | protected FlowRuleProviderRegistry providerRegistry; | 110 | protected FlowRuleProviderRegistry providerRegistry; |
105 | 111 | ||
106 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 112 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
107 | - protected ComponentConfigService cfgService; | ||
108 | - | ||
109 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
110 | protected BgpController bgpController; | 113 | protected BgpController bgpController; |
111 | 114 | ||
112 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 115 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
... | @@ -129,6 +132,12 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -129,6 +132,12 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
129 | public static final long SET = 0xFFFFFFFFL; | 132 | public static final long SET = 0xFFFFFFFFL; |
130 | private static final String LSRID = "lsrId"; | 133 | private static final String LSRID = "lsrId"; |
131 | 134 | ||
135 | + private enum PcepFlowType { | ||
136 | + ADD, | ||
137 | + MODIFY, | ||
138 | + REMOVE | ||
139 | + } | ||
140 | + | ||
132 | /** | 141 | /** |
133 | * Creates a BgpFlow host provider. | 142 | * Creates a BgpFlow host provider. |
134 | */ | 143 | */ |
... | @@ -138,14 +147,12 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -138,14 +147,12 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
138 | 147 | ||
139 | @Activate | 148 | @Activate |
140 | public void activate(ComponentContext context) { | 149 | public void activate(ComponentContext context) { |
141 | - cfgService.registerProperties(getClass()); | ||
142 | providerService = providerRegistry.register(this); | 150 | providerService = providerRegistry.register(this); |
143 | log.info("Started"); | 151 | log.info("Started"); |
144 | } | 152 | } |
145 | 153 | ||
146 | @Deactivate | 154 | @Deactivate |
147 | public void deactivate(ComponentContext context) { | 155 | public void deactivate(ComponentContext context) { |
148 | - cfgService.unregisterProperties(getClass(), false); | ||
149 | providerRegistry.unregister(this); | 156 | providerRegistry.unregister(this); |
150 | providerService = null; | 157 | providerService = null; |
151 | log.info("Stopped"); | 158 | log.info("Stopped"); |
... | @@ -154,26 +161,25 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -154,26 +161,25 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
154 | @Override | 161 | @Override |
155 | public void applyFlowRule(FlowRule... flowRules) { | 162 | public void applyFlowRule(FlowRule... flowRules) { |
156 | for (FlowRule flowRule : flowRules) { | 163 | for (FlowRule flowRule : flowRules) { |
157 | - processRule(flowRule, Objective.Operation.ADD); | 164 | + processRule(flowRule, PcepFlowType.ADD); |
158 | } | 165 | } |
159 | } | 166 | } |
160 | 167 | ||
161 | @Override | 168 | @Override |
162 | public void removeFlowRule(FlowRule... flowRules) { | 169 | public void removeFlowRule(FlowRule... flowRules) { |
163 | for (FlowRule flowRule : flowRules) { | 170 | for (FlowRule flowRule : flowRules) { |
164 | - processRule(flowRule, Objective.Operation.REMOVE); | 171 | + processRule(flowRule, PcepFlowType.REMOVE); |
165 | } | 172 | } |
166 | } | 173 | } |
167 | 174 | ||
168 | - private void processRule(FlowRule flowRule, Objective.Operation type) { | 175 | + private void processRule(FlowRule flowRule, PcepFlowType type) { |
169 | MplsLabel mplsLabel = null; | 176 | MplsLabel mplsLabel = null; |
170 | - IpPrefix ip4Prefix = null; | 177 | + IpPrefix ip4PrefixSrc = null; |
178 | + IpPrefix ip4PrefixDst = null; | ||
171 | PortNumber port = null; | 179 | PortNumber port = null; |
172 | TunnelId tunnelId = null; | 180 | TunnelId tunnelId = null; |
173 | long labelType = 0; | 181 | long labelType = 0; |
174 | boolean bottomOfStack = false; | 182 | boolean bottomOfStack = false; |
175 | - int srcPort = 0; | ||
176 | - int dstPort = 0; | ||
177 | 183 | ||
178 | TrafficSelector selector = flowRule.selector(); | 184 | TrafficSelector selector = flowRule.selector(); |
179 | for (Criterion c : selector.criteria()) { | 185 | for (Criterion c : selector.criteria()) { |
... | @@ -184,20 +190,16 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -184,20 +190,16 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
184 | break; | 190 | break; |
185 | case IPV4_SRC: | 191 | case IPV4_SRC: |
186 | IPCriterion ipCriterion = (IPCriterion) c; | 192 | IPCriterion ipCriterion = (IPCriterion) c; |
187 | - ip4Prefix = ipCriterion.ip().getIp4Prefix(); | 193 | + ip4PrefixSrc = ipCriterion.ip().getIp4Prefix(); |
194 | + break; | ||
195 | + case IPV4_DST: | ||
196 | + ipCriterion = (IPCriterion) c; | ||
197 | + ip4PrefixDst = ipCriterion.ip().getIp4Prefix(); | ||
188 | break; | 198 | break; |
189 | case IN_PORT: | 199 | case IN_PORT: |
190 | PortCriterion inPort = (PortCriterion) c; | 200 | PortCriterion inPort = (PortCriterion) c; |
191 | port = inPort.port(); | 201 | port = inPort.port(); |
192 | break; | 202 | break; |
193 | - case TCP_SRC: | ||
194 | - TcpPortCriterion srcTcpPort = (TcpPortCriterion) c; | ||
195 | - srcPort = srcTcpPort.tcpPort().toInt(); | ||
196 | - break; | ||
197 | - case TCP_DST: | ||
198 | - TcpPortCriterion dstTcpPort = (TcpPortCriterion) c; | ||
199 | - dstPort = dstTcpPort.tcpPort().toInt(); | ||
200 | - break; | ||
201 | case TUNNEL_ID: | 203 | case TUNNEL_ID: |
202 | TunnelIdCriterion tc = (TunnelIdCriterion) c; | 204 | TunnelIdCriterion tc = (TunnelIdCriterion) c; |
203 | tunnelId = TunnelId.valueOf(String.valueOf(tc.tunnelId())); | 205 | tunnelId = TunnelId.valueOf(String.valueOf(tc.tunnelId())); |
... | @@ -224,13 +226,12 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -224,13 +226,12 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
224 | return; | 226 | return; |
225 | } | 227 | } |
226 | 228 | ||
227 | - if (srcPort != 0 && dstPort != 0) { | 229 | + if (ip4PrefixDst != null) { |
228 | - pushAdjacencyLabel(flowRule.deviceId(), label, PortNumber.portNumber(srcPort), | 230 | + pushAdjacencyLabel(flowRule.deviceId(), label, ip4PrefixSrc, ip4PrefixDst, type); |
229 | - PortNumber.portNumber(dstPort), type); | ||
230 | return; | 231 | return; |
231 | } | 232 | } |
232 | 233 | ||
233 | - pushGlobalNodeLabel(flowRule.deviceId(), label, ip4Prefix, type, bottomOfStack); | 234 | + pushGlobalNodeLabel(flowRule.deviceId(), label, ip4PrefixSrc, type, bottomOfStack); |
234 | 235 | ||
235 | } catch (PcepParseException e) { | 236 | } catch (PcepParseException e) { |
236 | log.error("Exception occured while sending label message to PCC {}", e.getMessage()); | 237 | log.error("Exception occured while sending label message to PCC {}", e.getMessage()); |
... | @@ -255,7 +256,7 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -255,7 +256,7 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
255 | 256 | ||
256 | //Pushes node labels to the specified device. | 257 | //Pushes node labels to the specified device. |
257 | private void pushGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId, | 258 | private void pushGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId, |
258 | - IpPrefix ipPrefix, Objective.Operation type, boolean isBos) throws PcepParseException { | 259 | + IpPrefix ipPrefix, PcepFlowType type, boolean isBos) throws PcepParseException { |
259 | 260 | ||
260 | checkNotNull(deviceId); | 261 | checkNotNull(deviceId); |
261 | checkNotNull(labelId); | 262 | checkNotNull(labelId); |
... | @@ -271,7 +272,7 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -271,7 +272,7 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
271 | 272 | ||
272 | if (ipPrefix == null) { | 273 | if (ipPrefix == null) { |
273 | // Pushing self node label to device. | 274 | // Pushing self node label to device. |
274 | - IpPrefix.valueOf(pc.getPccId().ipAddress(), 32); | 275 | + ipPrefix = IpPrefix.valueOf(pc.getPccId().ipAddress(), 32); |
275 | } | 276 | } |
276 | 277 | ||
277 | PcepFecObjectIPv4 fecObject = pc.factory().buildFecObjectIpv4() | 278 | PcepFecObjectIPv4 fecObject = pc.factory().buildFecObjectIpv4() |
... | @@ -279,16 +280,9 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -279,16 +280,9 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
279 | .build(); | 280 | .build(); |
280 | 281 | ||
281 | boolean bSFlag = false; | 282 | boolean bSFlag = false; |
282 | - if (pc.labelDbSyncStatus() == IN_SYNC) { | 283 | + if (pc.labelDbSyncStatus() == IN_SYNC && !isBos) { |
283 | - if (isBos) { | 284 | + // Need to set sync flag in all messages till sync completes. |
284 | - /* | 285 | + bSFlag = true; |
285 | - * Now the sync is completed. | ||
286 | - * Need to send label DB end-of-sync msg, i.e. S flag in SRP id is reset. | ||
287 | - */ | ||
288 | - pc.setLabelDbSyncStatus(SYNCED); | ||
289 | - } else { | ||
290 | - bSFlag = true; | ||
291 | - } | ||
292 | } | 286 | } |
293 | 287 | ||
294 | PcepSrpObject srpObj = getSrpObject(pc, type, bSFlag); | 288 | PcepSrpObject srpObj = getSrpObject(pc, type, bSFlag); |
... | @@ -312,14 +306,19 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -312,14 +306,19 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
312 | .build(); | 306 | .build(); |
313 | 307 | ||
314 | pc.sendMessage(labelMsg); | 308 | pc.sendMessage(labelMsg); |
309 | + | ||
310 | + if (isBos) { | ||
311 | + // Sync is completed. | ||
312 | + pc.setLabelDbSyncStatus(SYNCED); | ||
313 | + } | ||
315 | } | 314 | } |
316 | 315 | ||
317 | - private PcepSrpObject getSrpObject(PcepClient pc, Objective.Operation type, boolean bSFlag) | 316 | + private PcepSrpObject getSrpObject(PcepClient pc, PcepFlowType type, boolean bSFlag) |
318 | throws PcepParseException { | 317 | throws PcepParseException { |
319 | PcepSrpObject srpObj; | 318 | PcepSrpObject srpObj; |
320 | boolean bRFlag = false; | 319 | boolean bRFlag = false; |
321 | 320 | ||
322 | - if (!type.equals(Objective.Operation.ADD)) { | 321 | + if (!type.equals(PcepFlowType.ADD)) { |
323 | // To cleanup labels, R bit is set | 322 | // To cleanup labels, R bit is set |
324 | bRFlag = true; | 323 | bRFlag = true; |
325 | } | 324 | } |
... | @@ -334,13 +333,14 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -334,13 +333,14 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
334 | } | 333 | } |
335 | 334 | ||
336 | //Pushes adjacency labels to the specified device. | 335 | //Pushes adjacency labels to the specified device. |
337 | - private void pushAdjacencyLabel(DeviceId deviceId, LabelResourceId labelId, | 336 | + private void pushAdjacencyLabel(DeviceId deviceId, LabelResourceId labelId, IpPrefix ip4PrefixSrc, |
338 | - PortNumber srcPortNum, PortNumber dstPortNum, Objective.Operation type) throws PcepParseException { | 337 | + IpPrefix ip4PrefixDst, PcepFlowType type) |
338 | + throws PcepParseException { | ||
339 | 339 | ||
340 | checkNotNull(deviceId); | 340 | checkNotNull(deviceId); |
341 | checkNotNull(labelId); | 341 | checkNotNull(labelId); |
342 | - checkNotNull(srcPortNum); | 342 | + checkNotNull(ip4PrefixSrc); |
343 | - checkNotNull(dstPortNum); | 343 | + checkNotNull(ip4PrefixDst); |
344 | checkNotNull(type); | 344 | checkNotNull(type); |
345 | 345 | ||
346 | PcepClient pc = getPcepClient(deviceId); | 346 | PcepClient pc = getPcepClient(deviceId); |
... | @@ -351,17 +351,21 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -351,17 +351,21 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
351 | 351 | ||
352 | LinkedList<PcepLabelUpdate> labelUpdateList = new LinkedList<>(); | 352 | LinkedList<PcepLabelUpdate> labelUpdateList = new LinkedList<>(); |
353 | 353 | ||
354 | - long srcPortNo = srcPortNum.toLong(); | 354 | + int srcPortNo = ip4PrefixSrc.address().getIp4Address().toInt(); |
355 | - long dstPortNo = dstPortNum.toLong(); | 355 | + int dstPortNo = ip4PrefixDst.address().getIp4Address().toInt(); |
356 | - srcPortNo = ((srcPortNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? srcPortNo & SET : srcPortNo; | ||
357 | - dstPortNo = ((dstPortNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? dstPortNo & SET : dstPortNo; | ||
358 | 356 | ||
359 | PcepFecObjectIPv4Adjacency fecAdjObject = pc.factory().buildFecIpv4Adjacency() | 357 | PcepFecObjectIPv4Adjacency fecAdjObject = pc.factory().buildFecIpv4Adjacency() |
360 | - .seRemoteIPv4Address((int) dstPortNo) | 358 | + .seRemoteIPv4Address(dstPortNo) |
361 | - .seLocalIPv4Address((int) srcPortNo) | 359 | + .seLocalIPv4Address(srcPortNo) |
362 | .build(); | 360 | .build(); |
363 | 361 | ||
364 | - PcepSrpObject srpObj = getSrpObject(pc, type, false); | 362 | + boolean bSFlag = false; |
363 | + if (pc.labelDbSyncStatus() == IN_SYNC) { | ||
364 | + // Need to set sync flag in all messages till sync completes. | ||
365 | + bSFlag = true; | ||
366 | + } | ||
367 | + | ||
368 | + PcepSrpObject srpObj = getSrpObject(pc, type, bSFlag); | ||
365 | 369 | ||
366 | //Adjacency label object | 370 | //Adjacency label object |
367 | PcepLabelObject labelObject = pc.factory().buildLabelObject() | 371 | PcepLabelObject labelObject = pc.factory().buildLabelObject() |
... | @@ -387,7 +391,7 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -387,7 +391,7 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
387 | //Pushes local labels to the device which is specific to path [CR-case]. | 391 | //Pushes local labels to the device which is specific to path [CR-case]. |
388 | private void pushLocalLabels(DeviceId deviceId, LabelResourceId labelId, | 392 | private void pushLocalLabels(DeviceId deviceId, LabelResourceId labelId, |
389 | PortNumber portNum, TunnelId tunnelId, | 393 | PortNumber portNum, TunnelId tunnelId, |
390 | - Boolean isBos, Long labelType, Objective.Operation type) throws PcepParseException { | 394 | + Boolean isBos, Long labelType, PcepFlowType type) throws PcepParseException { |
391 | 395 | ||
392 | checkNotNull(deviceId); | 396 | checkNotNull(deviceId); |
393 | checkNotNull(labelId); | 397 | checkNotNull(labelId); |
... | @@ -559,6 +563,31 @@ public class BgpcepFlowRuleProvider extends AbstractProvider | ... | @@ -559,6 +563,31 @@ public class BgpcepFlowRuleProvider extends AbstractProvider |
559 | 563 | ||
560 | @Override | 564 | @Override |
561 | public void executeBatch(FlowRuleBatchOperation batch) { | 565 | public void executeBatch(FlowRuleBatchOperation batch) { |
562 | - //TODO | 566 | + Collection<FlowEntry> flowEntries = new ArrayList<>(); |
567 | + | ||
568 | + for (FlowRuleBatchEntry fbe : batch.getOperations()) { | ||
569 | + Criterion criteria = fbe.target().selector().getCriterion(EXTENSION); | ||
570 | + | ||
571 | + switch (fbe.operator()) { | ||
572 | + case ADD: | ||
573 | + if (criteria == null) { | ||
574 | + processRule(fbe.target(), PcepFlowType.ADD); | ||
575 | + flowEntries.add(new DefaultFlowEntry(fbe.target(), FlowEntryState.ADDED, 0, 0, 0)); | ||
576 | + } | ||
577 | + break; | ||
578 | + case REMOVE: | ||
579 | + if (criteria == null) { | ||
580 | + processRule(fbe.target(), PcepFlowType.REMOVE); | ||
581 | + flowEntries.add(new DefaultFlowEntry(fbe.target(), FlowEntryState.REMOVED, 0, 0, 0)); | ||
582 | + } | ||
583 | + break; | ||
584 | + default: | ||
585 | + log.error("Unknown flow operation: {}", fbe); | ||
586 | + } | ||
587 | + } | ||
588 | + | ||
589 | + CompletedBatchOperation status = new CompletedBatchOperation(true, Collections.emptySet(), batch.deviceId()); | ||
590 | + providerService.batchOperationCompleted(batch.id(), status); | ||
591 | + providerService.pushFlowMetrics(batch.deviceId(), flowEntries); | ||
563 | } | 592 | } |
564 | } | 593 | } | ... | ... |
... | @@ -25,4 +25,5 @@ | ... | @@ -25,4 +25,5 @@ |
25 | <artifact>mvn:${project.groupId}/onos-pcep-controller-impl/${project.version}</artifact> | 25 | <artifact>mvn:${project.groupId}/onos-pcep-controller-impl/${project.version}</artifact> |
26 | <artifact>mvn:${project.groupId}/onos-pcep-provider-topology/${project.version}</artifact> | 26 | <artifact>mvn:${project.groupId}/onos-pcep-provider-topology/${project.version}</artifact> |
27 | <artifact>mvn:${project.groupId}/onos-pcep-provider-tunnel/${project.version}</artifact> | 27 | <artifact>mvn:${project.groupId}/onos-pcep-provider-tunnel/${project.version}</artifact> |
28 | + <artifact>mvn:${project.groupId}/onos-pcep-provider-packet/${project.version}</artifact> | ||
28 | </app> | 29 | </app> | ... | ... |
... | @@ -24,5 +24,6 @@ | ... | @@ -24,5 +24,6 @@ |
24 | <bundle>mvn:${project.groupId}/onos-pcep-controller-impl/${project.version}</bundle> | 24 | <bundle>mvn:${project.groupId}/onos-pcep-controller-impl/${project.version}</bundle> |
25 | <bundle>mvn:${project.groupId}/onos-pcep-provider-topology/${project.version}</bundle> | 25 | <bundle>mvn:${project.groupId}/onos-pcep-provider-topology/${project.version}</bundle> |
26 | <bundle>mvn:${project.groupId}/onos-pcep-provider-tunnel/${project.version}</bundle> | 26 | <bundle>mvn:${project.groupId}/onos-pcep-provider-tunnel/${project.version}</bundle> |
27 | + <bundle>mvn:${project.groupId}/onos-pcep-provider-packet/${project.version}</bundle> | ||
27 | </feature> | 28 | </feature> |
28 | </features> | 29 | </features> | ... | ... |
... | @@ -58,6 +58,10 @@ | ... | @@ -58,6 +58,10 @@ |
58 | <artifactId>onos-pcep-provider-tunnel</artifactId> | 58 | <artifactId>onos-pcep-provider-tunnel</artifactId> |
59 | <version>${project.version}</version> | 59 | <version>${project.version}</version> |
60 | </dependency> | 60 | </dependency> |
61 | - | 61 | + <dependency> |
62 | + <groupId>org.onosproject</groupId> | ||
63 | + <artifactId>onos-pcep-provider-packet</artifactId> | ||
64 | + <version>${project.version}</version> | ||
65 | + </dependency> | ||
62 | </dependencies> | 66 | </dependencies> |
63 | </project> | 67 | </project> | ... | ... |
... | @@ -107,6 +107,7 @@ public class PcepPacketProvider extends AbstractProvider implements PacketProvid | ... | @@ -107,6 +107,7 @@ public class PcepPacketProvider extends AbstractProvider implements PacketProvid |
107 | } | 107 | } |
108 | 108 | ||
109 | if (pccDeviceId == null) { | 109 | if (pccDeviceId == null) { |
110 | + log.error("Device not found to perform label DB sync."); | ||
110 | return; | 111 | return; |
111 | } | 112 | } |
112 | 113 | ... | ... |
... | @@ -21,9 +21,6 @@ import org.apache.felix.scr.annotations.Deactivate; | ... | @@ -21,9 +21,6 @@ import org.apache.felix.scr.annotations.Deactivate; |
21 | import org.apache.felix.scr.annotations.Reference; | 21 | import org.apache.felix.scr.annotations.Reference; |
22 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 22 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
23 | import org.onlab.packet.ChassisId; | 23 | import org.onlab.packet.ChassisId; |
24 | -import org.onosproject.cluster.ClusterService; | ||
25 | -import org.onosproject.mastership.MastershipAdminService; | ||
26 | -import org.onosproject.mastership.MastershipService; | ||
27 | import org.onosproject.net.ConnectPoint; | 24 | import org.onosproject.net.ConnectPoint; |
28 | import org.onosproject.net.DefaultAnnotations; | 25 | import org.onosproject.net.DefaultAnnotations; |
29 | import org.onosproject.net.Device; | 26 | import org.onosproject.net.Device; |
... | @@ -55,7 +52,6 @@ import org.onosproject.net.link.LinkDescription; | ... | @@ -55,7 +52,6 @@ import org.onosproject.net.link.LinkDescription; |
55 | import org.onosproject.net.link.LinkProvider; | 52 | import org.onosproject.net.link.LinkProvider; |
56 | import org.onosproject.net.link.LinkProviderRegistry; | 53 | import org.onosproject.net.link.LinkProviderRegistry; |
57 | import org.onosproject.net.link.LinkProviderService; | 54 | import org.onosproject.net.link.LinkProviderService; |
58 | -import org.onosproject.net.link.LinkService; | ||
59 | import org.onosproject.net.provider.AbstractProvider; | 55 | import org.onosproject.net.provider.AbstractProvider; |
60 | import org.onosproject.net.provider.ProviderId; | 56 | import org.onosproject.net.provider.ProviderId; |
61 | import org.onosproject.pcep.api.DeviceCapability; | 57 | import org.onosproject.pcep.api.DeviceCapability; |
... | @@ -94,7 +90,9 @@ public class PcepTopologyProvider extends AbstractProvider | ... | @@ -94,7 +90,9 @@ public class PcepTopologyProvider extends AbstractProvider |
94 | * Creates instance of PCEP topology provider. | 90 | * Creates instance of PCEP topology provider. |
95 | */ | 91 | */ |
96 | public PcepTopologyProvider() { | 92 | public PcepTopologyProvider() { |
97 | - super(new ProviderId("l3", "org.onosproject.provider.pcep")); | 93 | + //In BGP-PCEP app, since both BGP and PCEP topology provider have same scheme |
94 | + //so BGP will be primary and PCEP topology provider will be ancillary. | ||
95 | + super(new ProviderId("l3", "org.onosproject.provider.pcep", true)); | ||
98 | } | 96 | } |
99 | 97 | ||
100 | private static final Logger log = LoggerFactory | 98 | private static final Logger log = LoggerFactory |
... | @@ -113,18 +111,6 @@ public class PcepTopologyProvider extends AbstractProvider | ... | @@ -113,18 +111,6 @@ public class PcepTopologyProvider extends AbstractProvider |
113 | protected DeviceService deviceService; | 111 | protected DeviceService deviceService; |
114 | 112 | ||
115 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 113 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
116 | - protected LinkService linkService; | ||
117 | - | ||
118 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
119 | - protected MastershipAdminService mastershipAdminService; | ||
120 | - | ||
121 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
122 | - protected MastershipService mastershipService; | ||
123 | - | ||
124 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
125 | - protected ClusterService clusterService; | ||
126 | - | ||
127 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
128 | protected PcepClientController pcepClientController; | 114 | protected PcepClientController pcepClientController; |
129 | 115 | ||
130 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 116 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
... | @@ -141,7 +127,7 @@ public class PcepTopologyProvider extends AbstractProvider | ... | @@ -141,7 +127,7 @@ public class PcepTopologyProvider extends AbstractProvider |
141 | 127 | ||
142 | private final ConfigFactory<DeviceId, DeviceCapability> configFactory = | 128 | private final ConfigFactory<DeviceId, DeviceCapability> configFactory = |
143 | new ConfigFactory<DeviceId, DeviceCapability>(SubjectFactories.DEVICE_SUBJECT_FACTORY, | 129 | new ConfigFactory<DeviceId, DeviceCapability>(SubjectFactories.DEVICE_SUBJECT_FACTORY, |
144 | - DeviceCapability.class, "deviceCapability", true) { | 130 | + DeviceCapability.class, "deviceCapability", false) { |
145 | @Override | 131 | @Override |
146 | public DeviceCapability createConfig() { | 132 | public DeviceCapability createConfig() { |
147 | return new DeviceCapability(); | 133 | return new DeviceCapability(); |
... | @@ -156,6 +142,7 @@ public class PcepTopologyProvider extends AbstractProvider | ... | @@ -156,6 +142,7 @@ public class PcepTopologyProvider extends AbstractProvider |
156 | controller.addLinkListener(listener); | 142 | controller.addLinkListener(listener); |
157 | pcepClientController.addNodeListener(listener); | 143 | pcepClientController.addNodeListener(listener); |
158 | netConfigRegistry.registerConfigFactory(configFactory); | 144 | netConfigRegistry.registerConfigFactory(configFactory); |
145 | + log.info("Started"); | ||
159 | } | 146 | } |
160 | 147 | ||
161 | @Deactivate | 148 | @Deactivate |
... | @@ -166,6 +153,7 @@ public class PcepTopologyProvider extends AbstractProvider | ... | @@ -166,6 +153,7 @@ public class PcepTopologyProvider extends AbstractProvider |
166 | controller.removeLinkListener(listener); | 153 | controller.removeLinkListener(listener); |
167 | pcepClientController.removeNodeListener(listener); | 154 | pcepClientController.removeNodeListener(listener); |
168 | netConfigRegistry.unregisterConfigFactory(configFactory); | 155 | netConfigRegistry.unregisterConfigFactory(configFactory); |
156 | + log.info("Stopped"); | ||
169 | } | 157 | } |
170 | 158 | ||
171 | private List<PortDescription> buildPortDescriptions(PcepDpid dpid, | 159 | private List<PortDescription> buildPortDescriptions(PcepDpid dpid, | ... | ... |
... | @@ -24,6 +24,7 @@ import org.apache.felix.scr.annotations.Property; | ... | @@ -24,6 +24,7 @@ import org.apache.felix.scr.annotations.Property; |
24 | import org.apache.felix.scr.annotations.Reference; | 24 | import org.apache.felix.scr.annotations.Reference; |
25 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 25 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
26 | import org.apache.felix.scr.annotations.Service; | 26 | import org.apache.felix.scr.annotations.Service; |
27 | +import org.onlab.packet.Ip4Address; | ||
27 | import org.onlab.packet.IpAddress; | 28 | import org.onlab.packet.IpAddress; |
28 | import org.onosproject.cfg.ComponentConfigService; | 29 | import org.onosproject.cfg.ComponentConfigService; |
29 | import org.onosproject.core.DefaultGroupId; | 30 | import org.onosproject.core.DefaultGroupId; |
... | @@ -79,8 +80,9 @@ import org.onosproject.pcep.controller.PcepClient; | ... | @@ -79,8 +80,9 @@ import org.onosproject.pcep.controller.PcepClient; |
79 | import org.onosproject.pcep.controller.PcepClientController; | 80 | import org.onosproject.pcep.controller.PcepClientController; |
80 | import org.onosproject.pcep.controller.PcepClientListener; | 81 | import org.onosproject.pcep.controller.PcepClientListener; |
81 | import org.onosproject.pcep.controller.PcepEventListener; | 82 | import org.onosproject.pcep.controller.PcepEventListener; |
83 | +import org.onosproject.pcep.controller.PcepLspStatus; | ||
82 | import org.onosproject.pcep.controller.PcepLspSyncAction; | 84 | import org.onosproject.pcep.controller.PcepLspSyncAction; |
83 | -import org.onosproject.pcep.controller.impl.PcepLspStatus; | 85 | +import org.onosproject.pcep.controller.SrpIdGenerators; |
84 | import org.onosproject.pcepio.exceptions.PcepParseException; | 86 | import org.onosproject.pcepio.exceptions.PcepParseException; |
85 | import org.onosproject.pcepio.protocol.PcInitiatedLspRequest; | 87 | import org.onosproject.pcepio.protocol.PcInitiatedLspRequest; |
86 | import org.onosproject.pcepio.protocol.PcepAttribute; | 88 | import org.onosproject.pcepio.protocol.PcepAttribute; |
... | @@ -130,13 +132,13 @@ import static org.onosproject.net.PortNumber.portNumber; | ... | @@ -130,13 +132,13 @@ import static org.onosproject.net.PortNumber.portNumber; |
130 | import static org.onosproject.pcep.api.PcepDpid.uri; | 132 | import static org.onosproject.pcep.api.PcepDpid.uri; |
131 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; | 133 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; |
132 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING; | 134 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING; |
133 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.BANDWIDTH; | 135 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.BANDWIDTH; |
134 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LOCAL_LSP_ID; | 136 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.LOCAL_LSP_ID; |
135 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LSP_SIG_TYPE; | 137 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; |
136 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.PCC_TUNNEL_ID; | 138 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.PCC_TUNNEL_ID; |
137 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.PLSP_ID; | 139 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.PLSP_ID; |
138 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.DELEGATE; | 140 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.DELEGATE; |
139 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.COST_TYPE; | 141 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.COST_TYPE; |
140 | import static org.onosproject.provider.pcep.tunnel.impl.RequestType.CREATE; | 142 | import static org.onosproject.provider.pcep.tunnel.impl.RequestType.CREATE; |
141 | import static org.onosproject.provider.pcep.tunnel.impl.RequestType.DELETE; | 143 | import static org.onosproject.provider.pcep.tunnel.impl.RequestType.DELETE; |
142 | import static org.onosproject.provider.pcep.tunnel.impl.RequestType.LSP_STATE_RPT; | 144 | import static org.onosproject.provider.pcep.tunnel.impl.RequestType.LSP_STATE_RPT; |
... | @@ -306,18 +308,13 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid | ... | @@ -306,18 +308,13 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid |
306 | return; | 308 | return; |
307 | } | 309 | } |
308 | 310 | ||
309 | - if (!(srcElement instanceof IpElementId)) { | ||
310 | - log.error("Element id is not valid"); | ||
311 | - return; | ||
312 | - } | ||
313 | - | ||
314 | // check for tunnel end points | 311 | // check for tunnel end points |
315 | if (!(tunnel.src() instanceof IpTunnelEndPoint) || !(tunnel.dst() instanceof IpTunnelEndPoint)) { | 312 | if (!(tunnel.src() instanceof IpTunnelEndPoint) || !(tunnel.dst() instanceof IpTunnelEndPoint)) { |
316 | log.error("Tunnel source or destination is not valid"); | 313 | log.error("Tunnel source or destination is not valid"); |
317 | return; | 314 | return; |
318 | } | 315 | } |
319 | 316 | ||
320 | - PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpElementId) srcElement).ipAddress())); | 317 | + PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpTunnelEndPoint) tunnel.src()).ip())); |
321 | 318 | ||
322 | if (!(pc instanceof PcepClient)) { | 319 | if (!(pc instanceof PcepClient)) { |
323 | log.error("There is no PCC connected with ip addresss {}" | 320 | log.error("There is no PCC connected with ip addresss {}" |
... | @@ -822,21 +819,27 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid | ... | @@ -822,21 +819,27 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid |
822 | IpAddress ipDstAddress = null; | 819 | IpAddress ipDstAddress = null; |
823 | IpAddress ipSrcAddress = null; | 820 | IpAddress ipSrcAddress = null; |
824 | PcepValueType subObj = null; | 821 | PcepValueType subObj = null; |
822 | + long portNo; | ||
825 | 823 | ||
826 | for (Link link : listLink) { | 824 | for (Link link : listLink) { |
827 | source = link.src(); | 825 | source = link.src(); |
828 | if (!(source.equals(destination))) { | 826 | if (!(source.equals(destination))) { |
829 | //set IPv4SubObject for ERO object | 827 | //set IPv4SubObject for ERO object |
830 | - ipSrcAddress = source.ipElementId().ipAddress(); | 828 | + portNo = source.port().toLong(); |
829 | + portNo = ((portNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? portNo & SET : portNo; | ||
830 | + ipSrcAddress = Ip4Address.valueOf((int) portNo); | ||
831 | subObj = new IPv4SubObject(ipSrcAddress.getIp4Address().toInt()); | 831 | subObj = new IPv4SubObject(ipSrcAddress.getIp4Address().toInt()); |
832 | llSubObjects.add(subObj); | 832 | llSubObjects.add(subObj); |
833 | } | 833 | } |
834 | 834 | ||
835 | destination = link.dst(); | 835 | destination = link.dst(); |
836 | - ipDstAddress = destination.ipElementId().ipAddress(); | 836 | + portNo = destination.port().toLong(); |
837 | + portNo = ((portNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? portNo & SET : portNo; | ||
838 | + ipDstAddress = Ip4Address.valueOf((int) portNo); | ||
837 | subObj = new IPv4SubObject(ipDstAddress.getIp4Address().toInt()); | 839 | subObj = new IPv4SubObject(ipDstAddress.getIp4Address().toInt()); |
838 | llSubObjects.add(subObj); | 840 | llSubObjects.add(subObj); |
839 | } | 841 | } |
842 | + | ||
840 | return llSubObjects; | 843 | return llSubObjects; |
841 | } | 844 | } |
842 | 845 | ||
... | @@ -904,9 +907,9 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid | ... | @@ -904,9 +907,9 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid |
904 | //build ERO object | 907 | //build ERO object |
905 | PcepEroObject eroobj = pc.factory().buildEroObject().setSubObjects(llSubObjects).build(); | 908 | PcepEroObject eroobj = pc.factory().buildEroObject().setSubObjects(llSubObjects).build(); |
906 | 909 | ||
907 | - int iBandwidth = DEFAULT_BANDWIDTH_VALUE; | 910 | + float iBandwidth = DEFAULT_BANDWIDTH_VALUE; |
908 | if (tunnel.annotations().value(BANDWIDTH) != null) { | 911 | if (tunnel.annotations().value(BANDWIDTH) != null) { |
909 | - iBandwidth = Integer.parseInt(tunnel.annotations().value(BANDWIDTH)); | 912 | + iBandwidth = Float.parseFloat(tunnel.annotations().value(BANDWIDTH)); |
910 | } | 913 | } |
911 | // build bandwidth object | 914 | // build bandwidth object |
912 | PcepBandwidthObject bandwidthObject = pc.factory().buildBandwidthObject().setBandwidth(iBandwidth).build(); | 915 | PcepBandwidthObject bandwidthObject = pc.factory().buildBandwidthObject().setBandwidth(iBandwidth).build(); | ... | ... |
... | @@ -23,7 +23,7 @@ import static org.onosproject.net.DefaultAnnotations.EMPTY; | ... | @@ -23,7 +23,7 @@ import static org.onosproject.net.DefaultAnnotations.EMPTY; |
23 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; | 23 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; |
24 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING; | 24 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING; |
25 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; | 25 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; |
26 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LSP_SIG_TYPE; | 26 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; |
27 | 27 | ||
28 | import java.io.IOException; | 28 | import java.io.IOException; |
29 | import java.util.ArrayList; | 29 | import java.util.ArrayList; | ... | ... |
... | @@ -23,7 +23,7 @@ import static org.hamcrest.Matchers.nullValue; | ... | @@ -23,7 +23,7 @@ import static org.hamcrest.Matchers.nullValue; |
23 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; | 23 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; |
24 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING; | 24 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING; |
25 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; | 25 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; |
26 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LSP_SIG_TYPE; | 26 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; |
27 | 27 | ||
28 | import java.io.IOException; | 28 | import java.io.IOException; |
29 | import java.util.ArrayList; | 29 | import java.util.ArrayList; | ... | ... |
... | @@ -19,12 +19,12 @@ import static org.hamcrest.MatcherAssert.assertThat; | ... | @@ -19,12 +19,12 @@ import static org.hamcrest.MatcherAssert.assertThat; |
19 | import static org.hamcrest.core.Is.is; | 19 | import static org.hamcrest.core.Is.is; |
20 | import static org.onosproject.incubator.net.tunnel.Tunnel.Type.MPLS; | 20 | import static org.onosproject.incubator.net.tunnel.Tunnel.Type.MPLS; |
21 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.INIT; | 21 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.INIT; |
22 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.BANDWIDTH; | 22 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.BANDWIDTH; |
23 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LOCAL_LSP_ID; | 23 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.LOCAL_LSP_ID; |
24 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LSP_SIG_TYPE; | 24 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; |
25 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.PCC_TUNNEL_ID; | 25 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.PCC_TUNNEL_ID; |
26 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.PLSP_ID; | 26 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.PLSP_ID; |
27 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.DELEGATE; | 27 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.DELEGATE; |
28 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; | 28 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR; |
29 | import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED; | 29 | import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED; |
30 | import static org.onosproject.net.Device.Type.ROUTER; | 30 | import static org.onosproject.net.Device.Type.ROUTER; | ... | ... |
... | @@ -20,7 +20,7 @@ import static org.hamcrest.Matchers.nullValue; | ... | @@ -20,7 +20,7 @@ import static org.hamcrest.Matchers.nullValue; |
20 | import static org.hamcrest.core.IsNot.not; | 20 | import static org.hamcrest.core.IsNot.not; |
21 | import static org.onosproject.net.DefaultAnnotations.EMPTY; | 21 | import static org.onosproject.net.DefaultAnnotations.EMPTY; |
22 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; | 22 | import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING; |
23 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LSP_SIG_TYPE; | 23 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; |
24 | 24 | ||
25 | import java.io.IOException; | 25 | import java.io.IOException; |
26 | import java.util.ArrayList; | 26 | import java.util.ArrayList; | ... | ... |
... | @@ -20,7 +20,9 @@ import static org.hamcrest.Matchers.nullValue; | ... | @@ -20,7 +20,9 @@ import static org.hamcrest.Matchers.nullValue; |
20 | import static org.hamcrest.core.Is.is; | 20 | import static org.hamcrest.core.Is.is; |
21 | import static org.hamcrest.core.IsNot.not; | 21 | import static org.hamcrest.core.IsNot.not; |
22 | import static org.onosproject.net.DefaultAnnotations.EMPTY; | 22 | import static org.onosproject.net.DefaultAnnotations.EMPTY; |
23 | -import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LSP_SIG_TYPE; | 23 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE; |
24 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.LOCAL_LSP_ID; | ||
25 | +import static org.onosproject.pcep.controller.PcepAnnotationKeys.PLSP_ID; | ||
24 | 26 | ||
25 | import java.io.IOException; | 27 | import java.io.IOException; |
26 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
... | @@ -112,8 +114,8 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -112,8 +114,8 @@ public class PcepUpdateTunnelProviderTest { |
112 | path = new DefaultPath(pid, links, 20, EMPTY); | 114 | path = new DefaultPath(pid, links, 20, EMPTY); |
113 | 115 | ||
114 | Annotations annotations = DefaultAnnotations.builder() | 116 | Annotations annotations = DefaultAnnotations.builder() |
115 | - .set(PcepAnnotationKeys.PLSP_ID, "1") | 117 | + .set(PLSP_ID, "1") |
116 | - .set(PcepAnnotationKeys.LOCAL_LSP_ID, "1") | 118 | + .set(LOCAL_LSP_ID, "1") |
117 | .set(LSP_SIG_TYPE, WITH_SIGNALLING.name()) | 119 | .set(LSP_SIG_TYPE, WITH_SIGNALLING.name()) |
118 | .build(); | 120 | .build(); |
119 | 121 | ||
... | @@ -173,8 +175,8 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -173,8 +175,8 @@ public class PcepUpdateTunnelProviderTest { |
173 | 175 | ||
174 | Annotations annotations = DefaultAnnotations.builder() | 176 | Annotations annotations = DefaultAnnotations.builder() |
175 | .set(LSP_SIG_TYPE, WITH_SIGNALLING.name()) | 177 | .set(LSP_SIG_TYPE, WITH_SIGNALLING.name()) |
176 | - .set(PcepAnnotationKeys.PLSP_ID, "1") | 178 | + .set(PLSP_ID, "1") |
177 | - .set(PcepAnnotationKeys.LOCAL_LSP_ID, "1") | 179 | + .set(LOCAL_LSP_ID, "1") |
178 | .build(); | 180 | .build(); |
179 | 181 | ||
180 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, | 182 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, |
... | @@ -233,8 +235,8 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -233,8 +235,8 @@ public class PcepUpdateTunnelProviderTest { |
233 | 235 | ||
234 | Annotations annotations = DefaultAnnotations.builder() | 236 | Annotations annotations = DefaultAnnotations.builder() |
235 | .set(LSP_SIG_TYPE, SR_WITHOUT_SIGNALLING.name()) | 237 | .set(LSP_SIG_TYPE, SR_WITHOUT_SIGNALLING.name()) |
236 | - .set(PcepAnnotationKeys.PLSP_ID, "1") | 238 | + .set(PLSP_ID, "1") |
237 | - .set(PcepAnnotationKeys.LOCAL_LSP_ID, "1") | 239 | + .set(LOCAL_LSP_ID, "1") |
238 | .build(); | 240 | .build(); |
239 | 241 | ||
240 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, | 242 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, |
... | @@ -293,8 +295,8 @@ public class PcepUpdateTunnelProviderTest { | ... | @@ -293,8 +295,8 @@ public class PcepUpdateTunnelProviderTest { |
293 | 295 | ||
294 | Annotations annotations = DefaultAnnotations.builder() | 296 | Annotations annotations = DefaultAnnotations.builder() |
295 | .set(LSP_SIG_TYPE, WITHOUT_SIGNALLING_AND_WITHOUT_SR.name()) | 297 | .set(LSP_SIG_TYPE, WITHOUT_SIGNALLING_AND_WITHOUT_SR.name()) |
296 | - .set(PcepAnnotationKeys.PLSP_ID, "1") | 298 | + .set(PLSP_ID, "1") |
297 | - .set(PcepAnnotationKeys.LOCAL_LSP_ID, "1") | 299 | + .set(LOCAL_LSP_ID, "1") |
298 | .build(); | 300 | .build(); |
299 | 301 | ||
300 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, | 302 | tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS, | ... | ... |
-
Please register or login to post a comment