本文整理汇总了Java中org.onosproject.net.flowobjective.Objective.Operation.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Operation.equals方法的具体用法?Java Operation.equals怎么用?Java Operation.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.flowobjective.Objective.Operation
的用法示例。
在下文中一共展示了Operation.equals方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: programExportPortArpClassifierRules
import org.onosproject.net.flowobjective.Objective.Operation; //导入方法依赖的package包/类
@Override
public void programExportPortArpClassifierRules(Port exportPort,
DeviceId deviceId,
Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthType(EtherType.ARP.ethType().toShort())
.matchInPort(exportPort.number()).build();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
treatment.add(Instructions.createOutput(PortNumber.CONTROLLER));
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment.build())
.withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(L3_CLASSIFIER_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
flowObjectiveService.forward(deviceId, objective.add());
} else {
flowObjectiveService.forward(deviceId, objective.remove());
}
}
示例2: programRouteRules
import org.onosproject.net.flowobjective.Objective.Operation; //导入方法依赖的package包/类
@Override
public void programRouteRules(DeviceId deviceId, SegmentationId l3Vni,
IpAddress dstVmIP, SegmentationId dstVni,
MacAddress dstVmGwMac, MacAddress dstVmMac,
Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthType(IP_TYPE)
.matchTunnelId(Long.parseLong(l3Vni.segmentationId()))
.matchIPDst(IpPrefix.valueOf(dstVmIP, PREFIX_LENGTH)).build();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
treatment.setEthSrc(dstVmGwMac)
.setEthDst(dstVmMac)
.add(Instructions.modTunnelId(Long.parseLong(dstVni
.segmentationId())));
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment.build())
.withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(L3FWD_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
log.debug("RouteRules-->ADD");
flowObjectiveService.forward(deviceId, objective.add());
} else {
log.debug("RouteRules-->REMOVE");
flowObjectiveService.forward(deviceId, objective.remove());
}
}
示例3: programSnatSameSegmentUploadControllerRules
import org.onosproject.net.flowobjective.Objective.Operation; //导入方法依赖的package包/类
@Override
public void programSnatSameSegmentUploadControllerRules(DeviceId deviceId,
SegmentationId matchVni,
IpAddress srcIP,
IpAddress dstIP,
IpPrefix prefix,
Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
.matchTunnelId(Long.parseLong(matchVni.segmentationId()))
.matchIPSrc(IpPrefix.valueOf(srcIP, PREFIC_LENGTH))
.matchIPDst(IpPrefix.valueOf(dstIP, prefix.prefixLength()))
.build();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
treatment.add(Instructions.createOutput(PortNumber.CONTROLLER));
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment.build())
.withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(SNAT_SAME_SEG_CON_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
flowObjectiveService.forward(deviceId, objective.add());
} else {
flowObjectiveService.forward(deviceId, objective.remove());
}
}
示例4: programArpRules
import org.onosproject.net.flowobjective.Objective.Operation; //导入方法依赖的package包/类
@Override
public void programArpRules(DriverHandler hander, DeviceId deviceId,
IpAddress dstIP, SegmentationId srcVni,
MacAddress dstMac, Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthType(ARP_TYPE.ethType().toShort())
.matchArpTpa(Ip4Address.valueOf(dstIP.toString()))
.matchTunnelId(Long.parseLong(srcVni.segmentationId())).build();
ExtensionTreatmentResolver resolver = hander
.behaviour(ExtensionTreatmentResolver.class);
ExtensionTreatment ethSrcToDst = resolver
.getExtensionInstruction(ExtensionTreatmentType.ExtensionTreatmentTypes
.NICIRA_MOV_ETH_SRC_TO_DST.type());
ExtensionTreatment arpShaToTha = resolver
.getExtensionInstruction(ExtensionTreatmentType.ExtensionTreatmentTypes
.NICIRA_MOV_ARP_SHA_TO_THA.type());
ExtensionTreatment arpSpaToTpa = resolver
.getExtensionInstruction(ExtensionTreatmentType.ExtensionTreatmentTypes
.NICIRA_MOV_ARP_SPA_TO_TPA.type());
TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.extension(ethSrcToDst, deviceId)
.setEthSrc(dstMac).setArpOp(ARP_RESPONSE)
.extension(arpShaToTha, deviceId)
.extension(arpSpaToTpa, deviceId)
.setArpSha(dstMac).setArpSpa(dstIP)
.setOutput(PortNumber.IN_PORT).build();
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment).withSelector(selector)
.fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(ARP_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
log.debug("PrivateArpRules-->ADD");
flowObjectiveService.forward(deviceId, objective.add());
} else {
log.debug("PrivateArpRules-->REMOVE");
flowObjectiveService.forward(deviceId, objective.remove());
}
}
示例5: addArpFlows
import org.onosproject.net.flowobjective.Objective.Operation; //导入方法依赖的package包/类
private void addArpFlows(DeviceId deviceId,
EvpnRoute route,
Operation type,
Host host) {
DriverHandler handler = driverService.createHandler(deviceId);
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthType(ARP_TYPE.ethType().toShort())
.matchArpTpa(route.prefixIp().address().getIp4Address())
.matchInPort(host.location().port()).build();
ExtensionTreatmentResolver resolver = handler
.behaviour(ExtensionTreatmentResolver.class);
ExtensionTreatment ethSrcToDst = resolver
.getExtensionInstruction(ExtensionTreatmentType
.ExtensionTreatmentTypes
.NICIRA_MOV_ETH_SRC_TO_DST
.type());
ExtensionTreatment arpShaToTha = resolver
.getExtensionInstruction(ExtensionTreatmentType
.ExtensionTreatmentTypes
.NICIRA_MOV_ARP_SHA_TO_THA
.type());
ExtensionTreatment arpSpaToTpa = resolver
.getExtensionInstruction(ExtensionTreatmentType
.ExtensionTreatmentTypes
.NICIRA_MOV_ARP_SPA_TO_TPA
.type());
TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.extension(ethSrcToDst, deviceId).setEthSrc(route.prefixMac())
.setArpOp(ARP_RESPONSE).extension(arpShaToTha, deviceId)
.extension(arpSpaToTpa, deviceId).setArpSha(route.prefixMac())
.setArpSpa(route.prefixIp().address().getIp4Address())
.setOutput(PortNumber.IN_PORT)
.build();
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment).withSelector(selector)
.fromApp(appId).withFlag(ForwardingObjective.Flag.SPECIFIC)
.withPriority(ARP_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
log.info(ROUTE_ADD_ARP_RULES);
flowObjectiveService.forward(deviceId, objective.add());
} else {
log.info(ROUTE_REMOVE_ARP_RULES);
flowObjectiveService.forward(deviceId, objective.remove());
}
}
示例6: setFlows
import org.onosproject.net.flowobjective.Objective.Operation; //导入方法依赖的package包/类
private void setFlows(DeviceId deviceId, Host host, Label label,
List<VpnRouteTarget> rtImport,
Operation type) {
log.info("Set the flows to OVS");
ForwardingObjective.Builder objective = getMplsInBuilder(deviceId,
host,
label);
if (type.equals(Objective.Operation.ADD)) {
flowObjectiveService.forward(deviceId, objective.add());
} else {
flowObjectiveService.forward(deviceId, objective.remove());
}
// download remote flows if and only routes are present.
evpnRouteStore.getRouteTables().forEach(routeTableId -> {
Collection<EvpnRouteSet> routes
= evpnRouteStore.getRoutes(routeTableId);
if (routes != null) {
routes.forEach(route -> {
Collection<EvpnRoute> evpnRoutes = route.routes();
for (EvpnRoute evpnRoute : evpnRoutes) {
EvpnRoute evpnRouteTem = evpnRoute;
Set<Host> hostByMac = hostService
.getHostsByMac(evpnRouteTem
.prefixMac());
if (!hostByMac.isEmpty()
|| (!(compareLists(rtImport, evpnRouteTem
.exportRouteTarget())))) {
log.info("Route target import/export is not matched");
continue;
}
log.info("Set the ARP flows");
addArpFlows(deviceId, evpnRouteTem, type, host);
ForwardingObjective.Builder build = getMplsOutBuilder(deviceId,
evpnRouteTem,
host);
log.info("Set the MPLS flows");
if (type.equals(Objective.Operation.ADD)) {
flowObjectiveService.forward(deviceId, build.add());
} else {
flowObjectiveService.forward(deviceId, build.remove());
}
}
});
}
});
}
示例7: setPrivateRoute
import org.onosproject.net.flowobjective.Objective.Operation; //导入方法依赖的package包/类
/**
* update or withdraw evpn route from route admin service.
*
* @param host host
* @param vpnInstanceId vpn instance id
* @param privateLabel private label
* @param type operation type
*/
private void setPrivateRoute(Host host, VpnInstanceId vpnInstanceId,
Label privateLabel,
Operation type) {
DeviceId deviceId = host.location().deviceId();
Device device = deviceService.getDevice(deviceId);
VpnInstance vpnInstance = vpnInstanceService.getInstance(vpnInstanceId);
RouteDistinguisher rd = vpnInstance.routeDistinguisher();
Set<VpnRouteTarget> importRouteTargets
= vpnInstance.getImportRouteTargets();
Set<VpnRouteTarget> exportRouteTargets
= vpnInstance.getExportRouteTargets();
EvpnInstanceName instanceName = vpnInstance.vpnInstanceName();
String url = device.annotations().value(SWITCH_CHANNEL_ID);
String controllerIp = url.substring(0, url.lastIndexOf(":"));
if (controllerIp == null) {
log.error(CANT_FIND_CONTROLLER_DEVICE, device.id().toString());
return;
}
IpAddress ipAddress = IpAddress.valueOf(controllerIp);
// create private route
EvpnInstanceNextHop evpnNextHop = EvpnInstanceNextHop
.evpnNextHop(ipAddress, privateLabel);
EvpnInstancePrefix evpnPrefix = EvpnInstancePrefix
.evpnPrefix(host.mac(), IpPrefix.valueOf(host.ipAddresses()
.iterator()
.next()
.getIp4Address(), 32));
EvpnInstanceRoute evpnPrivateRoute
= new EvpnInstanceRoute(instanceName,
rd,
new LinkedList<>(importRouteTargets),
new LinkedList<>(exportRouteTargets),
evpnPrefix,
evpnNextHop,
IpPrefix.valueOf(host.ipAddresses()
.iterator()
.next()
.getIp4Address(), 32),
ipAddress,
privateLabel);
// change to public route
EvpnRoute evpnRoute
= new EvpnRoute(Source.LOCAL,
host.mac(),
IpPrefix.valueOf(host.ipAddresses()
.iterator()
.next()
.getIp4Address(), 32),
ipAddress,
rd,
new LinkedList<>(importRouteTargets),
new LinkedList<>(exportRouteTargets),
privateLabel);
if (type.equals(Objective.Operation.ADD)) {
//evpnRouteAdminService.update(Sets.newHashSet(evpnPrivateRoute));
evpnInstanceRoutes.add(evpnPrivateRoute);
evpnRouteAdminService.update(Sets.newHashSet(evpnRoute));
} else {
//evpnRouteAdminService.withdraw(Sets.newHashSet(evpnPrivateRoute));
evpnInstanceRoutes.remove(evpnPrivateRoute);
evpnRouteAdminService.withdraw(Sets.newHashSet(evpnRoute));
}
}