From ae37a3a44a56ccbbc760744f36ad9140aecc06eb Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Fri, 7 Oct 2016 11:11:09 +0200 Subject: Pbb Support models/implementation refactored to work as rewrite on interfaces Change-Id: I8ce42905ce8f183c354e718d02291aea2435110d Signed-off-by: Jan Srnicek --- .../translate/v3po/InterfacesWriterFactory.java | 91 ++++++++++++---------- 1 file changed, 51 insertions(+), 40 deletions(-) (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java') diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java index 29a6ac5a4..d138dac62 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java @@ -41,6 +41,7 @@ import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv4AddressCustomizer; import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv4Customizer; import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv4NeighbourCustomizer; import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv6Customizer; +import io.fd.honeycomb.translate.v3po.interfaces.pbb.PbbRewriteCustomizer; import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager; import io.fd.honeycomb.translate.vpp.util.NamingContext; import io.fd.honeycomb.translate.write.WriterFactory; @@ -71,24 +72,26 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.Vxlan; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.VxlanGpe; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.acl.Ingress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev160410.PbbRewriteInterfaceAugmentation; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev160410.interfaces._interface.PbbRewrite; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public final class InterfacesWriterFactory implements WriterFactory { public static final InstanceIdentifier IFC_ID = - InstanceIdentifier.create(Interfaces.class).child(Interface.class); + InstanceIdentifier.create(Interfaces.class).child(Interface.class); public static final InstanceIdentifier VPP_IFC_AUG_ID = - IFC_ID.augmentation(VppInterfaceAugmentation.class); + IFC_ID.augmentation(VppInterfaceAugmentation.class); public static final InstanceIdentifier ACL_ID = VPP_IFC_AUG_ID.child(Acl.class); public static final InstanceIdentifier INGRESS_ACL_ID = ACL_ID.child(Ingress.class); public static final InstanceIdentifier L2_ID = VPP_IFC_AUG_ID.child(L2.class); public static final InstanceIdentifier IETF_ACL_ID = VPP_IFC_AUG_ID.child(IetfAcl.class); public static final InstanceIdentifier - INGRESS_IETF_ACL_ID = IETF_ACL_ID.child( - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.ietf.acl.Ingress.class); + INGRESS_IETF_ACL_ID = IETF_ACL_ID.child( + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.ietf.acl.Ingress.class); public static final InstanceIdentifier - EGRESS_IETF_ACL_ID = IETF_ACL_ID.child( - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.ietf.acl.Egress.class); + EGRESS_IETF_ACL_ID = IETF_ACL_ID.child( + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.ietf.acl.Egress.class); private final FutureJVppCore jvpp; private final IetfAClWriter aclWriter; @@ -123,7 +126,9 @@ public final class InterfacesWriterFactory implements WriterFactory { addInterface1AugmentationWriters(IFC_ID, registry); // SubinterfaceAugmentation new SubinterfaceAugmentationWriterFactory(jvpp, aclWriter, ifcNamingContext, bdNamingContext, - classifyTableContext).init(registry); + classifyTableContext).init(registry); + + addPbbAugmentationWriters(IFC_ID, registry); } private void addInterface1AugmentationWriters(final InstanceIdentifier ifcId, @@ -131,19 +136,19 @@ public final class InterfacesWriterFactory implements WriterFactory { final InstanceIdentifier ifc1AugId = ifcId.augmentation(Interface1.class); // Ipv6(after interface) = registry.addAfter(new GenericWriter<>(ifc1AugId.child(Ipv6.class), new Ipv6Customizer(jvpp)), - ifcId); + ifcId); // Ipv4(after interface) final InstanceIdentifier ipv4Id = ifc1AugId.child(Ipv4.class); registry.addAfter(new GenericWriter<>(ipv4Id, new Ipv4Customizer(jvpp)), - ifcId); + ifcId); // Address(after Ipv4) = final InstanceIdentifier
ipv4AddressId = ipv4Id.child(Address.class); registry.addAfter(new GenericListWriter<>(ipv4AddressId, new Ipv4AddressCustomizer(jvpp, ifcNamingContext)), - ipv4Id); + ipv4Id); // Neighbor(after ipv4Address) registry.addAfter(new GenericListWriter<>(ipv4Id.child(Neighbor.class), new Ipv4NeighbourCustomizer(jvpp, - ifcNamingContext)), - ipv4AddressId); + ifcNamingContext)), + ipv4AddressId); } private void addVppInterfaceAgmentationWriters(final InstanceIdentifier ifcId, @@ -151,24 +156,24 @@ public final class InterfacesWriterFactory implements WriterFactory { // VhostUser(Needs to be executed before Interface customizer) = final InstanceIdentifier vhostId = VPP_IFC_AUG_ID.child(VhostUser.class); registry.addBefore(new GenericWriter<>(vhostId, new VhostUserCustomizer(jvpp, ifcNamingContext)), - ifcId); + ifcId); // Vxlan(Needs to be executed before Interface customizer) = final InstanceIdentifier vxlanId = VPP_IFC_AUG_ID.child(Vxlan.class); registry.addBefore(new GenericWriter<>(vxlanId, new VxlanCustomizer(jvpp, ifcNamingContext, ifcDisableContext)), - ifcId); + ifcId); // VxlanGpe(Needs to be executed before Interface customizer) = final InstanceIdentifier vxlanGpeId = VPP_IFC_AUG_ID.child(VxlanGpe.class); registry.addBefore(new GenericWriter<>(vxlanGpeId, - new VxlanGpeCustomizer(jvpp, ifcNamingContext, ifcDisableContext)), ifcId); + new VxlanGpeCustomizer(jvpp, ifcNamingContext, ifcDisableContext)), ifcId); // Tap(Needs to be executed before Interface customizer) = final InstanceIdentifier tapId = VPP_IFC_AUG_ID.child(Tap.class); registry.addBefore(new GenericWriter<>(tapId, new TapCustomizer(jvpp, ifcNamingContext)), - ifcId); + ifcId); // Gre(Needs to be executed before Interface customizer) = final InstanceIdentifier greId = VPP_IFC_AUG_ID.child(Gre.class); registry.addBefore(new GenericWriter<>(greId, new GreCustomizer(jvpp, ifcNamingContext)), - ifcId); + ifcId); final Set> specificIfcTypes = Sets.newHashSet(vhostId, vxlanGpeId, vxlanGpeId, tapId); @@ -177,48 +182,54 @@ public final class InterfacesWriterFactory implements WriterFactory { 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); + 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); + 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); + 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 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)); + .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)); // Ingress IETF-ACL, also handles AccessLists and Acl: final InstanceIdentifier accessListsIdIngress = InstanceIdentifier.create( - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.ietf.acl.Ingress.class) - .child(AccessLists.class); + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.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.v3po.rev150105.ietf.acl.base.attributes.access.lists.Acl.class); + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.ietf.acl.base.attributes.access.lists.Acl.class); registry.subtreeAdd( - Sets.newHashSet(accessListsIdIngress, aclIdIngress), - new GenericWriter<>(INGRESS_IETF_ACL_ID, new IetfAclCustomizer(aclWriter, ifcNamingContext))); + Sets.newHashSet(accessListsIdIngress, aclIdIngress), + new GenericWriter<>(INGRESS_IETF_ACL_ID, new IetfAclCustomizer(aclWriter, ifcNamingContext))); // Ingress IETF-ACL, also handles AccessLists and Acl: final InstanceIdentifier accessListsIdEgress = InstanceIdentifier.create( - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.ietf.acl.Egress.class) - .child(AccessLists.class); + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.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.v3po.rev150105.ietf.acl.base.attributes.access.lists.Acl.class); + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.ietf.acl.base.attributes.access.lists.Acl.class); registry.subtreeAdd( - Sets.newHashSet(accessListsIdEgress, aclIdEgress), - new GenericWriter<>(EGRESS_IETF_ACL_ID, - new io.fd.honeycomb.translate.v3po.interfaces.acl.egress.IetfAclCustomizer(aclWriter, - ifcNamingContext))); + Sets.newHashSet(accessListsIdEgress, aclIdEgress), + new GenericWriter<>(EGRESS_IETF_ACL_ID, + new io.fd.honeycomb.translate.v3po.interfaces.acl.egress.IetfAclCustomizer(aclWriter, + ifcNamingContext))); } + private void addPbbAugmentationWriters(final InstanceIdentifier ifcId, + final ModifiableWriterRegistryBuilder registry) { + final InstanceIdentifier pbbRewriteId = + ifcId.augmentation(PbbRewriteInterfaceAugmentation.class).child(PbbRewrite.class); + registry.add(new GenericWriter<>(pbbRewriteId, new PbbRewriteCustomizer(jvpp, ifcNamingContext))); + } } -- cgit 1.2.3-korg