Search in sources :

Example 16 with ActionGroup

use of org.opendaylight.genius.mdsalutil.actions.ActionGroup in project genius by opendaylight.

the class ActionInfoBuilderTest method groupActionWithSingleIntegerInStringValueWithActionKey.

@Test
public void groupActionWithSingleIntegerInStringValueWithActionKey() {
    ActionInfo actionInfo = new ActionGroup(69, 123);
    assertEquals("(new ActionGroupBuilder => [" + System.lineSeparator() + "    groupId = 123L" + System.lineSeparator() + "]).build()", generator.getExpression(actionInfo));
}
Also used : ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) Test(org.junit.Test)

Example 17 with ActionGroup

use of org.opendaylight.genius.mdsalutil.actions.ActionGroup in project netvirt by opendaylight.

the class ElanInterfaceManager method removeElanBroadcastGroup.

public void removeElanBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
    int bucketId = 0;
    int actionKey = 0;
    Long elanTag = elanInfo.getElanTag();
    List<Bucket> listBuckets = new ArrayList<>();
    List<Action> listAction = new ArrayList<>();
    listAction.add(new ActionGroup(++actionKey, ElanUtils.getElanLocalBCGId(elanTag)).buildAction());
    listBuckets.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
    bucketId++;
    listBuckets.addAll(getRemoteBCGroupBucketInfos(elanInfo, bucketId, interfaceInfo, elanTag));
    BigInteger dpnId = interfaceInfo.getDpId();
    long groupId = ElanUtils.getElanRemoteBCGId(elanInfo.getElanTag());
    Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
    LOG.trace("deleting the remoteBroadCast group:{}", group);
    mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
}
Also used : ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger)

Example 18 with ActionGroup

use of org.opendaylight.genius.mdsalutil.actions.ActionGroup in project netvirt by opendaylight.

the class ElanInterfaceManager method getInstructionsForOutGroup.

private List<InstructionInfo> getInstructionsForOutGroup(long groupId) {
    List<InstructionInfo> mkInstructions = new ArrayList<>();
    mkInstructions.add(new InstructionWriteActions(Collections.singletonList(new ActionGroup(groupId))));
    return mkInstructions;
}
Also used : InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) InstructionWriteActions(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteActions) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) ArrayList(java.util.ArrayList)

Example 19 with ActionGroup

use of org.opendaylight.genius.mdsalutil.actions.ActionGroup in project netvirt by opendaylight.

the class ElanInterfaceManager method removeLeavesEtreeBroadcastGroup.

private void removeLeavesEtreeBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
    EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
    if (etreeInstance != null) {
        long etreeTag = etreeInstance.getEtreeLeafTagVal().getValue();
        int bucketId = 0;
        int actionKey = 0;
        List<Bucket> listBuckets = new ArrayList<>();
        List<Action> listAction = new ArrayList<>();
        listAction.add(new ActionGroup(ElanUtils.getEtreeLeafLocalBCGId(etreeTag)).buildAction(++actionKey));
        listBuckets.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
        bucketId++;
        listBuckets.addAll(getRemoteBCGroupBucketInfos(elanInfo, bucketId, interfaceInfo, etreeTag));
        BigInteger dpnId = interfaceInfo.getDpId();
        long groupId = ElanUtils.getEtreeLeafRemoteBCGId(etreeTag);
        Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
        LOG.trace("deleting the remoteBroadCast group:{}", group);
        mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
    }
}
Also used : ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) ArrayList(java.util.ArrayList) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance) BigInteger(java.math.BigInteger)

Example 20 with ActionGroup

use of org.opendaylight.genius.mdsalutil.actions.ActionGroup in project netvirt by opendaylight.

the class ExternalRoutersListener method buildSnatFlowEntityWithUpdatedVpnId.

public FlowEntity buildSnatFlowEntityWithUpdatedVpnId(BigInteger dpId, String routerName, long groupId, long changedVpnId) {
    LOG.debug("buildSnatFlowEntityWithUpdatedVpnId : called for dpId {}, routerName {} groupId {} " + "changed VPN ID {}", dpId, routerName, groupId, changedVpnId);
    List<MatchInfo> matches = new ArrayList<>();
    matches.add(MatchEthernetType.IPV4);
    matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID));
    List<ActionInfo> actionsInfo = new ArrayList<>();
    long tunnelId = NatUtil.getTunnelIdForNonNaptToNaptFlow(dataBroker, elanManager, idManager, changedVpnId, routerName);
    actionsInfo.add(new ActionSetFieldTunnelId(BigInteger.valueOf(tunnelId)));
    LOG.debug("buildSnatFlowEntityWithUpdatedVpnId : Setting the tunnel to the list of action infos {}", actionsInfo);
    actionsInfo.add(new ActionGroup(groupId));
    List<InstructionInfo> instructions = new ArrayList<>();
    instructions.add(new InstructionApplyActions(actionsInfo));
    String flowRef = getFlowRefSnat(dpId, NwConstants.PSNAT_TABLE, routerName);
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef, NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
    LOG.debug("buildSnatFlowEntityWithUpdatedVpnId : Returning SNAT Flow Entity {}", flowEntity);
    return flowEntity;
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) ActionSetFieldTunnelId(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Aggregations

ActionGroup (org.opendaylight.genius.mdsalutil.actions.ActionGroup)26 ArrayList (java.util.ArrayList)20 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)15 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)13 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)12 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)8 BigInteger (java.math.BigInteger)7 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)7 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)7 ActionSetFieldTunnelId (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId)6 BucketInfo (org.opendaylight.genius.mdsalutil.BucketInfo)5 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)5 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)5 Group (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group)5 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)3 Test (org.junit.Test)3 MatchEthernetType (org.opendaylight.genius.mdsalutil.matches.MatchEthernetType)3 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)2 InetAddress (java.net.InetAddress)2