Search in sources :

Example 21 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project openflowplugin by opendaylight.

the class GroupStatNotificationSupplierImpl method createNotification.

@Override
public GroupStatisticsUpdated createNotification(final GroupStatistics groupStatistics, final InstanceIdentifier<GroupStatistics> path) {
    Preconditions.checkArgument(groupStatistics != null);
    Preconditions.checkArgument(path != null);
    final GroupStatisticsUpdatedBuilder builder = new GroupStatisticsUpdatedBuilder();
    builder.setId(getNodeId(path));
    builder.setMoreReplies(Boolean.FALSE);
    // TODO : fix if it needs, but we have to ask DataStore for the NodeConnector list
    builder.setNodeConnector(Collections.<NodeConnector>emptyList());
    builder.setGroupStats(Collections.singletonList(new GroupStatsBuilder(groupStatistics).build()));
    return builder.build();
}
Also used : GroupStatisticsUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdatedBuilder) GroupStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStatsBuilder)

Example 22 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project openflowplugin by opendaylight.

the class ActionUtil method readAction.

/**
 * Deserialize OpenFlow action, using extension converter if available.
 * TODO: Remove also extension converters
 *
 * @param version  OpenFlow version
 * @param message  OpenFlow buffered message
 * @param registry deserializer registry
 * @param path     Action path
 */
public static Action readAction(short version, ByteBuf message, DeserializerRegistry registry, ActionPath path) {
    int type = message.getUnsignedShort(message.readerIndex());
    Long expId = null;
    if (type == EncodeConstants.EXPERIMENTER_VALUE) {
        expId = message.getUnsignedInt(message.readerIndex() + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    }
    try {
        final MessageCodeExperimenterKey key = new MessageCodeExperimenterKey(version, type, Action.class, expId);
        final OFDeserializer<Action> deserializer = registry.getDeserializer(key);
        return deserializer.deserialize(message);
    } catch (ClassCastException | IllegalStateException e) {
        final MessageCodeKey key = Objects.nonNull(expId) ? new ExperimenterActionDeserializerKey(version, expId) : new ActionDeserializerKey(version, type, expId);
        final OFDeserializer<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> deserializer = registry.getDeserializer(key);
        return ActionExtensionHelper.processAlienAction(deserializer.deserialize(message), OpenflowVersion.get(version), path);
    }
}
Also used : ExperimenterActionDeserializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionDeserializerKey) OFDeserializer(org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action) MessageCodeExperimenterKey(org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MessageCodeExperimenterKey) MessageCodeKey(org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey) ExperimenterActionDeserializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionDeserializerKey) ActionDeserializerKey(org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey)

Example 23 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project openflowplugin by opendaylight.

the class ActionExtensionHelper method processAlienAction.

/**
 * Processes an alien action.
 *
 * @param action openflow action
 * @param ofVersion openflow version
 * @param actionPath openflow action path
 * @return augmentation wrapper containing augmentation depending on matchPath
 */
public static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action processAlienAction(final Action action, final OpenflowVersion ofVersion, final ActionPath actionPath) {
    ConvertorActionFromOFJava<Action, ActionPath> convertor = null;
    org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action alienAction = null;
    final ExtensionConverterProvider extensionConvertorProvider = OFSessionUtil.getExtensionConvertorProvider();
    if (Objects.isNull(extensionConvertorProvider)) {
        return null;
    }
    if (action.getActionChoice() instanceof ExperimenterIdCase) {
        ExperimenterIdCase actionCase = (ExperimenterIdCase) action.getActionChoice();
        // TODO: EXTENSION PROPOSAL (action, OFJava to MD-SAL)
        ExperimenterActionSerializerKey key = new ExperimenterActionSerializerKey(ofVersion.getVersion(), actionCase.getExperimenter().getExperimenter().getValue(), actionCase.getExperimenter().getSubType());
        convertor = extensionConvertorProvider.getActionConverter(key);
    } else if (action.getActionChoice() != null) {
        ActionSerializerKey<?> key = new ActionSerializerKey(EncodeConstants.OF13_VERSION_ID, action.getActionChoice().getImplementedInterface(), null);
        convertor = extensionConvertorProvider.getActionConverter(key);
    }
    if (convertor != null) {
        alienAction = convertor.convert(action, actionPath);
    }
    return alienAction;
}
Also used : ExperimenterIdCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) ExtensionConverterProvider(org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider) ActionPath(org.opendaylight.openflowplugin.extension.api.path.ActionPath) ExperimenterActionSerializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionSerializerKey) ActionSerializerKey(org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey) ExperimenterActionSerializerKey(org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionSerializerKey)

Example 24 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project openflowplugin by opendaylight.

the class ResubmitConvertor method convert.

@Override
public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(final Action input, final ActionPath path) {
    NxActionResubmit action = ((ActionResubmit) input.getActionChoice()).getNxActionResubmit();
    NxResubmitBuilder builder = new NxResubmitBuilder();
    builder.setInPort(action.getInPort());
    builder.setTable(action.getTable());
    return resolveAction(builder.build(), path);
}
Also used : NxActionResubmit(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.resubmit.grouping.NxActionResubmit) ActionResubmit(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionResubmit) NxResubmitBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.resubmit.grouping.NxResubmitBuilder) NxActionResubmit(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.resubmit.grouping.NxActionResubmit)

Example 25 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project openflowplugin by opendaylight.

the class CtMarkConvertor method convert.

/*
     * (non-Javadoc)
     *
     * @see
     * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
     * (org.opendaylight.yangtools.yang.binding.DataContainer,
     * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
     */
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
    CtMarkCaseValue ctMarkCaseValue = ((CtMarkCaseValue) input.getMatchEntryValue());
    NxmNxCtMarkBuilder ctMarkBuilder = new NxmNxCtMarkBuilder();
    ctMarkBuilder.setCtMark(ctMarkCaseValue.getCtMarkValues().getCtMark());
    ctMarkBuilder.setMask(ctMarkCaseValue.getCtMarkValues().getMask());
    return resolveAugmentation(ctMarkBuilder.build(), path, NxmNxCtMarkKey.class);
}
Also used : CtMarkCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtMarkCaseValue) NxmNxCtMarkBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.ct.mark.grouping.NxmNxCtMarkBuilder)

Aggregations

ArrayList (java.util.ArrayList)53 Test (org.junit.Test)48 ExecutionException (java.util.concurrent.ExecutionException)26 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)21 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)20 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)19 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)19 Collections (java.util.Collections)18 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)18 ByteBuf (io.netty.buffer.ByteBuf)16 List (java.util.List)16 TransportZones (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones)16 Logger (org.slf4j.Logger)16 LoggerFactory (org.slf4j.LoggerFactory)16 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)15 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)15 AsPathBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.AsPathBuilder)15 TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)14 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)12 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)11