本文整理汇总了Java中org.openflow.protocol.OFFlowMod.getPriority方法的典型用法代码示例。如果您正苦于以下问题:Java OFFlowMod.getPriority方法的具体用法?Java OFFlowMod.getPriority怎么用?Java OFFlowMod.getPriority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openflow.protocol.OFFlowMod
的用法示例。
在下文中一共展示了OFFlowMod.getPriority方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: OVXFlowMod
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
public OVXFlowMod(final OFFlowMod fm) {
super();
this.match = fm.getMatch();
this.cookie = fm.getCookie();
this.command = fm.getCommand();
this.idleTimeout = fm.getIdleTimeout();
this.hardTimeout = fm.getHardTimeout();
this.priority = fm.getPriority();
this.bufferId = fm.getBufferId();
this.outPort = fm.getOutPort();
this.flags = fm.getFlags();
this.actions = fm.getActions();
// Start with this in childrenFlowMods.
this.childrenFlowMods.add(this);
this.log.info("Hi, I'm a new OVXFlowMod: " + toString());
}
示例2: OFFlowTableEntry
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
/**
* Constructor
*
* @param flow_mod to read fields
*/
public OFFlowTableEntry(OFFlowMod flow_mod) {
this.nanoTime = System.nanoTime();
this.actionList = new ArrayList<>(flow_mod.getActions());
this.priority = flow_mod.getPriority();
this.hardTimeOut = flow_mod.getHardTimeout();
this.idleTimeOut = flow_mod.getIdleTimeout();
this.cookie = flow_mod.getCookie();
this.byteCount = 0;
this.packetCount = 0;
this.flowCount = 0;
this.notifyOnDelete = flow_mod.getFlags() == OFFlowMod.OFPFF_SEND_FLOW_REM;
}
示例3: rowsModified
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
@Override
public void rowsModified(String tableName, Set<Object> rowKeys) {
// This handles both rowInsert() and rowUpdate()
log.debug("Modifying Table {}", tableName);
HashMap<String, Map<String, OFFlowMod>> entriesToAdd =
new HashMap<String, Map<String, OFFlowMod>>();
// build up list of what was added
for (Object key: rowKeys) {
IResultSet resultSet = storageSource.getRow(tableName, key);
Iterator<IResultSet> it = resultSet.iterator();
while (it.hasNext()) {
Map<String, Object> row = it.next().getRow();
parseRow(row, entriesToAdd);
}
}
// batch updates by switch and blast them out
for (String dpid : entriesToAdd.keySet()) {
if (!entriesFromStorage.containsKey(dpid))
entriesFromStorage.put(dpid, new HashMap<String, OFFlowMod>());
List<OFMessage> outQueue = new ArrayList<OFMessage>();
for(String entry : entriesToAdd.get(dpid).keySet()) {
OFFlowMod newFlowMod = entriesToAdd.get(dpid).get(entry);
//OFFlowMod oldFlowMod = entriesFromStorage.get(dpid).get(entry);
OFFlowMod oldFlowMod = null;
String dpidOldFlowMod = entry2dpid.get(entry);
if (dpidOldFlowMod != null) {
oldFlowMod = entriesFromStorage.get(dpidOldFlowMod).remove(entry);
}
if (oldFlowMod != null && newFlowMod != null) {
// set the new flow mod to modify a pre-existing rule if these fields match
if(oldFlowMod.getMatch().equals(newFlowMod.getMatch())
&& oldFlowMod.getCookie() == newFlowMod.getCookie()
&& oldFlowMod.getPriority() == newFlowMod.getPriority()){
newFlowMod.setCommand(OFFlowMod.OFPFC_MODIFY_STRICT);
// if they don't match delete the old flow
} else{
oldFlowMod.setCommand(OFFlowMod.OFPFC_DELETE_STRICT);
if (dpidOldFlowMod.equals(dpid)) {
outQueue.add(oldFlowMod);
} else {
writeOFMessageToSwitch(HexString.toLong(dpidOldFlowMod), oldFlowMod);
}
}
}
// write the new flow
if (newFlowMod != null) {
entriesFromStorage.get(dpid).put(entry, newFlowMod);
outQueue.add(newFlowMod);
entry2dpid.put(entry, dpid);
} else {
entriesFromStorage.get(dpid).remove(entry);
entry2dpid.remove(entry);
}
}
writeOFMessagesToSwitch(HexString.toLong(dpid), outQueue);
}
}
示例4: rowsModified
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
@Override
public void rowsModified(String tableName, Set<Object> rowKeys) {
// This handles both rowInsert() and rowUpdate()
log.debug("Modifying Table {}", tableName);
HashMap<String, Map<String, OFFlowMod>> entriesToAdd =
new HashMap<String, Map<String, OFFlowMod>>();
// build up list of what was added
for (Object key: rowKeys) {
IResultSet resultSet = storageSource.getRow(tableName, key);
Iterator<IResultSet> it = resultSet.iterator();
while (it.hasNext()) {
Map<String, Object> row = it.next().getRow();
parseRow(row, entriesToAdd);
}
}
// batch updates by switch and blast them out
for (String dpid : entriesToAdd.keySet()) {
if (!entriesFromStorage.containsKey(dpid))
entriesFromStorage.put(dpid, new HashMap<String, OFFlowMod>());
List<OFMessage> outQueue = new ArrayList<OFMessage>();
for(String entry : entriesToAdd.get(dpid).keySet()) {
OFFlowMod newFlowMod = entriesToAdd.get(dpid).get(entry);
//OFFlowMod oldFlowMod = entriesFromStorage.get(dpid).get(entry);
OFFlowMod oldFlowMod = null;
String dpidOldFlowMod = entry2dpid.get(entry);
if (dpidOldFlowMod != null) {
oldFlowMod = entriesFromStorage.get(dpidOldFlowMod).remove(entry);
}
if (oldFlowMod != null && newFlowMod != null) {
// set the new flow mod to modify a pre-existing rule if these fields match
if(oldFlowMod.getMatch().equals(newFlowMod.getMatch())
&& oldFlowMod.getCookie() == newFlowMod.getCookie()
&& oldFlowMod.getPriority() == newFlowMod.getPriority()){
newFlowMod.setCommand(OFFlowMod.OFPFC_MODIFY_STRICT);
// if they don't match delete the old flow
} else{
oldFlowMod.setCommand(OFFlowMod.OFPFC_DELETE_STRICT);
if (dpidOldFlowMod.equals(dpid)) {
outQueue.add(oldFlowMod);
} else {
writeOFMessageToSwitch(HexString.toLong(dpidOldFlowMod), oldFlowMod);
}
}
}
// write the new flow
if (newFlowMod != null) {
entriesFromStorage.get(dpid).put(entry, newFlowMod);
outQueue.add(newFlowMod);
entry2dpid.put(entry, dpid);
} else {
entriesFromStorage.get(dpid).remove(entry);
entry2dpid.remove(entry);
}
}
writeOFMessagesToSwitch(HexString.toLong(dpid), outQueue);
}
}