ae540f94de99c10c0986894d159e3fcb4766a0d5
[honeycomb.git] / v3po / v3po2vpp / src / main / java / io / fd / honeycomb / translate / v3po / interfaces / acl / common / AceWriter.java
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package io.fd.honeycomb.translate.v3po.interfaces.acl.common;
18
19 import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
20 import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
21 import java.util.List;
22 import javax.annotation.Nonnull;
23 import javax.annotation.Nullable;
24 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
25 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.AceType;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
27
28 /**
29  * Writer responsible for translation of ietf-acl model ACEs to VPP's classify tables and sessions.
30  *
31  * @param <T> type of access control list entry
32  */
33 interface AceWriter<T extends AceType> {
34     /**
35      * @param ace            access list entry
36      * @param mode           interface mode (L2/L3)
37      * @param nextTableIndex index of the next classify table in chain
38      * @param vlanTags       number of vlan tags
39      */
40     @Nonnull
41     ClassifyAddDelTable createTable(@Nonnull final T ace, @Nullable final InterfaceMode mode, final int nextTableIndex,
42                                     final int vlanTags);
43
44     /**
45      * @param action     to be taken when packet does match the specified ace
46      * @param ace        access list entry
47      * @param mode       interface mode (L2/L3)
48      * @param tableIndex index of corresponding classify table
49      * @param vlanTags   number of vlan tags
50      */
51     @Nonnull
52     List<ClassifyAddDelSession> createSession(@Nonnull final PacketHandling action, @Nonnull T ace,
53                                               @Nullable final InterfaceMode mode, final int tableIndex, final int vlanTags);
54 }