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


Java RuleId类代码示例

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


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

示例1: processHostAddedEvent

import org.onosproject.acl.RuleId; //导入依赖的package包/类
/**
 * Generate new ACL flow rules for new host following the given ACL rule.
 */
private void processHostAddedEvent(HostEvent event, AclRule rule) {
    DeviceId deviceId = event.subject().location().deviceId();
    for (IpAddress address : event.subject().ipAddresses()) {
        if ((rule.srcIp() != null) ?
                (checkIpInCidr(address.getIp4Address(), rule.srcIp())) :
                (checkIpInCidr(address.getIp4Address(), rule.dstIp()))) {
            if (!aclStore.checkIfRuleWorksInDevice(rule.id(), deviceId)) {
                List<RuleId> allowingRuleList = aclStore
                        .getAllowingRuleByDenyingRule(rule.id());
                if (allowingRuleList != null) {
                    for (RuleId allowingRuleId : allowingRuleList) {
                        generateAclFlow(aclStore.getAclRule(allowingRuleId), deviceId);
                    }
                }
                generateAclFlow(rule, deviceId);
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:AclManager.java

示例2: enforceRuleAdding

import org.onosproject.acl.RuleId; //导入依赖的package包/类
/**
 * Enforces denying ACL rule by ACL flow rules.
 */
private void enforceRuleAdding(AclRule rule) {
    Set<DeviceId> dpidSet;
    if (rule.srcIp() != null) {
        dpidSet = getDeviceIdSet(rule.srcIp());
    } else {
        dpidSet = getDeviceIdSet(rule.dstIp());
    }

    for (DeviceId deviceId : dpidSet) {
        List<RuleId> allowingRuleList = aclStore.getAllowingRuleByDenyingRule(rule.id());
        if (allowingRuleList != null) {
            for (RuleId allowingRuleId : allowingRuleList) {
                generateAclFlow(aclStore.getAclRule(allowingRuleId), deviceId);
            }
        }
        generateAclFlow(rule, deviceId);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:AclManager.java

示例3: getAclRule

import org.onosproject.acl.RuleId; //导入依赖的package包/类
@Override
public AclRule getAclRule(RuleId ruleId) {
    Versioned<AclRule> rule = ruleSet.get(ruleId);
    if (rule != null) {
        return rule.value();
    } else {
        return null;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:DistributedAclStore.java

示例4: getFlowByRule

import org.onosproject.acl.RuleId; //导入依赖的package包/类
@Override
public Set<FlowRule> getFlowByRule(RuleId ruleId) {
    Versioned<Set<FlowRule>> flowRuleSet = ruleToFlow.get(ruleId);
    if (flowRuleSet != null) {
        return flowRuleSet.value();
    } else {
        return null;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:DistributedAclStore.java

示例5: addRuleToFlowMapping

import org.onosproject.acl.RuleId; //导入依赖的package包/类
@Override
public void addRuleToFlowMapping(RuleId ruleId, FlowRule flowRule) {
    ruleToFlow.computeIf(ruleId,
                         flowRuleSet -> (flowRuleSet == null || !flowRuleSet.contains(flowRule)),
                         (id, flowRuleSet) -> {
                             Set<FlowRule> newSet = new HashSet<>();
                             if (flowRuleSet != null) {
                                 newSet.addAll(flowRuleSet);
                             }
                             newSet.add(flowRule);
                             return newSet;
                         });
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:DistributedAclStore.java

示例6: getAllowingRuleByDenyingRule

import org.onosproject.acl.RuleId; //导入依赖的package包/类
@Override
public List<RuleId> getAllowingRuleByDenyingRule(RuleId denyingRuleId) {
    Versioned<List<RuleId>> allowRuleIdSet = denyRuleToAllowRule.get(denyingRuleId);
    if (allowRuleIdSet != null) {
        return allowRuleIdSet.value();
    } else {
        return null;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:DistributedAclStore.java

示例7: addDenyToAllowMapping

import org.onosproject.acl.RuleId; //导入依赖的package包/类
@Override
public void addDenyToAllowMapping(RuleId denyingRuleId, RuleId allowingRuleId) {
    denyRuleToAllowRule.computeIf(denyingRuleId,
                                  ruleIdList -> (ruleIdList == null || !ruleIdList.contains(allowingRuleId)),
                                  (id, ruleIdList) -> {
                                      ArrayList<RuleId> newList = new ArrayList<>();
                                      if (ruleIdList != null) {
                                          newList.addAll(ruleIdList);
                                      }
                                      newList.add(allowingRuleId);
                                      return newList;
                                  });
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:DistributedAclStore.java

示例8: addRuleToDeviceMapping

import org.onosproject.acl.RuleId; //导入依赖的package包/类
@Override
public void addRuleToDeviceMapping(RuleId ruleId, DeviceId deviceId) {
    ruleToDevice.computeIf(ruleId,
                           deviceIdSet -> (deviceIdSet == null || !deviceIdSet.contains(deviceId)),
                           (id, deviceIdSet) -> {
                               Set<DeviceId> newSet = new HashSet<>();
                               if (deviceIdSet != null) {
                                   newSet.addAll(deviceIdSet);
                               }
                               newSet.add(deviceId);
                               return newSet;
                           });
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:DistributedAclStore.java

示例9: enforceRuleRemoving

import org.onosproject.acl.RuleId; //导入依赖的package包/类
/**
 * Enforces removing an existing ACL rule.
 */
private void enforceRuleRemoving(RuleId ruleId) {
    Set<FlowRule> flowSet = aclStore.getFlowByRule(ruleId);
    if (flowSet != null) {
        for (FlowRule flowRule : flowSet) {
            flowRuleService.removeFlowRules(flowRule);
            log.debug("ACL flow rule {} is removed from {}.", flowRule.toString(), flowRule.deviceId().toString());
        }
    }
    aclStore.removeRuleToFlowMapping(ruleId);
    aclStore.removeRuleToDeviceMapping(ruleId);
    aclStore.removeDenyToAllowMapping(ruleId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:AclManager.java

示例10: activate

import org.onosproject.acl.RuleId; //导入依赖的package包/类
@Activate
public void activate() {
    ApplicationId appId = coreService.getAppId("org.onosproject.acl");

    KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(AclRule.class)
            .register(AclRule.Action.class)
            .register(RuleId.class);

    ruleSet = storageService.<RuleId, AclRule>consistentMapBuilder()
            .withSerializer(Serializer.using(serializer.build()))
            .withName("acl-rule-set")
            .withApplicationId(appId)
            .withPurgeOnUninstall()
            .build();

    deviceToPriority = storageService.<DeviceId, Integer>consistentMapBuilder()
            .withSerializer(Serializer.using(serializer.build()))
            .withName("device-to-priority")
            .withApplicationId(appId)
            .withPurgeOnUninstall()
            .build();

    ruleToFlow = storageService.<RuleId, Set<FlowRule>>consistentMapBuilder()
            .withSerializer(Serializer.using(serializer.build()))
            .withName("rule-to-flow")
            .withApplicationId(appId)
            .withPurgeOnUninstall()
            .build();

    denyRuleToAllowRule = storageService.<RuleId, List<RuleId>>consistentMapBuilder()
            .withSerializer(Serializer.using(serializer.build()))
            .withName("deny-to-allow")
            .withApplicationId(appId)
            .withPurgeOnUninstall()
            .build();

    ruleToDevice = storageService.<RuleId, Set<DeviceId>>consistentMapBuilder()
            .withSerializer(Serializer.using(serializer.build()))
            .withName("rule-to-device")
            .withApplicationId(appId)
            .withPurgeOnUninstall()
            .build();

    log.info("Started");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:48,代码来源:DistributedAclStore.java

示例11: removeAclRule

import org.onosproject.acl.RuleId; //导入依赖的package包/类
@Override
public void removeAclRule(RuleId ruleId) {
    ruleSet.remove(ruleId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:DistributedAclStore.java

示例12: removeRuleToFlowMapping

import org.onosproject.acl.RuleId; //导入依赖的package包/类
@Override
public void removeRuleToFlowMapping(RuleId ruleId) {
    ruleToFlow.remove(ruleId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:DistributedAclStore.java

示例13: removeDenyToAllowMapping

import org.onosproject.acl.RuleId; //导入依赖的package包/类
@Override
public void removeDenyToAllowMapping(RuleId denyingRuleId) {
    denyRuleToAllowRule.remove(denyingRuleId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:DistributedAclStore.java

示例14: checkIfRuleWorksInDevice

import org.onosproject.acl.RuleId; //导入依赖的package包/类
@Override
public boolean checkIfRuleWorksInDevice(RuleId ruleId, DeviceId deviceId) {
    return ruleToDevice.containsKey(ruleId) && ruleToDevice.get(ruleId).value().contains(deviceId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:DistributedAclStore.java

示例15: removeRuleToDeviceMapping

import org.onosproject.acl.RuleId; //导入依赖的package包/类
@Override
public void removeRuleToDeviceMapping(RuleId ruleId) {
    ruleToDevice.remove(ruleId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:DistributedAclStore.java


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