Search in sources :

Example 81 with Result

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.Result in project openflowplugin by opendaylight.

the class AbstractTableMultipartService method storeStatistics.

/**
 * Stores table features to operational datastore.
 */
protected void storeStatistics(List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures> result) {
    multipartWriterProvider.lookup(MultipartType.OFPMPTABLEFEATURES).ifPresent(writer -> {
        writer.write(new TableUpdatedBuilder().setTableFeatures(result).build(), false);
        getTxFacade().submitTransaction();
    });
}
Also used : TableUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.TableUpdatedBuilder)

Example 82 with Result

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.Result in project openflowplugin by opendaylight.

the class MatchConvertor method convert.

@Override
public List<MatchEntry> convert(final Match source, final VersionConvertorData data) {
    List<MatchEntry> result = new ArrayList<>();
    if (source == null) {
        return result;
    }
    final ExtensionConverterProvider extensionConvertorProvider = OFSessionUtil.getExtensionConvertorProvider();
    inPortMatch(result, source.getInPort());
    inPhyPortMatch(result, source.getInPhyPort());
    metadataMatch(result, source.getMetadata());
    ethernetMatch(result, source.getEthernetMatch());
    vlanMatch(result, source.getVlanMatch());
    ipMatch(result, source.getIpMatch());
    layer4Match(result, source.getLayer4Match(), getConvertorExecutor(), extensionConvertorProvider);
    icmpv4Match(result, source.getIcmpv4Match());
    icmpv6Match(result, source.getIcmpv6Match());
    layer3Match(result, source.getLayer3Match(), getConvertorExecutor(), extensionConvertorProvider);
    protocolMatchFields(result, source.getProtocolMatchFields());
    tunnelMatch(result, source.getTunnel());
    tcpFlagsMatch(result, source.getTcpFlagsMatch());
    /*
         * TODO: EXTENSION PROPOSAL (source, MD-SAL to OFJava)
         * - we might need version for conversion and for key
         */
    Optional<GeneralExtensionListGrouping> extensionListOpt = ExtensionResolvers.getMatchExtensionResolver().getExtension(source);
    if (extensionListOpt.isPresent()) {
        List<ExtensionList> extensionListList = extensionListOpt.get().getExtensionList();
        for (ExtensionList extensionItem : extensionListList) {
            // TODO: get real version
            ConverterExtensionKey<? extends ExtensionKey> key = new ConverterExtensionKey<>(extensionItem.getExtensionKey(), OFConstants.OFP_VERSION_1_3);
            ConvertorToOFJava<MatchEntry> convertor = extensionConvertorProvider.getConverter(key);
            if (convertor == null) {
                throw new IllegalStateException("No converter found for key: " + key.toString());
            }
            MatchEntry ofMatch = convertor.convert(extensionItem.getExtension());
            result.add(ofMatch);
        }
    }
    return result;
}
Also used : MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) ExtensionConverterProvider(org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider) ExtensionList(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.list.grouping.ExtensionList) ArrayList(java.util.ArrayList) GeneralExtensionListGrouping(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralExtensionListGrouping) ConverterExtensionKey(org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey)

Example 83 with Result

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.Result in project openflowplugin by opendaylight.

the class SalToOfSetNwDstActionV10Case method process.

@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetNwDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
    final ActionBuilder builder = new ActionBuilder();
    final Address address = source.getSetNwDstAction().getAddress();
    if (address instanceof Ipv4) {
        // FIXME use of substring should be removed and OF models should distinguish where
        // FIXME to use Ipv4Prefix (with mask) and where to use Ipv4Address (without mask)
        String ipAddress = ((Ipv4) address).getIpv4Address().getValue();
        ipAddress = ipAddress.substring(0, ipAddress.indexOf("/"));
        Ipv4Address result = new Ipv4Address(ipAddress);
        SetNwDstCaseBuilder setNwDstCaseBuilder = new SetNwDstCaseBuilder();
        SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
        setNwDstActionBuilder.setIpAddress(result);
        setNwDstCaseBuilder.setSetNwDstAction(setNwDstActionBuilder.build());
        builder.setActionChoice(setNwDstCaseBuilder.build());
    } else {
        throw new IllegalArgumentException("Address is not supported by OF-1.0: " + address.getClass().getName());
    }
    return Optional.of(builder.build());
}
Also used : ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) SetNwDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.dst._case.SetNwDstActionBuilder) Address(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) SetNwDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.dst._case.SetNwDstActionBuilder) Ipv4(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4) SetNwDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwDstCaseBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Nonnull(javax.annotation.Nonnull)

