本文整理汇总了Java中net.floodlightcontroller.util.MatchUtils类的典型用法代码示例。如果您正苦于以下问题:Java MatchUtils类的具体用法?Java MatchUtils怎么用?Java MatchUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MatchUtils类属于net.floodlightcontroller.util包,在下文中一共展示了MatchUtils类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addFlow
import net.floodlightcontroller.util.MatchUtils; //导入依赖的package包/类
public void addFlow(String dpid,Match match,List<OFAction> actions,boolean doflush){
DatapathId swId=DatapathId.of(dpid);
IOFSwitch sw=switchService.getSwitch(swId);
OFFlowMod.Builder fmb = sw.getOFFactory().buildFlowModify();
Match.Builder mb = MatchUtils.createRetentiveBuilder(match);
fmb.setMatch(mb.build())
.setActions(actions)
.setIdleTimeout(FLOWMOD_DEFAULT_IDLE_TIMEOUT)
.setHardTimeout(FLOWMOD_DEFAULT_HARD_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setPriority(FLOWMOD_DEFAULT_PRIORITY);
if(doflush){
sw.flush();
sw.write(fmb.build());
sw.flush();
}
else{
sw.write(fmb.build());
}
}
示例2: checkActions
import net.floodlightcontroller.util.MatchUtils; //导入依赖的package包/类
/**
* Validates actions/instructions
*
* -1 --> IPv4/IPv6 conflict
* 0 --> no IPv4 or IPv6 actions
* 1 --> IPv4 only actions
* 2 --> IPv6 only actions
*
* @param Map containing the fields of the flow
* @return state indicating whether a flow is valid or not
*/
public static int checkActions(Map<String, Object> entry) {
boolean ip6 = false;
boolean ip4 = false;
String actions = null;
if (entry.containsKey(StaticFlowEntryPusher.COLUMN_ACTIONS) ||
entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS) ||
entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS)) {
if (entry.containsKey(StaticFlowEntryPusher.COLUMN_ACTIONS)) {
actions = (String) entry.get(StaticFlowEntryPusher.COLUMN_ACTIONS);
}
else if (entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS)) {
actions = (String) entry.get(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS);
}
else if (entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS)) {
actions = (String) entry.get(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS);
}
if (actions.contains(MatchUtils.STR_ICMPV6_CODE) || actions.contains(MatchUtils.STR_ICMPV6_TYPE) ||
actions.contains(MatchUtils.STR_IPV6_DST) || actions.contains(MatchUtils.STR_IPV6_SRC) ||
actions.contains(MatchUtils.STR_IPV6_FLOW_LABEL) || actions.contains(MatchUtils.STR_IPV6_ND_SSL) ||
actions.contains(MatchUtils.STR_IPV6_ND_TARGET) || actions.contains(MatchUtils.STR_IPV6_ND_TTL)) {
ip6 = true;
}
if (actions.contains(MatchUtils.STR_NW_SRC) || actions.contains(MatchUtils.STR_NW_DST) ||
actions.contains(MatchUtils.STR_ARP_OPCODE) || actions.contains(MatchUtils.STR_ARP_SHA) ||
actions.contains(MatchUtils.STR_ARP_DHA) || actions.contains(MatchUtils.STR_ARP_SPA) ||
actions.contains(MatchUtils.STR_ARP_DPA) || actions.contains(MatchUtils.STR_ICMP_CODE) ||
actions.contains(MatchUtils.STR_ICMP_TYPE)) {
ip4 = true;
}
}
if (ip6 == false && ip4 == false) {
return 0; // no actions involving ipv4 or ipv6
} else if (ip6 == false && ip4 == true) {
return 1; //ipv4
} else if (ip6 == true && ip4 == false) {
return 2; //ipv6
} else {
return -1; // conflict of ipv4 and ipv6 actions
}
}
示例3: checkActions
import net.floodlightcontroller.util.MatchUtils; //导入依赖的package包/类
/**
* Validates actions/instructions
*
* -1 --> IPv4/IPv6 conflict
* 0 --> no IPv4 or IPv6 actions
* 1 --> IPv4 only actions
* 2 --> IPv6 only actions
*
* @param Map containing the fields of the flow
* @return state indicating whether a flow is valid or not
*/
public static int checkActions(Map<String, Object> entry) {
boolean ip6 = false;
boolean ip4 = false;
String actions = null;
if (entry.containsKey(StaticFlowEntryPusher.COLUMN_ACTIONS) ||
entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS) ||
entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS)) {
if (entry.containsKey(StaticFlowEntryPusher.COLUMN_ACTIONS)) {
actions = (String) entry.get(StaticFlowEntryPusher.COLUMN_ACTIONS);
}
else if (entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS)) {
actions = (String) entry.get(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS);
}
else if (entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS)) {
actions = (String) entry.get(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS);
}
if (actions.contains(MatchUtils.STR_ICMPV6_CODE) || actions.contains(MatchUtils.STR_ICMPV6_TYPE) ||
actions.contains(MatchUtils.STR_IPV6_DST) || actions.contains(MatchUtils.STR_IPV6_SRC) ||
actions.contains(MatchUtils.STR_IPV6_FLOW_LABEL) || actions.contains(MatchUtils.STR_IPV6_ND_SSL) ||
actions.contains(MatchUtils.STR_IPV6_ND_TARGET) || actions.contains(MatchUtils.STR_IPV6_ND_TTL)) {
ip6 = true;
}
if (actions.contains(MatchUtils.STR_NW_SRC) || actions.contains(MatchUtils.STR_NW_DST) ||
actions.contains(MatchUtils.STR_ARP_OPCODE) || actions.contains(MatchUtils.STR_ARP_SHA) ||
actions.contains(MatchUtils.STR_ARP_DHA) || actions.contains(MatchUtils.STR_ARP_SPA) ||
actions.contains(MatchUtils.STR_ARP_DPA) || actions.contains(MatchUtils.STR_ICMP_CODE) ||
actions.contains(MatchUtils.STR_ICMP_TYPE)) {
ip4 = true;
}
}
if (ip6 == false && ip4 == false) {
return 0; // no actions involving ipv4 or ipv6
} else if (ip6 == false && ip4 == true) {
return 1; //ipv4
} else if (ip6 == true && ip4 == false) {
return 2; //ipv6
} else {
return -1; // conflict of ipv4 and ipv6 actions
}
}
示例4: checkActions
import net.floodlightcontroller.util.MatchUtils; //导入依赖的package包/类
public static int checkActions(Map<String, Object> entry) {
boolean ip6 = false;
boolean ip4 = false;
String actions = null;
if (entry.containsKey(StaticFlowEntryPusher.COLUMN_ACTIONS) ||
entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS) ||
entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS)) {
if (entry.containsKey(StaticFlowEntryPusher.COLUMN_ACTIONS)) {
actions = (String) entry.get(StaticFlowEntryPusher.COLUMN_ACTIONS);
}
else if (entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS)) {
actions = (String) entry.get(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS);
}
else if (entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS)) {
actions = (String) entry.get(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS);
}
if (actions.contains(MatchUtils.STR_ICMPV6_CODE) || actions.contains(MatchUtils.STR_ICMPV6_TYPE) ||
actions.contains(MatchUtils.STR_IPV6_DST) || actions.contains(MatchUtils.STR_IPV6_SRC) ||
actions.contains(MatchUtils.STR_IPV6_FLOW_LABEL) || actions.contains(MatchUtils.STR_IPV6_ND_SSL) ||
actions.contains(MatchUtils.STR_IPV6_ND_TARGET) || actions.contains(MatchUtils.STR_IPV6_ND_TTL)) {
ip6 = true;
}
if (actions.contains(MatchUtils.STR_NW_SRC) || actions.contains(MatchUtils.STR_NW_DST) ||
actions.contains(MatchUtils.STR_ARP_OPCODE) || actions.contains(MatchUtils.STR_ARP_SHA) ||
actions.contains(MatchUtils.STR_ARP_DHA) || actions.contains(MatchUtils.STR_ARP_SPA) ||
actions.contains(MatchUtils.STR_ARP_DPA) || actions.contains(MatchUtils.STR_ICMP_CODE) ||
actions.contains(MatchUtils.STR_ICMP_TYPE)) {
ip4 = true;
}
}
if (ip6 == false && ip4 == false) {
return 0; // no actions involving ipv4 or ipv6
} else if (ip6 == false && ip4 == true) {
return 1; //ipv4
} else if (ip6 == true && ip4 == false) {
return 2; //ipv6
} else {
return -1; // conflict of ipv4 and ipv6 actions
}
}