2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.cases;
11 import java.util.Optional;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.openflowplugin.api.OFConstants;
14 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
15 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCase;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.ttl._case.SetNwTtlAction;
22 public class OfToSalSetNwTtlCase extends ConvertorCase<SetNwTtlCase, Action, ActionResponseConvertorData> {
23 public OfToSalSetNwTtlCase() {
24 super(SetNwTtlCase.class, true, OFConstants.OFP_VERSION_1_0, OFConstants.OFP_VERSION_1_3);
28 public Optional<Action> process(@Nonnull final SetNwTtlCase source, final ActionResponseConvertorData data) {
29 SetNwTtlAction setNwTtlActionFromOf = source.getSetNwTtlAction();
30 SetNwTtlActionBuilder setNwTtl = new SetNwTtlActionBuilder();
31 setNwTtl.setNwTtl(setNwTtlActionFromOf.getNwTtl());
32 return Optional.of(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtl.build()).build());