本文整理汇总了Java中org.onosproject.net.flow.DefaultTrafficTreatment类的典型用法代码示例。如果您正苦于以下问题:Java DefaultTrafficTreatment类的具体用法?Java DefaultTrafficTreatment怎么用?Java DefaultTrafficTreatment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultTrafficTreatment类属于org.onosproject.net.flow包,在下文中一共展示了DefaultTrafficTreatment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: nextObjective
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
/**
* Tests adding a next objective.
*/
@Test
public void nextObjective() {
TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
NextObjective next =
DefaultNextObjective.builder()
.withId(manager.allocateNextId())
.addTreatment(treatment)
.withType(NextObjective.Type.BROADCAST)
.fromApp(NetTestTools.APP_ID)
.makePermanent()
.add();
manager.next(id1, next);
TestTools.assertAfter(RETRY_MS, () ->
assertThat(nextObjectives, hasSize(1)));
assertThat(forwardingObjectives, hasSize(0));
assertThat(filteringObjectives, hasSize(0));
assertThat(nextObjectives, hasItem("of:d1"));
}
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:FlowObjectiveManagerTest.java
示例2: populateRuleToGateway
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
private void populateRuleToGateway(Device d, Device gatewayDevice, long vni) {
TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
sBuilder.matchEthType(Ethernet.TYPE_IPV4)
.matchTunnelId(vni)
.matchEthDst(GATEWAYMAC);
tBuilder.extension(buildNiciraExtenstion(d.id(), config.nodes().get(gatewayDevice.id())), d.id())
.setOutput(getTunnelPort(d.id()));
ForwardingObjective fo = DefaultForwardingObjective.builder()
.withSelector(sBuilder.build())
.withTreatment(tBuilder.build())
.withFlag(ForwardingObjective.Flag.SPECIFIC)
.withPriority(ROUTING_RULE_PRIORITY)
.fromApp(appId)
.add();
flowObjectiveService.forward(d.id(), fo);
}
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:OpenstackRoutingRulePopulator.java
示例3: processVniTable
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
private void processVniTable(boolean install) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
treatment.transition(FORWARDING_TABLE);
FlowRule flowRule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(DROP_PRIORITY)
.fromApp(appId)
.makePermanent()
.forTable(VNI_TABLE)
.build();
applyRules(install, flowRule);
}
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:OpenstackPipeline.java
示例4: processForwardingTable
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
private void processForwardingTable(boolean install) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
treatment.drop();
FlowRule flowRule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(DROP_PRIORITY)
.fromApp(appId)
.makePermanent()
.forTable(FORWARDING_TABLE)
.build();
applyRules(install, flowRule);
}
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:OpenstackPipeline.java
示例5: processEthDstOnlyFilter
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
protected List<FlowRule> processEthDstOnlyFilter(EthCriterion ethCriterion,
ApplicationId applicationId) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
selector.matchEthType(Ethernet.TYPE_IPV4);
selector.matchEthDst(ethCriterion.mac());
treatment.transition(UNICAST_ROUTING_TABLE);
FlowRule rule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(DEFAULT_PRIORITY)
.fromApp(applicationId)
.makePermanent()
.forTable(TMAC_TABLE).build();
return ImmutableList.<FlowRule>builder().add(rule).build();
}
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:Ofdpa2Pipeline.java
示例6: populateL3RulestoSameNode
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
private void populateL3RulestoSameNode(Ip4Address vmIp, OpenstackPort p, Port port, Device device, long vni) {
TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
sBuilder.matchEthType(Ethernet.TYPE_IPV4)
.matchIPDst(vmIp.toIpPrefix())
.matchTunnelId(vni);
tBuilder.setEthDst(p.macAddress())
.setOutput(port.number());
ForwardingObjective fo = DefaultForwardingObjective.builder()
.withSelector(sBuilder.build())
.withTreatment(tBuilder.build())
.withPriority(ROUTING_RULE_PRIORITY)
.withFlag(ForwardingObjective.Flag.SPECIFIC)
.fromApp(appId)
.add();
flowObjectiveService.forward(device.id(), fo);
}
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:OpenstackRoutingRulePopulator.java
示例7: reassemblyFlowRule
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
private Collection<FlowRule> reassemblyFlowRule(FlowRule.Builder ruleBuilder,
TrafficTreatment tb,
Integer transition,
Integer forTable) {
if (transition != null) {
TrafficTreatment.Builder newTraffic = DefaultTrafficTreatment
.builder();
tb.allInstructions().forEach(t -> newTraffic.add(t));
newTraffic.transition(transition);
ruleBuilder.withTreatment(newTraffic.build());
} else {
ruleBuilder.withTreatment(tb);
}
if (forTable != null) {
ruleBuilder.forTable(forTable);
}
return Collections.singletonList(ruleBuilder.build());
}
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:OpenVSwitchPipeline.java
示例8: processEthDstOnlyFilter
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
protected List<FlowRule> processEthDstOnlyFilter(EthCriterion ethCriterion,
ApplicationId applicationId, int priority) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
selector.matchEthType(Ethernet.TYPE_IPV4);
selector.matchEthDst(ethCriterion.mac());
treatment.transition(TABLE_IPV4_UNICAST);
FlowRule rule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(priority)
.fromApp(applicationId)
.makePermanent()
.forTable(TABLE_TMAC).build();
return ImmutableList.<FlowRule>builder().add(rule).build();
}
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:SpringOpenTTP.java
示例9: setVxLanFlowRule
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
/**
* Sets the flow rules between traffic from VMs in different Cnode.
*
* @param vni VNI
* @param deviceId device ID
* @param hostIp host IP of the VM
* @param vmIp fixed IP of the VM
*/
private void setVxLanFlowRule(String vni, DeviceId deviceId, Ip4Address hostIp,
Ip4Address vmIp) {
TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
sBuilder.matchEthType(Ethernet.TYPE_IPV4)
.matchTunnelId(Long.parseLong(vni))
.matchIPDst(vmIp.toIpPrefix());
tBuilder.extension(buildNiciraExtenstion(deviceId, hostIp), deviceId)
.setOutput(getTunnelPort(deviceId));
ForwardingObjective fo = DefaultForwardingObjective.builder()
.withSelector(sBuilder.build())
.withTreatment(tBuilder.build())
.withPriority(SWITCHING_RULE_PRIORITY)
.withFlag(ForwardingObjective.Flag.SPECIFIC)
.fromApp(appId)
.add();
flowObjectiveService.forward(deviceId, fo);
}
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:OpenstackSwitchingRulePopulator.java
示例10: removeFlowRuleForTunnelTag
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
/**
* Removes flow rules for tagging tunnelId.
*
* @param deviceId device id
* @param portNumber port number
*/
private void removeFlowRuleForTunnelTag(DeviceId deviceId, PortNumber portNumber) {
TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
sBuilder.matchEthType(Ethernet.TYPE_IPV4)
.matchInPort(portNumber);
ForwardingObjective fo = DefaultForwardingObjective.builder()
.withSelector(sBuilder.build())
.withTreatment(tBuilder.build())
.withPriority(TUNNELTAG_RULE_PRIORITY)
.withFlag(ForwardingObjective.Flag.SPECIFIC)
.fromApp(appId)
.remove();
flowObjectiveService.forward(deviceId, fo);
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:OpenstackSwitchingRulePopulator.java
示例11: ingressFlow
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
private FlowRule ingressFlow(PortNumber inPort, Link link,
MplsPathIntent intent,
MplsLabel label) {
TrafficSelector.Builder ingressSelector = DefaultTrafficSelector
.builder(intent.selector());
TrafficTreatment.Builder treat = DefaultTrafficTreatment.builder();
ingressSelector.matchInPort(inPort);
if (intent.ingressLabel().isPresent()) {
ingressSelector.matchEthType(Ethernet.MPLS_UNICAST)
.matchMplsLabel(intent.ingressLabel().get());
// Swap the MPLS label
treat.setMpls(label);
} else {
// Push and set the MPLS label
treat.pushMpls().setMpls(label);
}
// Add the output action
treat.setOutput(link.src().port());
return createFlowRule(intent, link.src().deviceId(), ingressSelector.build(), treat.build());
}
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:MplsPathIntentCompiler.java
示例12: buildBrcIntent
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
/**
* Builds a Single Point to Multi Point intent.
*
* @param key The intent key
* @param src The source Connect Point
* @param dsts The destination Connect Points
* @return Single Point to Multi Point intent generated.
*/
private SinglePointToMultiPointIntent buildBrcIntent(Key key,
ConnectPoint src,
Set<ConnectPoint> dsts,
VlanId vlanId) {
SinglePointToMultiPointIntent intent;
TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthDst(MacAddress.BROADCAST)
.matchVlanId(vlanId)
.build();
intent = SinglePointToMultiPointIntent.builder()
.appId(APPID)
.key(key)
.selector(selector)
.treatment(treatment)
.ingressPoint(src)
.egressPoints(dsts)
.priority(PRIORITY_OFFSET)
.build();
return intent;
}
开发者ID:shlee89,项目名称:athena,代码行数:33,代码来源:VplsTest.java
示例13: processTableMissDrop
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
protected void processTableMissDrop(boolean install, int table, String description) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
treatment.drop();
FlowRule rule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(DROP_PRIORITY)
.fromApp(appId)
.makePermanent()
.forTable(table).build();
processFlowRule(install, rule, description);
}
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:AbstractCorsaPipeline.java
示例14: programArpClassifierRules
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
@Override
public void programArpClassifierRules(DeviceId deviceId, IpAddress dstIp,
SegmentationId actionVni,
Objective.Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthType(ETH_TYPE.ethType().toShort())
.matchArpTpa(Ip4Address.valueOf(dstIp.toString()))
.build();
TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.setTunnelId(Long.parseLong(actionVni.segmentationId()))
.build();
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment).withSelector(selector)
.fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(ARP_CLASSIFIER_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
log.debug("ArpClassifierRules-->ADD");
flowObjectiveService.forward(deviceId, objective.add());
} else {
log.debug("ArpClassifierRules-->REMOVE");
flowObjectiveService.forward(deviceId, objective.remove());
}
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:ClassifierServiceImpl.java
示例15: processVlanFiler
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
@Override
protected FlowRule.Builder processVlanFiler(FilteringObjective filt, VlanIdCriterion vlan, PortCriterion port) {
log.debug("adding rule for VLAN: {}", vlan.vlanId());
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
selector.matchVlanId(vlan.vlanId());
selector.matchInPort(port.port());
treatment.transition(ETHER_TABLE);
treatment.deferred().popVlan();
return DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(CONTROLLER_PRIORITY)
.makePermanent()
.forTable(VLAN_TABLE);
}
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:OvsCorsaPipeline.java
示例16: processMacTable
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
private void processMacTable(boolean install) {
TrafficSelector.Builder selector;
TrafficTreatment.Builder treatment;
// Bcast rule
selector = DefaultTrafficSelector.builder();
treatment = DefaultTrafficTreatment.builder();
selector.matchEthDst(MacAddress.BROADCAST);
treatment.transition(VLAN_MPLS_TABLE);
FlowRule rule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(CONTROLLER_PRIORITY)
.fromApp(appId)
.makePermanent()
.forTable(MAC_TABLE).build();
processFlowRule(true, rule, "Provisioned mac table transition");
//Drop rule
processTableMissDrop(true, MAC_TABLE, "Provisioned mac table drop action");
}
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:OvsCorsaPipeline.java
示例17: processVlanMplsTable
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
protected void processVlanMplsTable(boolean install) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment
.builder();
FlowRuleOperations.Builder ops = FlowRuleOperations.builder();
FlowRule rule;
selector.matchVlanId(VlanId.ANY);
treatment.transition(VLAN_TABLE);
rule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(CONTROLLER_PRIORITY)
.fromApp(appId)
.makePermanent()
.forTable(VLAN_MPLS_TABLE).build();
processFlowRule(true, rule, "Provisioned vlan/mpls table");
}
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:OvsCorsaPipeline.java
示例18: processCosTable
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
private void processCosTable(boolean install) {
TrafficTreatment.Builder treatment = DefaultTrafficTreatment
.builder()
.transition(FIB_TABLE);
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
FlowRule rule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(DROP_PRIORITY)
.fromApp(appId)
.makePermanent()
.forTable(COS_MAP_TABLE).build();
processFlowRule(true, rule, "Provisioned cos table");
}
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:OvsCorsaPipeline.java
示例19: processLocalTable
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
private void processLocalTable(boolean install) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment
.builder()
.punt();
FlowRule rule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(CONTROLLER_PRIORITY)
.fromApp(appId)
.makePermanent()
.forTable(LOCAL_TABLE).build();
processFlowRule(true, rule, "Provisioned Local table");
}
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:OvsCorsaPipeline.java
示例20: processNextTreatment
import org.onosproject.net.flow.DefaultTrafficTreatment; //导入依赖的package包/类
@Override
protected TrafficTreatment processNextTreatment(TrafficTreatment treatment) {
TrafficTreatment.Builder tb = DefaultTrafficTreatment.builder();
treatment.immediate().stream()
.filter(i -> {
switch (i.type()) {
case L2MODIFICATION:
L2ModificationInstruction l2i = (L2ModificationInstruction) i;
if (l2i instanceof L2ModificationInstruction.ModVlanIdInstruction ||
l2i instanceof L2ModificationInstruction.ModEtherInstruction) {
return true;
}
case OUTPUT:
return true;
default:
return false;
}
}).forEach(i -> tb.add(i));
return tb.build();
}
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:CorsaPipelineV3.java
注:本文中的org.onosproject.net.flow.DefaultTrafficTreatment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论