--- /dev/null
+/*
+ * 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;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.Multibinder;
+import io.fd.hc2vpp.v3po.factory.AclWriterFactory;
+import io.fd.hc2vpp.v3po.factory.EgressIetfAClWriterProvider;
+import io.fd.hc2vpp.v3po.factory.IngressIetfAClWriterProvider;
+import io.fd.hc2vpp.v3po.factory.InterfacesClassifierIetfAclWriterFactory;
+import io.fd.hc2vpp.v3po.factory.SubInterfacesClassifierIetfAclWriterFactory;
+import io.fd.hc2vpp.v3po.interfaces.acl.egress.EgressIetfAclWriter;
+import io.fd.hc2vpp.v3po.interfaces.acl.ingress.IngressIetfAclWriter;
+import io.fd.honeycomb.translate.write.WriterFactory;
+import net.jmob.guice.conf.core.ConfigurationModule;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ClassifierIetfAclModule extends AbstractModule {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ClassifierIetfAclModule.class);
+
+ @Override
+ protected void configure() {
+ LOG.debug("Installing VppClassifierAcl module");
+ install(ConfigurationModule.create());
+
+ // Utils
+ bind(IngressIetfAclWriter.class).toProvider(IngressIetfAClWriterProvider.class);
+ bind(EgressIetfAclWriter.class).toProvider(EgressIetfAClWriterProvider.class);
+
+ // Writers
+ final Multibinder<WriterFactory> writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
+ writerFactoryBinder.addBinding().to(AclWriterFactory.class);
+ writerFactoryBinder.addBinding().to(InterfacesClassifierIetfAclWriterFactory.class);
+ writerFactoryBinder.addBinding().to(SubInterfacesClassifierIetfAclWriterFactory.class);
+
+ LOG.info("Module VppClassifierAcl module successfully configured");
+ }
+}
import com.google.inject.AbstractModule;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Names;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.v3po.cfgattrs.V3poConfiguration;
+import io.fd.hc2vpp.v3po.factory.EgressIetfAClWriterProvider;
+import io.fd.hc2vpp.v3po.factory.IngressIetfAClWriterProvider;
+import io.fd.hc2vpp.v3po.factory.InterfacesStateReaderFactory;
+import io.fd.hc2vpp.v3po.factory.InterfacesWriterFactory;
+import io.fd.hc2vpp.v3po.factory.VppClassifierHoneycombWriterFactory;
+import io.fd.hc2vpp.v3po.factory.VppClassifierReaderFactory;
+import io.fd.hc2vpp.v3po.factory.VppHoneycombWriterFactory;
+import io.fd.hc2vpp.v3po.factory.VppStateHoneycombReaderFactory;
import io.fd.hc2vpp.v3po.interfaces.acl.egress.EgressIetfAclWriter;
+import io.fd.hc2vpp.v3po.interfaces.acl.ingress.IngressIetfAclWriter;
import io.fd.hc2vpp.v3po.notification.InterfaceChangeNotificationProducer;
import io.fd.hc2vpp.v3po.vppclassifier.VppClassifierContextManager;
import io.fd.hc2vpp.v3po.vppclassifier.VppClassifierContextManagerImpl;
import io.fd.honeycomb.notification.ManagedNotificationProducer;
import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.hc2vpp.v3po.cfgattrs.V3poConfiguration;
-import io.fd.hc2vpp.v3po.interfaces.acl.ingress.IngressIetfAclWriter;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.translate.write.WriterFactory;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
writerFactoryBinder.addBinding().to(InterfacesWriterFactory.class);
writerFactoryBinder.addBinding().to(VppHoneycombWriterFactory.class);
writerFactoryBinder.addBinding().to(VppClassifierHoneycombWriterFactory.class);
- writerFactoryBinder.addBinding().to(AclWriterFactory.class);
// Notifications
final Multibinder<ManagedNotificationProducer> notifiersBinder =
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po;
+package io.fd.hc2vpp.v3po.factory;
-import static io.fd.hc2vpp.v3po.InterfacesWriterFactory.IETF_ACL_ID;
-import static io.fd.hc2vpp.v3po.SubinterfaceAugmentationWriterFactory.SUBIF_IETF_ACL_ID;
+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;
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po;
+package io.fd.hc2vpp.v3po.factory;
import com.google.inject.Inject;
import com.google.inject.Provider;
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;
-class EgressIetfAClWriterProvider implements Provider<EgressIetfAclWriter> {
+public class EgressIetfAClWriterProvider implements Provider<EgressIetfAclWriter> {
private final FutureJVppCore jvpp;
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po;
+package io.fd.hc2vpp.v3po.factory;
import com.google.inject.Inject;
import com.google.inject.Provider;
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;
-class IngressIetfAClWriterProvider implements Provider<IngressIetfAclWriter> {
+public class IngressIetfAClWriterProvider implements Provider<IngressIetfAclWriter> {
private final FutureJVppCore jvpp;
--- /dev/null
+/*
+ * 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)));
+ }
+}
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po;
+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;
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po;
+package io.fd.hc2vpp.v3po.factory;
-import static io.fd.hc2vpp.v3po.VppClassifierHoneycombWriterFactory.CLASSIFY_SESSION_ID;
-import static io.fd.hc2vpp.v3po.VppClassifierHoneycombWriterFactory.CLASSIFY_TABLE_ID;
+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 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.IetfAcl;
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.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.classfier.acl.rev161214.ietf.acl.base.attributes.AccessLists;
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 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);
- public static final InstanceIdentifier<IetfAcl> IETF_ACL_ID = VPP_IFC_AUG_ID.child(IetfAcl.class);
- public static final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Ingress>
- INGRESS_IETF_ACL_ID = IETF_ACL_ID.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Ingress.class);
- public static final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Egress>
- EGRESS_IETF_ACL_ID = IETF_ACL_ID.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Egress.class);
private final FutureJVppCore jvpp;
private final IngressIetfAclWriter ingressAclWriter;
registry.add(new GenericListWriter<>(IFC_ID, new InterfaceCustomizer(jvpp, ifcNamingContext)));
// VppInterfaceAugmentation
addVppInterfaceAgmentationWriters(IFC_ID, registry);
- // Interface1 (ietf-ip augmentation)
+ // Interface1 (ietf-ip aug\ 1mentation)
addInterface1AugmentationWriters(IFC_ID, registry);
// SubinterfaceAugmentation
- new SubinterfaceAugmentationWriterFactory(jvpp, ingressAclWriter, egressAclWriter, ifcNamingContext, bdNamingContext,
- classifyTableContext).init(registry);
+ new SubinterfaceAugmentationWriterFactory(jvpp, ifcNamingContext, bdNamingContext,
+ classifyTableContext).init(registry);
addPbbAugmentationWriters(IFC_ID, registry);
}
new AclCustomizer(jvpp, ifcNamingContext, classifyTableContext)),
Sets.newHashSet(CLASSIFY_TABLE_ID, CLASSIFY_SESSION_ID));
- // Ingress IETF-ACL, also handles AccessLists and Acl:
- final InstanceIdentifier<AccessLists> accessListsIdIngress = InstanceIdentifier.create(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Ingress.class)
- .child(AccessLists.class);
- final InstanceIdentifier<?> aclIdIngress = accessListsIdIngress.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.ietf.acl.base.attributes.access.lists.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(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Egress.class)
- .child(AccessLists.class);
- final InstanceIdentifier<?> aclIdEgress = accessListsIdEgress.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.ietf.acl.base.attributes.access.lists.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)));
// Span writers
// Mirrored interfaces
final InstanceIdentifier<MirroredInterfaces> mirroredIfcsId = VPP_IFC_AUG_ID
--- /dev/null
+/*
+ * 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)));
+ }
+}
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po;
-
-import static io.fd.hc2vpp.v3po.VppClassifierHoneycombWriterFactory.CLASSIFY_SESSION_ID;
-import static io.fd.hc2vpp.v3po.VppClassifierHoneycombWriterFactory.CLASSIFY_TABLE_ID;
+package io.fd.hc2vpp.v3po.factory;
import com.google.common.collect.Sets;
-import io.fd.hc2vpp.v3po.interfaces.acl.egress.EgressIetfAclWriter;
-import io.fd.hc2vpp.v3po.interfaces.acl.ingress.SubInterfaceAclCustomizer;
-import io.fd.hc2vpp.v3po.interfaces.acl.ingress.SubInterfaceIetfAclCustomizer;
-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.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.IngressIetfAclWriter;
+import io.fd.hc2vpp.v3po.interfaces.acl.ingress.SubInterfaceAclCustomizer;
import io.fd.hc2vpp.v3po.interfaces.ip.SubInterfaceIpv4AddressCustomizer;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
+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.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.classfier.acl.rev161214.ietf.acl.base.attributes.AccessLists;
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.IetfAcl;
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;
public final class SubinterfaceAugmentationWriterFactory implements WriterFactory {
private final FutureJVppCore jvpp;
- private final IngressIetfAclWriter ingressAclWriter;
- private final EgressIetfAclWriter egressAclWriter;
private final NamingContext ifcContext;
private final NamingContext bdContext;
private final VppClassifierContextManager classifyTableContext;
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 static final InstanceIdentifier<IetfAcl> SUBIF_IETF_ACL_ID = SUB_IFC_ID.child(IetfAcl.class);
- public static final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Ingress> SUBIF_INGRESS_IETF_ACL_ID = SUBIF_IETF_ACL_ID.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Ingress.class);
- public static final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Egress> SUBIF_EGRESS_IETF_ACL_ID = SUBIF_IETF_ACL_ID.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Egress.class);
- public SubinterfaceAugmentationWriterFactory(final FutureJVppCore jvpp,
- final IngressIetfAclWriter ingressAclWriter,
- final EgressIetfAclWriter egressAclWriter,
- final NamingContext ifcContext, final NamingContext bdContext, final VppClassifierContextManager classifyTableContext) {
+ public SubinterfaceAugmentationWriterFactory(final FutureJVppCore jvpp, final NamingContext ifcContext, final NamingContext bdContext, final VppClassifierContextManager classifyTableContext) {
this.jvpp = jvpp;
- this.ingressAclWriter = ingressAclWriter;
- this.egressAclWriter = egressAclWriter;
this.ifcContext = ifcContext;
this.bdContext = bdContext;
this.classifyTableContext = classifyTableContext;
.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(CLASSIFY_TABLE_ID, CLASSIFY_SESSION_ID));
-
- // Ingress IETF-ACL, also handles AccessLists and Acl:
- final InstanceIdentifier<AccessLists> accessListsIdIngress = InstanceIdentifier.create(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Ingress.class)
- .child(AccessLists.class);
- final InstanceIdentifier<?> aclIdIngress = accessListsIdIngress.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.ietf.acl.base.attributes.access.lists.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(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Egress.class)
- .child(AccessLists.class);
- final InstanceIdentifier<?> aclIdEgress = accessListsIdEgress.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.ietf.acl.base.attributes.access.lists.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)));
+ Sets.newHashSet(VppClassifierHoneycombWriterFactory.CLASSIFY_TABLE_ID, VppClassifierHoneycombWriterFactory.CLASSIFY_SESSION_ID));
}
}
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po;
+package io.fd.hc2vpp.v3po.factory;
import com.google.common.collect.Sets;
import io.fd.hc2vpp.v3po.interfacesstate.RewriteCustomizer;
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po;
+package io.fd.hc2vpp.v3po.factory;
import com.google.inject.Inject;
import com.google.inject.name.Named;
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po;
+package io.fd.hc2vpp.v3po.factory;
import com.google.inject.Inject;
import com.google.inject.name.Named;
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po;
-
-import static io.fd.hc2vpp.v3po.InterfacesWriterFactory.L2_ID;
+package io.fd.hc2vpp.v3po.factory;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
InstanceIdentifier.create(Vpp.class).child(BridgeDomains.class).child(BridgeDomain.class);
registry.addBefore(new GenericListWriter<>(bdId, new BridgeDomainCustomizer(jvpp, bdContext)),
Sets.newHashSet(
- L2_ID,
+ InterfacesWriterFactory.L2_ID,
SubinterfaceAugmentationWriterFactory.L2_ID));
// L2FibTable has no handlers
// L2FibEntry(handled after BridgeDomain and L2 of ifc and subifc) =
new GenericListWriter<>(l2FibEntryId, new L2FibEntryCustomizer(jvpp, bdContext, ifcContext)),
Sets.newHashSet(
bdId,
- L2_ID,
+ InterfacesWriterFactory.L2_ID,
SubinterfaceAugmentationWriterFactory.L2_ID));
// ArpTerminationTable has no handlers
// ArpTerminationTableEntry(handled after BridgeDomain) =
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po;
+package io.fd.hc2vpp.v3po.factory;
import com.google.inject.Inject;
import com.google.inject.name.Named;
--- /dev/null
+/*
+ * 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;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.Matchers.empty;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import com.google.inject.Guice;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import com.google.inject.testing.fieldbinder.Bind;
+import com.google.inject.testing.fieldbinder.BoundFieldModule;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
+import io.fd.honeycomb.translate.write.WriterFactory;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+
+public class ClassifierIetfAclModuleTest {
+
+ @Bind
+ @Mock
+ private FutureJVppCore futureJVppCore;
+
+ @Named("interface-context")
+ @Bind
+ private NamingContext ifcContext;
+
+ @Inject
+ private Set<WriterFactory> writerFactories = new HashSet<>();
+
+ @Before
+ public void setUp() {
+ initMocks(this);
+ ifcContext = new NamingContext("interface-", "interface-context");
+ Guice.createInjector(new ClassifierIetfAclModule(), BoundFieldModule.of(this)).injectMembers(this);
+ }
+
+ @Test
+ public void testWriterFactories() throws Exception {
+ assertThat(writerFactories, is(not(empty())));
+
+ // Test registration process (all dependencies present, topological order of writers does exist, etc.)
+ final FlatWriterRegistryBuilder registryBuilder = new FlatWriterRegistryBuilder();
+ writerFactories.stream().forEach(factory -> factory.init(registryBuilder));
+ assertNotNull(registryBuilder.build());
+ }
+
+}
\ No newline at end of file
io.fd.hc2vpp.common.integration.VppCommonModule,
io.fd.hc2vpp.lisp.LispModule,
io.fd.hc2vpp.v3po.V3poModule,
+ io.fd.hc2vpp.v3po.ClassifierIetfAclModule,
io.fd.hc2vpp.nat.NatModule,
io.fd.hc2vpp.routing.RoutingModule,
// io.fd.hc2vpp.vppnsh.impl.VppNshModule,