aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/cli/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/cli/src/main')
-rw-r--r--framework/src/onos/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java4
-rw-r--r--framework/src/onos/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java38
-rw-r--r--framework/src/onos/cli/src/main/java/org/onosproject/cli/net/DeviceSetControllersCommand.java7
-rw-r--r--framework/src/onos/cli/src/main/java/org/onosproject/cli/net/GetFlowStatistics.java18
-rw-r--r--framework/src/onos/cli/src/main/java/org/onosproject/cli/net/GroupsListCommand.java8
-rw-r--r--framework/src/onos/cli/src/main/java/org/onosproject/cli/net/LinkResourceTestCommand.java17
6 files changed, 52 insertions, 40 deletions
diff --git a/framework/src/onos/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java b/framework/src/onos/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java
index 17cf89e2..100f6823 100644
--- a/framework/src/onos/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java
+++ b/framework/src/onos/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java
@@ -41,7 +41,7 @@ public class ApplicationsListCommand extends AbstractShellCommand {
private static final String FMT =
"%s id=%d, name=%s, version=%s, origin=%s, description=%s, " +
- "features=%s, featuresRepo=%s, permissions=%s";
+ "features=%s, featuresRepo=%s, apps=%s, permissions=%s";
private static final String SHORT_FMT =
"%s %3d %-32s %-8s %s";
@@ -76,7 +76,7 @@ public class ApplicationsListCommand extends AbstractShellCommand {
app.id().id(), app.id().name(), app.version(), app.origin(),
app.description(), app.features(),
app.featuresRepo().isPresent() ? app.featuresRepo().get().toString() : "",
- app.permissions());
+ app.requiredApps(), app.permissions());
}
}
}
diff --git a/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java b/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
index 62cf042a..fbce9648 100644
--- a/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
+++ b/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
@@ -15,12 +15,6 @@
*/
package org.onosproject.cli.net;
-import static com.google.common.base.Strings.isNullOrEmpty;
-import static org.onosproject.net.flow.DefaultTrafficTreatment.builder;
-
-import java.util.LinkedList;
-import java.util.List;
-
import org.apache.karaf.shell.commands.Option;
import org.onlab.packet.Ip6Address;
import org.onlab.packet.IpAddress;
@@ -33,6 +27,7 @@ import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.net.Link;
+import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.DefaultTrafficSelector;
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.TrafficSelector;
@@ -46,6 +41,12 @@ import org.onosproject.net.intent.constraint.LinkTypeConstraint;
import org.onosproject.net.intent.constraint.PartialFailureConstraint;
import org.onosproject.net.resource.link.BandwidthResource;
+import java.util.LinkedList;
+import java.util.List;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static org.onosproject.net.flow.DefaultTrafficTreatment.builder;
+
/**
* Base class for command line operations for connectivity based intents.
*/
@@ -98,11 +99,11 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
@Option(name = "--ndSLL", description = "IPv6 Neighbor Discovery Source Link-Layer",
required = false, multiValued = false)
- private String ndSLLString = null;
+ private String ndSllString = null;
@Option(name = "--ndTLL", description = "IPv6 Neighbor Discovery Target Link-Layer",
required = false, multiValued = false)
- private String ndTLLString = null;
+ private String ndTllString = null;
@Option(name = "--tcpSrc", description = "Source TCP Port",
required = false, multiValued = false)
@@ -166,7 +167,8 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
required = false, multiValued = false)
private String pushVlan = null;
- @Option(name = "--setQueue", description = "Set Queue ID",
+ @Option(name = "--setQueue", description = "Set Queue ID (for OpenFlow 1.0, " +
+ "also the port has to be specified, i.e., <port>/<queue>",
required = false, multiValued = false)
private String setQueue = null;
@@ -262,12 +264,12 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
selectorBuilder.matchIPv6NDTargetAddress(Ip6Address.valueOf(ndTargetString));
}
- if (!isNullOrEmpty(ndSLLString)) {
- selectorBuilder.matchIPv6NDSourceLinkLayerAddress(MacAddress.valueOf(ndSLLString));
+ if (!isNullOrEmpty(ndSllString)) {
+ selectorBuilder.matchIPv6NDSourceLinkLayerAddress(MacAddress.valueOf(ndSllString));
}
- if (!isNullOrEmpty(ndTLLString)) {
- selectorBuilder.matchIPv6NDTargetLinkLayerAddress(MacAddress.valueOf(ndTLLString));
+ if (!isNullOrEmpty(ndTllString)) {
+ selectorBuilder.matchIPv6NDTargetLinkLayerAddress(MacAddress.valueOf(ndTllString));
}
if (!isNullOrEmpty(srcTcpString)) {
@@ -332,7 +334,15 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
emptyTreatment = false;
}
if (!isNullOrEmpty(setQueue)) {
- treatmentBuilder.setQueue(Long.parseLong(setQueue));
+ // OpenFlow 1.0 notation (for ENQUEUE): <port>/<queue>
+ if (setQueue.contains("/")) {
+ String[] queueConfig = setQueue.split("/");
+ PortNumber port = PortNumber.portNumber(Long.parseLong(queueConfig[0]));
+ long queueId = Long.parseLong(queueConfig[1]);
+ treatmentBuilder.setQueue(queueId, port);
+ } else {
+ treatmentBuilder.setQueue(Long.parseLong(setQueue));
+ }
emptyTreatment = false;
}
diff --git a/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/DeviceSetControllersCommand.java b/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/DeviceSetControllersCommand.java
index c3693799..cb4ff04a 100644
--- a/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/DeviceSetControllersCommand.java
+++ b/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/DeviceSetControllersCommand.java
@@ -59,8 +59,11 @@ public class DeviceSetControllersCommand extends AbstractShellCommand {
ControllerConfig config = h.behaviour(ControllerConfig.class);
print("before:");
config.getControllers().forEach(c -> print(c.target()));
-
- config.setControllers(newControllers);
+ try {
+ config.setControllers(newControllers);
+ } catch (NullPointerException e) {
+ print("No Device with requested parameters {} ", uri);
+ }
print("after:");
config.getControllers().forEach(c -> print(c.target()));
print("size %d", config.getControllers().size());
diff --git a/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/GetFlowStatistics.java b/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/GetFlowStatistics.java
index cafe87f9..4bbf4f10 100644
--- a/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/GetFlowStatistics.java
+++ b/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/GetFlowStatistics.java
@@ -82,15 +82,15 @@ public class GetFlowStatistics extends AbstractShellCommand {
DeviceService deviceService = get(DeviceService.class);
FlowStatisticService flowStatsService = get(FlowStatisticService.class);
- String deviceURI = getDeviceId(devicePort);
- String portURI = getPortNumber(devicePort);
+ String deviceUri = getDeviceId(devicePort);
+ String portUri = getPortNumber(devicePort);
- DeviceId ingressDeviceId = deviceId(deviceURI);
+ DeviceId ingressDeviceId = deviceId(deviceUri);
PortNumber ingressPortNumber;
- if (portURI.length() == 0) {
+ if (portUri.length() == 0) {
ingressPortNumber = null;
} else {
- ingressPortNumber = portNumber(portURI);
+ ingressPortNumber = portNumber(portUri);
}
Device device = deviceService.getDevice(ingressDeviceId);
@@ -102,7 +102,7 @@ public class GetFlowStatistics extends AbstractShellCommand {
if (ingressPortNumber != null) {
Port port = deviceService.getPort(ingressDeviceId, ingressPortNumber);
if (port == null) {
- error("No such port %s on device %s", portURI, ingressDeviceId.uri());
+ error("No such port %s on device %s", portUri, ingressDeviceId.uri());
return;
}
}
@@ -148,7 +148,7 @@ public class GetFlowStatistics extends AbstractShellCommand {
// print show topn head line with type
print("deviceId=%s, show TOPN=%s flows, live type=%s, instruction type=%s",
- deviceURI,
+ deviceUri,
Integer.toString(topn),
flowLiveType == null ? "ALL" : flowLiveType,
instructionType == null ? "ALL" : instructionType);
@@ -169,7 +169,7 @@ public class GetFlowStatistics extends AbstractShellCommand {
} else if (showAll) { // is true?
// print show all head line with type
print("deviceId=%s, show ALL flows, live type=%s, instruction type=%s",
- deviceURI,
+ deviceUri,
flowLiveType == null ? "ALL" : flowLiveType,
instructionType == null ? "ALL" : instructionType);
if (ingressPortNumber == null) {
@@ -188,7 +188,7 @@ public class GetFlowStatistics extends AbstractShellCommand {
}
} else { // if (showSummary == true) //always is true
// print show summary head line
- print("deviceId=%s, show SUMMARY flows", deviceURI);
+ print("deviceId=%s, show SUMMARY flows", deviceUri);
if (ingressPortNumber == null) {
Map<ConnectPoint, SummaryFlowEntryWithLoad> summaryFlowLoadMap =
flowStatsService.loadSummary(device);
diff --git a/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/GroupsListCommand.java b/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/GroupsListCommand.java
index b10621de..ee6d31b8 100644
--- a/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/GroupsListCommand.java
+++ b/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/GroupsListCommand.java
@@ -46,9 +46,9 @@ import static com.google.common.collect.Lists.newArrayList;
public class GroupsListCommand extends AbstractShellCommand {
private static final String FORMAT =
- " id=%s, state=%s, type=%s, bytes=%s, packets=%s, appId=%s";
+ " id=0x%s, state=%s, type=%s, bytes=%s, packets=%s, appId=%s";
private static final String BUCKET_FORMAT =
- " id=%s, bucket=%s, bytes=%s, packets=%s, actions=%s";
+ " id=0x%s, bucket=%s, bytes=%s, packets=%s, actions=%s";
@Argument(index = 1, name = "uri", description = "Device ID",
required = false, multiValued = false)
@@ -121,11 +121,11 @@ public class GroupsListCommand extends AbstractShellCommand {
private void printGroups(DeviceId deviceId, List<Group> groups) {
print("deviceId=%s", deviceId);
for (Group group : groups) {
- print(FORMAT, group.id().id(), group.state(), group.type(),
+ print(FORMAT, Integer.toHexString(group.id().id()), group.state(), group.type(),
group.bytes(), group.packets(), group.appId().name());
int i = 0;
for (GroupBucket bucket:group.buckets().buckets()) {
- print(BUCKET_FORMAT, group.id().id(), ++i,
+ print(BUCKET_FORMAT, Integer.toHexString(group.id().id()), ++i,
bucket.bytes(), bucket.packets(),
bucket.treatment().allInstructions());
}
diff --git a/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/LinkResourceTestCommand.java b/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/LinkResourceTestCommand.java
index 12e9ab5f..a1a76925 100644
--- a/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/LinkResourceTestCommand.java
+++ b/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/LinkResourceTestCommand.java
@@ -15,24 +15,23 @@
*/
package org.onosproject.cli.net;
-import java.util.Set;
-import java.util.List;
-
+import com.google.common.collect.Lists;
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.net.Path;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.resource.link.DefaultLinkResourceRequest;
import org.onosproject.net.resource.link.LinkResourceAllocations;
import org.onosproject.net.resource.link.LinkResourceRequest;
import org.onosproject.net.resource.link.LinkResourceService;
import org.onosproject.net.topology.PathService;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Link;
-import org.onosproject.net.Path;
-import com.google.common.collect.Lists;
+import java.util.List;
+import java.util.Set;
/**
* Commands to test out LinkResourceManager directly.
@@ -44,7 +43,7 @@ public class LinkResourceTestCommand extends AbstractShellCommand {
// default is bandwidth.
@Option(name = "-m", aliases = "--mpls", description = "MPLS resource",
required = false, multiValued = false)
- private boolean isMPLS = false;
+ private boolean isMpls = false;
@Option(name = "-o", aliases = "--optical", description = "Optical resource",
required = false, multiValued = false)
@@ -96,7 +95,7 @@ public class LinkResourceTestCommand extends AbstractShellCommand {
for (Path p : paths) {
List<Link> links = p.links();
LinkResourceRequest.Builder request = null;
- if (isMPLS) {
+ if (isMpls) {
List<Link> nlinks = Lists.newArrayList();
try {
nlinks.addAll(links.subList(1, links.size() - 2));