本文整理汇总了Java中net.floodlightcontroller.qos.QoSTypeOfService类的典型用法代码示例。如果您正苦于以下问题:Java QoSTypeOfService类的具体用法?Java QoSTypeOfService怎么用?Java QoSTypeOfService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
QoSTypeOfService类属于net.floodlightcontroller.qos包,在下文中一共展示了QoSTypeOfService类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import net.floodlightcontroller.qos.QoSTypeOfService; //导入依赖的package包/类
@Override
public void init(FloodlightModuleContext context)
throws FloodlightModuleException {
//initiate services
floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
flowPusher = context.getServiceImpl(IStaticFlowEntryPusherService.class);
logger = LoggerFactory.getLogger(QoS.class);
storageSource = context.getServiceImpl(IStorageSourceService.class);
restApi = context.getServiceImpl(IRestApiService.class);
policies = new ArrayList<QoSPolicy>();
services = new ArrayList<QoSTypeOfService>();
logger = LoggerFactory.getLogger(QoS.class);
// start disabled
enabled = false;
}
示例2: startUp
import net.floodlightcontroller.qos.QoSTypeOfService; //导入依赖的package包/类
@Override
public void startUp(FloodlightModuleContext context) {
// initialize REST interface
restApi.addRestletRoutable(new QoSWebRoutable());
floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
//Storage for policies
storageSource.createTable(TABLE_NAME, null);
storageSource.setTablePrimaryKeyName(TABLE_NAME, COLUMN_POLID);
//avoid thread issues for concurrency
synchronized (policies) {
this.policies = readPoliciesFromStorage();
}
//Storage for services
storageSource.createTable(TOS_TABLE_NAME, null);
storageSource.setTablePrimaryKeyName(TOS_TABLE_NAME, COLUMN_SID);
//avoid thread issues for concurrency
synchronized (services) {
this.services = readServicesFromStorage();
}
// create default "Best Effort" service
// most networks use this as default, adding here for defaulting
try{
QoSTypeOfService service = new QoSTypeOfService();
service.name = "Best Effort";
service.tos = (byte)0x00;
service.sid = service.genID();
this.addService(service);
}catch(Exception e){
logger.error("Error adding default Best Effort {}", e);
}
}
示例3: addService
import net.floodlightcontroller.qos.QoSTypeOfService; //导入依赖的package包/类
/**
* Add a service class to use in policies
* Used to make ToS/DiffServ Bits human readable.
* Bit notation 000000 becomes "Best Effort"
* @param QoSTypeOfService
*/
@Override
public synchronized void addService(QoSTypeOfService service) {
//debug
logger.debug("Adding Service to List and Storage");
//create the UID
service.sid = service.genID();
//check tos bits are within bounds
if (service.tos >= (byte)0x00 && service.tos <= (byte)0x3F ){
try{
//Add to the list of services
//un-ordered, naturally a short list
this.services.add(service);
//add to the storage source
Map<String, Object> serviceEntry = new HashMap<String,Object>();
serviceEntry.put(COLUMN_SID, Integer.toString(service.sid));
serviceEntry.put(COLUMN_SNAME, service.name);
serviceEntry.put(COLUMN_TOSBITS, Byte.toString(service.tos));
//ad to storage
storageSource.insertRow(TOS_TABLE_NAME, serviceEntry);
}catch(Exception e){
logger.debug("Error adding service, error: {}" ,e);
}
}
else{
logger.debug("Type of Service must be 0-64");
}
}
示例4: deleteService
import net.floodlightcontroller.qos.QoSTypeOfService; //导入依赖的package包/类
/**
* Removes a Network Type of Service
* @category by sid
*/
@Override
public synchronized void deleteService(int sid) {
Iterator<QoSTypeOfService> sIter = this.services.iterator();
while(sIter.hasNext()){
QoSTypeOfService s = sIter.next();
if(s.sid == sid){
sIter.remove();
break; //done only one can exist
}
}
}
示例5: startUp
import net.floodlightcontroller.qos.QoSTypeOfService; //导入依赖的package包/类
@Override
public void startUp(FloodlightModuleContext context) {
// initialize REST interface
restApi.addRestletRoutable(new QoSWebRoutable());
//listen to packet_in for applied QoS messages
floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
//Storage for policies
storageSource.createTable(TABLE_NAME, null);
storageSource.setTablePrimaryKeyName(TABLE_NAME, COLUMN_POLID);
//avoid thread issues for concurrency
synchronized (policies) {
this.policies = readPoliciesFromStorage();
}
//Storage for services
storageSource.createTable(TOS_TABLE_NAME, null);
storageSource.setTablePrimaryKeyName(TOS_TABLE_NAME, COLUMN_SID);
//avoid thread issues for concurrency
synchronized (services) {
this.services = readServicesFromStorage();
}
// create default "Best Effort" service
// most networks use this as default, adding here for defaulting
try{
QoSTypeOfService service = new QoSTypeOfService();
service.name = "Best Effort";
service.tos = (byte)0x00;
service.sid = service.genID();
this.addService(service);
}catch(Exception e){
logger.error("Error adding default Best Effort {}", e);
}
}
示例6: getServices
import net.floodlightcontroller.qos.QoSTypeOfService; //导入依赖的package包/类
/**
* Returns a list of services available for Network Type of Service
* @return List
*/
@Override
public List<QoSTypeOfService> getServices() {
return this.services;
}
示例7: startUp
import net.floodlightcontroller.qos.QoSTypeOfService; //导入依赖的package包/类
@Override
public void startUp(FloodlightModuleContext context) {
// initialize REST interface
restApi.addRestletRoutable(new QoSWebRoutable());
floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
//Storage for policies
storageSource.createTable(TABLE_NAME, null);
storageSource.setTablePrimaryKeyName(TABLE_NAME, COLUMN_POLID);
//avoid thread issues for concurrency
synchronized (policies) {
this.policies = readPoliciesFromStorage();
}
//Storage for services
storageSource.createTable(TOS_TABLE_NAME, null);
storageSource.setTablePrimaryKeyName(TOS_TABLE_NAME, COLUMN_SID);
//avoid thread issues for concurrency
synchronized (services) {
this.services = readServicesFromStorage();
}
// create default "Best Effort" service
// most networks use this as default, adding here for defaulting
try{
QoSTypeOfService service = new QoSTypeOfService();
service.name = "Best Effort";
service.tos = (byte)0x00;
service.sid = service.genID();
this.addService(service);
}catch(Exception e){
logger.error("Error adding default Best Effort {}", e);
}
enabled = true ;
// test
/* String qosJson = new String();
qosJson = "{\n \"ip-src\": \"10.0.0.1\",\n \"protocol\": \"6\",\n \"name\": \"Qoos.00:00:00:00:00:00:00:02\",\n \"ip-dst\": \"10.0.0.2\",\n \"queue\": \"2\",\n \"eth-type\": \"0x0800\"\n}\n"; // 設定Json
System.out.println(qosJson); // 印出
try{
QoSPolicy p = QoSPoliciesResource.jsonToPolicy(qosJson); // 轉
addPolicy(p);
}
catch (Exception e){
System.out.println("\n\n fail\n\n");
}
*/
}