当前位置: 首页>>代码示例>>Java>>正文


Java Operation类代码示例

本文整理汇总了Java中org.onosproject.net.flowobjective.Objective.Operation的典型用法代码示例。如果您正苦于以下问题:Java Operation类的具体用法?Java Operation怎么用?Java Operation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Operation类属于org.onosproject.net.flowobjective.Objective包,在下文中一共展示了Operation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: programLocalIn

import org.onosproject.net.flowobjective.Objective.Operation; //导入依赖的package包/类
@Override
public void programLocalIn(DeviceId deviceId,
                           SegmentationId segmentationId, PortNumber inPort,
                           MacAddress srcMac, ApplicationId appid,
                           Objective.Operation type) {
    TrafficSelector selector = DefaultTrafficSelector.builder()
            .matchInPort(inPort).matchEthSrc(srcMac).build();
    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
    treatment.add(Instructions
            .modTunnelId(Long.parseLong(segmentationId.toString())));
    ForwardingObjective.Builder objective = DefaultForwardingObjective
            .builder().withTreatment(treatment.build())
            .withSelector(selector).fromApp(appId).makePermanent()
            .withFlag(Flag.SPECIFIC).withPriority(L2_CLASSIFIER_PRIORITY);
    if (type.equals(Objective.Operation.ADD)) {
        log.debug("programLocalIn-->ADD");
        flowObjectiveService.forward(deviceId, objective.add());
    } else {
        log.debug("programLocalIn-->REMOVE");
        flowObjectiveService.forward(deviceId, objective.remove());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:ClassifierServiceImpl.java

示例2: programL3ExPortClassifierRules

import org.onosproject.net.flowobjective.Objective.Operation; //导入依赖的package包/类
@Override
public void programL3ExPortClassifierRules(DeviceId deviceId, PortNumber inPort,
                                           IpAddress dstIp,
                                           Objective.Operation type) {
    TrafficSelector selector = DefaultTrafficSelector.builder()
            .matchEthType(Ethernet.TYPE_IPV4).matchInPort(inPort)
            .matchIPDst(IpPrefix.valueOf(dstIp, 32)).build();
    TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
    ForwardingObjective.Builder objective = DefaultForwardingObjective
            .builder().withTreatment(treatment).withSelector(selector)
            .fromApp(appId).withFlag(Flag.SPECIFIC)
            .withPriority(L3_CLASSIFIER_PRIORITY);
    if (type.equals(Objective.Operation.ADD)) {
        log.debug("L3ExToInClassifierRules-->ADD");
        flowObjectiveService.forward(deviceId, objective.add());
    } else {
        log.debug("L3ExToInClassifierRules-->REMOVE");
        flowObjectiveService.forward(deviceId, objective.remove());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:ClassifierServiceImpl.java

示例3: programL3InPortClassifierRules

import org.onosproject.net.flowobjective.Objective.Operation; //导入依赖的package包/类
@Override
public void programL3InPortClassifierRules(DeviceId deviceId, PortNumber inPort,
                                           MacAddress srcMac, MacAddress dstMac,
                                           SegmentationId actionVni,
                                           Objective.Operation type) {
    TrafficSelector selector = DefaultTrafficSelector.builder()
            .matchInPort(inPort).matchEthSrc(srcMac).matchEthDst(dstMac)
            .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(L3_CLASSIFIER_PRIORITY);
    if (type.equals(Objective.Operation.ADD)) {
        log.debug("L3InternalClassifierRules-->ADD");
        flowObjectiveService.forward(deviceId, objective.add());
    } else {
        log.debug("L3InternalClassifierRules-->REMOVE");
        flowObjectiveService.forward(deviceId, objective.remove());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:ClassifierServiceImpl.java

示例4: programArpClassifierRules

import org.onosproject.net.flowobjective.Objective.Operation; //导入依赖的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

示例5: programUserdataClassifierRules

import org.onosproject.net.flowobjective.Objective.Operation; //导入依赖的package包/类
@Override
public void programUserdataClassifierRules(DeviceId deviceId,
                                           IpPrefix ipPrefix,
                                           IpAddress dstIp,
                                           MacAddress dstmac,
                                           SegmentationId actionVni,
                                           Objective.Operation type) {
    TrafficSelector selector = DefaultTrafficSelector.builder()
            .matchEthType(Ethernet.TYPE_IPV4).matchIPSrc(ipPrefix)
            .matchIPDst(IpPrefix.valueOf(dstIp, 32)).build();
    TrafficTreatment treatment = DefaultTrafficTreatment.builder()
            .setTunnelId(Long.parseLong(actionVni.segmentationId()))
            .setEthDst(dstmac).build();
    ForwardingObjective.Builder objective = DefaultForwardingObjective
            .builder().withTreatment(treatment).withSelector(selector)
            .fromApp(appId).withFlag(Flag.SPECIFIC)
            .withPriority(USERDATA_CLASSIFIER_PRIORITY);
    if (type.equals(Objective.Operation.ADD)) {
        log.debug("UserdataClassifierRules-->ADD");
        flowObjectiveService.forward(deviceId, objective.add());
    } else {
        log.debug("UserdataClassifierRules-->REMOVE");
        flowObjectiveService.forward(deviceId, objective.remove());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:ClassifierServiceImpl.java

示例6: 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());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:ClassifierServiceImpl.java

示例7: 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());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:L3ForwardServiceImpl.java

示例8: programSnatSameSegmentRules

import org.onosproject.net.flowobjective.Objective.Operation; //导入依赖的package包/类
@Override
public void programSnatSameSegmentRules(DeviceId deviceId, SegmentationId matchVni,
                         IpAddress srcIP, IpAddress dstIP, MacAddress ethDst,
                         MacAddress ethSrc, IpAddress ipSrc,
                         SegmentationId actionVni, Objective.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, PREFIC_LENGTH)).build();

    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
    treatment.setEthDst(ethDst).setEthSrc(ethSrc).setIpSrc(ipSrc)
            .setTunnelId(Long.parseLong(actionVni.segmentationId()));
    ForwardingObjective.Builder objective = DefaultForwardingObjective
            .builder().withTreatment(treatment.build())
            .withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
            .withPriority(SNAT_SAME_SEG_PRIORITY);
    if (type.equals(Objective.Operation.ADD)) {
        flowObjectiveService.forward(deviceId, objective.add());
    } else {
        flowObjectiveService.forward(deviceId, objective.remove());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:SnatServiceImpl.java

示例9: programSnatDiffSegmentRules

import org.onosproject.net.flowobjective.Objective.Operation; //导入依赖的package包/类
@Override
public void programSnatDiffSegmentRules(DeviceId deviceId, SegmentationId matchVni,
                         IpAddress srcIP, MacAddress ethDst,
                         MacAddress ethSrc, IpAddress ipSrc,
                         SegmentationId actionVni, Objective.Operation type) {
    TrafficSelector selector = DefaultTrafficSelector.builder()
            .matchEthType(Ethernet.TYPE_IPV4)
            .matchTunnelId(Long.parseLong(matchVni.segmentationId()))
            .matchIPSrc(IpPrefix.valueOf(srcIP, PREFIC_LENGTH)).build();

    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
    treatment.setEthDst(ethDst).setEthSrc(ethSrc).setIpSrc(ipSrc)
            .setTunnelId(Long.parseLong(actionVni.segmentationId()));
    ForwardingObjective.Builder objective = DefaultForwardingObjective
            .builder().withTreatment(treatment.build())
            .withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
            .withPriority(SNAT_DIFF_SEG_PRIORITY);
    if (type.equals(Objective.Operation.ADD)) {
        flowObjectiveService.forward(deviceId, objective.add());
    } else {
        flowObjectiveService.forward(deviceId, objective.remove());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:SnatServiceImpl.java

示例10: 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());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:SnatServiceImpl.java

示例11: updateFlowObjectiveStore

import org.onosproject.net.flowobjective.Objective.Operation; //导入依赖的package包/类
private void updateFlowObjectiveStore(Integer nextId, OfdpaNextGroup nextGrp) {
    synchronized (flowObjectiveStore) {
        // get fresh copy of what the store holds
        NextGroup next = flowObjectiveStore.getNextGroup(nextId);
        if (next == null || nextGrp.nextObjective().op() == Operation.ADD) {
            flowObjectiveStore.putNextGroup(nextId, nextGrp);
            return;
        }
        if (nextGrp.nextObjective().op() == Operation.ADD_TO_EXISTING) {
            List<Deque<GroupKey>> allActiveKeys = appKryo.deserialize(next.data());
            allActiveKeys = Lists.newArrayList(allActiveKeys);
            // If active keys shows only the top-level group without a chain of groups,
            // then it represents an empty group. Update by replacing empty chain.
            if (allActiveKeys.size() == 1 && allActiveKeys.get(0).size() == 1) {
                allActiveKeys.clear();
            }
            allActiveKeys.addAll(nextGrp.allKeys());
            flowObjectiveStore.putNextGroup(nextId,
                new OfdpaNextGroup(allActiveKeys, nextGrp.nextObjective()));
        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:23,代码来源:Ofdpa2GroupHandler.java

示例12: programTunnelIn

import org.onosproject.net.flowobjective.Objective.Operation; //导入依赖的package包/类
@Override
public void programTunnelIn(DeviceId deviceId,
                            SegmentationId segmentationId,
                            Iterable<PortNumber> localTunnelPorts,
                            Objective.Operation type) {
    if (localTunnelPorts == null) {
        log.info("No tunnel port in device");
        return;
    }
    Sets.newHashSet(localTunnelPorts).stream().forEach(tp -> {
        TrafficSelector selector = DefaultTrafficSelector.builder()
                .matchInPort(tp).add(Criteria.matchTunnelId(Long
                        .parseLong(segmentationId.toString())))
                .build();

        TrafficTreatment treatment = DefaultTrafficTreatment.builder()
                .build();
        ForwardingObjective.Builder objective = DefaultForwardingObjective
                .builder().withTreatment(treatment).withSelector(selector)
                .fromApp(appId).makePermanent().withFlag(Flag.SPECIFIC)
                .withPriority(L2_CLASSIFIER_PRIORITY);
        if (type.equals(Objective.Operation.ADD)) {
            log.debug("programTunnelIn-->ADD");
            flowObjectiveService.forward(deviceId, objective.add());
        } else {
            log.debug("programTunnelIn-->REMOVE");
            flowObjectiveService.forward(deviceId, objective.remove());
        }
    });
}
 
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:ClassifierServiceImpl.java

示例13: removeSnatRules

import org.onosproject.net.flowobjective.Objective.Operation; //导入依赖的package包/类
@Override
public void removeSnatRules(DeviceId deviceId, TrafficSelector selector,
                            TrafficTreatment treatment, int priority,
                            Objective.Operation type) {
    ForwardingObjective.Builder objective = DefaultForwardingObjective
            .builder().withTreatment(treatment).withSelector(selector)
            .fromApp(appId).withFlag(Flag.SPECIFIC).withPriority(priority);
    if (type.equals(Objective.Operation.ADD)) {
        flowObjectiveService.forward(deviceId, objective.add());
    } else {
        flowObjectiveService.forward(deviceId, objective.remove());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:SnatServiceImpl.java

示例14: onHostVanished

import org.onosproject.net.flowobjective.Objective.Operation; //导入依赖的package包/类
@Override
public void onHostVanished(Host host) {
    log.info(HOST_VANISHED, host);
    DeviceId deviceId = host.location().deviceId();
    if (!mastershipService.isLocalMaster(deviceId)) {
        return;
    }
    String ifaceId = host.annotations().value(IFACEID);
    if (ifaceId == null) {
        log.error(IFACEID_OF_HOST_IS_NULL);
        return;
    }
    // Get info from Gluon Shim
    VpnPort vpnPort = vpnPortService.getPort(VpnPortId.vpnPortId(ifaceId));
    VpnInstanceId vpnInstanceId = vpnPort.vpnInstanceId();
    if (!vpnInstanceService.exists(vpnInstanceId)) {
        log.info(CANT_FIND_VPN_INSTANCE, vpnInstanceId);
        return;
    }
    VpnInstance vpnInstance = vpnInstanceService.getInstance(vpnInstanceId);

    Label label = releaseLabel(vpnInstance, host);
    // create private route and get label
    setPrivateRoute(host, vpnInstanceId, label, Objective.Operation.REMOVE);
    // download flows
    List<VpnRouteTarget> rtImport
            = new LinkedList<>(vpnInstance.getImportRouteTargets());
    List<VpnRouteTarget> rtExport
            = new LinkedList<>(vpnInstance.getExportRouteTargets());
    setFlows(deviceId, host, label, rtImport,
             Objective.Operation.REMOVE);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:33,代码来源:EvpnManager.java

示例15: onVpnPortDelete

import org.onosproject.net.flowobjective.Objective.Operation; //导入依赖的package包/类
@Override
public void onVpnPortDelete(VpnPort vpnPort) {
    // delete the flows of this vpn
    hostService.getHosts().forEach(host -> {
        VpnPortId vpnPortId = vpnPort.id();
        VpnInstanceId vpnInstanceId = vpnPort.vpnInstanceId();
        if (!vpnInstanceService.exists(vpnInstanceId)) {
            log.error(CANT_FIND_VPN_INSTANCE, vpnInstanceId);
            return;
        }
        VpnInstance vpnInstance = vpnInstanceService
                .getInstance(vpnInstanceId);
        List<VpnRouteTarget> rtImport
                = new LinkedList<>(vpnInstance.getImportRouteTargets());
        List<VpnRouteTarget> rtExport
                = new LinkedList<>(vpnInstance.getExportRouteTargets());

        if (vpnPortId.vpnPortId()
                .equals(host.annotations().value(IFACEID))) {
            log.info(VPN_PORT_UNBIND);
            Label label = releaseLabel(vpnInstance, host);
            // create private route and get label
            DeviceId deviceId = host.location().deviceId();
            setPrivateRoute(host, vpnInstanceId, label,
                            Objective.Operation.REMOVE);
            // download flows
            setFlows(deviceId, host, label, rtImport,
                     Objective.Operation.REMOVE);
        }
    });
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:32,代码来源:EvpnManager.java


注:本文中的org.onosproject.net.flowobjective.Objective.Operation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。