本文整理汇总了Java中org.onosproject.net.flow.criteria.Criteria类的典型用法代码示例。如果您正苦于以下问题:Java Criteria类的具体用法?Java Criteria怎么用?Java Criteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Criteria类属于org.onosproject.net.flow.criteria包,在下文中一共展示了Criteria类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createFilteringObjective
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
private void createFilteringObjective(boolean install, Interface intf) {
VlanId assignedVlan = (egressVlan().equals(VlanId.NONE)) ?
VlanId.vlanId(ASSIGNED_VLAN) :
egressVlan();
FilteringObjective.Builder fob = DefaultFilteringObjective.builder();
// first add filter for the interface
fob.withKey(Criteria.matchInPort(intf.connectPoint().port()))
.addCondition(Criteria.matchEthDst(intf.mac()))
.addCondition(Criteria.matchVlanId(intf.vlan()));
fob.withPriority(PRIORITY_OFFSET);
if (intf.vlan() == VlanId.NONE) {
TrafficTreatment tt = DefaultTrafficTreatment.builder()
.pushVlan().setVlanId(assignedVlan).build();
fob.withMeta(tt);
}
fob.permit().fromApp(routerAppId);
sendFilteringObjective(install, fob, intf);
if (controlPlaneConnectPoint != null) {
// then add the same mac/vlan filters for control-plane connect point
fob.withKey(Criteria.matchInPort(controlPlaneConnectPoint.port()));
sendFilteringObjective(install, fob, intf);
}
}
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:SingleSwitchFibInstaller.java
示例2: createMcastFilteringObjective
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
private void createMcastFilteringObjective(boolean install, Interface intf) {
VlanId assignedVlan = (egressVlan().equals(VlanId.NONE)) ?
VlanId.vlanId(ASSIGNED_VLAN) :
egressVlan();
FilteringObjective.Builder fob = DefaultFilteringObjective.builder();
// first add filter for the interface
fob.withKey(Criteria.matchInPort(intf.connectPoint().port()))
.addCondition(Criteria.matchEthDstMasked(MacAddress.IPV4_MULTICAST,
MacAddress.IPV4_MULTICAST_MASK))
.addCondition(Criteria.matchVlanId(ingressVlan()));
fob.withPriority(PRIORITY_OFFSET);
TrafficTreatment tt = DefaultTrafficTreatment.builder()
.pushVlan().setVlanId(assignedVlan).build();
fob.withMeta(tt);
fob.permit().fromApp(routerAppId);
sendFilteringObjective(install, fob, intf);
}
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:SingleSwitchFibInstaller.java
示例3: matchIPv6ExthdrFlagsTest
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests IPv6 Extension Header pseudo-field flags criterion.
*/
@Test
public void matchIPv6ExthdrFlagsTest() {
int exthdrFlags =
Criterion.IPv6ExthdrFlags.NONEXT.getValue() |
Criterion.IPv6ExthdrFlags.ESP.getValue() |
Criterion.IPv6ExthdrFlags.AUTH.getValue() |
Criterion.IPv6ExthdrFlags.DEST.getValue() |
Criterion.IPv6ExthdrFlags.FRAG.getValue() |
Criterion.IPv6ExthdrFlags.ROUTER.getValue() |
Criterion.IPv6ExthdrFlags.HOP.getValue() |
Criterion.IPv6ExthdrFlags.UNREP.getValue() |
Criterion.IPv6ExthdrFlags.UNSEQ.getValue();
Criterion criterion = Criteria.matchIPv6ExthdrFlags(exthdrFlags);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:CriterionCodecTest.java
示例4: filterObjBuilder
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Creates a filtering objective builder for multicast.
*
* @param deviceId Device ID
* @param ingressPort ingress port of the multicast stream
* @param assignedVlan assigned VLAN ID
* @return filtering objective builder
*/
private FilteringObjective.Builder filterObjBuilder(DeviceId deviceId, PortNumber ingressPort,
VlanId assignedVlan) {
FilteringObjective.Builder filtBuilder = DefaultFilteringObjective.builder();
filtBuilder.withKey(Criteria.matchInPort(ingressPort))
.addCondition(Criteria.matchEthDstMasked(MacAddress.IPV4_MULTICAST,
MacAddress.IPV4_MULTICAST_MASK))
.addCondition(Criteria.matchVlanId(egressVlan()))
.withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
// vlan assignment is valid only if this instance is master
if (srManager.mastershipService.isLocalMaster(deviceId)) {
TrafficTreatment tt = DefaultTrafficTreatment.builder()
.pushVlan().setVlanId(assignedVlan).build();
filtBuilder.withMeta(tt);
}
return filtBuilder.permit().fromApp(srManager.appId);
}
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:McastHandler.java
示例5: testTrafficSelectorEncode
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests encoding of a traffic selector object.
*/
@Test
public void testTrafficSelectorEncode() {
Criterion inPort = Criteria.matchInPort(PortNumber.portNumber(0));
Criterion ethSrc = Criteria.matchEthSrc(MacAddress.valueOf("11:22:33:44:55:66"));
Criterion ethDst = Criteria.matchEthDst(MacAddress.valueOf("44:55:66:77:88:99"));
Criterion ethType = Criteria.matchEthType(Ethernet.TYPE_IPV4);
TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();
TrafficSelector selector = sBuilder
.add(inPort)
.add(ethSrc)
.add(ethDst)
.add(ethType)
.build();
ObjectNode selectorJson = trafficSelectorCodec.encode(selector, context);
assertThat(selectorJson, TrafficSelectorJsonMatcher.matchesTrafficSelector(selector));
}
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:TrafficSelectorCodecTest.java
示例6: testEquals
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests equals(), hashCode() and toString() methods.
*/
@Test
public void testEquals() {
final TrafficSelector selector1 = DefaultTrafficSelector.builder()
.add(Criteria.matchLambda(new OchSignal(GridType.FLEX, ChannelSpacing.CHL_100GHZ, 1, 1)))
.build();
final TrafficSelector sameAsSelector1 = DefaultTrafficSelector.builder()
.add(Criteria.matchLambda(new OchSignal(GridType.FLEX, ChannelSpacing.CHL_100GHZ, 1, 1)))
.build();
final TrafficSelector selector2 = DefaultTrafficSelector.builder()
.add(Criteria.matchLambda(new OchSignal(GridType.FLEX, ChannelSpacing.CHL_50GHZ, 1, 1)))
.build();
new EqualsTester()
.addEqualityGroup(selector1, sameAsSelector1)
.addEqualityGroup(selector2)
.testEquals();
}
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:DefaultTrafficSelectorTest.java
示例7: filteringObjective
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests adding a filtering objective.
*/
@Test
public void filteringObjective() {
TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
FilteringObjective filter =
DefaultFilteringObjective.builder()
.fromApp(NetTestTools.APP_ID)
.withMeta(treatment)
.makePermanent()
.deny()
.addCondition(Criteria.matchEthType(12))
.add();
manager.activate();
manager.filter(id1, filter);
TestTools.assertAfter(RETRY_MS, () ->
assertThat(filteringObjectives, hasSize(1)));
assertThat(forwardingObjectives, hasSize(0));
assertThat(filteringObjectives, hasItem("of:d1"));
assertThat(nextObjectives, hasSize(0));
}
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:FlowObjectiveManagerTest.java
示例8: read
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
@Override
public ExtensionCriterion read(Kryo kryo, Input input,
Class<ExtensionCriterion> type) {
ExtensionSelectorType exType = (ExtensionSelectorType) kryo.readClassAndObject(input);
DeviceId deviceId = (DeviceId) kryo.readClassAndObject(input);
DriverService driverService = DefaultServiceDirectory.getService(DriverService.class);
DriverHandler handler = new DefaultDriverHandler(
new DefaultDriverData(driverService.getDriver(deviceId), deviceId));
ExtensionSelectorResolver resolver = handler.behaviour(ExtensionSelectorResolver.class);
ExtensionSelector selector = resolver.getExtensionSelector(exType);
byte[] bytes = (byte[]) kryo.readClassAndObject(input);
selector.deserialize(bytes);
return Criteria.extension(selector, deviceId);
}
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:ExtensionCriterionSerializer.java
示例9: decodeCriterion
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
@Override
public Criterion decodeCriterion(ObjectNode json) {
JsonNode oduSignalId = nullIsIllegal(json.get(CriterionCodec.ODU_SIGNAL_ID),
CriterionCodec.TRIBUTARY_PORT_NUMBER + MISSING_MEMBER_MESSAGE);
int tributaryPortNumber = nullIsIllegal(oduSignalId.get(CriterionCodec.TRIBUTARY_PORT_NUMBER),
CriterionCodec.TRIBUTARY_PORT_NUMBER + MISSING_MEMBER_MESSAGE).asInt();
int tributarySlotLen = nullIsIllegal(oduSignalId.get(CriterionCodec.TRIBUTARY_SLOT_LEN),
CriterionCodec.TRIBUTARY_SLOT_LEN + MISSING_MEMBER_MESSAGE).asInt();
byte[] tributarySlotBitmap = HexString.fromHexString(
nullIsIllegal(oduSignalId.get(CriterionCodec.TRIBUTARY_SLOT_BITMAP),
CriterionCodec.TRIBUTARY_SLOT_BITMAP + MISSING_MEMBER_MESSAGE).asText());
return Criteria.matchOduSignalId(
OduSignalId.oduSignalId(tributaryPortNumber, tributarySlotLen, tributarySlotBitmap));
}
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:DecodeCriterionCodecHelper.java
示例10: matchIcmpv6CodeTest
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests ICMP v6 code criterion.
*/
@Test
public void matchIcmpv6CodeTest() {
Criterion criterion = Criteria.matchIcmpv6Code((byte) 250);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CriterionCodecTest.java
示例11: matchIPv6FlowLabelTest
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests IPv6 flow label criterion.
*/
@Test
public void matchIPv6FlowLabelTest() {
Criterion criterion = Criteria.matchIPv6FlowLabel(0xffffe);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CriterionCodecTest.java
示例12: programTunnelBcastRules
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
@Override
public void programTunnelBcastRules(DeviceId deviceId,
SegmentationId segmentationId,
Iterable<PortNumber> localVmPorts,
Iterable<PortNumber> localTunnelPorts,
Objective.Operation type) {
if (localVmPorts == null || localTunnelPorts == null) {
log.info("No other host port or tunnel ports in the device");
return;
}
Sets.newHashSet(localTunnelPorts).stream().forEach(tp -> {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchInPort(tp)
.add(Criteria.matchTunnelId(Long
.parseLong(segmentationId.toString())))
.matchEthDst(MacAddress.BROADCAST).build();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment
.builder();
for (PortNumber outPort : localVmPorts) {
treatment.setOutput(outPort);
}
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment.build())
.withSelector(selector).fromApp(appId).makePermanent()
.withFlag(Flag.SPECIFIC).withPriority(MAC_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
if (Sets.newHashSet(localVmPorts).size() == 0) {
flowObjectiveService.forward(deviceId, objective.remove());
} else {
flowObjectiveService.forward(deviceId, objective.add());
}
} else {
flowObjectiveService.forward(deviceId, objective.remove());
}
});
}
开发者ID:shlee89,项目名称:athena,代码行数:39,代码来源:L2ForwardServiceImpl.java
示例13: matchInPhyPortTest
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests in physical port criterion.
*/
@Test
public void matchInPhyPortTest() {
Criterion criterion = Criteria.matchInPhyPort(port);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CriterionCodecTest.java
示例14: matchIcmpv6TypeTest
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests ICMP v6 type criterion.
*/
@Test
public void matchIcmpv6TypeTest() {
Criterion criterion = Criteria.matchIcmpv6Type((byte) 250);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CriterionCodecTest.java
示例15: getVRouterFlowObjBuilders
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
private Set<FilteringObjective.Builder> getVRouterFlowObjBuilders(Set<MacAddress> macAddresses) {
ImmutableSet.Builder<FilteringObjective.Builder> setBuilder = ImmutableSet.builder();
macAddresses.forEach(macAddress -> {
FilteringObjective.Builder fobuilder = DefaultFilteringObjective.builder();
fobuilder.withKey(Criteria.matchInPort(PortNumber.ANY))
.addCondition(Criteria.matchEthDst(macAddress))
.permit()
.withPriority(SegmentRoutingService.DEFAULT_PRIORITY)
.fromApp(srManager.appId);
setBuilder.add(fobuilder);
});
return setBuilder.build();
}
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:AppConfigHandler.java
示例16: matchInPortTest
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests in port criterion.
*/
@Test
public void matchInPortTest() {
Criterion criterion = Criteria.matchInPort(port);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CriterionCodecTest.java
示例17: matchEthTypeTest
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests ethernet type criterion.
*/
@Test
public void matchEthTypeTest() {
Criterion criterion = Criteria.matchEthType((short) 0x8844);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CriterionCodecTest.java
示例18: matchOchSignal
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests lambda criterion.
*/
@Test
public void matchOchSignal() {
Lambda ochSignal = Lambda.ochSignal(GridType.DWDM, ChannelSpacing.CHL_100GHZ, 4, 8);
Criterion criterion = Criteria.matchLambda(ochSignal);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:CriterionCodecTest.java
示例19: matchOduSignalIdTest
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests Odu Signal ID criterion.
*/
@Test
public void matchOduSignalIdTest() {
OduSignalId oduSignalId = OduSignalId.oduSignalId(tributaryPortNumber, tributarySlotLen, tributarySlotBitmap);
Criterion criterion = Criteria.matchOduSignalId(oduSignalId);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:CriterionCodecTest.java
示例20: matchOchSignalTypeTest
import org.onosproject.net.flow.criteria.Criteria; //导入依赖的package包/类
/**
* Tests Och signal type criterion.
*/
@Test
public void matchOchSignalTypeTest() {
Criterion criterion = Criteria.matchOchSignalType(OchSignalType.FIXED_GRID);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CriterionCodecTest.java
注:本文中的org.onosproject.net.flow.criteria.Criteria类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论