本文整理汇总了Java中net.floodlightcontroller.qos.IQoSService.isEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java IQoSService.isEnabled方法的具体用法?Java IQoSService.isEnabled怎么用?Java IQoSService.isEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.floodlightcontroller.qos.IQoSService
的用法示例。
在下文中一共展示了IQoSService.isEnabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleRequest
import net.floodlightcontroller.qos.IQoSService; //导入方法依赖的package包/类
/**
* Get basic info about the tool
* @return
*/
@Get("json")
public Object handleRequest() {
String op = (String) getRequestAttributes().get("op");
IQoSService qos =
(IQoSService)getContext().getAttributes().
get(IQoSService.class.getCanonicalName());
if (op.equalsIgnoreCase("enable")) {
qos.enableQoS(true);
return "{\"status\" : \"success\", \"details\" : \"QoS Enabled\"}";
}else if (op.equalsIgnoreCase("status")) {
return qos.isEnabled();
}else if (op.equalsIgnoreCase("disable")) {
qos.enableQoS(false);
return "{\"status\" : \"success\", \"details\" : \"QoS Disabled\"}";
}
return "{\"status\" : \"failure\", \"details\" : \"Invalid Operation\"}";
}
示例2: handleRequest
import net.floodlightcontroller.qos.IQoSService; //导入方法依赖的package包/类
/**
* Get list of services
* @return
*/
@Get("json")
public Object handleRequest(){
IQoSService qos =
(IQoSService)getContext().getAttributes().
get(IQoSService.class.getCanonicalName());
String status = null;
if(qos.isEnabled()){
// gets the list of policies currently being implemented
return qos.getServices();
}
else{
status = "Please enable Quality of Service";
return ("{\"status\" : \"" + status + "\"}");
}
}
示例3: store
import net.floodlightcontroller.qos.IQoSService; //导入方法依赖的package包/类
/**
*
* @param tosJson The qos policy entry in JSON format.
* @return A string status message
*/
@Post
public String store(String tosJson) {
IQoSService qos =
(IQoSService)getContext().getAttributes().
get(IQoSService.class.getCanonicalName());
//dummy service
QoSTypeOfService service;
try{
service = jsonToService(tosJson);
}
catch(IOException e){
logger.debug("Error Parsing QoS Service to JSON: {}, Error: {}", tosJson, e);
e.printStackTrace();
return "{\"status\" : \"Error! Could not parse Service, see log for details.\"}";
}
String status = null;
if(checkIfServiceExists(service,qos.getServices())){
status = "Error!, This service already exists!";
logger.error(status);
}
else{
//Only add if enabled ?needed?
if(qos.isEnabled()){
status = "Adding Type Of Service: " + service.name + " " + service.tos;
qos.addService(service);
}
else{
status = "Please enable Quality of Service";
}
}
return ("{\"status\" : \"" + status + "\"}");
}
示例4: delete
import net.floodlightcontroller.qos.IQoSService; //导入方法依赖的package包/类
/**
*
* @param tosJson
* @return
*/
@Delete
public String delete(String tosJson) {
IQoSService qos =
(IQoSService)getContext().getAttributes().
get(IQoSService.class.getCanonicalName());
//dummy service
QoSTypeOfService service;
//Accepts just "name": "<Service-Name>"
//or the full service object
try{
service = jsonToService(tosJson);
}
catch(IOException e){
logger.debug("Error Parsing QoS Service to JSON: {}, Error: {}", tosJson, e);
e.printStackTrace();
return "{\"status\" : \"Error! Could not parse Service, see log for details.\"}";
}
String status = null;
if(qos.isEnabled()){
boolean found = false;
Iterator<QoSTypeOfService> sIter = qos.getServices().iterator();
while(sIter.hasNext()){
QoSTypeOfService s = sIter.next();
if(s.sid == service.sid){
found = true;
break;
}
}
if(!found){
status = "Error! Cannot delete a rule with this ID or NAME, does not exist.";
logger.error(status);
}
else{
qos.deleteService(service.sid);
status = "Type Of Service Service-ID: "+service.sid+" Deleted";
}
}
else{
status = "Please enable QoS";
}
return ("{\"status\" : \"" + status + "\"}");
}