本文整理匯總了Java中net.floodlightcontroller.qos.QoSTypeOfService.genID方法的典型用法代碼示例。如果您正苦於以下問題:Java QoSTypeOfService.genID方法的具體用法?Java QoSTypeOfService.genID怎麽用?Java QoSTypeOfService.genID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.floodlightcontroller.qos.QoSTypeOfService
的用法示例。
在下文中一共展示了QoSTypeOfService.genID方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
示例2: 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");
}
}
示例3: 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);
}
}
示例4: 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");
}
*/
}