Pbb Support
[honeycomb.git] / v3po / v3po2vpp / src / main / java / io / fd / honeycomb / translate / v3po / InterfacesStateReaderFactory.java
index 0a94a1b..c7f80e3 100644 (file)
@@ -25,7 +25,6 @@ import io.fd.honeycomb.translate.read.ReaderFactory;
 import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
 import io.fd.honeycomb.translate.v3po.interfacesstate.EthernetCustomizer;
 import io.fd.honeycomb.translate.v3po.interfacesstate.GreCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.acl.ingress.AclCustomizer;
 import io.fd.honeycomb.translate.v3po.interfacesstate.InterfaceCustomizer;
 import io.fd.honeycomb.translate.v3po.interfacesstate.L2Customizer;
 import io.fd.honeycomb.translate.v3po.interfacesstate.ProxyArpCustomizer;
@@ -33,10 +32,12 @@ import io.fd.honeycomb.translate.v3po.interfacesstate.TapCustomizer;
 import io.fd.honeycomb.translate.v3po.interfacesstate.VhostUserCustomizer;
 import io.fd.honeycomb.translate.v3po.interfacesstate.VxlanCustomizer;
 import io.fd.honeycomb.translate.v3po.interfacesstate.VxlanGpeCustomizer;
+import io.fd.honeycomb.translate.v3po.interfacesstate.acl.ingress.AclCustomizer;
 import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv4AddressCustomizer;
 import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv4Customizer;
 import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv4NeighbourCustomizer;
 import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv6Customizer;
+import io.fd.honeycomb.translate.v3po.interfacesstate.pbb.PbbRewriteStateCustomizer;
 import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
 import io.fd.honeycomb.translate.vpp.util.NamingContext;
 import io.fd.vpp.jvpp.core.future.FutureJVppCore;
@@ -65,6 +66,9 @@ 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.state._interface.Vxlan;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VxlanGpe;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.acl.Ingress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev160410.PbbRewriteStateInterfaceAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev160410.PbbRewriteStateInterfaceAugmentationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev160410.interfaces.state._interface.PbbRewriteState;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 public final class InterfacesStateReaderFactory implements ReaderFactory {
@@ -76,7 +80,7 @@ public final class InterfacesStateReaderFactory implements ReaderFactory {
     private final FutureJVppCore jvpp;
 
     static final InstanceIdentifier<InterfacesState> IFC_STATE_ID =
-        InstanceIdentifier.create(InterfacesState.class);
+            InstanceIdentifier.create(InterfacesState.class);
     static final InstanceIdentifier<Interface> IFC_ID = IFC_STATE_ID.child(Interface.class);
 
     @Inject
@@ -105,6 +109,8 @@ public final class InterfacesStateReaderFactory implements ReaderFactory {
         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,
@@ -130,39 +136,54 @@ public final class InterfacesStateReaderFactory implements ReaderFactory {
                                                final InstanceIdentifier<Interface> ifcId) {
         //   VppInterfaceStateAugmentation
         final InstanceIdentifier<VppInterfaceStateAugmentation> vppIfcAugId =
-            ifcId.augmentation(VppInterfaceStateAugmentation.class);
+                ifcId.augmentation(VppInterfaceStateAugmentation.class);
         registry.addStructuralReader(vppIfcAugId, VppInterfaceStateAugmentationBuilder.class);
         //    Ethernet
         registry
-            .add(new GenericReader<>(vppIfcAugId.child(Ethernet.class), new EthernetCustomizer(jvpp, ifcNamingCtx)));
+                .add(new GenericReader<>(vppIfcAugId.child(Ethernet.class),
+                        new EthernetCustomizer(jvpp, ifcNamingCtx)));
         //    Tap
         registry.add(new GenericReader<>(vppIfcAugId.child(Tap.class), new TapCustomizer(jvpp, ifcNamingCtx)));
         //    VhostUser
         registry
-            .add(new GenericReader<>(vppIfcAugId.child(VhostUser.class), new VhostUserCustomizer(jvpp, ifcNamingCtx)));
+                .add(new GenericReader<>(vppIfcAugId.child(VhostUser.class),
+                        new VhostUserCustomizer(jvpp, ifcNamingCtx)));
         //    Vxlan
         registry.add(new GenericReader<>(vppIfcAugId.child(Vxlan.class), new VxlanCustomizer(jvpp, ifcNamingCtx)));
         //    VxlanGpe
         registry
-            .add(new GenericReader<>(vppIfcAugId.child(VxlanGpe.class), new VxlanGpeCustomizer(jvpp, ifcNamingCtx)));
+                .add(new GenericReader<>(vppIfcAugId.child(VxlanGpe.class),
+                        new VxlanGpeCustomizer(jvpp, ifcNamingCtx)));
         //    Gre
         registry.add(new GenericReader<>(vppIfcAugId.child(Gre.class), new GreCustomizer(jvpp, ifcNamingCtx)));
         //    L2
         registry
-            .add(new GenericReader<>(vppIfcAugId.child(L2.class), new L2Customizer(jvpp, ifcNamingCtx, bdNamingCtx)));
+                .add(new GenericReader<>(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 GenericReader<>(aclIid.child(Ingress.class),
-                new AclCustomizer(jvpp, ifcNamingCtx,
-                    classifyContext)));
+                Sets.newHashSet(ingressIdRelative.child(L2Acl.class), ingressIdRelative.child(Ip4Acl.class),
+                        ingressIdRelative.child(Ip6Acl.class)),
+                new GenericReader<>(aclIid.child(Ingress.class),
+                        new AclCustomizer(jvpp, ifcNamingCtx,
+                                classifyContext)));
         //   Proxy ARP
         registry.add(new GenericReader<>(vppIfcAugId.child(ProxyArp.class), new ProxyArpCustomizer(jvpp,
-            ifcNamingCtx)));
+                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)));
+    }
+
 }