use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class ApplicationResource method getIcon.
@Path("{name}/icon")
@GET
@Produces("image/png")
public Response getIcon(@PathParam("name") String name) throws IOException {
ApplicationAdminService service = get(ApplicationAdminService.class);
ApplicationId appId = service.getId(name);
Application app = service.getApplication(appId);
return Response.ok(app.icon()).build();
}
use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class FlowViewMessageHandler method makeAppName.
// Return an application name, based on a lookup of the internal short ID
private String makeAppName(short id, Map<Short, ApplicationId> lookup) {
ApplicationId appId = lookup.get(id);
if (appId == null) {
appId = get(CoreService.class).getAppId(id);
if (appId == null) {
return UNKNOWN + SPACE + ANGLE_O + id + ANGLE_C;
}
lookup.put(id, appId);
}
String appName = appId.name();
return appName.startsWith(ONOS_PREFIX) ? appName.replaceFirst(ONOS_PREFIX, ONOS_MARKER) : appName;
}
use of org.onosproject.core.ApplicationId in project up4 by omec-project.
the class ConfigPscEncap method doExecute.
@Override
protected void doExecute() throws Exception {
if (enable == null) {
return;
}
NetworkConfigService netCfgService = get(NetworkConfigService.class);
CoreService coreService = get(CoreService.class);
ApplicationId appId = coreService.getAppId(APP_NAME);
Up4Config config = netCfgService.getConfig(appId, Up4Config.class);
if (config == null) {
print("No UP4 netcfg has been pushed yet");
return;
}
config.setPscEncap(enable);
netCfgService.applyConfig(appId, Up4Config.class, config.node());
}
use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class VirtualFlowsListCommand method printFlows.
/**
* Prints flows.
*
* @param d the device
* @param flows the set of flows for that device
* @param coreService core system service
*/
protected void printFlows(Device d, List<FlowEntry> flows, CoreService coreService) {
List<FlowEntry> filteredFlows = flows.stream().filter(f -> contentFilter.filter(f)).collect(Collectors.toList());
boolean empty = filteredFlows == null || filteredFlows.isEmpty();
print("deviceId=%s, flowRuleCount=%d", d.id(), empty ? 0 : filteredFlows.size());
if (empty || countOnly) {
return;
}
for (FlowEntry f : filteredFlows) {
if (shortOutput) {
print(SHORT_FORMAT, f.state(), f.bytes(), f.packets(), f.tableId(), f.priority(), f.selector().criteria(), printTreatment(f.treatment()));
} else {
ApplicationId appId = coreService.getAppId(f.appId());
print(LONG_FORMAT, Long.toHexString(f.id().value()), f.state(), f.bytes(), f.packets(), f.life(), f.liveType(), f.priority(), f.tableId(), appId != null ? appId.name() : "<none>", f.selector().criteria(), f.treatment());
}
}
}
use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class VirtualNetworkIntentRemoveCommand method doExecute.
@Override
protected void doExecute() {
VirtualNetworkService service = get(VirtualNetworkService.class);
IntentService intentService = service.get(NetworkId.networkId(networkId), IntentService.class);
CoreService coreService = get(CoreService.class);
if (purgeAfterRemove || sync) {
print("Using \"sync\" to remove/purge intents - this may take a while...");
print("Check \"summary\" to see remove/purge progress.");
}
ApplicationId appId = appId();
if (!isNullOrEmpty(applicationIdString)) {
appId = coreService.getAppId(applicationIdString);
if (appId == null) {
print("Cannot find application Id %s", applicationIdString);
return;
}
}
if (isNullOrEmpty(keyString)) {
for (Intent intent : intentService.getIntents()) {
if (intent.appId().equals(appId)) {
removeIntent(intentService, intent);
}
}
} else {
final Key key;
if (keyString.startsWith("0x")) {
// The intent uses a LongKey
keyString = keyString.replaceFirst("0x", "");
key = Key.of(new BigInteger(keyString, 16).longValue(), appId);
} else {
// The intent uses a StringKey
key = Key.of(keyString, appId);
}
Intent intent = intentService.getIntent(key);
if (intent != null) {
removeIntent(intentService, intent);
} else {
print("Intent not found!");
}
}
}
Aggregations