From 4605c552b8073fb203a204e594e48f137a5b5ee2 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Fri, 9 Sep 2016 11:41:03 +0200 Subject: HONEYCOMB-204 exclude deleted interfaces from operational data Change-Id: I187ac52095e15c8c9302871a0d7e7be792e6a0e2 Signed-off-by: Maros Marsalek --- .../v3po/InterfacesStateReaderFactory.java | 50 ++++++++++++---------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java') diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java index 69ac8f9b8..ef020e971 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java @@ -66,10 +66,11 @@ import org.openvpp.jvpp.core.future.FutureJVppCore; public final class InterfacesStateReaderFactory implements ReaderFactory { - private NamingContext ifcCtx; - private NamingContext bdCtx; - private NamingContext classifyCtx; - private FutureJVppCore jvpp; + private final NamingContext ifcNamingCtx; + private final NamingContext bdNamingCtx; + private final NamingContext classifyNamingCtx; + private final DisabledInterfacesManager ifcDisableContext; + private final FutureJVppCore jvpp; static final InstanceIdentifier IFC_STATE_ID = InstanceIdentifier.create(InterfacesState.class); @@ -77,13 +78,15 @@ public final class InterfacesStateReaderFactory implements ReaderFactory { @Inject public InterfacesStateReaderFactory(final FutureJVppCore jvpp, - @Named("interface-context") final NamingContext ifcCtx, - @Named("bridge-domain-context") final NamingContext bdCtx, - @Named("classify-table-context") final NamingContext classifyCtx) { + @Named("interface-context") final NamingContext ifcNamingCtx, + @Named("bridge-domain-context") final NamingContext bdNamingCtx, + @Named("classify-table-context") final NamingContext classifyNamingCtx, + final DisabledInterfacesManager ifcDisableContext) { this.jvpp = jvpp; - this.ifcCtx = ifcCtx; - this.bdCtx = bdCtx; - this.classifyCtx = classifyCtx; + this.ifcNamingCtx = ifcNamingCtx; + this.bdNamingCtx = bdNamingCtx; + this.classifyNamingCtx = classifyNamingCtx; + this.ifcDisableContext = ifcDisableContext; } @Override @@ -91,14 +94,14 @@ public final class InterfacesStateReaderFactory implements ReaderFactory { // InterfacesState(Structural) registry.addStructuralReader(IFC_STATE_ID, InterfacesStateBuilder.class); // Interface - registry.add(new GenericListReader<>(IFC_ID, new InterfaceCustomizer(jvpp, ifcCtx))); + registry.add(new GenericListReader<>(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, ifcCtx, bdCtx, classifyCtx).init(registry); + new SubinterfaceStateAugmentationReaderFactory(jvpp, ifcNamingCtx, bdNamingCtx, classifyNamingCtx).init(registry); } private void initInterface2AugmentationReaders(final ModifiableReaderRegistryBuilder registry, @@ -111,13 +114,13 @@ public final class InterfacesStateReaderFactory implements ReaderFactory { registry.add(new GenericReader<>(ipv4Id, new Ipv4Customizer(jvpp))); // Address final InstanceIdentifier
ipv4AddrId = ipv4Id.child(Address.class); - registry.add(new GenericListReader<>(ipv4AddrId, new Ipv4AddressCustomizer(jvpp, ifcCtx))); + registry.add(new GenericListReader<>(ipv4AddrId, new Ipv4AddressCustomizer(jvpp, ifcNamingCtx))); // Neighbor final InstanceIdentifier neighborId = ipv4Id.child(Neighbor.class); registry.add(new GenericListReader<>(neighborId, new Ipv4NeighbourCustomizer(jvpp))); // Ipv6 final InstanceIdentifier ipv6Id = ifc2AugId.child(Ipv6.class); - registry.add(new GenericReader<>(ipv6Id, new Ipv6Customizer(jvpp, ifcCtx))); + registry.add(new GenericReader<>(ipv6Id, new Ipv6Customizer(jvpp, ifcNamingCtx))); } private void initVppIfcAugmentationReaders(final ModifiableReaderRegistryBuilder registry, @@ -126,26 +129,27 @@ public final class InterfacesStateReaderFactory implements ReaderFactory { final InstanceIdentifier vppIfcAugId = ifcId.augmentation(VppInterfaceStateAugmentation.class); registry.addStructuralReader(vppIfcAugId, VppInterfaceStateAugmentationBuilder.class); // Ethernet - registry.add(new GenericReader<>(vppIfcAugId.child(Ethernet.class), new EthernetCustomizer(jvpp, ifcCtx))); + registry.add(new GenericReader<>(vppIfcAugId.child(Ethernet.class), new EthernetCustomizer(jvpp, ifcNamingCtx))); // Tap - registry.add(new GenericReader<>(vppIfcAugId.child(Tap.class), new TapCustomizer(jvpp, ifcCtx))); + registry.add(new GenericReader<>(vppIfcAugId.child(Tap.class), new TapCustomizer(jvpp, ifcNamingCtx))); // VhostUser - registry.add(new GenericReader<>(vppIfcAugId.child(VhostUser.class), new VhostUserCustomizer(jvpp, ifcCtx))); + registry.add(new GenericReader<>(vppIfcAugId.child(VhostUser.class), new VhostUserCustomizer(jvpp, ifcNamingCtx))); // Vxlan - registry.add(new GenericReader<>(vppIfcAugId.child(Vxlan.class), new VxlanCustomizer(jvpp, ifcCtx))); + registry.add(new GenericReader<>(vppIfcAugId.child(Vxlan.class), new VxlanCustomizer(jvpp, ifcNamingCtx))); // VxlanGpe - registry.add(new GenericReader<>(vppIfcAugId.child(VxlanGpe.class), new VxlanGpeCustomizer(jvpp, ifcCtx))); + registry.add(new GenericReader<>(vppIfcAugId.child(VxlanGpe.class), new VxlanGpeCustomizer(jvpp, ifcNamingCtx))); // Gre - registry.add(new GenericReader<>(vppIfcAugId.child(Gre.class), new GreCustomizer(jvpp, ifcCtx))); + registry.add(new GenericReader<>(vppIfcAugId.child(Gre.class), new GreCustomizer(jvpp, ifcNamingCtx))); // L2 - registry.add(new GenericReader<>(vppIfcAugId.child(L2.class), new L2Customizer(jvpp, ifcCtx, bdCtx))); + registry.add(new GenericReader<>(vppIfcAugId.child(L2.class), new L2Customizer(jvpp, ifcNamingCtx, bdNamingCtx))); // Acl(Subtree) final InstanceIdentifier aclIdRelative = InstanceIdentifier.create(Acl.class); registry.subtreeAdd( Sets.newHashSet(aclIdRelative.child(L2Acl.class), aclIdRelative.child(Ip4Acl.class), aclIdRelative.child(Ip6Acl.class)), - new GenericReader<>(vppIfcAugId.child(Acl.class), new AclCustomizer(jvpp, ifcCtx, classifyCtx))); + new GenericReader<>(vppIfcAugId.child(Acl.class), new AclCustomizer(jvpp, ifcNamingCtx, + classifyNamingCtx))); // Proxy ARP registry.add(new GenericReader<>(vppIfcAugId.child(ProxyArp.class), new ProxyArpCustomizer(jvpp, - ifcCtx))); + ifcNamingCtx))); } } -- cgit 1.2.3-korg