Example 84 with Result

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.Result in project openflowplugin by opendaylight.

the class SalToOfSetNwSrcActionV10Case method process.

@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetNwSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
    final ActionBuilder builder = new ActionBuilder();
    final Address address = source.getSetNwSrcAction().getAddress();
    if (address instanceof Ipv4) {
        // FIXME use of substring should be removed and OF models should distinguish where
        // FIXME to use Ipv4Prefix (with mask) and where to use Ipv4Address (without mask)
        String ipAddress = ((Ipv4) address).getIpv4Address().getValue();
        ipAddress = ipAddress.substring(0, ipAddress.indexOf("/"));
        Ipv4Address result = new Ipv4Address(ipAddress);
        SetNwSrcCaseBuilder nwSrcCaseBuilder = new SetNwSrcCaseBuilder();
        SetNwSrcActionBuilder nwSrcBuilder = new SetNwSrcActionBuilder();
        nwSrcBuilder.setIpAddress(new Ipv4Address(result));
        nwSrcCaseBuilder.setSetNwSrcAction(nwSrcBuilder.build());
        builder.setActionChoice(nwSrcCaseBuilder.build());
    } else {
        throw new IllegalArgumentException("Address is not supported by OF-1.0: " + address.getClass().getName());
    }
    return Optional.of(builder.build());
}
Also used : SetNwSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.src._case.SetNwSrcActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) Address(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Ipv4(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4) SetNwSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.src._case.SetNwSrcActionBuilder) SetNwSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwSrcCaseBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Nonnull(javax.annotation.Nonnull)

Example 85 with Result

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.Result in project openflowplugin by opendaylight.

the class GroupFeaturesService method transformToNotification.

@Override
public GroupFeaturesUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
    final int mpSize = result.size();
    Preconditions.checkArgument(mpSize == 1, "unexpected (!=1) mp-reply size received: {}", mpSize);
    GroupFeaturesUpdatedBuilder notification = new GroupFeaturesUpdatedBuilder();
    notification.setId(getDeviceInfo().getNodeId());
    notification.setMoreReplies(Boolean.FALSE);
    notification.setTransactionId(emulatedTxId);
    MultipartReplyGroupFeaturesCase caseBody = (MultipartReplyGroupFeaturesCase) result.get(0).getMultipartReplyBody();
    MultipartReplyGroupFeatures replyBody = caseBody.getMultipartReplyGroupFeatures();
    notification.setGroupTypesSupported(extractSupportedGroupTypes(replyBody.getTypes()));
    notification.setMaxGroups(replyBody.getMaxGroups());
    notification.setGroupCapabilitiesSupported(extractSupportedCapabilities(replyBody.getCapabilities()));
    notification.setActions(GroupUtil.extractGroupActionsSupportBitmap(replyBody.getActionsBitmap()));
    return notification.build();
}
Also used : MultipartReplyGroupFeaturesCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase) GroupFeaturesUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupFeaturesUpdatedBuilder) MultipartReplyGroupFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures)

Aggregations

Test (org.junit.Test)384 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)212 ArrayList (java.util.ArrayList)136 ExecutionException (java.util.concurrent.ExecutionException)134 ByteBuf (io.netty.buffer.ByteBuf)115 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)51 Collections (java.util.Collections)50 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)47 List (java.util.List)39 RouteAttributeContainer (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer)39 Statement (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.Statement)39 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)33 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)31 BigInteger (java.math.BigInteger)28 AllocateIdInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput)28 AllocateIdInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder)28 AllocateIdOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput)27 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)26 CommitInfo (org.opendaylight.mdsal.common.api.CommitInfo)25 IPV4UNICAST (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST)25