本文整理汇总了Java中org.onosproject.net.flow.DefaultTrafficSelector类的典型用法代码示例。如果您正苦于以下问题:Java DefaultTrafficSelector类的具体用法?Java DefaultTrafficSelector怎么用?Java DefaultTrafficSelector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultTrafficSelector类属于org.onosproject.net.flow包,在下文中一共展示了DefaultTrafficSelector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupMockFlowRules
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
/**
* Populates some flow rules used as testing data.
*/
private void setupMockFlowRules() {
flowRule2.treatment = DefaultTrafficTreatment.builder()
.setEthDst(MacAddress.BROADCAST)
.build();
flowRule2.selector = DefaultTrafficSelector.builder()
.matchEthType((short) 3)
.matchIPProtocol((byte) 9)
.build();
flowRule4.treatment = DefaultTrafficTreatment.builder()
.build();
flowRules.add(flowRule1);
flowRules.add(flowRule2);
flowRules.add(flowRule3);
flowRules.add(flowRule4);
}
示例2: removeL3Rules
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
/**
* Removes L3 rules for routerInterface events.
*
* @param vmIp Corresponding Vm ip
* @param routerInterfaces Corresponding routerInterfaces
*/
public void removeL3Rules(Ip4Address vmIp, List<OpenstackRouterInterface> routerInterfaces) {
if (vmIp == null) {
return;
}
OpenstackRoutingService routingService = getService(OpenstackRoutingService.class);
deviceService.getAvailableDevices().forEach(d -> {
if (!d.equals(getGatewayNode())) {
routerInterfaces.forEach(routerInterface -> {
String networkId = routingService.networkIdForRouterInterface(routerInterface.portId());
long vni = getVni(networkId);
TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();
sBuilder.matchEthType(Ethernet.TYPE_IPV4)
.matchIPDst(vmIp.toIpPrefix())
.matchTunnelId(vni);
removeRule(d.id(), sBuilder, ForwardingObjective.Flag.SPECIFIC, ROUTING_RULE_PRIORITY);
});
}
});
}
示例3: fwdObjBuilder
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
/**
* Creates a forwarding objective builder for multicast.
*
* @param mcastIp multicast group
* @param assignedVlan assigned VLAN ID
* @param nextId next ID of the L3 multicast group
* @return forwarding objective builder
*/
private ForwardingObjective.Builder fwdObjBuilder(IpAddress mcastIp,
VlanId assignedVlan, int nextId) {
TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
IpPrefix mcastPrefix = IpPrefix.valueOf(mcastIp, IpPrefix.MAX_INET_MASK_LENGTH);
sbuilder.matchEthType(Ethernet.TYPE_IPV4);
sbuilder.matchIPDst(mcastPrefix);
TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder();
metabuilder.matchVlanId(assignedVlan);
ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective.builder();
fwdBuilder.withSelector(sbuilder.build())
.withMeta(metabuilder.build())
.nextStep(nextId)
.withFlag(ForwardingObjective.Flag.SPECIFIC)
.fromApp(srManager.appId)
.withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
return fwdBuilder;
}
示例4: processAclTable
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
private void processAclTable(boolean install) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
treatment.wipeDeferred();
treatment.drop();
FlowRule flowRule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(DROP_PRIORITY)
.fromApp(appId)
.makePermanent()
.forTable(ACL_TABLE)
.build();
applyRules(install, flowRule);
}
示例5: processEthDstOnlyFilter
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的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();
}
示例6: processMcastEthDstFilter
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
protected List<FlowRule> processMcastEthDstFilter(EthCriterion ethCriterion,
ApplicationId applicationId) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
selector.matchEthType(Ethernet.TYPE_IPV4);
selector.matchEthDstMasked(ethCriterion.mac(), ethCriterion.mask());
treatment.transition(MULTICAST_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();
}
示例7: ingressFlow
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的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());
}
示例8: populateTableMissEntry
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
protected void populateTableMissEntry(int tableToAdd,
boolean toControllerNow,
boolean toControllerWrite,
boolean toTable, int tableToSend) {
TrafficSelector selector = DefaultTrafficSelector.builder().build();
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
if (toControllerNow) {
tBuilder.setOutput(PortNumber.CONTROLLER);
}
if (toControllerWrite) {
tBuilder.deferred().setOutput(PortNumber.CONTROLLER);
}
if (toTable) {
tBuilder.transition(tableToSend);
}
FlowRule flow = DefaultFlowRule.builder().forDevice(deviceId)
.withSelector(selector).withTreatment(tBuilder.build())
.withPriority(0).fromApp(appId).makePermanent()
.forTable(tableToAdd).build();
flowRuleService.applyFlowRules(flow);
}
示例9: setFlowRuleForTunnelTag
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
private void setFlowRuleForTunnelTag(DeviceId deviceId, Port port, String vni) {
TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
sBuilder.matchEthType(Ethernet.TYPE_IPV4)
.matchInPort(port.number());
tBuilder.setTunnelId(Long.parseLong(vni));
ForwardingObjective fo = DefaultForwardingObjective.builder()
.withSelector(sBuilder.build())
.withTreatment(tBuilder.build())
.withPriority(TUNNELTAG_RULE_PRIORITY)
.withFlag(ForwardingObjective.Flag.SPECIFIC)
.fromApp(appId)
.add();
flowObjectiveService.forward(deviceId, fo);
}
示例10: processTableMissDrop
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的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);
}
示例11: processVlanFiler
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的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);
}
示例12: fwdObjBuilder
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的package包/类
/**
* Creates a forwarding objective builder for XConnect.
*
* @param key XConnect key
* @param nextId next ID of the broadcast group for this XConnect key
* @return next objective builder
*/
private ForwardingObjective.Builder fwdObjBuilder(XConnectStoreKey key, int nextId) {
/*
* Driver should treat objectives with MacAddress.NONE and !VlanId.NONE
* as the VLAN cross-connect broadcast rules
*/
TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
sbuilder.matchVlanId(key.vlanId());
sbuilder.matchEthDst(MacAddress.NONE);
ForwardingObjective.Builder fob = DefaultForwardingObjective.builder();
fob.withFlag(ForwardingObjective.Flag.SPECIFIC)
.withSelector(sbuilder.build())
.nextStep(nextId)
.withPriority(SegmentRoutingService.XCONNECT_PRIORITY)
.fromApp(srManager.appId)
.makePermanent();
return fob;
}
示例13: processVlanMplsTable
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的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");
}
示例14: processCosTable
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的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");
}
示例15: processLocalTable
import org.onosproject.net.flow.DefaultTrafficSelector; //导入依赖的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");
}