summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-12-06 07:56:27 +0100
committerJan Srnicek <jsrnicek@cisco.com>2016-12-07 09:46:42 +0000
commit304258199c928cd73baced4b6c62614b469c272e (patch)
tree58d5a72e42e04960e344ec1a97e6d768dc59667a /v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory
parentfb7dd3797b431d2a14c574c712fdf43bb9acb7a3 (diff)
HONEYCOMB-304: provide separate guice module for ietf-acl implementation
Current IETF-ACL implementation is using vpp-classfier. In the future, acl implementation based on acl plugin is going to be supported. Current implementation is going to be deprecated, then removed. In order to switch between acl implementations, ietf-acl configuration needs separate guice module. After fixing nested augmentation support (HONEYCOMB-302), current implementation can be moved to separate hc2vpp module (HONEYCOMB-308). Change-Id: I1668c274c03f9a750654cb0f96ec328af09f89f5 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/AclWriterFactory.java58
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/EgressIetfAClWriterProvider.java39
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/IngressIetfAClWriterProvider.java39
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesClassifierIetfAclWriterFactory.java81
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesStateReaderFactory.java199
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesWriterFactory.java225
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubInterfacesClassifierIetfAclWriterFactory.java83
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceAugmentationWriterFactory.java117
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceStateAugmentationReaderFactory.java118
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppClassifierHoneycombWriterFactory.java64
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppClassifierReaderFactory.java60
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppHoneycombWriterFactory.java82
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppStateHoneycombReaderFactory.java94
13 files changed, 1259 insertions, 0 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/AclWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/AclWriterFactory.java
new file mode 100644
index 000000000..2b72cd058
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/AclWriterFactory.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import static io.fd.hc2vpp.v3po.factory.InterfacesClassifierIetfAclWriterFactory.IETF_ACL_ID;
+import static io.fd.hc2vpp.v3po.factory.SubInterfacesClassifierIetfAclWriterFactory.SUBIF_IETF_ACL_ID;
+
+import com.google.common.collect.Sets;
+import io.fd.honeycomb.translate.impl.write.GenericListWriter;
+import io.fd.hc2vpp.v3po.interfaces.acl.IetfAclWriter;
+import io.fd.honeycomb.translate.write.WriterFactory;
+import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AccessLists;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.AccessListEntries;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.Ace;
+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;
+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;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.DestinationPortRange;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.SourcePortRange;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public final class AclWriterFactory implements WriterFactory {
+
+ public static final InstanceIdentifier<Acl> ACL_ID =
+ InstanceIdentifier.create(AccessLists.class).child(Acl.class);
+
+ @Override
+ public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
+
+ final InstanceIdentifier<Acl> aclIdRelative = InstanceIdentifier.create(Acl.class);
+
+ final InstanceIdentifier<Ace> aceId = aclIdRelative.child(AccessListEntries.class).child(Ace.class);
+ final InstanceIdentifier<Actions> actionsId = aceId.child(Actions.class);
+ final InstanceIdentifier<Matches> matchesId = aceId.child(Matches.class);
+ final InstanceIdentifier<SourcePortRange> srcPortId = matchesId.child((Class)SourcePortRange.class);
+ final InstanceIdentifier<DestinationPortRange> dstPortId = matchesId.child((Class)DestinationPortRange.class);
+
+ registry.subtreeAddBefore(Sets.newHashSet(aceId, actionsId, matchesId, srcPortId, dstPortId),
+ new GenericListWriter<>(ACL_ID, new IetfAclWriter()),
+ Sets.newHashSet(IETF_ACL_ID, SUBIF_IETF_ACL_ID));
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/EgressIetfAClWriterProvider.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/EgressIetfAClWriterProvider.java
new file mode 100644
index 000000000..9ccc1d8e5
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/EgressIetfAClWriterProvider.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import io.fd.hc2vpp.v3po.interfaces.acl.egress.EgressIetfAclWriter;
+import io.fd.hc2vpp.v3po.interfaces.acl.common.AclTableContextManagerImpl;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.MappingTable;
+
+public class EgressIetfAClWriterProvider implements Provider<EgressIetfAclWriter> {
+
+ private final FutureJVppCore jvpp;
+
+ @Inject
+ public EgressIetfAClWriterProvider(final FutureJVppCore jvpp) {
+ this.jvpp = jvpp;
+ }
+
+ @Override
+ public EgressIetfAclWriter get() {
+ return new EgressIetfAclWriter(jvpp, new AclTableContextManagerImpl(MappingTable.Direction.Egress));
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/IngressIetfAClWriterProvider.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/IngressIetfAClWriterProvider.java
new file mode 100644
index 000000000..be6a2a3fb
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/IngressIetfAClWriterProvider.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import io.fd.hc2vpp.v3po.interfaces.acl.common.AclTableContextManagerImpl;
+import io.fd.hc2vpp.v3po.interfaces.acl.ingress.IngressIetfAclWriter;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.MappingTable;
+
+public class IngressIetfAClWriterProvider implements Provider<IngressIetfAclWriter> {
+
+ private final FutureJVppCore jvpp;
+
+ @Inject
+ public IngressIetfAClWriterProvider(final FutureJVppCore jvpp) {
+ this.jvpp = jvpp;
+ }
+
+ @Override
+ public IngressIetfAclWriter get() {
+ return new IngressIetfAclWriter(jvpp, new AclTableContextManagerImpl(MappingTable.Direction.Ingress));
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesClassifierIetfAclWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesClassifierIetfAclWriterFactory.java
new file mode 100644
index 000000000..b463e47c6
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesClassifierIetfAclWriterFactory.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import com.google.common.collect.Sets;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.v3po.interfaces.acl.egress.EgressIetfAclWriter;
+import io.fd.hc2vpp.v3po.interfaces.acl.ingress.IngressIetfAclWriter;
+import io.fd.honeycomb.translate.impl.write.GenericWriter;
+import io.fd.honeycomb.translate.write.WriterFactory;
+import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.IetfAcl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Egress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Ingress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.ietf.acl.base.attributes.AccessLists;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.ietf.acl.base.attributes.access.lists.Acl;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public final class InterfacesClassifierIetfAclWriterFactory implements WriterFactory {
+
+ public static final InstanceIdentifier<Interface> IFC_ID =
+ InstanceIdentifier.create(Interfaces.class).child(Interface.class);
+ public static final InstanceIdentifier<VppInterfaceAugmentation> VPP_IFC_AUG_ID =
+ IFC_ID.augmentation(VppInterfaceAugmentation.class);
+ public static final InstanceIdentifier<IetfAcl> IETF_ACL_ID = VPP_IFC_AUG_ID.child(IetfAcl.class);
+ public static final InstanceIdentifier<Ingress> INGRESS_IETF_ACL_ID = IETF_ACL_ID.child(Ingress.class);
+ public static final InstanceIdentifier<Egress> EGRESS_IETF_ACL_ID = IETF_ACL_ID.child(Egress.class);
+
+ private final IngressIetfAclWriter ingressAclWriter;
+ private final EgressIetfAclWriter egressAclWriter;
+ private final NamingContext ifcNamingContext;
+
+ @Inject
+ public InterfacesClassifierIetfAclWriterFactory(final IngressIetfAclWriter ingressAclWriter,
+ final EgressIetfAclWriter egressAclWriter,
+ @Named("interface-context") final NamingContext interfaceContextDependency) {
+ this.ingressAclWriter = ingressAclWriter;
+ this.egressAclWriter = egressAclWriter;
+ this.ifcNamingContext = interfaceContextDependency;
+ }
+
+ @Override
+ public void init(final ModifiableWriterRegistryBuilder registry) {
+ // Ingress IETF-ACL, also handles AccessLists and Acl:
+ final InstanceIdentifier<AccessLists> accessListsIdIngress =
+ InstanceIdentifier.create(Ingress.class).child(AccessLists.class);
+ final InstanceIdentifier<?> aclIdIngress = accessListsIdIngress.child(Acl.class);
+ registry.subtreeAdd(
+ Sets.newHashSet(accessListsIdIngress, aclIdIngress),
+ new GenericWriter<>(INGRESS_IETF_ACL_ID,
+ new io.fd.hc2vpp.v3po.interfaces.acl.ingress.IetfAclCustomizer(ingressAclWriter, ifcNamingContext)));
+
+ // Ingress IETF-ACL, also handles AccessLists and Acl:
+ final InstanceIdentifier<AccessLists> accessListsIdEgress =
+ InstanceIdentifier.create(Egress.class).child(AccessLists.class);
+ final InstanceIdentifier<?> aclIdEgress = accessListsIdEgress.child(Acl.class);
+ registry.subtreeAdd(
+ Sets.newHashSet(accessListsIdEgress, aclIdEgress),
+ new GenericWriter<>(EGRESS_IETF_ACL_ID,
+ new io.fd.hc2vpp.v3po.interfaces.acl.egress.IetfAclCustomizer(egressAclWriter, ifcNamingContext)));
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesStateReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesStateReaderFactory.java
new file mode 100644
index 000000000..66777d93f
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesStateReaderFactory.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import com.google.common.collect.Sets;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.v3po.DisabledInterfacesManager;
+import io.fd.hc2vpp.v3po.interfacesstate.EthernetCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.GreCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.InterfaceCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.L2Customizer;
+import io.fd.hc2vpp.v3po.interfacesstate.ProxyArpCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.TapCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.VhostUserCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.VxlanCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.VxlanGpeCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.acl.ingress.AclCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.ip.Ipv4AddressCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.ip.Ipv4Customizer;
+import io.fd.hc2vpp.v3po.interfacesstate.ip.Ipv4NeighbourCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.ip.Ipv6Customizer;
+import io.fd.hc2vpp.v3po.interfacesstate.pbb.PbbRewriteStateCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.span.MirroredInterfacesCustomizer;
+import io.fd.hc2vpp.v3po.vppclassifier.VppClassifierContextManager;
+import io.fd.honeycomb.translate.impl.read.GenericInitListReader;
+import io.fd.honeycomb.translate.impl.read.GenericInitReader;
+import io.fd.honeycomb.translate.impl.read.GenericListReader;
+import io.fd.honeycomb.translate.impl.read.GenericReader;
+import io.fd.honeycomb.translate.read.ReaderFactory;
+import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesStateBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Neighbor;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.AclBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Ethernet;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Gre;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.L2;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.ProxyArp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Span;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.SpanBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Tap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VhostUser;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Vxlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VxlanGpe;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.acl.Ingress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.span.attributes.MirroredInterfaces;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.Ip4Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.Ip6Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.L2Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.PbbRewriteStateInterfaceAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.PbbRewriteStateInterfaceAugmentationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.interfaces.state._interface.PbbRewriteState;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public final class InterfacesStateReaderFactory implements ReaderFactory {
+
+ private final NamingContext ifcNamingCtx;
+ private final NamingContext bdNamingCtx;
+ private final VppClassifierContextManager classifyContext;
+ private final DisabledInterfacesManager ifcDisableContext;
+ private final FutureJVppCore jvpp;
+
+ static final InstanceIdentifier<InterfacesState> IFC_STATE_ID =
+ InstanceIdentifier.create(InterfacesState.class);
+ static final InstanceIdentifier<Interface> IFC_ID = IFC_STATE_ID.child(Interface.class);
+
+ @Inject
+ public InterfacesStateReaderFactory(final FutureJVppCore jvpp,
+ @Named("interface-context") final NamingContext ifcNamingCtx,
+ @Named("bridge-domain-context") final NamingContext bdNamingCtx,
+ @Named("classify-table-context") final VppClassifierContextManager classifyContext,
+ final DisabledInterfacesManager ifcDisableContext) {
+ this.jvpp = jvpp;
+ this.ifcNamingCtx = ifcNamingCtx;
+ this.bdNamingCtx = bdNamingCtx;
+ this.classifyContext = classifyContext;
+ this.ifcDisableContext = ifcDisableContext;
+ }
+
+ @Override
+ public void init(final ModifiableReaderRegistryBuilder registry) {
+ // InterfacesState(Structural)
+ registry.addStructuralReader(IFC_STATE_ID, InterfacesStateBuilder.class);
+ // Interface
+ registry.add(new GenericInitListReader<>(IFC_ID, new InterfaceCustomizer(jvpp, ifcNamingCtx, ifcDisableContext)));
+
+ // v3po.yang
+ initVppIfcAugmentationReaders(registry, IFC_ID);
+ // ietf-ip.yang
+ initInterface2AugmentationReaders(registry, IFC_ID);
+ // vpp-vlan.yang
+ new SubinterfaceStateAugmentationReaderFactory(jvpp, ifcNamingCtx, bdNamingCtx, classifyContext).init(registry);
+ //vpp-pbb.yang
+ initPbbRewriteAugmentation(registry, IFC_ID);
+ }
+
+ private void initInterface2AugmentationReaders(final ModifiableReaderRegistryBuilder registry,
+ final InstanceIdentifier<Interface> ifcId) {
+ // Interface2Augmentation(Structural)
+ final InstanceIdentifier<Interface2> ifc2AugId = ifcId.augmentation(Interface2.class);
+ registry.addStructuralReader(ifc2AugId, Interface2Builder.class);
+ // Ipv4
+ final InstanceIdentifier<Ipv4> ipv4Id = ifc2AugId.child(Ipv4.class);
+ registry.add(new GenericReader<>(ipv4Id, new Ipv4Customizer(jvpp)));
+ // Address
+ final InstanceIdentifier<Address> ipv4AddrId = ipv4Id.child(Address.class);
+ registry.add(new GenericInitListReader<>(ipv4AddrId, new Ipv4AddressCustomizer(jvpp, ifcNamingCtx)));
+ // Neighbor
+ final InstanceIdentifier<Neighbor> neighborId = ipv4Id.child(Neighbor.class);
+ registry.add(new GenericListReader<>(neighborId, new Ipv4NeighbourCustomizer(jvpp)));
+ // Ipv6
+ final InstanceIdentifier<Ipv6> ipv6Id = ifc2AugId.child(Ipv6.class);
+ registry.add(new GenericReader<>(ipv6Id, new Ipv6Customizer(jvpp, ifcNamingCtx)));
+ }
+
+ private void initVppIfcAugmentationReaders(final ModifiableReaderRegistryBuilder registry,
+ final InstanceIdentifier<Interface> ifcId) {
+ // VppInterfaceStateAugmentation
+ final InstanceIdentifier<VppInterfaceStateAugmentation> vppIfcAugId =
+ ifcId.augmentation(VppInterfaceStateAugmentation.class);
+ registry.addStructuralReader(vppIfcAugId, VppInterfaceStateAugmentationBuilder.class);
+ // Ethernet
+ registry.add(new GenericInitReader<>(vppIfcAugId.child(Ethernet.class),
+ new EthernetCustomizer(jvpp, ifcNamingCtx)));
+ // Tap
+ registry.add(new GenericInitReader<>(vppIfcAugId.child(Tap.class), new TapCustomizer(jvpp, ifcNamingCtx)));
+ // VhostUser
+ registry.add(new GenericInitReader<>(vppIfcAugId.child(VhostUser.class),
+ new VhostUserCustomizer(jvpp, ifcNamingCtx)));
+ // Vxlan
+ registry.add(new GenericInitReader<>(vppIfcAugId.child(Vxlan.class), new VxlanCustomizer(jvpp, ifcNamingCtx)));
+ // VxlanGpe
+ registry.add(new GenericInitReader<>(vppIfcAugId.child(VxlanGpe.class),
+ new VxlanGpeCustomizer(jvpp, ifcNamingCtx)));
+ // Gre
+ registry.add(new GenericInitReader<>(vppIfcAugId.child(Gre.class), new GreCustomizer(jvpp, ifcNamingCtx)));
+ // L2
+ registry.add(new GenericInitReader<>(vppIfcAugId.child(L2.class),
+ new L2Customizer(jvpp, ifcNamingCtx, bdNamingCtx)));
+
+ // Acl(Structural)
+ final InstanceIdentifier<Acl> aclIid = vppIfcAugId.child(Acl.class);
+ registry.addStructuralReader(aclIid, AclBuilder.class);
+ // Ingress(Subtree)
+ final InstanceIdentifier<Ingress> ingressIdRelative = InstanceIdentifier.create(Ingress.class);
+ registry.subtreeAdd(
+ Sets.newHashSet(ingressIdRelative.child(L2Acl.class), ingressIdRelative.child(Ip4Acl.class),
+ ingressIdRelative.child(Ip6Acl.class)),
+ new GenericInitReader<>(aclIid.child(Ingress.class),
+ new AclCustomizer(jvpp, ifcNamingCtx, classifyContext)));
+
+ // Proxy ARP
+ registry.add(new GenericReader<>(vppIfcAugId.child(ProxyArp.class), new ProxyArpCustomizer(jvpp,
+ ifcNamingCtx)));
+
+ // Span
+ final InstanceIdentifier<Span> spanId = vppIfcAugId.child(Span.class);
+ registry.addStructuralReader(spanId, SpanBuilder.class);
+ // MirroredInterfaces
+ registry.add(new GenericInitReader<>(spanId.child(MirroredInterfaces.class),
+ new MirroredInterfacesCustomizer(jvpp, ifcNamingCtx)));
+ }
+
+ private void initPbbRewriteAugmentation(final ModifiableReaderRegistryBuilder registry,
+ final InstanceIdentifier<Interface> ifcId) {
+ registry.addStructuralReader(ifcId.augmentation(PbbRewriteStateInterfaceAugmentation.class),
+ PbbRewriteStateInterfaceAugmentationBuilder.class);
+
+ registry.add(new GenericReader<>(ifcId.augmentation(PbbRewriteStateInterfaceAugmentation.class).child(
+ PbbRewriteState.class), new PbbRewriteStateCustomizer(jvpp)));
+ }
+
+}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesWriterFactory.java
new file mode 100644
index 000000000..fbf741fba
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesWriterFactory.java
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import static io.fd.hc2vpp.v3po.factory.VppClassifierHoneycombWriterFactory.CLASSIFY_SESSION_ID;
+import static io.fd.hc2vpp.v3po.factory.VppClassifierHoneycombWriterFactory.CLASSIFY_TABLE_ID;
+
+import com.google.common.collect.Sets;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.v3po.DisabledInterfacesManager;
+import io.fd.hc2vpp.v3po.interfaces.EthernetCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.GreCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.InterfaceCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.L2Customizer;
+import io.fd.hc2vpp.v3po.interfaces.LoopbackCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.ProxyArpCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.RoutingCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.TapCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.VhostUserCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.VxlanCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.VxlanGpeCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.acl.egress.EgressIetfAclWriter;
+import io.fd.hc2vpp.v3po.interfaces.acl.ingress.AclCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.acl.ingress.IngressIetfAclWriter;
+import io.fd.hc2vpp.v3po.interfaces.ip.Ipv4AddressCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.ip.Ipv4Customizer;
+import io.fd.hc2vpp.v3po.interfaces.ip.Ipv4NeighbourCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.ip.Ipv6Customizer;
+import io.fd.hc2vpp.v3po.interfaces.pbb.PbbRewriteCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.span.MirroredInterfacesCustomizer;
+import io.fd.hc2vpp.v3po.vppclassifier.VppClassifierContextManager;
+import io.fd.honeycomb.translate.impl.write.GenericListWriter;
+import io.fd.honeycomb.translate.impl.write.GenericWriter;
+import io.fd.honeycomb.translate.write.WriterFactory;
+import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.Set;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Neighbor;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Ethernet;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Gre;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.L2;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Loopback;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ProxyArp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Routing;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Span;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Tap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VhostUser;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Vxlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VxlanGpe;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.acl.Ingress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.span.attributes.MirroredInterfaces;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.Ip4Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.Ip6Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.L2Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.PbbRewriteInterfaceAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.interfaces._interface.PbbRewrite;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public final class InterfacesWriterFactory implements WriterFactory {
+
+ public static final InstanceIdentifier<Interface> IFC_ID =
+ InstanceIdentifier.create(Interfaces.class).child(Interface.class);
+ public static final InstanceIdentifier<VppInterfaceAugmentation> VPP_IFC_AUG_ID =
+ IFC_ID.augmentation(VppInterfaceAugmentation.class);
+ public static final InstanceIdentifier<Acl> ACL_ID = VPP_IFC_AUG_ID.child(Acl.class);
+ public static final InstanceIdentifier<Ingress> INGRESS_ACL_ID = ACL_ID.child(Ingress.class);
+ public static final InstanceIdentifier<L2> L2_ID = VPP_IFC_AUG_ID.child(L2.class);
+
+ private final FutureJVppCore jvpp;
+ private final IngressIetfAclWriter ingressAclWriter;
+ private final EgressIetfAclWriter egressAclWriter;
+ private final NamingContext bdNamingContext;
+ private final NamingContext ifcNamingContext;
+ private final VppClassifierContextManager classifyTableContext;
+ private final DisabledInterfacesManager ifcDisableContext;
+
+ @Inject
+ public InterfacesWriterFactory(final FutureJVppCore vppJvppIfcDependency,
+ final IngressIetfAclWriter ingressAclWriter,
+ final EgressIetfAclWriter egressAclWriter,
+ @Named("bridge-domain-context") final NamingContext bridgeDomainContextDependency,
+ @Named("interface-context") final NamingContext interfaceContextDependency,
+ @Named("classify-table-context") final VppClassifierContextManager classifyTableContext,
+ final DisabledInterfacesManager ifcDisableContext) {
+ this.jvpp = vppJvppIfcDependency;
+ this.ingressAclWriter = ingressAclWriter;
+ this.egressAclWriter = egressAclWriter;
+ this.bdNamingContext = bridgeDomainContextDependency;
+ this.ifcNamingContext = interfaceContextDependency;
+ this.ifcDisableContext = ifcDisableContext;
+ this.classifyTableContext = classifyTableContext;
+ }
+
+ @Override
+ public void init(final ModifiableWriterRegistryBuilder registry) {
+ // Interfaces
+ // Interface =
+ registry.add(new GenericListWriter<>(IFC_ID, new InterfaceCustomizer(jvpp, ifcNamingContext)));
+ // VppInterfaceAugmentation
+ addVppInterfaceAgmentationWriters(IFC_ID, registry);
+ // Interface1 (ietf-ip augmentation)
+ addInterface1AugmentationWriters(IFC_ID, registry);
+ // SubinterfaceAugmentation
+ new SubinterfaceAugmentationWriterFactory(jvpp, ifcNamingContext, bdNamingContext,
+ classifyTableContext).init(registry);
+
+ addPbbAugmentationWriters(IFC_ID, registry);
+ }
+
+ private void addInterface1AugmentationWriters(final InstanceIdentifier<Interface> ifcId,
+ final ModifiableWriterRegistryBuilder registry) {
+ final InstanceIdentifier<Interface1> ifc1AugId = ifcId.augmentation(Interface1.class);
+ // Ipv6(after interface) =
+ registry.addAfter(new GenericWriter<>(ifc1AugId.child(Ipv6.class), new Ipv6Customizer(jvpp)),
+ ifcId);
+ // Ipv4(after interface)
+ final InstanceIdentifier<Ipv4> ipv4Id = ifc1AugId.child(Ipv4.class);
+ registry.addAfter(new GenericWriter<>(ipv4Id, new Ipv4Customizer(jvpp)),
+ ifcId);
+ // Address(after Ipv4) =
+ final InstanceIdentifier<Address> ipv4AddressId = ipv4Id.child(Address.class);
+ registry.addAfter(new GenericListWriter<>(ipv4AddressId, new Ipv4AddressCustomizer(jvpp, ifcNamingContext)),
+ ipv4Id);
+ // Neighbor(after ipv4Address)
+ registry.addAfter(new GenericListWriter<>(ipv4Id.child(Neighbor.class), new Ipv4NeighbourCustomizer(jvpp,
+ ifcNamingContext)),
+ ipv4AddressId);
+ }
+
+ private void addVppInterfaceAgmentationWriters(final InstanceIdentifier<Interface> ifcId,
+ final ModifiableWriterRegistryBuilder registry) {
+ // VhostUser(Needs to be executed before Interface customizer) =
+ final InstanceIdentifier<VhostUser> vhostId = VPP_IFC_AUG_ID.child(VhostUser.class);
+ registry.addBefore(new GenericWriter<>(vhostId, new VhostUserCustomizer(jvpp, ifcNamingContext)),
+ ifcId);
+ // Vxlan(Needs to be executed before Interface customizer) =
+ final InstanceIdentifier<Vxlan> vxlanId = VPP_IFC_AUG_ID.child(Vxlan.class);
+ registry.addBefore(new GenericWriter<>(vxlanId, new VxlanCustomizer(jvpp, ifcNamingContext, ifcDisableContext)),
+ ifcId);
+ // VxlanGpe(Needs to be executed before Interface customizer) =
+ final InstanceIdentifier<VxlanGpe> vxlanGpeId = VPP_IFC_AUG_ID.child(VxlanGpe.class);
+ registry.addBefore(new GenericWriter<>(vxlanGpeId,
+ new VxlanGpeCustomizer(jvpp, ifcNamingContext, ifcDisableContext)), ifcId);
+ // Tap(Needs to be executed before Interface customizer) =
+ final InstanceIdentifier<Tap> tapId = VPP_IFC_AUG_ID.child(Tap.class);
+ registry.addBefore(new GenericWriter<>(tapId, new TapCustomizer(jvpp, ifcNamingContext)),
+ ifcId);
+ // Loopback(Needs to be executed before Interface customizer) =
+ final InstanceIdentifier<Loopback> loopbackId = VPP_IFC_AUG_ID.child(Loopback.class);
+ registry.addBefore(new GenericWriter<>(loopbackId, new LoopbackCustomizer(jvpp, ifcNamingContext)),
+ ifcId);
+
+ // Gre(Needs to be executed before Interface customizer) =
+ final InstanceIdentifier<Gre> greId = VPP_IFC_AUG_ID.child(Gre.class);
+ registry.addBefore(new GenericWriter<>(greId, new GreCustomizer(jvpp, ifcNamingContext)),
+ ifcId);
+
+
+ final Set<InstanceIdentifier<?>> specificIfcTypes = Sets.newHashSet(vhostId, vxlanGpeId, vxlanGpeId, tapId);
+
+ // Ethernet =
+ registry.add(new GenericWriter<>(VPP_IFC_AUG_ID.child(Ethernet.class), new EthernetCustomizer(jvpp)));
+ // Routing(Execute only after specific interface customizers) =
+ registry.addAfter(
+ new GenericWriter<>(VPP_IFC_AUG_ID.child(Routing.class), new RoutingCustomizer(jvpp, ifcNamingContext)),
+ specificIfcTypes);
+ // L2(Execute only after subinterface (and all other ifc types) =
+ registry.addAfter(new GenericWriter<>(L2_ID, new L2Customizer(jvpp, ifcNamingContext, bdNamingContext)),
+ SubinterfaceAugmentationWriterFactory.SUB_IFC_ID);
+ // Proxy Arp (execute after specific interface customizers)
+ registry.addAfter(
+ new GenericWriter<>(VPP_IFC_AUG_ID.child(ProxyArp.class), new ProxyArpCustomizer(jvpp)),
+ specificIfcTypes);
+ // Ingress (execute after classify table and session writers)
+ // also handles L2Acl, Ip4Acl and Ip6Acl:
+ final InstanceIdentifier<Ingress> ingressId = InstanceIdentifier.create(Ingress.class);
+ registry
+ .subtreeAddAfter(
+ Sets.newHashSet(ingressId.child(L2Acl.class), ingressId.child(Ip4Acl.class),
+ ingressId.child(Ip6Acl.class)),
+ new GenericWriter<>(INGRESS_ACL_ID,
+ new AclCustomizer(jvpp, ifcNamingContext, classifyTableContext)),
+ Sets.newHashSet(CLASSIFY_TABLE_ID, CLASSIFY_SESSION_ID));
+
+ // Span writers
+ // Mirrored interfaces
+ final InstanceIdentifier<MirroredInterfaces> mirroredIfcsId = VPP_IFC_AUG_ID
+ .child(Span.class)
+ .child(MirroredInterfaces.class);
+ registry.addAfter(new GenericWriter<>(mirroredIfcsId, new MirroredInterfacesCustomizer(jvpp, ifcNamingContext)),
+ ifcId);
+ }
+
+ private void addPbbAugmentationWriters(final InstanceIdentifier<Interface> ifcId,
+ final ModifiableWriterRegistryBuilder registry) {
+ final InstanceIdentifier<PbbRewrite> pbbRewriteId =
+ ifcId.augmentation(PbbRewriteInterfaceAugmentation.class).child(PbbRewrite.class);
+
+ registry.add(new GenericWriter<>(pbbRewriteId, new PbbRewriteCustomizer(jvpp, ifcNamingContext)));
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubInterfacesClassifierIetfAclWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubInterfacesClassifierIetfAclWriterFactory.java
new file mode 100644
index 000000000..5748f081b
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubInterfacesClassifierIetfAclWriterFactory.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import com.google.common.collect.Sets;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.v3po.interfaces.acl.egress.EgressIetfAclWriter;
+import io.fd.hc2vpp.v3po.interfaces.acl.ingress.IngressIetfAclWriter;
+import io.fd.hc2vpp.v3po.interfaces.acl.ingress.SubInterfaceIetfAclCustomizer;
+import io.fd.honeycomb.translate.impl.write.GenericWriter;
+import io.fd.honeycomb.translate.write.WriterFactory;
+import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.ietf.acl.base.attributes.AccessLists;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.ietf.acl.base.attributes.access.lists.Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.SubInterfaces;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.IetfAcl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Egress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Ingress;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public final class SubInterfacesClassifierIetfAclWriterFactory implements WriterFactory {
+
+ public static final InstanceIdentifier<SubinterfaceAugmentation> SUB_IFC_AUG_ID =
+ InterfacesWriterFactory.IFC_ID.augmentation(SubinterfaceAugmentation.class);
+ public static final InstanceIdentifier<SubInterface> SUB_IFC_ID =
+ SUB_IFC_AUG_ID.child(SubInterfaces.class).child(SubInterface.class);
+ public static final InstanceIdentifier<IetfAcl> SUBIF_IETF_ACL_ID = SUB_IFC_ID.child(IetfAcl.class);
+ public static final InstanceIdentifier<Ingress> SUBIF_INGRESS_IETF_ACL_ID = SUBIF_IETF_ACL_ID.child(Ingress.class);
+ public static final InstanceIdentifier<Egress> SUBIF_EGRESS_IETF_ACL_ID = SUBIF_IETF_ACL_ID.child(Egress.class);
+
+ private final IngressIetfAclWriter ingressAclWriter;
+ private final EgressIetfAclWriter egressAclWriter;
+ private final NamingContext ifcContext;
+
+ @Inject
+ public SubInterfacesClassifierIetfAclWriterFactory(final IngressIetfAclWriter ingressAclWriter,
+ final EgressIetfAclWriter egressAclWriter,
+ @Named("interface-context") final NamingContext ifcContext) {
+ this.ingressAclWriter = ingressAclWriter;
+ this.egressAclWriter = egressAclWriter;
+ this.ifcContext = ifcContext;
+ }
+
+ @Override
+ public void init(final ModifiableWriterRegistryBuilder registry) {
+ // Ingress IETF-ACL, also handles AccessLists and Acl:
+ final InstanceIdentifier<AccessLists> accessListsIdIngress =
+ InstanceIdentifier.create(Ingress.class).child(AccessLists.class);
+ final InstanceIdentifier<?> aclIdIngress = accessListsIdIngress.child(Acl.class);
+ registry.subtreeAdd(
+ Sets.newHashSet(accessListsIdIngress, aclIdIngress),
+ new GenericWriter<>(SUBIF_INGRESS_IETF_ACL_ID,
+ new SubInterfaceIetfAclCustomizer(ingressAclWriter, ifcContext)));
+
+ // Egress IETF-ACL, also handles AccessLists and Acl:
+ final InstanceIdentifier<AccessLists> accessListsIdEgress =
+ InstanceIdentifier.create(Egress.class).child(AccessLists.class);
+ final InstanceIdentifier<?> aclIdEgress = accessListsIdEgress.child(Acl.class);
+ registry.subtreeAdd(
+ Sets.newHashSet(accessListsIdEgress, aclIdEgress),
+ new GenericWriter<>(SUBIF_EGRESS_IETF_ACL_ID,
+ new io.fd.hc2vpp.v3po.interfaces.acl.egress.SubInterfaceIetfAclCustomizer(
+ egressAclWriter, ifcContext)));
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceAugmentationWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceAugmentationWriterFactory.java
new file mode 100644
index 000000000..0b9b848ff
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceAugmentationWriterFactory.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import com.google.common.collect.Sets;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.v3po.interfaces.RewriteCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.SubInterfaceCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.SubInterfaceL2Customizer;
+import io.fd.hc2vpp.v3po.interfaces.acl.ingress.SubInterfaceAclCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.ip.SubInterfaceIpv4AddressCustomizer;
+import io.fd.hc2vpp.v3po.vppclassifier.VppClassifierContextManager;
+import io.fd.honeycomb.translate.impl.write.GenericListWriter;
+import io.fd.honeycomb.translate.impl.write.GenericWriter;
+import io.fd.honeycomb.translate.write.WriterFactory;
+import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any.Dot1qTag;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.Ip4Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.Ip6Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.L2Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.SubInterfaces;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.vlan.tagged.VlanTagged;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Tags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.acl.Ingress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.l2.Rewrite;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.Tag;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.tag.rewrite.PushTags;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public final class SubinterfaceAugmentationWriterFactory implements WriterFactory {
+
+ private final FutureJVppCore jvpp;
+ private final NamingContext ifcContext;
+ private final NamingContext bdContext;
+ private final VppClassifierContextManager classifyTableContext;
+
+ public static final InstanceIdentifier<SubinterfaceAugmentation> SUB_IFC_AUG_ID =
+ InterfacesWriterFactory.IFC_ID.augmentation(SubinterfaceAugmentation.class);
+ public static final InstanceIdentifier<SubInterface> SUB_IFC_ID =
+ SUB_IFC_AUG_ID.child(SubInterfaces.class).child(SubInterface.class);
+ public static final InstanceIdentifier<L2> L2_ID = SUB_IFC_ID.child(
+ L2.class);
+ public static final InstanceIdentifier<Acl> SUBIF_ACL_ID = SUB_IFC_ID.child(Acl.class);
+ public static final InstanceIdentifier<Ingress> SUBIF_INGRESS_ACL_ID = SUBIF_ACL_ID.child(Ingress.class);
+
+ public SubinterfaceAugmentationWriterFactory(final FutureJVppCore jvpp, final NamingContext ifcContext, final NamingContext bdContext, final VppClassifierContextManager classifyTableContext) {
+ this.jvpp = jvpp;
+ this.ifcContext = ifcContext;
+ this.bdContext = bdContext;
+ this.classifyTableContext = classifyTableContext;
+ }
+
+ @Override
+ public void init(final ModifiableWriterRegistryBuilder registry) {
+ // Subinterfaces
+ // Subinterface(Handle only after all interface related stuff gets processed) =
+ registry.subtreeAddAfter(
+ // TODO HONEYCOMB-188 this customizer covers quite a lot of complex child nodes (maybe refactor ?)
+ Sets.newHashSet(
+ InstanceIdentifier.create(SubInterface.class).child(Tags.class),
+ InstanceIdentifier.create(SubInterface.class).child(Tags.class).child(Tag.class),
+ InstanceIdentifier.create(SubInterface.class).child(Tags.class).child(Tag.class).child(
+ Dot1qTag.class),
+ InstanceIdentifier.create(SubInterface.class).child(Match.class),
+ InstanceIdentifier.create(SubInterface.class).child(Match.class).child(VlanTagged.class)),
+ new GenericListWriter<>(SUB_IFC_ID, new SubInterfaceCustomizer(jvpp, ifcContext)),
+ InterfacesWriterFactory.IFC_ID);
+ // L2 =
+ registry.addAfter(new GenericWriter<>(L2_ID, new SubInterfaceL2Customizer(jvpp, ifcContext, bdContext)),
+ SUB_IFC_ID);
+ // Rewrite(also handles pushTags + pushTags/dot1qtag) =
+ final InstanceIdentifier<Rewrite> rewriteId = L2_ID.child(Rewrite.class);
+ registry.subtreeAddAfter(
+ Sets.newHashSet(
+ InstanceIdentifier.create(Rewrite.class).child(PushTags.class),
+ InstanceIdentifier.create(Rewrite.class).child(PushTags.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.Dot1qTag.class)),
+ new GenericWriter<>(rewriteId, new RewriteCustomizer(jvpp, ifcContext)),
+ L2_ID);
+ // Ipv4(handled after L2 and L2/rewrite is done) =
+ final InstanceIdentifier<Address> ipv4SubifcAddressId = SUB_IFC_ID.child(Ipv4.class).child(Address.class);
+ registry.addAfter(new GenericListWriter<>(ipv4SubifcAddressId,
+ new SubInterfaceIpv4AddressCustomizer(jvpp, ifcContext)),
+ rewriteId);
+
+ // Ingress (execute after classify table and session writers)
+ // also handles L2Acl, Ip4Acl and Ip6Acl:
+ final InstanceIdentifier<Ingress> aclId = InstanceIdentifier.create(Ingress.class);
+ registry
+ .subtreeAddAfter(
+ Sets.newHashSet(aclId.child(L2Acl.class), aclId.child(Ip4Acl.class), aclId.child(Ip6Acl.class)),
+ new GenericWriter<>(SUBIF_INGRESS_ACL_ID, new SubInterfaceAclCustomizer(jvpp, ifcContext, classifyTableContext)),
+ Sets.newHashSet(VppClassifierHoneycombWriterFactory.CLASSIFY_TABLE_ID, VppClassifierHoneycombWriterFactory.CLASSIFY_SESSION_ID));
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceStateAugmentationReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceStateAugmentationReaderFactory.java
new file mode 100644
index 000000000..1946a28c7
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceStateAugmentationReaderFactory.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import com.google.common.collect.Sets;
+import io.fd.hc2vpp.v3po.interfacesstate.RewriteCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.SubInterfaceCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.SubInterfaceL2Customizer;
+import io.fd.hc2vpp.v3po.interfacesstate.acl.ingress.SubInterfaceAclCustomizer;
+import io.fd.hc2vpp.v3po.interfacesstate.ip.SubInterfaceIpv4AddressCustomizer;
+import io.fd.hc2vpp.v3po.vppclassifier.VppClassifierContextManager;
+import io.fd.honeycomb.translate.impl.read.GenericInitListReader;
+import io.fd.honeycomb.translate.impl.read.GenericInitReader;
+import io.fd.honeycomb.translate.impl.read.GenericReader;
+import io.fd.honeycomb.translate.read.ReaderFactory;
+import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any.Dot1qTag;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.Ip4Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.Ip6Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.L2Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceStateAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceStateAugmentationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.SubInterfaces;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.SubInterfacesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.vlan.tagged.VlanTagged;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Acl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.AclBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Tags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.acl.Ingress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.l2.Rewrite;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.Tag;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.tag.rewrite.PushTags;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+final class SubinterfaceStateAugmentationReaderFactory implements ReaderFactory {
+
+ private final FutureJVppCore jvpp;
+ private final NamingContext ifcCtx;
+ private final NamingContext bdCtx;
+ private final VppClassifierContextManager classifyCtx;
+
+ SubinterfaceStateAugmentationReaderFactory(final FutureJVppCore jvpp, final NamingContext ifcCtx,
+ final NamingContext bdCtx,
+ final VppClassifierContextManager classifyCtx) {
+ this.jvpp = jvpp;
+ this.ifcCtx = ifcCtx;
+ this.bdCtx = bdCtx;
+ this.classifyCtx = classifyCtx;
+ }
+
+ @Override
+ public void init(final ModifiableReaderRegistryBuilder registry) {
+ // SubinterfaceStateAugmentation(Structural)
+ final InstanceIdentifier<SubinterfaceStateAugmentation> subIfcAugId =
+ InterfacesStateReaderFactory.IFC_ID.augmentation(SubinterfaceStateAugmentation.class);
+ registry.addStructuralReader(subIfcAugId, SubinterfaceStateAugmentationBuilder.class);
+ // SubInterfaces(Structural)
+ final InstanceIdentifier<SubInterfaces> subIfcsId = subIfcAugId.child(SubInterfaces.class);
+ registry.addStructuralReader(subIfcsId, SubInterfacesBuilder.class);
+ // SubInterface(Subtree)
+ final InstanceIdentifier<SubInterface> subIfcId = subIfcsId.child(SubInterface.class);
+ registry.subtreeAdd(Sets.newHashSet(
+ InstanceIdentifier.create(SubInterface.class).child(Tags.class),
+ InstanceIdentifier.create(SubInterface.class).child(Tags.class).child(Tag.class),
+ InstanceIdentifier.create(SubInterface.class).child(Tags.class).child(Tag.class).child(Dot1qTag.class),
+ InstanceIdentifier.create(SubInterface.class).child(Match.class),
+ InstanceIdentifier.create(SubInterface.class).child(Match.class).child(VlanTagged.class)),
+ new GenericInitListReader<>(subIfcId, new SubInterfaceCustomizer(jvpp, ifcCtx)));
+ // L2
+ final InstanceIdentifier<L2> l2Id = subIfcId.child(L2.class);
+ registry.add(new GenericInitReader<>(l2Id, new SubInterfaceL2Customizer(jvpp, ifcCtx, bdCtx)));
+ // Rewrite(Subtree)
+ registry.subtreeAdd(Sets.newHashSet(
+ InstanceIdentifier.create(Rewrite.class).child(PushTags.class),
+ InstanceIdentifier.create(Rewrite.class).child(PushTags.class)
+ .child(
+ org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.Dot1qTag.class)),
+ new GenericReader<>(l2Id.child(Rewrite.class), new RewriteCustomizer(jvpp, ifcCtx)));
+ // Ipv4(Structural)
+ final InstanceIdentifier<Ipv4> ipv4Id = subIfcId.child(Ipv4.class);
+ registry.addStructuralReader(ipv4Id, Ipv4Builder.class);
+ // Address
+ registry.add(
+ new GenericInitListReader<>(ipv4Id.child(Address.class), new SubInterfaceIpv4AddressCustomizer(jvpp, ifcCtx)));
+ // Acl(Structural)
+ final InstanceIdentifier<Acl> aclIid = subIfcId.child(Acl.class);
+ registry.addStructuralReader(aclIid, AclBuilder.class);
+ // Ingress(Subtree)
+ final InstanceIdentifier<Ingress> ingressIdRelative = InstanceIdentifier.create(Ingress.class);
+ registry.subtreeAdd(
+ Sets.newHashSet(ingressIdRelative.child(L2Acl.class), ingressIdRelative.child(Ip4Acl.class),
+ ingressIdRelative.child(Ip6Acl.class)),
+ new GenericInitReader<>(aclIid.child(Ingress.class),
+ new SubInterfaceAclCustomizer(jvpp, ifcCtx, classifyCtx)));
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppClassifierHoneycombWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppClassifierHoneycombWriterFactory.java
new file mode 100644
index 000000000..5a7b64694
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppClassifierHoneycombWriterFactory.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.hc2vpp.v3po.vppclassifier.ClassifySessionWriter;
+import io.fd.hc2vpp.v3po.vppclassifier.ClassifyTableWriter;
+import io.fd.hc2vpp.v3po.vppclassifier.VppClassifierContextManager;
+import io.fd.honeycomb.translate.impl.write.GenericListWriter;
+import io.fd.honeycomb.translate.write.WriterFactory;
+import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppClassifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySession;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+
+public final class VppClassifierHoneycombWriterFactory implements WriterFactory {
+
+ public static final InstanceIdentifier<ClassifyTable> CLASSIFY_TABLE_ID =
+ InstanceIdentifier.create(VppClassifier.class).child(ClassifyTable.class);
+
+ public static final InstanceIdentifier<ClassifySession> CLASSIFY_SESSION_ID =
+ CLASSIFY_TABLE_ID.child(ClassifySession.class);
+
+ private final FutureJVppCore jvpp;
+ private final VppClassifierContextManager classifyTableContext;
+
+ @Inject
+ public VppClassifierHoneycombWriterFactory(@Nonnull final FutureJVppCore jvpp,
+ @Named("classify-table-context") @Nonnull final VppClassifierContextManager classifyTableContext) {
+ this.jvpp = jvpp;
+ this.classifyTableContext = classifyTableContext;
+ }
+
+ @Override
+ public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
+ // Ordering here is: First create table, then create sessions and then assign as ACL
+ // ClassifyTable
+ registry.addBefore(
+ new GenericListWriter<>(CLASSIFY_TABLE_ID, new ClassifyTableWriter(jvpp, classifyTableContext)),
+ CLASSIFY_SESSION_ID);
+ // ClassifyTableSession
+ registry.addBefore(
+ new GenericListWriter<>(CLASSIFY_SESSION_ID, new ClassifySessionWriter(jvpp, classifyTableContext)),
+ InterfacesWriterFactory.ACL_ID);
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppClassifierReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppClassifierReaderFactory.java
new file mode 100644
index 000000000..56983e9f3
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppClassifierReaderFactory.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.honeycomb.translate.impl.read.GenericInitListReader;
+import io.fd.honeycomb.translate.impl.read.GenericListReader;
+import io.fd.honeycomb.translate.read.ReaderFactory;
+import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
+import io.fd.hc2vpp.v3po.vppclassifier.ClassifySessionReader;
+import io.fd.hc2vpp.v3po.vppclassifier.ClassifyTableReader;
+import io.fd.hc2vpp.v3po.vppclassifier.VppClassifierContextManager;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppClassifierState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppClassifierStateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySession;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public final class VppClassifierReaderFactory implements ReaderFactory {
+
+ private final FutureJVppCore jvpp;
+ private final VppClassifierContextManager classifyCtx;
+
+ @Inject
+ public VppClassifierReaderFactory(final FutureJVppCore jvpp,
+ @Named("classify-table-context") final VppClassifierContextManager classifyCtx) {
+ this.jvpp = jvpp;
+ this.classifyCtx = classifyCtx;
+ }
+
+ @Override
+ public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
+ // VppClassifierState
+ final InstanceIdentifier<VppClassifierState> vppStateId = InstanceIdentifier.create(VppClassifierState.class);
+ registry.addStructuralReader(vppStateId, VppClassifierStateBuilder.class);
+ // ClassifyTable
+ final InstanceIdentifier<ClassifyTable> classTblId = vppStateId.child(ClassifyTable.class);
+ registry.add(new GenericInitListReader<>(classTblId, new ClassifyTableReader(jvpp, classifyCtx)));
+ // ClassifySession
+ final InstanceIdentifier<ClassifySession> classSesId = classTblId.child(ClassifySession.class);
+ registry.add(new GenericListReader<>(classSesId, new ClassifySessionReader(jvpp, classifyCtx)));
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppHoneycombWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppHoneycombWriterFactory.java
new file mode 100644
index 000000000..0fb95938a
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppHoneycombWriterFactory.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import com.google.common.collect.Sets;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.hc2vpp.v3po.vpp.ArpTerminationTableEntryCustomizer;
+import io.fd.hc2vpp.v3po.vpp.BridgeDomainCustomizer;
+import io.fd.hc2vpp.v3po.vpp.L2FibEntryCustomizer;
+import io.fd.honeycomb.translate.impl.write.GenericListWriter;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.honeycomb.translate.write.WriterFactory;
+import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.Vpp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.ArpTerminationTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.BridgeDomains;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+
+public final class VppHoneycombWriterFactory implements WriterFactory {
+
+ private final FutureJVppCore jvpp;
+ private final NamingContext bdContext;
+ private final NamingContext ifcContext;
+
+ @Inject
+ public VppHoneycombWriterFactory(final FutureJVppCore vppJvppWriterDependency,
+ @Named("bridge-domain-context") final NamingContext bridgeDomainContextVppDependency,
+ @Named("interface-context") final NamingContext interfaceContextVppDependency) {
+ this.jvpp = vppJvppWriterDependency;
+ this.bdContext = bridgeDomainContextVppDependency;
+ this.ifcContext = interfaceContextVppDependency;
+ }
+
+ @Override
+ public void init(final ModifiableWriterRegistryBuilder registry) {
+ // Vpp has no handlers
+ // BridgeDomains has no handlers
+ // BridgeDomain(handled before L2 of ifc and subifc) =
+ final InstanceIdentifier<BridgeDomain> bdId =
+ InstanceIdentifier.create(Vpp.class).child(BridgeDomains.class).child(BridgeDomain.class);
+ registry.addBefore(new GenericListWriter<>(bdId, new BridgeDomainCustomizer(jvpp, bdContext)),
+ Sets.newHashSet(
+ InterfacesWriterFactory.L2_ID,
+ SubinterfaceAugmentationWriterFactory.L2_ID));
+ // L2FibTable has no handlers
+ // L2FibEntry(handled after BridgeDomain and L2 of ifc and subifc) =
+ final InstanceIdentifier<L2FibEntry> l2FibEntryId = bdId.child(L2FibTable.class).child(L2FibEntry.class);
+ registry.addAfter(
+ new GenericListWriter<>(l2FibEntryId, new L2FibEntryCustomizer(jvpp, bdContext, ifcContext)),
+ Sets.newHashSet(
+ bdId,
+ InterfacesWriterFactory.L2_ID,
+ SubinterfaceAugmentationWriterFactory.L2_ID));
+ // ArpTerminationTable has no handlers
+ // ArpTerminationTableEntry(handled after BridgeDomain) =
+ final InstanceIdentifier<ArpTerminationTableEntry> arpEntryId =
+ bdId.child(ArpTerminationTable.class).child(ArpTerminationTableEntry.class);
+ registry.addAfter(
+ new GenericListWriter<>(arpEntryId, new ArpTerminationTableEntryCustomizer(jvpp, bdContext)),
+ bdId);
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppStateHoneycombReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppStateHoneycombReaderFactory.java
new file mode 100644
index 000000000..6d019ea2a
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppStateHoneycombReaderFactory.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.v3po.factory;
+
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.common.translate.util.ReadTimeoutException;
+import io.fd.hc2vpp.common.translate.util.VppStatusListener;
+import io.fd.hc2vpp.v3po.cfgattrs.V3poConfiguration;
+import io.fd.hc2vpp.v3po.vppstate.BridgeDomainCustomizer;
+import io.fd.hc2vpp.v3po.vppstate.L2FibEntryCustomizer;
+import io.fd.hc2vpp.v3po.vppstate.VersionCustomizer;
+import io.fd.honeycomb.translate.impl.read.GenericInitListReader;
+import io.fd.honeycomb.translate.impl.read.GenericReader;
+import io.fd.honeycomb.translate.read.ReaderFactory;
+import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
+import io.fd.honeycomb.translate.util.read.KeepaliveReaderWrapper;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.concurrent.ScheduledExecutorService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppStateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomains;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomainsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.Version;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomain;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public final class VppStateHoneycombReaderFactory implements ReaderFactory {
+
+ private final FutureJVppCore jVpp;
+ private final NamingContext ifcCtx;
+ private final NamingContext bdCtx;
+ private final ScheduledExecutorService keepaliveExecutor;
+ private final VppStatusListener vppStatusListener;
+
+ @Inject
+ private V3poConfiguration v3poConfiguration;
+
+ @Inject
+ public VppStateHoneycombReaderFactory(final FutureJVppCore jVpp,
+ @Named("interface-context") final NamingContext ifcCtx,
+ @Named("bridge-domain-context") final NamingContext bdCtx,
+ final ScheduledExecutorService keepaliveExecutorDependency,
+ final VppStatusListener vppStatusListener) {
+ this.jVpp = jVpp;
+ this.ifcCtx = ifcCtx;
+ this.bdCtx = bdCtx;
+ this.keepaliveExecutor = keepaliveExecutorDependency;
+ this.vppStatusListener = vppStatusListener;
+ }
+
+ @Override
+ public void init(final ModifiableReaderRegistryBuilder registry) {
+ // VppState(Structural)
+ final InstanceIdentifier<VppState> vppStateId = InstanceIdentifier.create(VppState.class);
+ registry.addStructuralReader(vppStateId, VppStateBuilder.class);
+ // Version
+ // Wrap with keepalive reader to detect connection issues
+ // Relying on VersionCustomizer to provide a "timing out read"
+ registry.add(new KeepaliveReaderWrapper<>(
+ new GenericReader<>(vppStateId.child(Version.class), new VersionCustomizer(jVpp)),
+ keepaliveExecutor, ReadTimeoutException.class, v3poConfiguration.getKeepaliveDelay(), vppStatusListener));
+ // BridgeDomains(Structural)
+ final InstanceIdentifier<BridgeDomains> bridgeDomainsId = vppStateId.child(BridgeDomains.class);
+ registry.addStructuralReader(bridgeDomainsId, BridgeDomainsBuilder.class);
+ // BridgeDomain
+ final InstanceIdentifier<BridgeDomain> bridgeDomainId = bridgeDomainsId.child(BridgeDomain.class);
+ registry.add(new GenericInitListReader<>(bridgeDomainId, new BridgeDomainCustomizer(jVpp, bdCtx)));
+ // L2FibTable(Structural)
+ final InstanceIdentifier<L2FibTable> l2FibTableId = bridgeDomainId.child(L2FibTable.class);
+ registry.addStructuralReader(l2FibTableId, L2FibTableBuilder.class);
+ // L2FibEntry
+ registry.add(new GenericInitListReader<>(l2FibTableId.child(L2FibEntry.class),
+ new L2FibEntryCustomizer(jVpp, bdCtx, ifcCtx)));
+ }
+}