本文整理汇总了Java中net.floodlightcontroller.qos.IQoSService类的典型用法代码示例。如果您正苦于以下问题:Java IQoSService类的具体用法?Java IQoSService怎么用?Java IQoSService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IQoSService类属于net.floodlightcontroller.qos包,在下文中一共展示了IQoSService类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getModuleDependencies
import net.floodlightcontroller.qos.IQoSService; //导入依赖的package包/类
@Override
public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
Collection<Class<? extends IFloodlightService>> l = new ArrayList<Class<? extends IFloodlightService>>();
l.add(IFloodlightProviderService.class);
l.add(IQoSService.class);
l.add(IStorageSourceService.class);
l.add(IPolicyManager.class);
return l;
}
示例5: init
import net.floodlightcontroller.qos.IQoSService; //导入依赖的package包/类
@Override
public void init(FloodlightModuleContext context)
throws FloodlightModuleException {
floodlightProvider = context
.getServiceImpl(IFloodlightProviderService.class);
this.QoSService = context.getServiceImpl(IQoSService.class);
this.storageSource = context
.getServiceImpl(IStorageSourceService.class);
this.restApi = context.getServiceImpl(IRestApiService.class);
logger = LoggerFactory.getLogger(IPolicyManager.class);
}
示例6: 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 + "\"}");
}