當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。