2 * Copyright (c) 2016 Cisco and/or its affiliates.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package io.fd.honeycomb.translate.v3po;
19 import static io.fd.honeycomb.translate.v3po.InterfacesWriterFactory.ACL_ID;
21 import com.google.inject.Inject;
22 import com.google.inject.name.Named;
23 import io.fd.honeycomb.translate.impl.write.GenericListWriter;
24 import io.fd.honeycomb.translate.v3po.vppclassifier.ClassifySessionWriter;
25 import io.fd.honeycomb.translate.v3po.vppclassifier.ClassifyTableWriter;
26 import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
27 import io.fd.honeycomb.translate.write.WriterFactory;
28 import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
29 import javax.annotation.Nonnull;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.VppClassifier;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.classify.table.base.attributes.ClassifySession;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTable;
33 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
34 import org.openvpp.jvpp.core.future.FutureJVppCore;
36 public final class VppClassifierHoneycombWriterFactory implements WriterFactory {
38 public static final InstanceIdentifier<ClassifyTable> CLASSIFY_TABLE_ID =
39 InstanceIdentifier.create(VppClassifier.class).child(ClassifyTable.class);
41 public static final InstanceIdentifier<ClassifySession> CLASSIFY_SESSION_ID =
42 CLASSIFY_TABLE_ID.child(ClassifySession.class);
44 private final FutureJVppCore jvpp;
45 private final VppClassifierContextManager classifyTableContext;
48 public VppClassifierHoneycombWriterFactory(@Nonnull final FutureJVppCore jvpp,
49 @Named("classify-table-context") @Nonnull final VppClassifierContextManager classifyTableContext) {
51 this.classifyTableContext = classifyTableContext;
55 public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
56 // Ordering here is: First create table, then create sessions and then assign as ACL
59 new GenericListWriter<>(CLASSIFY_TABLE_ID, new ClassifyTableWriter(jvpp, classifyTableContext)),
61 // ClassifyTableSession
63 new GenericListWriter<>(CLASSIFY_SESSION_ID, new ClassifySessionWriter(jvpp, classifyTableContext)),