本文整理汇总了Java中org.onosproject.segmentrouting.TunnelHandler类的典型用法代码示例。如果您正苦于以下问题:Java TunnelHandler类的具体用法?Java TunnelHandler怎么用?Java TunnelHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TunnelHandler类属于org.onosproject.segmentrouting包,在下文中一共展示了TunnelHandler类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.onosproject.segmentrouting.TunnelHandler; //导入依赖的package包/类
@Override
protected void execute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
Tunnel tunnel = new DefaultTunnel(tunnelId, Lists.newArrayList());
TunnelHandler.Result result = srService.removeTunnel(tunnel);
switch (result) {
case TUNNEL_IN_USE:
print("ERROR: the tunnel is still in use");
break;
case TUNNEL_NOT_FOUND:
print("ERROR: the tunnel is not found");
break;
default:
break;
}
}
示例2: execute
import org.onosproject.segmentrouting.TunnelHandler; //导入依赖的package包/类
@Override
protected void execute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
List<Integer> labelIds = new ArrayList<>();
StringTokenizer strToken = new StringTokenizer(labels, ",");
while (strToken.hasMoreTokens()) {
labelIds.add(Integer.valueOf(strToken.nextToken()));
}
Tunnel tunnel = new DefaultTunnel(tunnelId, labelIds);
TunnelHandler.Result result = srService.createTunnel(tunnel);
switch (result) {
case ID_EXISTS:
print("ERROR: the same tunnel ID exists");
break;
case TUNNEL_EXISTS:
print("ERROR: the same tunnel exists");
break;
case INTERNAL_ERROR:
print("ERROR: internal tunnel creation error");
break;
case WRONG_PATH:
print("ERROR: the tunnel path is wrong");
break;
default:
break;
}
}