Search in sources :

Example 1 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project netvirt by opendaylight.

the class ElanInterfaceManager method bindElanService.

private void bindElanService(long elanTag, String elanInstanceName, String interfaceName, int lportTag, WriteTransaction tx) {
    int instructionKey = 0;
    List<Instruction> instructions = new ArrayList<>();
    instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(ElanHelper.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE, ++instructionKey));
    List<Action> actions = new ArrayList<>();
    actions.add(new ActionRegLoad(0, NxmNxReg1.class, 0, ElanConstants.INTERFACE_TAG_LENGTH - 1, lportTag).buildAction());
    actions.add(new ActionRegLoad(1, ElanConstants.ELAN_REG_ID, 0, ElanConstants.ELAN_TAG_LENGTH - 1, elanTag).buildAction());
    instructions.add(MDSALUtil.buildApplyActionsInstruction(actions, ++instructionKey));
    instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.ARP_CHECK_TABLE, ++instructionKey));
    short elanServiceIndex = ServiceIndex.getIndex(NwConstants.ELAN_SERVICE_NAME, NwConstants.ELAN_SERVICE_INDEX);
    BoundServices serviceInfo = ElanUtils.getBoundServices(String.format("%s.%s.%s", "elan", elanInstanceName, interfaceName), elanServiceIndex, NwConstants.ELAN_SERVICE_INDEX, NwConstants.COOKIE_ELAN_INGRESS_TABLE, instructions);
    InstanceIdentifier<BoundServices> bindServiceId = ElanUtils.buildServiceId(interfaceName, elanServiceIndex);
    Optional<BoundServices> existingElanService = ElanUtils.read(broker, LogicalDatastoreType.CONFIGURATION, bindServiceId);
    if (!existingElanService.isPresent()) {
        tx.put(LogicalDatastoreType.CONFIGURATION, bindServiceId, serviceInfo, WriteTransaction.CREATE_MISSING_PARENTS);
    }
}
Also used : BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) ArrayList(java.util.ArrayList) ActionRegLoad(org.opendaylight.genius.mdsalutil.actions.ActionRegLoad) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)

Example 2 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project netvirt by opendaylight.

the class ElanInterfaceManager method setBCGrouponOtherDpns.

@SuppressWarnings("checkstyle:IllegalCatch")
private void setBCGrouponOtherDpns(ElanInstance elanInfo, BigInteger dpId, int elanTag, long groupId) {
    int bucketId = 0;
    ElanDpnInterfacesList elanDpns = elanUtils.getElanDpnInterfacesList(elanInfo.getElanInstanceName());
    if (elanDpns != null) {
        List<DpnInterfaces> dpnInterfaces = elanDpns.getDpnInterfaces();
        for (DpnInterfaces dpnInterface : dpnInterfaces) {
            List<Bucket> remoteListBucketInfo = new ArrayList<>();
            if (elanUtils.isDpnPresent(dpnInterface.getDpId()) && !Objects.equals(dpnInterface.getDpId(), dpId) && dpnInterface.getInterfaces() != null && !dpnInterface.getInterfaces().isEmpty()) {
                List<Action> listAction = new ArrayList<>();
                int actionKey = 0;
                listAction.add(new ActionGroup(ElanUtils.getElanLocalBCGId(elanTag)).buildAction(++actionKey));
                remoteListBucketInfo.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
                bucketId++;
                for (DpnInterfaces otherFes : dpnInterfaces) {
                    if (elanUtils.isDpnPresent(otherFes.getDpId()) && !Objects.equals(otherFes.getDpId(), dpnInterface.getDpId()) && otherFes.getInterfaces() != null && !otherFes.getInterfaces().isEmpty()) {
                        try {
                            List<Action> remoteListActionInfo = elanItmUtils.getInternalTunnelItmEgressAction(dpnInterface.getDpId(), otherFes.getDpId(), elanUtils.isOpenstackVniSemanticsEnforced() ? elanUtils.getVxlanSegmentationId(elanInfo) : elanTag);
                            if (!remoteListActionInfo.isEmpty()) {
                                remoteListBucketInfo.add(MDSALUtil.buildBucket(remoteListActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
                                bucketId++;
                            }
                        } catch (Exception ex) {
                            LOG.error("setElanBCGrouponOtherDpns failed due to Exception caught; " + "Logical Group Interface not found between source Dpn - {}, " + "destination Dpn - {} ", dpnInterface.getDpId(), otherFes.getDpId(), ex);
                            return;
                        }
                    }
                }
                List<Bucket> elanL2GwDevicesBuckets = elanL2GatewayMulticastUtils.getRemoteBCGroupBucketsOfElanL2GwDevices(elanInfo, dpnInterface.getDpId(), bucketId);
                remoteListBucketInfo.addAll(elanL2GwDevicesBuckets);
                if (remoteListBucketInfo.isEmpty()) {
                    LOG.debug("No ITM is present on Dpn - {} ", dpnInterface.getDpId());
                    continue;
                }
                Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(remoteListBucketInfo));
                LOG.trace("Installing remote bc group {} on dpnId {}", group, dpnInterface.getDpId());
                mdsalManager.syncInstallGroup(dpnInterface.getDpId(), group);
            }
        }
        try {
            Thread.sleep(WAIT_TIME_FOR_SYNC_INSTALL);
        } catch (InterruptedException e1) {
            LOG.warn("Error while waiting for remote BC group on other DPNs for ELAN {} to install", elanInfo);
        }
    }
}
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) ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) ArrayList(java.util.ArrayList) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) ElanException(org.opendaylight.netvirt.elan.ElanException) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup)

Example 3 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project netvirt by opendaylight.

the class ElanInterfaceManager method createDropBucket.

private void createDropBucket(List<Bucket> listBucket) {
    List<Action> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionDrop().buildAction());
    Bucket dropBucket = MDSALUtil.buildBucket(actionsInfos, MDSALUtil.GROUP_WEIGHT, 0, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP);
    listBucket.add(dropBucket);
}
Also used : 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) ArrayList(java.util.ArrayList) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop)

Example 4 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project netvirt by opendaylight.

the class OpenFlow13Utils method createActionNxLoadNsi.

public static Action createActionNxLoadNsi(short value, int order) {
    ActionBuilder ab = createActionBuilder(order);
    ab.setAction(nxLoadRegAction(new DstNxNsiCaseBuilder().setNxNsiDst(Boolean.TRUE).build(), BigInteger.valueOf(value), 7, false));
    return ab.build();
}
Also used : OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder) DstNxNsiCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNsiCaseBuilder)

Example 5 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project netvirt by opendaylight.

the class OpenFlow13Utils method createActionNxLoadNshMdtype.

public static Action createActionNxLoadNshMdtype(short value, int order) {
    ActionBuilder ab = createActionBuilder(order);
    ab.setAction(nxLoadRegAction(new DstNxNshMdtypeCaseBuilder().setNxNshMdtype(Boolean.TRUE).build(), BigInteger.valueOf(value), 7, false));
    return ab.build();
}
Also used : OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder) DstNxNshMdtypeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshMdtypeCaseBuilder)

Aggregations

ArrayList (java.util.ArrayList)245 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)204 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)176 Test (org.junit.Test)127 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder)127 GroupActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder)126 PushMplsActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder)121 PushPbbActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder)121 PopVlanActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder)110 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)108 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)107 PopMplsActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder)105 PopPbbActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder)105 PushVlanActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder)105 InstructionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)105 SetVlanIdActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder)98 ApplyActionsCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder)98 ActionKey (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey)97 InstructionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder)97 ApplyActionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder)96