Committed by
Gerrit Code Review
[ONOS] Capability defect fix and component activation fix
Change-Id: Ie7336d1b445a14820a948e4b20c7ad2d6478682d (cherry picked from commit b19d0349)
Showing
3 changed files
with
132 additions
and
8 deletions
... | @@ -141,19 +141,15 @@ public final class CapabilityConstraint extends BooleanConstraint { | ... | @@ -141,19 +141,15 @@ public final class CapabilityConstraint extends BooleanConstraint { |
141 | DeviceCapability dstDeviceConfig = netCfgService.getConfig(DeviceId.deviceId(dstLsrId), | 141 | DeviceCapability dstDeviceConfig = netCfgService.getConfig(DeviceId.deviceId(dstLsrId), |
142 | DeviceCapability.class); | 142 | DeviceCapability.class); |
143 | 143 | ||
144 | - if (srcDeviceConfig == null || dstDeviceConfig == null) { | ||
145 | - return false; | ||
146 | - } | ||
147 | - | ||
148 | switch (capabilityType) { | 144 | switch (capabilityType) { |
149 | case WITH_SIGNALLING: | 145 | case WITH_SIGNALLING: |
150 | return true; | 146 | return true; |
151 | case WITHOUT_SIGNALLING_AND_WITHOUT_SR: | 147 | case WITHOUT_SIGNALLING_AND_WITHOUT_SR: |
152 | - return srcDeviceConfig.localLabelCap() && dstDeviceConfig.localLabelCap(); | 148 | + return srcDeviceConfig != null && dstDeviceConfig != null |
153 | - | 149 | + && srcDeviceConfig.localLabelCap() && dstDeviceConfig.localLabelCap(); |
154 | case SR_WITHOUT_SIGNALLING: | 150 | case SR_WITHOUT_SIGNALLING: |
155 | - return srcDeviceConfig.srCap() && dstDeviceConfig.srCap() | 151 | + return srcDeviceConfig != null && dstDeviceConfig != null && srcDeviceConfig.srCap() |
156 | - && srcDeviceConfig.labelStackCap() && dstDeviceConfig.labelStackCap(); | 152 | + && dstDeviceConfig.srCap() && srcDeviceConfig.labelStackCap() && dstDeviceConfig.labelStackCap(); |
157 | default: | 153 | default: |
158 | return false; | 154 | return false; |
159 | } | 155 | } | ... | ... |
... | @@ -3,6 +3,7 @@ COMPILE_DEPS = [ | ... | @@ -3,6 +3,7 @@ COMPILE_DEPS = [ |
3 | '//protocols/pcep/pcepio:onos-protocols-pcep-pcepio', | 3 | '//protocols/pcep/pcepio:onos-protocols-pcep-pcepio', |
4 | '//protocols/pcep/api:onos-protocols-pcep-api', | 4 | '//protocols/pcep/api:onos-protocols-pcep-api', |
5 | '//incubator/api:onos-incubator-api', | 5 | '//incubator/api:onos-incubator-api', |
6 | + '//apps/pcep-api:onos-apps-pcep-api', | ||
6 | ] | 7 | ] |
7 | 8 | ||
8 | osgi_jar_with_tests ( | 9 | osgi_jar_with_tests ( | ... | ... |
protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepControllerImpl.java
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 | +package org.onosproject.pcep.controller.impl; | ||
17 | + | ||
18 | +import com.google.common.collect.Sets; | ||
19 | + | ||
20 | +import org.apache.felix.scr.annotations.Activate; | ||
21 | +import org.apache.felix.scr.annotations.Component; | ||
22 | +import org.apache.felix.scr.annotations.Deactivate; | ||
23 | +import org.apache.felix.scr.annotations.Service; | ||
24 | +import org.onosproject.net.DeviceId; | ||
25 | +import org.onosproject.pcep.api.PcepController; | ||
26 | +import org.onosproject.pcep.api.PcepDpid; | ||
27 | +import org.onosproject.pcep.api.PcepLinkListener; | ||
28 | +import org.onosproject.pcep.api.PcepSwitch; | ||
29 | +import org.onosproject.pcep.api.PcepSwitchListener; | ||
30 | +import org.onosproject.pcep.api.PcepTunnel; | ||
31 | +import org.onosproject.pcep.api.PcepTunnelListener; | ||
32 | +import org.slf4j.Logger; | ||
33 | +import org.slf4j.LoggerFactory; | ||
34 | + | ||
35 | +import java.util.Set; | ||
36 | + | ||
37 | +/** | ||
38 | + * Implementation of PCEP controller [protocol]. | ||
39 | + */ | ||
40 | +@Component(immediate = true) | ||
41 | +@Service | ||
42 | +public class PcepControllerImpl implements PcepController { | ||
43 | + | ||
44 | + private static final Logger log = LoggerFactory.getLogger(PcepControllerImpl.class); | ||
45 | + | ||
46 | + protected Set<PcepTunnelListener> pcepTunnelListener = Sets.newHashSet(); | ||
47 | + protected Set<PcepLinkListener> pcepLinkListener = Sets.newHashSet(); | ||
48 | + protected Set<PcepSwitchListener> pcepSwitchListener = Sets.newHashSet(); | ||
49 | + | ||
50 | + private final Controller ctrl = new Controller(); | ||
51 | + | ||
52 | + @Activate | ||
53 | + public void activate() { | ||
54 | + log.info("Started"); | ||
55 | + } | ||
56 | + | ||
57 | + @Deactivate | ||
58 | + public void deactivate() { | ||
59 | + log.info("Stopped"); | ||
60 | + } | ||
61 | + | ||
62 | + @Override | ||
63 | + public Iterable<PcepSwitch> getSwitches() { | ||
64 | + // TODO Auto-generated method stub | ||
65 | + return null; | ||
66 | + } | ||
67 | + | ||
68 | + @Override | ||
69 | + public PcepSwitch getSwitch(PcepDpid did) { | ||
70 | + // TODO Auto-generated method stub | ||
71 | + return null; | ||
72 | + } | ||
73 | + | ||
74 | + @Override | ||
75 | + public void addListener(PcepSwitchListener listener) { | ||
76 | + this.pcepSwitchListener.add(listener); | ||
77 | + } | ||
78 | + | ||
79 | + @Override | ||
80 | + public void removeListener(PcepSwitchListener listener) { | ||
81 | + this.pcepSwitchListener.remove(listener); | ||
82 | + } | ||
83 | + | ||
84 | + @Override | ||
85 | + public void addLinkListener(PcepLinkListener listener) { | ||
86 | + this.pcepLinkListener.add(listener); | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public void removeLinkListener(PcepLinkListener listener) { | ||
91 | + this.pcepLinkListener.remove(listener); | ||
92 | + } | ||
93 | + | ||
94 | + @Override | ||
95 | + public void addTunnelListener(PcepTunnelListener listener) { | ||
96 | + this.pcepTunnelListener.add(listener); | ||
97 | + } | ||
98 | + | ||
99 | + @Override | ||
100 | + public void removeTunnelListener(PcepTunnelListener listener) { | ||
101 | + this.pcepTunnelListener.remove(listener); | ||
102 | + } | ||
103 | + | ||
104 | + @Override | ||
105 | + public PcepTunnel applyTunnel(DeviceId srcDid, DeviceId dstDid, long srcPort, long dstPort, long bandwidth, | ||
106 | + String name) { | ||
107 | + // TODO Auto-generated method stub | ||
108 | + return null; | ||
109 | + } | ||
110 | + | ||
111 | + @Override | ||
112 | + public Boolean deleteTunnel(String id) { | ||
113 | + // TODO Auto-generated method stub | ||
114 | + return null; | ||
115 | + } | ||
116 | + | ||
117 | + @Override | ||
118 | + public Boolean updateTunnelBandwidth(String id, long bandwidth) { | ||
119 | + // TODO Auto-generated method stub | ||
120 | + return null; | ||
121 | + } | ||
122 | + | ||
123 | + @Override | ||
124 | + public void getTunnelStatistics(String pcepTunnelId) { | ||
125 | + // TODO Auto-generated method stub | ||
126 | + } | ||
127 | +} |
-
Please register or login to post a comment