Committed by
Gerrit Code Review
1. move tunnel 3 commands to onos-cli
2. add OCH ODU OMS port type; 3. fix some bugs in pcep tunnel provider and topology provider 4. Optimization of the command line tools of tunnel Change-Id: I323ede971795c8fe6ecddc40e1061f42a8243867 fix tunnel provider bugs. Change-Id: I323ede971795c8fe6ecddc40e1061f42a8243867
Showing
14 changed files
with
66 additions
and
328 deletions
| ... | @@ -48,13 +48,16 @@ public interface PcepLink extends PcepOperator { | ... | @@ -48,13 +48,16 @@ public interface PcepLink extends PcepOperator { |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | + public enum PortType { | ||
| 52 | + ODU_PORT, OCH_PORT, OMS_PORT | ||
| 53 | + } | ||
| 51 | 54 | ||
| 52 | /** | 55 | /** |
| 53 | * Get the link endpoint port type. | 56 | * Get the link endpoint port type. |
| 54 | * | 57 | * |
| 55 | * @return endpoint port type | 58 | * @return endpoint port type |
| 56 | */ | 59 | */ |
| 57 | - public String portType(); | 60 | + public PortType portType(); |
| 58 | 61 | ||
| 59 | /** | 62 | /** |
| 60 | * Get the link sub type,OTS,OPS,PKT_OPTICAL or ODUK. | 63 | * Get the link sub type,OTS,OPS,PKT_OPTICAL or ODUK. | ... | ... |
| ... | @@ -20,7 +20,7 @@ package org.onosproject.pcep.api; | ... | @@ -20,7 +20,7 @@ package org.onosproject.pcep.api; |
| 20 | */ | 20 | */ |
| 21 | public interface PcepSwitch extends PcepOperator { | 21 | public interface PcepSwitch extends PcepOperator { |
| 22 | 22 | ||
| 23 | - public static enum SubDeviceType { | 23 | + public static enum DeviceType { |
| 24 | /* optical device */ | 24 | /* optical device */ |
| 25 | ROADM, | 25 | ROADM, |
| 26 | 26 | ||
| ... | @@ -52,7 +52,7 @@ public interface PcepSwitch extends PcepOperator { | ... | @@ -52,7 +52,7 @@ public interface PcepSwitch extends PcepOperator { |
| 52 | * Gets the sub type of the device. | 52 | * Gets the sub type of the device. |
| 53 | * @return the sub type | 53 | * @return the sub type |
| 54 | */ | 54 | */ |
| 55 | - public SubDeviceType getDeviceSubType(); | 55 | + public DeviceType getDeviceType(); |
| 56 | 56 | ||
| 57 | /** | 57 | /** |
| 58 | * fetch the manufacturer description. | 58 | * fetch the manufacturer description. | ... | ... |
| ... | @@ -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.tunnel.cli; | 16 | +package org.onosproject.cli.net; |
| 17 | 17 | ||
| 18 | import java.util.Optional; | 18 | import java.util.Optional; |
| 19 | 19 | ||
| ... | @@ -64,11 +64,11 @@ public class TunnelCreateCommand extends AbstractShellCommand { | ... | @@ -64,11 +64,11 @@ public class TunnelCreateCommand extends AbstractShellCommand { |
| 64 | String type = null; | 64 | String type = null; |
| 65 | @Option(name = "-g", aliases = "--groupId", | 65 | @Option(name = "-g", aliases = "--groupId", |
| 66 | description = "Group flow table id which a tunnel match up", required = false, multiValued = false) | 66 | description = "Group flow table id which a tunnel match up", required = false, multiValued = false) |
| 67 | - String groupId = null; | 67 | + String groupId = "0"; |
| 68 | 68 | ||
| 69 | @Option(name = "-n", aliases = "--tunnelName", | 69 | @Option(name = "-n", aliases = "--tunnelName", |
| 70 | description = "The name of tunnels", required = false, multiValued = false) | 70 | description = "The name of tunnels", required = false, multiValued = false) |
| 71 | - String tunnelName = null; | 71 | + String tunnelName = "onos"; |
| 72 | 72 | ||
| 73 | @Option(name = "-b", aliases = "--bandwidth", | 73 | @Option(name = "-b", aliases = "--bandwidth", |
| 74 | description = "The bandwidth attribute of tunnel", required = false, multiValued = false) | 74 | description = "The bandwidth attribute of tunnel", required = false, multiValued = false) | ... | ... |
| ... | @@ -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.tunnel.cli; | 16 | +package org.onosproject.cli.net; |
| 17 | 17 | ||
| 18 | import java.util.Optional; | 18 | import java.util.Optional; |
| 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.tunnel.cli; | 16 | +package org.onosproject.cli.net; |
| 17 | 17 | ||
| 18 | import org.apache.karaf.shell.commands.Argument; | 18 | import org.apache.karaf.shell.commands.Argument; |
| 19 | import org.apache.karaf.shell.commands.Command; | 19 | import org.apache.karaf.shell.commands.Command; | ... | ... |
| ... | @@ -380,6 +380,15 @@ | ... | @@ -380,6 +380,15 @@ |
| 380 | <command> | 380 | <command> |
| 381 | <action class="org.onosproject.cli.net.TunnelQuerySubscriptionCommand"/> | 381 | <action class="org.onosproject.cli.net.TunnelQuerySubscriptionCommand"/> |
| 382 | </command> | 382 | </command> |
| 383 | + <command> | ||
| 384 | + <action class="org.onosproject.cli.net.TunnelCreateCommand"/> | ||
| 385 | + </command> | ||
| 386 | + <command> | ||
| 387 | + <action class="org.onosproject.cli.net.TunnelRemoveCommand"/> | ||
| 388 | + </command> | ||
| 389 | + <command> | ||
| 390 | + <action class="org.onosproject.cli.net.TunnelUpdateCommand"/> | ||
| 391 | + </command> | ||
| 383 | </command-bundle> | 392 | </command-bundle> |
| 384 | 393 | ||
| 385 | <bean id="permAppNameCompleter" class="org.onosproject.cli.security.PermissionApplicationNameCompleter"/> | 394 | <bean id="permAppNameCompleter" class="org.onosproject.cli.security.PermissionApplicationNameCompleter"/> | ... | ... |
| ... | @@ -15,6 +15,10 @@ | ... | @@ -15,6 +15,10 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.provider.pcep.topology.impl; | 16 | package org.onosproject.provider.pcep.topology.impl; |
| 17 | 17 | ||
| 18 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
| 19 | +import static org.onosproject.net.DeviceId.deviceId; | ||
| 20 | +import static org.onosproject.pcep.api.PcepDpid.uri; | ||
| 21 | + | ||
| 18 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
| 19 | import java.util.HashSet; | 23 | import java.util.HashSet; |
| 20 | import java.util.List; | 24 | import java.util.List; |
| ... | @@ -27,7 +31,6 @@ import org.apache.felix.scr.annotations.Reference; | ... | @@ -27,7 +31,6 @@ import org.apache.felix.scr.annotations.Reference; |
| 27 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 31 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 28 | import org.onlab.packet.ChassisId; | 32 | import org.onlab.packet.ChassisId; |
| 29 | import org.onosproject.cluster.ClusterService; | 33 | import org.onosproject.cluster.ClusterService; |
| 30 | -import org.onosproject.cluster.NodeId; | ||
| 31 | import org.onosproject.mastership.MastershipAdminService; | 34 | import org.onosproject.mastership.MastershipAdminService; |
| 32 | import org.onosproject.mastership.MastershipService; | 35 | import org.onosproject.mastership.MastershipService; |
| 33 | import org.onosproject.net.ConnectPoint; | 36 | import org.onosproject.net.ConnectPoint; |
| ... | @@ -57,6 +60,7 @@ import org.onosproject.net.provider.ProviderId; | ... | @@ -57,6 +60,7 @@ import org.onosproject.net.provider.ProviderId; |
| 57 | import org.onosproject.pcep.api.PcepController; | 60 | import org.onosproject.pcep.api.PcepController; |
| 58 | import org.onosproject.pcep.api.PcepDpid; | 61 | import org.onosproject.pcep.api.PcepDpid; |
| 59 | import org.onosproject.pcep.api.PcepLink; | 62 | import org.onosproject.pcep.api.PcepLink; |
| 63 | +import org.onosproject.pcep.api.PcepLink.PortType; | ||
| 60 | import org.onosproject.pcep.api.PcepLinkListener; | 64 | import org.onosproject.pcep.api.PcepLinkListener; |
| 61 | import org.onosproject.pcep.api.PcepOperator.OperationType; | 65 | import org.onosproject.pcep.api.PcepOperator.OperationType; |
| 62 | import org.onosproject.pcep.api.PcepSwitch; | 66 | import org.onosproject.pcep.api.PcepSwitch; |
| ... | @@ -64,10 +68,6 @@ import org.onosproject.pcep.api.PcepSwitchListener; | ... | @@ -64,10 +68,6 @@ import org.onosproject.pcep.api.PcepSwitchListener; |
| 64 | import org.slf4j.Logger; | 68 | import org.slf4j.Logger; |
| 65 | import org.slf4j.LoggerFactory; | 69 | import org.slf4j.LoggerFactory; |
| 66 | 70 | ||
| 67 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
| 68 | -import static org.onosproject.net.DeviceId.deviceId; | ||
| 69 | -import static org.onosproject.pcep.api.PcepDpid.uri; | ||
| 70 | - | ||
| 71 | /** | 71 | /** |
| 72 | * Provider which uses an PCEP controller to detect network infrastructure | 72 | * Provider which uses an PCEP controller to detect network infrastructure |
| 73 | * topology. | 73 | * topology. |
| ... | @@ -130,7 +130,7 @@ public class PcepTopologyProvider extends AbstractProvider | ... | @@ -130,7 +130,7 @@ public class PcepTopologyProvider extends AbstractProvider |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | private List<PortDescription> buildPortDescriptions(List<Long> ports, | 132 | private List<PortDescription> buildPortDescriptions(List<Long> ports, |
| 133 | - String portType) { | 133 | + PortType portType) { |
| 134 | final List<PortDescription> portDescs = new ArrayList<>(); | 134 | final List<PortDescription> portDescs = new ArrayList<>(); |
| 135 | for (long port : ports) { | 135 | for (long port : ports) { |
| 136 | portDescs.add(buildPortDescription(port, portType)); | 136 | portDescs.add(buildPortDescription(port, portType)); |
| ... | @@ -138,11 +138,11 @@ public class PcepTopologyProvider extends AbstractProvider | ... | @@ -138,11 +138,11 @@ public class PcepTopologyProvider extends AbstractProvider |
| 138 | return portDescs; | 138 | return portDescs; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | - private PortDescription buildPortDescription(long port, String portType) { | 141 | + private PortDescription buildPortDescription(long port, PortType portType) { |
| 142 | final PortNumber portNo = PortNumber.portNumber(port); | 142 | final PortNumber portNo = PortNumber.portNumber(port); |
| 143 | final boolean enabled = true; | 143 | final boolean enabled = true; |
| 144 | DefaultAnnotations extendedAttributes = DefaultAnnotations.builder() | 144 | DefaultAnnotations extendedAttributes = DefaultAnnotations.builder() |
| 145 | - .set("portType", portType).build(); | 145 | + .set("portType", String.valueOf(portType)).build(); |
| 146 | return new DefaultPortDescription(portNo, enabled, extendedAttributes); | 146 | return new DefaultPortDescription(portNo, enabled, extendedAttributes); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| ... | @@ -246,14 +246,22 @@ public class PcepTopologyProvider extends AbstractProvider | ... | @@ -246,14 +246,22 @@ public class PcepTopologyProvider extends AbstractProvider |
| 246 | PcepSwitch sw = controller.getSwitch(dpid); | 246 | PcepSwitch sw = controller.getSwitch(dpid); |
| 247 | checkNotNull(sw, "device should not null."); | 247 | checkNotNull(sw, "device should not null."); |
| 248 | // The default device type is switch. | 248 | // The default device type is switch. |
| 249 | - Device.Type deviceType = Device.Type.SWITCH; | ||
| 250 | ChassisId cId = new ChassisId(dpid.value()); | 249 | ChassisId cId = new ChassisId(dpid.value()); |
| 250 | + Device.Type deviceType = null; | ||
| 251 | 251 | ||
| 252 | - // Device subType: ROADM,OTN,ROUTER. | 252 | + switch (sw.getDeviceType()) { |
| 253 | - DefaultAnnotations extendedAttributes = DefaultAnnotations | 253 | + case ROADM: |
| 254 | - .builder() | 254 | + deviceType = Device.Type.ROADM; |
| 255 | - .set("subType", String.valueOf(sw.getDeviceSubType())) | 255 | + break; |
| 256 | - .build(); | 256 | + case OTN: |
| 257 | + deviceType = Device.Type.SWITCH; | ||
| 258 | + break; | ||
| 259 | + case ROUTER: | ||
| 260 | + deviceType = Device.Type.ROUTER; | ||
| 261 | + break; | ||
| 262 | + default: | ||
| 263 | + deviceType = Device.Type.OTHER; | ||
| 264 | + } | ||
| 257 | 265 | ||
| 258 | DeviceDescription description = new DefaultDeviceDescription( | 266 | DeviceDescription description = new DefaultDeviceDescription( |
| 259 | devicdId.uri(), | 267 | devicdId.uri(), |
| ... | @@ -262,12 +270,7 @@ public class PcepTopologyProvider extends AbstractProvider | ... | @@ -262,12 +270,7 @@ public class PcepTopologyProvider extends AbstractProvider |
| 262 | sw.hardwareDescription(), | 270 | sw.hardwareDescription(), |
| 263 | sw.softwareDescription(), | 271 | sw.softwareDescription(), |
| 264 | sw.serialNumber(), | 272 | sw.serialNumber(), |
| 265 | - cId, | 273 | + cId); |
| 266 | - extendedAttributes); | ||
| 267 | - NodeId localNode = clusterService.getLocalNode().id(); | ||
| 268 | - mastershipAdminService.setRole(localNode, devicdId, | ||
| 269 | - MastershipRole.MASTER); | ||
| 270 | - mastershipService.relinquishMastership(devicdId); | ||
| 271 | deviceProviderService.deviceConnected(devicdId, description); | 274 | deviceProviderService.deviceConnected(devicdId, description); |
| 272 | 275 | ||
| 273 | } | 276 | } |
| ... | @@ -322,19 +325,15 @@ public class PcepTopologyProvider extends AbstractProvider | ... | @@ -322,19 +325,15 @@ public class PcepTopologyProvider extends AbstractProvider |
| 322 | @Override | 325 | @Override |
| 323 | public void triggerProbe(DeviceId deviceId) { | 326 | public void triggerProbe(DeviceId deviceId) { |
| 324 | // TODO Auto-generated method stub | 327 | // TODO Auto-generated method stub |
| 325 | - | ||
| 326 | } | 328 | } |
| 327 | 329 | ||
| 328 | @Override | 330 | @Override |
| 329 | public void roleChanged(DeviceId deviceId, MastershipRole newRole) { | 331 | public void roleChanged(DeviceId deviceId, MastershipRole newRole) { |
| 330 | - // NodeId localNode = clusterService.getLocalNode().id(); | ||
| 331 | - // mastershipService.setRole(localNode, deviceId, newRole); | ||
| 332 | - | ||
| 333 | } | 332 | } |
| 334 | 333 | ||
| 335 | @Override | 334 | @Override |
| 336 | public boolean isReachable(DeviceId deviceId) { | 335 | public boolean isReachable(DeviceId deviceId) { |
| 337 | // TODO Auto-generated method stub | 336 | // TODO Auto-generated method stub |
| 338 | - return false; | 337 | + return true; |
| 339 | } | 338 | } |
| 340 | } | 339 | } | ... | ... |
| ... | @@ -78,6 +78,7 @@ public class PcepTunnelProvider extends AbstractProvider | ... | @@ -78,6 +78,7 @@ public class PcepTunnelProvider extends AbstractProvider |
| 78 | private static final Logger log = getLogger(PcepTunnelProvider.class); | 78 | private static final Logger log = getLogger(PcepTunnelProvider.class); |
| 79 | private static final long MAX_BANDWIDTH = 99999744; | 79 | private static final long MAX_BANDWIDTH = 99999744; |
| 80 | private static final long MIN_BANDWIDTH = 64; | 80 | private static final long MIN_BANDWIDTH = 64; |
| 81 | + private static final String BANDWIDTH_UINT = "kbps"; | ||
| 81 | static final String PROVIDER_ID = "org.onosproject.provider.tunnel.default"; | 82 | static final String PROVIDER_ID = "org.onosproject.provider.tunnel.default"; |
| 82 | 83 | ||
| 83 | private static final String TUNNLE_NOT_NULL = "Create failed,The given port may be wrong or has been occupied."; | 84 | private static final String TUNNLE_NOT_NULL = "Create failed,The given port may be wrong or has been occupied."; |
| ... | @@ -154,10 +155,11 @@ public class PcepTunnelProvider extends AbstractProvider | ... | @@ -154,10 +155,11 @@ public class PcepTunnelProvider extends AbstractProvider |
| 154 | @Override | 155 | @Override |
| 155 | public TunnelId tunnelAdded(TunnelDescription tunnel) { | 156 | public TunnelId tunnelAdded(TunnelDescription tunnel) { |
| 156 | 157 | ||
| 157 | - long bandwidth = Long.parseLong(tunnel.annotations().value("bandWith")); | 158 | + long bandwidth = Long |
| 159 | + .parseLong(tunnel.annotations().value("bandwidth")); | ||
| 158 | 160 | ||
| 159 | if (bandwidth < MIN_BANDWIDTH || bandwidth > MAX_BANDWIDTH) { | 161 | if (bandwidth < MIN_BANDWIDTH || bandwidth > MAX_BANDWIDTH) { |
| 160 | - System.out.println("Update failed, invalid bandwidth."); | 162 | + error("Update failed, invalid bandwidth."); |
| 161 | return null; | 163 | return null; |
| 162 | } | 164 | } |
| 163 | 165 | ||
| ... | @@ -175,8 +177,7 @@ public class PcepTunnelProvider extends AbstractProvider | ... | @@ -175,8 +177,7 @@ public class PcepTunnelProvider extends AbstractProvider |
| 175 | 177 | ||
| 176 | // type | 178 | // type |
| 177 | if (tunnel.type() != Tunnel.Type.VLAN) { | 179 | if (tunnel.type() != Tunnel.Type.VLAN) { |
| 178 | - System.out | 180 | + error("Illegal tunnel type. Only support VLAN tunnel creation."); |
| 179 | - .println("Llegal tunnel type. Only support VLAN tunnel creation."); | ||
| 180 | return null; | 181 | return null; |
| 181 | } | 182 | } |
| 182 | 183 | ||
| ... | @@ -198,18 +199,17 @@ public class PcepTunnelProvider extends AbstractProvider | ... | @@ -198,18 +199,17 @@ public class PcepTunnelProvider extends AbstractProvider |
| 198 | Tunnel tunnelOld = tunnelQueryById(tunnel.id()); | 199 | Tunnel tunnelOld = tunnelQueryById(tunnel.id()); |
| 199 | checkNotNull(tunnelOld, "The tunnel id is not exsited."); | 200 | checkNotNull(tunnelOld, "The tunnel id is not exsited."); |
| 200 | if (tunnelOld.type() != Tunnel.Type.VLAN) { | 201 | if (tunnelOld.type() != Tunnel.Type.VLAN) { |
| 201 | - System.out | 202 | + error("Llegal tunnel type. Only support VLAN tunnel deletion."); |
| 202 | - .println("Llegal tunnel type. Only support VLAN tunnel deletion."); | ||
| 203 | return; | 203 | return; |
| 204 | } | 204 | } |
| 205 | String pcepTunnelId = getPCEPTunnelKey(tunnel.id()); | 205 | String pcepTunnelId = getPCEPTunnelKey(tunnel.id()); |
| 206 | checkNotNull(pcepTunnelId, "The tunnel id is not exsited."); | 206 | checkNotNull(pcepTunnelId, "The tunnel id is not exsited."); |
| 207 | - if (controller.deleteTunnel(pcepTunnelId)) { | 207 | + if (!controller.deleteTunnel(pcepTunnelId)) { |
| 208 | - log.info("delete tunnel:" + pcepTunnelId + "ok."); | 208 | + error("Delete tunnel failed, Maybe some devices have been disconnected."); |
| 209 | + return; | ||
| 209 | } | 210 | } |
| 210 | tunnelMap.remove(pcepTunnelId); | 211 | tunnelMap.remove(pcepTunnelId); |
| 211 | service.tunnelRemoved(tunnel); | 212 | service.tunnelRemoved(tunnel); |
| 212 | - | ||
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | @Override | 215 | @Override |
| ... | @@ -217,13 +217,13 @@ public class PcepTunnelProvider extends AbstractProvider | ... | @@ -217,13 +217,13 @@ public class PcepTunnelProvider extends AbstractProvider |
| 217 | 217 | ||
| 218 | Tunnel tunnelOld = tunnelQueryById(tunnel.id()); | 218 | Tunnel tunnelOld = tunnelQueryById(tunnel.id()); |
| 219 | if (tunnelOld.type() != Tunnel.Type.VLAN) { | 219 | if (tunnelOld.type() != Tunnel.Type.VLAN) { |
| 220 | - System.out | 220 | + error("Llegal tunnel type. Only support VLAN tunnel update."); |
| 221 | - .println("Llegal tunnel type. Only support VLAN tunnel update."); | ||
| 222 | return; | 221 | return; |
| 223 | } | 222 | } |
| 224 | - long bandwidth = Long.parseLong(tunnel.annotations().value("bandWith")); | 223 | + long bandwidth = Long |
| 224 | + .parseLong(tunnel.annotations().value("bandwidth")); | ||
| 225 | if (bandwidth < MIN_BANDWIDTH || bandwidth > MAX_BANDWIDTH) { | 225 | if (bandwidth < MIN_BANDWIDTH || bandwidth > MAX_BANDWIDTH) { |
| 226 | - System.out.println("Update failed, invalid bandwidth."); | 226 | + error("Update failed, invalid bandwidth."); |
| 227 | return; | 227 | return; |
| 228 | } | 228 | } |
| 229 | String pcepTunnelId = getPCEPTunnelKey(tunnel.id()); | 229 | String pcepTunnelId = getPCEPTunnelKey(tunnel.id()); |
| ... | @@ -231,13 +231,17 @@ public class PcepTunnelProvider extends AbstractProvider | ... | @@ -231,13 +231,17 @@ public class PcepTunnelProvider extends AbstractProvider |
| 231 | checkNotNull(pcepTunnelId, "Invalid tunnel id"); | 231 | checkNotNull(pcepTunnelId, "Invalid tunnel id"); |
| 232 | if (!controller.updateTunnelBandwidth(pcepTunnelId, bandwidth)) { | 232 | if (!controller.updateTunnelBandwidth(pcepTunnelId, bandwidth)) { |
| 233 | 233 | ||
| 234 | - System.out.println("Update failed,maybe invalid bandwidth."); | 234 | + error("Update failed,maybe invalid bandwidth."); |
| 235 | return; | 235 | return; |
| 236 | 236 | ||
| 237 | } | 237 | } |
| 238 | service.tunnelUpdated(tunnel); | 238 | service.tunnelUpdated(tunnel); |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | + private void error(String info) { | ||
| 242 | + System.err.println(info); | ||
| 243 | + } | ||
| 244 | + | ||
| 241 | // Short-hand for creating a connection point. | 245 | // Short-hand for creating a connection point. |
| 242 | private ConnectPoint connectPoint(PcepDpid id, long port) { | 246 | private ConnectPoint connectPoint(PcepDpid id, long port) { |
| 243 | return new ConnectPoint(deviceId(uri(id)), portNumber(port)); | 247 | return new ConnectPoint(deviceId(uri(id)), portNumber(port)); |
| ... | @@ -334,22 +338,13 @@ public class PcepTunnelProvider extends AbstractProvider | ... | @@ -334,22 +338,13 @@ public class PcepTunnelProvider extends AbstractProvider |
| 334 | true); | 338 | true); |
| 335 | 339 | ||
| 336 | // basic annotations | 340 | // basic annotations |
| 337 | - DefaultAnnotations annotations = DefaultAnnotations.builder() | 341 | + DefaultAnnotations annotations = DefaultAnnotations |
| 338 | - .set("bandWith", String.valueOf(pcepTunnel.bandWidth())) | 342 | + .builder() |
| 339 | .set("SLA", String.valueOf(pcepTunnel.getSla())) | 343 | .set("SLA", String.valueOf(pcepTunnel.getSla())) |
| 344 | + .set("bandwidth", | ||
| 345 | + String.valueOf(pcepTunnel.bandWidth()) + BANDWIDTH_UINT) | ||
| 340 | .set("index", String.valueOf(pcepTunnel.id())).build(); | 346 | .set("index", String.valueOf(pcepTunnel.id())).build(); |
| 341 | 347 | ||
| 342 | - // if (path != null) { | ||
| 343 | - // | ||
| 344 | - // DefaultAnnotations extendAnnotations = DefaultAnnotations.builder() | ||
| 345 | - // .set("pathNum", String.valueOf(hopNum)) | ||
| 346 | - // // .set("path", pathString) | ||
| 347 | - // .set("pathType", String.valueOf(pcepTunnel.getPathType())) | ||
| 348 | - // .build(); | ||
| 349 | - // annotations = DefaultAnnotations.merge(annotations, | ||
| 350 | - // extendAnnotations); | ||
| 351 | - // } | ||
| 352 | - | ||
| 353 | // a VLAN tunnel always carry OCH tunnel, this annotation is the index | 348 | // a VLAN tunnel always carry OCH tunnel, this annotation is the index |
| 354 | // of a OCH tunnel. | 349 | // of a OCH tunnel. |
| 355 | if (pcepTunnel.underLayTunnelId() != 0) { | 350 | if (pcepTunnel.underLayTunnelId() != 0) { | ... | ... |
| ... | @@ -37,7 +37,6 @@ | ... | @@ -37,7 +37,6 @@ |
| 37 | <module>host</module> | 37 | <module>host</module> |
| 38 | <module>netconf</module> | 38 | <module>netconf</module> |
| 39 | <module>null</module> | 39 | <module>null</module> |
| 40 | - <module>tunnel</module> | ||
| 41 | <module>pcep</module> | 40 | <module>pcep</module> |
| 42 | </modules> | 41 | </modules> |
| 43 | 42 | ... | ... |
providers/tunnel/pom.xml
deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<!-- | ||
| 3 | - ~ Copyright 2014 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 | -<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 18 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 19 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
| 20 | - <modelVersion>4.0.0</modelVersion> | ||
| 21 | - | ||
| 22 | - <parent> | ||
| 23 | - <groupId>org.onosproject</groupId> | ||
| 24 | - <artifactId>onos-providers</artifactId> | ||
| 25 | - <version>1.2.0-SNAPSHOT</version> | ||
| 26 | - <relativePath>../pom.xml</relativePath> | ||
| 27 | - </parent> | ||
| 28 | - | ||
| 29 | - <artifactId>onos-tunnel-provider</artifactId> | ||
| 30 | - <packaging>bundle</packaging> | ||
| 31 | - | ||
| 32 | - <description>tunnel southbound providers</description> | ||
| 33 | - | ||
| 34 | - <properties> | ||
| 35 | - <onos.app.name>org.onosproject.tunnel</onos.app.name> | ||
| 36 | - </properties> | ||
| 37 | - | ||
| 38 | - <dependencies> | ||
| 39 | - <dependency> | ||
| 40 | - <groupId>org.osgi</groupId> | ||
| 41 | - <artifactId>org.osgi.compendium</artifactId> | ||
| 42 | - </dependency> | ||
| 43 | - <dependency> | ||
| 44 | - <groupId>org.apache.karaf.shell</groupId> | ||
| 45 | - <artifactId>org.apache.karaf.shell.console</artifactId> | ||
| 46 | - </dependency> | ||
| 47 | - <dependency> | ||
| 48 | - <groupId>org.onosproject</groupId> | ||
| 49 | - <artifactId>onos-cli</artifactId> | ||
| 50 | - <version>${project.version}</version> | ||
| 51 | - </dependency> | ||
| 52 | - | ||
| 53 | - <dependency> | ||
| 54 | - <groupId>org.onosproject</groupId> | ||
| 55 | - <artifactId>onos-api</artifactId> | ||
| 56 | - <classifier>tests</classifier> | ||
| 57 | - <scope>test</scope> | ||
| 58 | - </dependency> | ||
| 59 | - </dependencies> | ||
| 60 | - | ||
| 61 | -</project> |
providers/tunnel/src/main/java/org/onosproject/provider/tunnel/DefaultTunnelProvider.java
deleted
100644 → 0
| 1 | -/* | ||
| 2 | - * Copyright 2015 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.provider.tunnel; | ||
| 17 | - | ||
| 18 | -import static org.slf4j.LoggerFactory.getLogger; | ||
| 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.Reference; | ||
| 24 | -import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
| 25 | -import org.apache.felix.scr.annotations.Service; | ||
| 26 | -import org.onosproject.cfg.ComponentConfigService; | ||
| 27 | -import org.onosproject.net.ElementId; | ||
| 28 | -import org.onosproject.net.Path; | ||
| 29 | -import org.onosproject.net.provider.AbstractProvider; | ||
| 30 | -import org.onosproject.net.provider.ProviderId; | ||
| 31 | -import org.onosproject.incubator.net.tunnel.Tunnel; | ||
| 32 | -import org.onosproject.incubator.net.tunnel.TunnelDescription; | ||
| 33 | -import org.onosproject.incubator.net.tunnel.TunnelId; | ||
| 34 | -import org.onosproject.incubator.net.tunnel.TunnelProvider; | ||
| 35 | -import org.onosproject.incubator.net.tunnel.TunnelProviderRegistry; | ||
| 36 | -import org.onosproject.incubator.net.tunnel.TunnelProviderService; | ||
| 37 | -import org.osgi.service.component.ComponentContext; | ||
| 38 | -import org.slf4j.Logger; | ||
| 39 | - | ||
| 40 | -/** | ||
| 41 | - * Provider of a fake network environment, i.e. devices, links, hosts, etc. To | ||
| 42 | - * be used for benchmarking only. | ||
| 43 | - */ | ||
| 44 | -@Component(immediate = true) | ||
| 45 | -@Service | ||
| 46 | -public class DefaultTunnelProvider extends AbstractProvider | ||
| 47 | - implements TunnelProvider { | ||
| 48 | - | ||
| 49 | - private static final Logger log = getLogger(DefaultTunnelProvider.class); | ||
| 50 | - | ||
| 51 | - static final String PROVIDER_ID = "org.onosproject.provider.tunnel.default"; | ||
| 52 | - | ||
| 53 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
| 54 | - protected ComponentConfigService cfgService; | ||
| 55 | - | ||
| 56 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
| 57 | - protected TunnelProviderRegistry tunnelProviderRegistry; | ||
| 58 | - | ||
| 59 | - TunnelProviderService service; | ||
| 60 | - | ||
| 61 | - /** | ||
| 62 | - * Creates a Tunnel provider. | ||
| 63 | - */ | ||
| 64 | - public DefaultTunnelProvider() { | ||
| 65 | - super(new ProviderId("default", PROVIDER_ID)); | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - @Activate | ||
| 69 | - public void activate(ComponentContext context) { | ||
| 70 | - service = tunnelProviderRegistry.register(this); | ||
| 71 | - log.info("Started"); | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - @Deactivate | ||
| 75 | - public void deactivate(ComponentContext context) { | ||
| 76 | - tunnelProviderRegistry.unregister(this); | ||
| 77 | - log.info("Stopped"); | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - @Override | ||
| 81 | - public void setupTunnel(Tunnel tunnel, Path path) { | ||
| 82 | - // TODO Auto-generated method stub | ||
| 83 | - | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - @Override | ||
| 87 | - public void setupTunnel(ElementId srcElement, Tunnel tunnel, Path path) { | ||
| 88 | - // TODO Auto-generated method stub | ||
| 89 | - | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - @Override | ||
| 93 | - public void releaseTunnel(Tunnel tunnel) { | ||
| 94 | - // TODO Auto-generated method stub | ||
| 95 | - | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - @Override | ||
| 99 | - public void releaseTunnel(ElementId srcElement, Tunnel tunnel) { | ||
| 100 | - // TODO Auto-generated method stub | ||
| 101 | - | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - @Override | ||
| 105 | - public void updateTunnel(Tunnel tunnel, Path path) { | ||
| 106 | - // TODO Auto-generated method stub | ||
| 107 | - | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - @Override | ||
| 111 | - public void updateTunnel(ElementId srcElement, Tunnel tunnel, Path path) { | ||
| 112 | - // TODO Auto-generated method stub | ||
| 113 | - | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - @Override | ||
| 117 | - public TunnelId tunnelAdded(TunnelDescription tunnel) { | ||
| 118 | - return service.tunnelAdded(tunnel); | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - @Override | ||
| 122 | - public void tunnelRemoved(TunnelDescription tunnel) { | ||
| 123 | - service.tunnelRemoved(tunnel); | ||
| 124 | - } | ||
| 125 | - | ||
| 126 | - @Override | ||
| 127 | - public void tunnelUpdated(TunnelDescription tunnel) { | ||
| 128 | - service.tunnelUpdated(tunnel); | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - @Override | ||
| 132 | - public Tunnel tunnelQueryById(TunnelId tunnelId) { | ||
| 133 | - return service.tunnelQueryById(tunnelId); | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | -} |
providers/tunnel/src/main/java/org/onosproject/provider/tunnel/cli/package-info.java
deleted
100644 → 0
| 1 | -/* | ||
| 2 | - * Copyright 2015 Open Networking Laboratory | ||
| 3 | - * | ||
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | - * you may not use this file except in compliance with the License. | ||
| 6 | - * You may obtain a copy of the License at | ||
| 7 | - * | ||
| 8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | - * | ||
| 10 | - * Unless required by applicable law or agreed to in writing, software | ||
| 11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | - * See the License for the specific language governing permissions and | ||
| 14 | - * limitations under the License. | ||
| 15 | - */ | ||
| 16 | - | ||
| 17 | -/** | ||
| 18 | - * Null provider CLI commands and completers. | ||
| 19 | - */ | ||
| 20 | -package org.onosproject.provider.tunnel.cli; |
| 1 | -/* | ||
| 2 | - * Copyright 2015 Open Networking Laboratory | ||
| 3 | - * | ||
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | - * you may not use this file except in compliance with the License. | ||
| 6 | - * You may obtain a copy of the License at | ||
| 7 | - * | ||
| 8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | - * | ||
| 10 | - * Unless required by applicable law or agreed to in writing, software | ||
| 11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | - * See the License for the specific language governing permissions and | ||
| 14 | - * limitations under the License. | ||
| 15 | - */ | ||
| 16 | - | ||
| 17 | -/** | ||
| 18 | - * Set of null south-bound providers which permit simulating a network | ||
| 19 | - * topology using fake devices, links, hosts, etc. | ||
| 20 | - */ | ||
| 21 | -package org.onosproject.provider.tunnel; |
| 1 | -<!-- | ||
| 2 | - ~ Copyright 2015 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 | -<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> | ||
| 17 | - | ||
| 18 | - <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0"> | ||
| 19 | - <command> | ||
| 20 | - <action class="org.onosproject.provider.tunnel.cli.TunnelCreateCommand"/> | ||
| 21 | - </command> | ||
| 22 | - <command> | ||
| 23 | - <action class="org.onosproject.provider.tunnel.cli.TunnelRemoveCommand"/> | ||
| 24 | - </command> | ||
| 25 | - <command> | ||
| 26 | - <action class="org.onosproject.provider.tunnel.cli.TunnelUpdateCommand"/> | ||
| 27 | - </command> | ||
| 28 | - </command-bundle> | ||
| 29 | -</blueprint> |
-
Please register or login to post a comment