Committed by
Gerrit Code Review
[ONOS-4671]PCECC defect fix , bgp pcep provider having same scheme problem
Change-Id: Ibfb18cfa79ec04ec2a62b2139d28b9c7b03d0a07
Showing
5 changed files
with
25 additions
and
32 deletions
... | @@ -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 | ... | ... |
... | @@ -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; | ... | ... |
... | @@ -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) |
... | @@ -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; |
... | @@ -306,18 +307,13 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid | ... | @@ -306,18 +307,13 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid |
306 | return; | 307 | return; |
307 | } | 308 | } |
308 | 309 | ||
309 | - if (!(srcElement instanceof IpElementId)) { | ||
310 | - log.error("Element id is not valid"); | ||
311 | - return; | ||
312 | - } | ||
313 | - | ||
314 | // check for tunnel end points | 310 | // check for tunnel end points |
315 | if (!(tunnel.src() instanceof IpTunnelEndPoint) || !(tunnel.dst() instanceof IpTunnelEndPoint)) { | 311 | if (!(tunnel.src() instanceof IpTunnelEndPoint) || !(tunnel.dst() instanceof IpTunnelEndPoint)) { |
316 | log.error("Tunnel source or destination is not valid"); | 312 | log.error("Tunnel source or destination is not valid"); |
317 | return; | 313 | return; |
318 | } | 314 | } |
319 | 315 | ||
320 | - PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpElementId) srcElement).ipAddress())); | 316 | + PcepClient pc = pcepClientController.getClient(PccId.pccId(((IpTunnelEndPoint) tunnel.src()).ip())); |
321 | 317 | ||
322 | if (!(pc instanceof PcepClient)) { | 318 | if (!(pc instanceof PcepClient)) { |
323 | log.error("There is no PCC connected with ip addresss {}" | 319 | log.error("There is no PCC connected with ip addresss {}" |
... | @@ -822,21 +818,27 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid | ... | @@ -822,21 +818,27 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid |
822 | IpAddress ipDstAddress = null; | 818 | IpAddress ipDstAddress = null; |
823 | IpAddress ipSrcAddress = null; | 819 | IpAddress ipSrcAddress = null; |
824 | PcepValueType subObj = null; | 820 | PcepValueType subObj = null; |
821 | + long portNo; | ||
825 | 822 | ||
826 | for (Link link : listLink) { | 823 | for (Link link : listLink) { |
827 | source = link.src(); | 824 | source = link.src(); |
828 | if (!(source.equals(destination))) { | 825 | if (!(source.equals(destination))) { |
829 | //set IPv4SubObject for ERO object | 826 | //set IPv4SubObject for ERO object |
830 | - ipSrcAddress = source.ipElementId().ipAddress(); | 827 | + portNo = source.port().toLong(); |
828 | + portNo = ((portNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? portNo & SET : portNo; | ||
829 | + ipSrcAddress = Ip4Address.valueOf((int) portNo); | ||
831 | subObj = new IPv4SubObject(ipSrcAddress.getIp4Address().toInt()); | 830 | subObj = new IPv4SubObject(ipSrcAddress.getIp4Address().toInt()); |
832 | llSubObjects.add(subObj); | 831 | llSubObjects.add(subObj); |
833 | } | 832 | } |
834 | 833 | ||
835 | destination = link.dst(); | 834 | destination = link.dst(); |
836 | - ipDstAddress = destination.ipElementId().ipAddress(); | 835 | + portNo = destination.port().toLong(); |
836 | + portNo = ((portNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? portNo & SET : portNo; | ||
837 | + ipDstAddress = Ip4Address.valueOf((int) portNo); | ||
837 | subObj = new IPv4SubObject(ipDstAddress.getIp4Address().toInt()); | 838 | subObj = new IPv4SubObject(ipDstAddress.getIp4Address().toInt()); |
838 | llSubObjects.add(subObj); | 839 | llSubObjects.add(subObj); |
839 | } | 840 | } |
841 | + | ||
840 | return llSubObjects; | 842 | return llSubObjects; |
841 | } | 843 | } |
842 | 844 | ||
... | @@ -904,9 +906,9 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid | ... | @@ -904,9 +906,9 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid |
904 | //build ERO object | 906 | //build ERO object |
905 | PcepEroObject eroobj = pc.factory().buildEroObject().setSubObjects(llSubObjects).build(); | 907 | PcepEroObject eroobj = pc.factory().buildEroObject().setSubObjects(llSubObjects).build(); |
906 | 908 | ||
907 | - int iBandwidth = DEFAULT_BANDWIDTH_VALUE; | 909 | + float iBandwidth = DEFAULT_BANDWIDTH_VALUE; |
908 | if (tunnel.annotations().value(BANDWIDTH) != null) { | 910 | if (tunnel.annotations().value(BANDWIDTH) != null) { |
909 | - iBandwidth = Integer.parseInt(tunnel.annotations().value(BANDWIDTH)); | 911 | + iBandwidth = Float.parseFloat(tunnel.annotations().value(BANDWIDTH)); |
910 | } | 912 | } |
911 | // build bandwidth object | 913 | // build bandwidth object |
912 | PcepBandwidthObject bandwidthObject = pc.factory().buildBandwidthObject().setBandwidth(iBandwidth).build(); | 914 | PcepBandwidthObject bandwidthObject = pc.factory().buildBandwidthObject().setBandwidth(iBandwidth).build(); | ... | ... |
-
Please register or login to post a comment