本文整理汇总了Java中org.onosproject.net.flow.criteria.Criterion.type方法的典型用法代码示例。如果您正苦于以下问题:Java Criterion.type方法的具体用法?Java Criterion.type怎么用?Java Criterion.type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.flow.criteria.Criterion
的用法示例。
在下文中一共展示了Criterion.type方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cleanAllFlowRules
import org.onosproject.net.flow.criteria.Criterion; //导入方法依赖的package包/类
private void cleanAllFlowRules() {
Iterable<Device> deviceList = deviceService.getAvailableDevices();
for (Device d : deviceList) {
DeviceId id = d.id();
log.trace("Searching for flow rules to remove from: " + id);
for (FlowEntry r : flowRuleService.getFlowEntries(id)) {
boolean match = false;
for (Instruction i : r.treatment().allInstructions()) {
if (i.type() == Instruction.Type.OUTPUT) {
OutputInstruction oi = (OutputInstruction) i;
// if the flow has matching src and dst
for (Criterion cr : r.selector().criteria()) {
if (cr.type() == Criterion.Type.ETH_DST || cr.type() == Criterion.Type.ETH_SRC) {
match = true;
}
}
}
}
if (match) {
log.trace("Removed flow rule from device: " + id);
flowRuleService.removeFlowRules((FlowRule) r);
}
}
}
}
示例2: cleanFlowRules
import org.onosproject.net.flow.criteria.Criterion; //导入方法依赖的package包/类
private void cleanFlowRules(SrcDstPair pair, DeviceId id) {
log.trace("Searching for flow rules to remove from: " + id);
log.trace("Removing flows w/ SRC=" + pair.src + ", DST=" + pair.dst);
for (FlowEntry r : flowRuleService.getFlowEntries(id)) {
boolean matchesSrc = false, matchesDst = false;
for (Instruction i : r.treatment().allInstructions()) {
if (i.type() == Instruction.Type.OUTPUT) {
// if the flow has matching src and dst
for (Criterion cr : r.selector().criteria()) {
if (cr.type() == Criterion.Type.ETH_DST) {
if (((EthCriterion) cr).mac().equals(pair.dst)) {
matchesDst = true;
}
} else if (cr.type() == Criterion.Type.ETH_SRC) {
if (((EthCriterion) cr).mac().equals(pair.src)) {
matchesSrc = true;
}
}
}
}
}
if (matchesDst && matchesSrc) {
log.trace("Removed flow rule from device: " + id);
flowRuleService.removeFlowRules((FlowRule) r);
}
}
}
示例3: findSrcDstPairs
import org.onosproject.net.flow.criteria.Criterion; //导入方法依赖的package包/类
private Set<SrcDstPair> findSrcDstPairs(Set<FlowEntry> rules) {
ImmutableSet.Builder<SrcDstPair> builder = ImmutableSet.builder();
for (FlowEntry r : rules) {
MacAddress src = null, dst = null;
for (Criterion cr : r.selector().criteria()) {
if (cr.type() == Criterion.Type.ETH_DST) {
dst = ((EthCriterion) cr).mac();
} else if (cr.type() == Criterion.Type.ETH_SRC) {
src = ((EthCriterion) cr).mac();
}
}
builder.add(new SrcDstPair(src, dst));
}
return builder.build();
}
示例4: cleanConflictedFlowRules
import org.onosproject.net.flow.criteria.Criterion; //导入方法依赖的package包/类
private void cleanConflictedFlowRules() {
Iterable<Device> deviceList = deviceService.getAvailableDevices();
for (Device d : deviceList) {
DeviceId id = d.id();
log.trace("Searching for flow rules to remove from: " + id);
for (FlowEntry r : flowRuleService.getFlowEntries(id)) {
boolean match = false;
for (Instruction i : r.treatment().allInstructions()) {
if (i.type() == Instruction.Type.OUTPUT) {
OutputInstruction oi = (OutputInstruction) i;
// if the flow has matching src and dst
for (Criterion cr : r.selector().criteria()) {
if (cr.type() == Criterion.Type.ETH_DST || cr.type() == Criterion.Type.ETH_SRC) {
if (((EthCriterion) cr).mac().equals(gateway1.mac())) {
if (id.equals(DeviceId.deviceId("of:0000000000000004"))
|| id.equals(DeviceId.deviceId("of:0000000000000007"))
|| id.equals(DeviceId.deviceId("of:0000000000000002"))) {
match = true;
}
} else if (((EthCriterion) cr).mac().equals(gateway2.mac())) {
if (id.equals(DeviceId.deviceId("of:0000000000000005"))
|| id.equals(DeviceId.deviceId("of:0000000000000006"))
|| id.equals(DeviceId.deviceId("of:0000000000000003"))
|| id.equals(DeviceId.deviceId("of:0000000000000001"))) {
match = true;
}
}
}
}
}
}
if (match) {
log.trace("Removed flow rule from device: " + id);
flowRuleService.removeFlowRules((FlowRule) r);
}
}
}
}
示例5: cleanAllFlowRules
import org.onosproject.net.flow.criteria.Criterion; //导入方法依赖的package包/类
private void cleanAllFlowRules() {
Iterable<Device> deviceList = deviceService.getAvailableDevices();
for (Device d : deviceList) {
DeviceId id = d.id();
log.trace("Searching for flow rules to remove from: " + id);
for (FlowEntry r : flowRuleService.getFlowEntries(id)) {
boolean match = false;
for (Instruction i : r.treatment().allInstructions()) {
if (i.type() == Instruction.Type.OUTPUT) {
OutputInstruction oi = (OutputInstruction) i;
// if the flow has matching src and dst
for (Criterion cr : r.selector().criteria()) {
if (cr.type() == Criterion.Type.ETH_DST || cr.type() == Criterion.Type.ETH_SRC) {
match = true;
}
}
}
}
if (match) {
log.info("Removed flow rule from device: " + id);
flowRuleService.removeFlowRules((FlowRule) r);
}
}
}
}
示例6: cleanConflictedFlowRules
import org.onosproject.net.flow.criteria.Criterion; //导入方法依赖的package包/类
private void cleanConflictedFlowRules() {
Iterable<Device> deviceList = deviceService.getAvailableDevices();
for (Device d : deviceList) {
DeviceId id = d.id();
log.trace("Searching for flow rules to remove from: " + id);
for (FlowEntry r : flowRuleService.getFlowEntries(id)) {
boolean match = false;
for (Instruction i : r.treatment().allInstructions()) {
if (i.type() == Instruction.Type.OUTPUT) {
OutputInstruction oi = (OutputInstruction) i;
// if the flow has matching src and dst
for (Criterion cr : r.selector().criteria()) {
if (cr.type() == Criterion.Type.TCP_DST || cr.type() == Criterion.Type.TCP_SRC) {
int portNumber = ((TcpPortCriterion) cr).tcpPort().toInt();
if (portNumber == 20) {
match = true;
}
}
}
}
}
if (match) {
log.trace("Removed flow rule from device: " + id);
flowRuleService.removeFlowRules((FlowRule) r);
}
}
}
}
示例7: cleanupDevice
import org.onosproject.net.flow.criteria.Criterion; //导入方法依赖的package包/类
private Collection<? extends FlowRule> cleanupDevice(Device device, Host host) {
List<FlowRule> flowRules = Lists.newLinkedList();
MacAddress mac = host.mac();
for (FlowRule rule : flowRuleService.getFlowEntries(device.id())) {
for (Criterion c : rule.selector().criteria()) {
if (c.type() == Type.ETH_DST || c.type() == Type.ETH_SRC) {
EthCriterion eth = (EthCriterion) c;
if (eth.mac().equals(mac)) {
flowRules.add(rule);
}
}
}
}
return flowRules;
}
示例8: getCriterion
import org.onosproject.net.flow.criteria.Criterion; //导入方法依赖的package包/类
@Override
public Criterion getCriterion(Criterion.Type type) {
for (Criterion c : criteria) {
if (c.type() == type) {
return c;
}
}
return null;
}
示例9: add
import org.onosproject.net.flow.criteria.Criterion; //导入方法依赖的package包/类
@Override
public Builder add(Criterion criterion) {
if (criterion.type() == EXTENSION) {
extSelector.put(((ExtensionCriterion) criterion).extensionSelector().type(), criterion);
} else {
selector.put(criterion.type(), criterion);
}
return this;
}