Bump upstreams for 2022.09 Chlorine
[openflowplugin.git] / extension / openflowplugin-extension-eric / src / main / java / org / opendaylight / openflowplugin / extension / vendor / eric / convertor / match / MatchUtil.java
1 /*
2  * Copyright (c) 2019 Ericsson India Global Services Pvt Ltd. 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 package org.opendaylight.openflowplugin.extension.vendor.eric.convertor.match;
9
10 import java.util.HashSet;
11 import java.util.Set;
12 import org.opendaylight.openflowplugin.extension.api.GroupingResolver;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.MatchEntryValue;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchNodesNodeTableFlow;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchNodesNodeTableFlowApplyActionsSetField;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchNotifPacketIn;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchNotifSwitchFlowRemoved;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchNotifUpdateFlowStats;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchPacketInMessage;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchRpcAddFlow;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchRpcRemoveFlow;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchRpcUpdateFlowOriginal;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchRpcUpdateFlowUpdated;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricOfIcmpv6NdOptionsTypeGrouping;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricOfIcmpv6NdReservedGrouping;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension;
30 import org.opendaylight.yangtools.yang.binding.Augmentation;
31
32 /**
33  * Match utilities.
34  */
35 public final class MatchUtil {
36     private static final Set<Class<? extends Augmentation<Extension>>> AUGMENTATIONS_OF_EXTENSION = new HashSet<>();
37     public static final GroupingResolver<EricOfIcmpv6NdReservedGrouping, Extension> ICMPV6_ND_RESERVED_RESOLVER
38             = new GroupingResolver<>(EricOfIcmpv6NdReservedGrouping.class);
39     public static final GroupingResolver<EricOfIcmpv6NdOptionsTypeGrouping, Extension> ICMPV6_ND_OPTIONS_TYPE_RESOLVER
40             = new GroupingResolver<>(EricOfIcmpv6NdOptionsTypeGrouping.class);
41
42     static {
43         AUGMENTATIONS_OF_EXTENSION.add(EricAugMatchRpcAddFlow.class);
44         AUGMENTATIONS_OF_EXTENSION.add(EricAugMatchRpcRemoveFlow.class);
45         AUGMENTATIONS_OF_EXTENSION.add(EricAugMatchRpcUpdateFlowOriginal.class);
46         AUGMENTATIONS_OF_EXTENSION.add(EricAugMatchRpcUpdateFlowUpdated.class);
47         AUGMENTATIONS_OF_EXTENSION.add(EricAugMatchNodesNodeTableFlow.class);
48         AUGMENTATIONS_OF_EXTENSION.add(EricAugMatchNotifSwitchFlowRemoved.class);
49         AUGMENTATIONS_OF_EXTENSION.add(EricAugMatchNotifPacketIn.class);
50         AUGMENTATIONS_OF_EXTENSION.add(EricAugMatchNotifUpdateFlowStats.class);
51         AUGMENTATIONS_OF_EXTENSION.add(EricAugMatchPacketInMessage.class);
52         AUGMENTATIONS_OF_EXTENSION.add(EricAugMatchNodesNodeTableFlowApplyActionsSetField.class);
53         ICMPV6_ND_RESERVED_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
54         ICMPV6_ND_OPTIONS_TYPE_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
55     }
56
57     private MatchUtil() {
58     }
59
60     public static MatchEntryBuilder createDefaultMatchEntryBuilder(final MatchField matchField,
61                                                                    final OxmClassBase oxmClass,
62                                                                    final MatchEntryValue matchEntryValue) {
63         MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
64         matchEntryBuilder.setHasMask(false);
65         matchEntryBuilder.setOxmMatchField(matchField);
66         matchEntryBuilder.setOxmClass(oxmClass);
67         matchEntryBuilder.setMatchEntryValue(matchEntryValue);
68         return matchEntryBuilder;
69     }
70 }