e5904310c5288618b29f0a8529834a91d5391fd0
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / translator / FlowRemovedV10Translator.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowplugin.impl.translator;
10
11 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
12 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
13 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorImpl;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved;
16
17 /**
18  * translate {@link FlowRemoved} message to FlowRemoved notification (omit instructions)
19  */
20 public class FlowRemovedV10Translator extends FlowRemovedTranslator {
21
22     @Override
23     protected MatchBuilder translateMatch(FlowRemoved flowRemoved, DeviceInfo deviceInfo) {
24         return MatchConvertorImpl.fromOFMatchV10ToSALMatch(flowRemoved.getMatchV10(),
25                 deviceInfo.getDatapathId(), OpenflowVersion.OF10);
26     }
27
28     /**
29      * Always returns zero because OF10 FLOW_REMOVED doesn't contain table ID.
30      *
31      * @param flowRemoved  FLOW_REMOVED message.
32      * @return  Zero.
33      */
34     @Override
35     protected Short translateTableId(FlowRemoved flowRemoved) {
36         return Short.valueOf((short)0);
37     }
38 }