diff options
Diffstat (limited to 'v3po/v3po2vpp')
22 files changed, 113 insertions, 567 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/V3poModule.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/V3poModule.java index 06d6d290f..1a0430049 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/V3poModule.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/V3poModule.java @@ -20,22 +20,16 @@ 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.InterfacesStateReaderFactory; import io.fd.hc2vpp.v3po.factory.InterfacesWriterFactory; +import io.fd.hc2vpp.v3po.factory.L2HoneycombWriterFactory; +import io.fd.hc2vpp.v3po.factory.L2StateHoneycombReaderFactory; import io.fd.hc2vpp.v3po.factory.SubinterfaceAugmentationWriterFactory; import io.fd.hc2vpp.v3po.factory.SubinterfaceStateAugmentationReaderFactory; -import io.fd.hc2vpp.v3po.factory.VppHoneycombWriterFactory; -import io.fd.hc2vpp.v3po.factory.VppStateHoneycombReaderFactory; import io.fd.hc2vpp.v3po.notification.InterfaceChangeNotificationProducer; -import io.fd.hc2vpp.v3po.rpc.CliInbandService; import io.fd.honeycomb.notification.ManagedNotificationProducer; -import io.fd.honeycomb.rpc.RpcService; import io.fd.honeycomb.translate.read.ReaderFactory; import io.fd.honeycomb.translate.write.WriterFactory; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import net.jmob.guice.conf.core.ConfigurationModule; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,8 +40,6 @@ public class V3poModule extends AbstractModule { @Override protected void configure() { LOG.debug("Installing V3PO module"); - install(ConfigurationModule.create()); - requestInjection(V3poConfiguration.class); // TODO HONEYCOMB-173 put into constants // Naming contexts @@ -58,10 +50,6 @@ public class V3poModule extends AbstractModule { .annotatedWith(Names.named("bridge-domain-context")) .toInstance(new NamingContext("bridge-domain-", "bridge-domain-context")); - // Executor needed for keepalives - bind(ScheduledExecutorService.class).toInstance(Executors.newScheduledThreadPool(1)); - - // Context utility for deleted interfaces bind(DisabledInterfacesManager.class).toInstance(new DisabledInterfacesManager()); @@ -69,7 +57,7 @@ public class V3poModule extends AbstractModule { final Multibinder<ReaderFactory> readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class); readerFactoryBinder.addBinding().to(InterfacesStateReaderFactory.class); readerFactoryBinder.addBinding().to(SubinterfaceStateAugmentationReaderFactory.class); - readerFactoryBinder.addBinding().to(VppStateHoneycombReaderFactory.class); + readerFactoryBinder.addBinding().to(L2StateHoneycombReaderFactory.class); // Expose disabled interfaces in operational data readerFactoryBinder.addBinding().to(DisabledInterfacesManager.ContextsReaderFactory.class); @@ -78,17 +66,13 @@ public class V3poModule extends AbstractModule { final Multibinder<WriterFactory> writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class); writerFactoryBinder.addBinding().to(InterfacesWriterFactory.class); writerFactoryBinder.addBinding().to(SubinterfaceAugmentationWriterFactory.class); - writerFactoryBinder.addBinding().to(VppHoneycombWriterFactory.class); + writerFactoryBinder.addBinding().to(L2HoneycombWriterFactory.class); // Notifications final Multibinder<ManagedNotificationProducer> notifiersBinder = Multibinder.newSetBinder(binder(), ManagedNotificationProducer.class); notifiersBinder.addBinding().to(InterfaceChangeNotificationProducer.class); - // RPCs - final Multibinder<RpcService> rpcsBinder = Multibinder.newSetBinder(binder(), RpcService.class); - rpcsBinder.addBinding().to(CliInbandService.class); - LOG.info("Module V3PO successfully configured"); } } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/cfgattrs/V3poConfiguration.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/cfgattrs/V3poConfiguration.java deleted file mode 100644 index f7b52accd..000000000 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/cfgattrs/V3poConfiguration.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.cfgattrs; - -import net.jmob.guice.conf.core.BindConfig; -import net.jmob.guice.conf.core.InjectConfig; -import net.jmob.guice.conf.core.Syntax; - -@BindConfig(value = "v3po", syntax = Syntax.JSON) -public class V3poConfiguration { - - @InjectConfig("keepalive-delay") - private String keepaliveDelay; - - public int getKeepaliveDelay() { - return Integer.valueOf(this.keepaliveDelay); - } -} 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/L2HoneycombWriterFactory.java index 0fb95938a..80f72db78 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppHoneycombWriterFactory.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/L2HoneycombWriterFactory.java @@ -19,33 +19,32 @@ 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.hc2vpp.v3po.l2.ArpTerminationTableEntryCustomizer; +import io.fd.hc2vpp.v3po.l2.BridgeDomainCustomizer; +import io.fd.hc2vpp.v3po.l2.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.BridgeDomains; 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.bridge.domains.BridgeDomain; 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 { +public final class L2HoneycombWriterFactory 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) { + public L2HoneycombWriterFactory(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; @@ -57,7 +56,7 @@ public final class VppHoneycombWriterFactory implements WriterFactory { // 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); + InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class); registry.addBefore(new GenericListWriter<>(bdId, new BridgeDomainCustomizer(jvpp, bdContext)), Sets.newHashSet( InterfacesWriterFactory.L2_ID, 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/L2StateHoneycombReaderFactory.java index 6d019ea2a..eacc371fe 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/VppStateHoneycombReaderFactory.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/L2StateHoneycombReaderFactory.java @@ -19,68 +19,41 @@ 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.hc2vpp.v3po.l2state.BridgeDomainCustomizer; +import io.fd.hc2vpp.v3po.l2state.L2FibEntryCustomizer; 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.BridgeDomainsState; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomainsStateBuilder; + +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomain; 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 { +public final class L2StateHoneycombReaderFactory 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) { + public L2StateHoneycombReaderFactory(final FutureJVppCore jVpp, + @Named("interface-context") final NamingContext ifcCtx, + @Named("bridge-domain-context") final NamingContext bdCtx) { 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); + final InstanceIdentifier<BridgeDomainsState> bridgeDomainsId = InstanceIdentifier.create(BridgeDomainsState.class); + registry.addStructuralReader(bridgeDomainsId, BridgeDomainsStateBuilder.class); // BridgeDomain final InstanceIdentifier<BridgeDomain> bridgeDomainId = bridgeDomainsId.child(BridgeDomain.class); registry.add(new GenericInitListReader<>(bridgeDomainId, new BridgeDomainCustomizer(jVpp, bdCtx))); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizer.java index 2b9f59209..614570dcc 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.hc2vpp.v3po.vpp; +package io.fd.hc2vpp.v3po.l2; import com.google.common.base.Preconditions; import io.fd.hc2vpp.common.translate.util.AddressTranslator; @@ -33,7 +33,7 @@ import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; 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.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntryKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomain; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vpp/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/BridgeDomainCustomizer.java index 2962ec578..b316d28be 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vpp/BridgeDomainCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/BridgeDomainCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.hc2vpp.v3po.vpp; +package io.fd.hc2vpp.v3po.l2; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; @@ -39,9 +39,10 @@ import javax.annotation.concurrent.GuardedBy; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2BaseAttributes; 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.bridge.domains.BridgeDomain; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomainKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.BridgeBased; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey; + import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vpp/L2FibEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/L2FibEntryCustomizer.java index 0eced8237..db2e0aef0 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vpp/L2FibEntryCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/L2FibEntryCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.hc2vpp.v3po.vpp; +package io.fd.hc2vpp.v3po.l2; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; @@ -35,9 +35,9 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore; import java.util.concurrent.CompletionStage; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibFilter; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomain; 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.l2.fib.attributes.l2.fib.table.L2FibEntryKey; -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 org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vppstate/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2state/BridgeDomainCustomizer.java index e6f3bbb49..bf4222a77 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vppstate/BridgeDomainCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2state/BridgeDomainCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.hc2vpp.v3po.vppstate; +package io.fd.hc2vpp.v3po.l2state; import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; @@ -33,12 +33,11 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.annotation.Nonnull; -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.vpp.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.bridge.domains.BridgeDomain; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomains; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomainsStateBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomain; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainKey; import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -152,16 +151,16 @@ public final class BridgeDomainCustomizer extends FutureJVppCustomizer @Override public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<BridgeDomain> readData) { - ((BridgeDomainsBuilder) builder).setBridgeDomain(readData); + ((BridgeDomainsStateBuilder) builder).setBridgeDomain(readData); } @Override - public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain> init( + public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomain> init( @Nonnull final InstanceIdentifier<BridgeDomain> id, @Nonnull final BridgeDomain readValue, @Nonnull final ReadContext ctx) { return Initialized.create(getCfgId(id), - new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainBuilder() + new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomainBuilder() .setName(readValue.getName()) .setLearn(readValue.isLearn()) .setUnknownUnicastFlood(readValue.isUnknownUnicastFlood()) @@ -171,11 +170,11 @@ public final class BridgeDomainCustomizer extends FutureJVppCustomizer .build()); } - static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain> getCfgId( + static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomain> getCfgId( final InstanceIdentifier<BridgeDomain> id) { - return InstanceIdentifier.create(Vpp.class).child(BridgeDomains.class).child( - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain.class, - new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey( + return InstanceIdentifier.create(BridgeDomains.class).child( + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomain.class, + new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomainKey( id.firstKeyOf(BridgeDomain.class).getName())); } } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vppstate/L2FibEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2state/L2FibEntryCustomizer.java index 2605293c5..95188e5b1 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vppstate/L2FibEntryCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2state/L2FibEntryCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.hc2vpp.v3po.vppstate; +package io.fd.hc2vpp.v3po.l2state; import com.google.common.base.Preconditions; import com.google.common.primitives.Longs; @@ -40,13 +40,13 @@ import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibFilter; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibForward; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomain; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainKey; 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.l2.fib.attributes.l2.fib.table.L2FibEntryBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomain; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey; import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/rpc/CliInbandService.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/rpc/CliInbandService.java deleted file mode 100644 index 7128d06bc..000000000 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/rpc/CliInbandService.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.rpc; - -import com.google.inject.Inject; -import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; -import io.fd.honeycomb.rpc.RpcService; -import io.fd.vpp.jvpp.core.dto.CliInband; -import io.fd.vpp.jvpp.core.future.FutureJVppCore; -import java.nio.charset.StandardCharsets; -import java.util.concurrent.CompletionStage; -import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.CliInbandInput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.CliInbandOutput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.CliInbandOutputBuilder; -import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.model.api.SchemaPath; - -public class CliInbandService implements RpcService<CliInbandInput, CliInbandOutput>, JvppReplyConsumer { - - private final FutureJVppCore jvpp; - private static final String localName = "cli-inband"; - private static final QName name = QName.create(CliInbandInput.QNAME, localName); - private static final SchemaPath schemaPath = SchemaPath.ROOT.createChild(name); - - @Inject - public CliInbandService(@Nonnull final FutureJVppCore jvpp) { - this.jvpp = jvpp; - } - - @Override - @Nonnull - public CompletionStage<CliInbandOutput> invoke(@Nonnull final CliInbandInput input) { - final CliInband request = new CliInband(); - request.cmd = input.getCmd().getBytes(StandardCharsets.UTF_8); - request.length = request.cmd.length; - return jvpp.cliInband(request) - .thenApply( - reply -> new CliInbandOutputBuilder().setReply(new String(reply.reply)).build() - ); - } - - @Nonnull - @Override - public SchemaPath getManagedNode() { - return schemaPath; - } -} diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vppstate/VersionCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vppstate/VersionCustomizer.java deleted file mode 100644 index 3f69c98df..000000000 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vppstate/VersionCustomizer.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.vppstate; - -import com.google.common.primitives.UnsignedInts; -import io.fd.honeycomb.translate.read.ReadContext; -import io.fd.honeycomb.translate.read.ReadFailedException; -import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; -import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; -import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer; -import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; -import io.fd.vpp.jvpp.core.dto.ShowVersion; -import io.fd.vpp.jvpp.core.dto.ShowVersionReply; -import io.fd.vpp.jvpp.core.future.FutureJVppCore; -import io.fd.vpp.jvpp.dto.ControlPing; -import io.fd.vpp.jvpp.dto.ControlPingReply; -import io.fd.vpp.jvpp.dto.JVppReply; -import java.util.concurrent.CompletionStage; -import javax.annotation.Nonnull; -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.vpp.state.Version; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.VersionBuilder; -import org.opendaylight.yangtools.concepts.Builder; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -public final class VersionCustomizer - extends FutureJVppCustomizer - implements ReaderCustomizer<Version, VersionBuilder>, ByteDataTranslator, JvppReplyConsumer { - - public VersionCustomizer(@Nonnull final FutureJVppCore futureJVppCore) { - super(futureJVppCore); - } - - @Override - public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Version readValue) { - ((VppStateBuilder) parentBuilder).setVersion(readValue); - } - - @Nonnull - @Override - public VersionBuilder getBuilder(@Nonnull InstanceIdentifier<Version> id) { - return new VersionBuilder(); - } - - @Override - public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Version> id, @Nonnull final VersionBuilder builder, - @Nonnull final ReadContext context) throws ReadFailedException { - - // Execute with timeout - final CompletionStage<ShowVersionReply> showVersionFuture = getFutureJVpp().showVersion(new ShowVersion()); - final ShowVersionReply reply = getReplyForRead(showVersionFuture.toCompletableFuture(), id); - - builder.setBranch(toString(reply.version)); - builder.setName(toString(reply.program)); - builder.setBuildDate(toString(reply.buildDate)); - builder.setBuildDirectory(toString(reply.buildDirectory)); - builder.setPid(getPid(id)); - } - - private Long getPid(@Nonnull final InstanceIdentifier<Version> id) throws ReadFailedException { - final CompletionStage<JVppReply<ControlPing>> request = getFutureJVpp().send(new ControlPing()); - final ControlPingReply reply = (ControlPingReply)getReplyForRead(request.toCompletableFuture(), id); - return UnsignedInts.toLong(reply.vpePid); - } - - -} diff --git a/v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json b/v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json deleted file mode 100644 index 9ea66efe8..000000000 --- a/v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "keepalive-delay": "30" -} diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java index 66231b2ff..9d799d850 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java @@ -19,7 +19,6 @@ 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.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; import static org.mockito.MockitoAnnotations.initMocks; @@ -29,7 +28,6 @@ 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.v3po.cfgattrs.V3poConfiguration; import io.fd.honeycomb.translate.MappingContext; import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder; import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder; @@ -70,9 +68,6 @@ public class V3poModuleTest { @Inject private Set<WriterFactory> writerFactories = new HashSet<>(); - @Inject - private V3poConfiguration configuration; - @Before public void setUp() { initMocks(this); @@ -99,8 +94,5 @@ public class V3poModuleTest { assertNotNull(registryBuilder.build()); } - @Test - public void testConfiguration() { - assertEquals(30, configuration.getKeepaliveDelay()); - } + }
\ No newline at end of file diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizerTest.java index c1dd5b170..29caf068b 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizerTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.hc2vpp.v3po.vpp; +package io.fd.hc2vpp.v3po.l2; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -38,13 +38,13 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomains; 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.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntryBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntryKey; -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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomain; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomainKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest { diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/BridgeDomainCustomizerTest.java index 25b398fab..8bf7007fe 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/BridgeDomainCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/BridgeDomainCustomizerTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.hc2vpp.v3po.vpp; +package io.fd.hc2vpp.v3po.l2; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; @@ -38,14 +38,14 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesBuilder; 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.interfaces.rev140508.interfaces.InterfaceBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomains; 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.VppInterfaceAugmentationBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomain; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomainBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomainKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.L2Builder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.BridgeBasedBuilder; -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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/L2FibEntryCustomizerTest.java index 551b0879e..b00e9e7e2 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/L2FibEntryCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/L2FibEntryCustomizerTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.hc2vpp.v3po.vpp; +package io.fd.hc2vpp.v3po.l2; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -34,15 +34,15 @@ import io.fd.vpp.jvpp.core.dto.L2FibAddDelReply; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomains; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibFilter; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibForward; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomain; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomainKey; 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.l2.fib.attributes.l2.fib.table.L2FibEntryBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryKey; -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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class L2FibEntryCustomizerTest extends WriterCustomizerTest { diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/BridgeDomainCustomizerTest.java index 0fbdb986e..98e0cde08 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/BridgeDomainCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/BridgeDomainCustomizerTest.java @@ -14,15 +14,16 @@ * limitations under the License. */ -package io.fd.hc2vpp.v3po.vppstate; +package io.fd.hc2vpp.v3po.l2state; -import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; -import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.hc2vpp.common.test.read.ListReaderCustomizerTest; -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.bridge.domains.BridgeDomain; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey; +import io.fd.hc2vpp.common.translate.util.NamingContext; +import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomainsStateBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomain; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainKey; + public class BridgeDomainCustomizerTest extends ListReaderCustomizerTest<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> { @@ -31,7 +32,7 @@ public class BridgeDomainCustomizerTest private NamingContext interfacesContext; public BridgeDomainCustomizerTest() { - super(BridgeDomain.class, BridgeDomainsBuilder.class); + super(BridgeDomain.class, BridgeDomainsStateBuilder.class); } @Override diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2FibEntryCustomizerTest.java index 94a654c15..836653b28 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/L2FibEntryCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2FibEntryCustomizerTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.hc2vpp.v3po.vppstate; +package io.fd.hc2vpp.v3po.l2state; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; @@ -30,15 +30,16 @@ import java.util.List; import java.util.concurrent.ExecutionException; import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomains; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomainsState; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibForward; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomain; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainKey; 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.l2.fib.attributes.l2.fib.table.L2FibEntryBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryKey; -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.bridge.domains.BridgeDomain; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import io.fd.vpp.jvpp.VppInvocationException; import io.fd.vpp.jvpp.core.dto.L2FibTableDump; @@ -73,7 +74,7 @@ public class L2FibEntryCustomizerTest extends ListReaderCustomizerTest<L2FibEntr } private static InstanceIdentifier<L2FibEntry> getL2FibEntryId(final String bdName, final PhysAddress address) { - return InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class, new BridgeDomainKey(bdName)) + return InstanceIdentifier.create(BridgeDomainsState.class).child(BridgeDomain.class, new BridgeDomainKey(bdName)) .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address)); } diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/VppStateTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2StateTest.java index 7134a595a..9a0d0e4c8 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/VppStateTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2StateTest.java @@ -14,10 +14,9 @@ * limitations under the License. */ -package io.fd.hc2vpp.v3po.vppstate; +package io.fd.hc2vpp.v3po.l2state; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doAnswer; @@ -28,53 +27,39 @@ import static org.mockito.MockitoAnnotations.initMocks; import com.google.common.base.Optional; import com.google.common.collect.Iterables; import com.google.common.collect.Multimap; +import io.fd.hc2vpp.common.test.util.FutureProducer; +import io.fd.hc2vpp.common.test.util.NamingContextHelper; +import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.MappingContext; import io.fd.honeycomb.translate.ModificationCache; import io.fd.honeycomb.translate.impl.read.GenericListReader; -import io.fd.honeycomb.translate.impl.read.GenericReader; +import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder; import io.fd.honeycomb.translate.read.ReadContext; import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.read.registry.ReaderRegistry; -import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder; -import io.fd.hc2vpp.common.test.util.NamingContextHelper; -import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.hc2vpp.common.test.util.FutureProducer; -import io.fd.vpp.jvpp.dto.ControlPing; -import io.fd.vpp.jvpp.dto.ControlPingReply; +import io.fd.vpp.jvpp.core.dto.BridgeDomainDetails; +import io.fd.vpp.jvpp.core.dto.BridgeDomainDetailsReplyDump; +import io.fd.vpp.jvpp.core.dto.BridgeDomainDump; +import io.fd.vpp.jvpp.core.dto.L2FibTableDump; +import io.fd.vpp.jvpp.core.dto.L2FibTableEntry; +import io.fd.vpp.jvpp.core.dto.L2FibTableEntryReplyDump; +import io.fd.vpp.jvpp.core.future.FutureJVppCore; import java.util.Arrays; import java.util.Collections; import java.util.List; import javax.annotation.Nonnull; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.mockito.Mock; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress; -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.l2.fib.table.L2FibEntry; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryKey; -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.VersionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomain; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomainsState; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomainsStateBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomain; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainKey; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import io.fd.vpp.jvpp.core.dto.BridgeDomainDetails; -import io.fd.vpp.jvpp.core.dto.BridgeDomainDetailsReplyDump; -import io.fd.vpp.jvpp.core.dto.BridgeDomainDump; -import io.fd.vpp.jvpp.core.dto.L2FibTableDump; -import io.fd.vpp.jvpp.core.dto.L2FibTableEntry; -import io.fd.vpp.jvpp.core.dto.L2FibTableEntryReplyDump; -import io.fd.vpp.jvpp.core.dto.ShowVersion; -import io.fd.vpp.jvpp.core.dto.ShowVersionReply; -import io.fd.vpp.jvpp.core.future.FutureJVppCore; -public class VppStateTest implements FutureProducer, NamingContextHelper { +public class L2StateTest implements FutureProducer, NamingContextHelper { private static final String BD_CTX_NAME = "bd-test-instance"; @Mock @@ -88,7 +73,7 @@ public class VppStateTest implements FutureProducer, NamingContextHelper { private ReaderRegistry readerRegistry; - private static InstanceIdentifier<BridgeDomains> bridgeDomainsId; + private static InstanceIdentifier<BridgeDomainsState> bridgeDomainsId; /** * Create root VppState reader with all its children wired. @@ -97,14 +82,9 @@ public class VppStateTest implements FutureProducer, NamingContextHelper { @Nonnull final NamingContext bdContext) { final CompositeReaderRegistryBuilder registry = new CompositeReaderRegistryBuilder(); - // VppState(Structural) - final InstanceIdentifier<VppState> vppStateId = InstanceIdentifier.create(VppState.class); - registry.addStructuralReader(vppStateId, VppStateBuilder.class); - // Version - registry.add(new GenericReader<>(vppStateId.child(Version.class), new VersionCustomizer(jVpp))); // BridgeDomains(Structural) - bridgeDomainsId = vppStateId.child(BridgeDomains.class); - registry.addStructuralReader(bridgeDomainsId, BridgeDomainsBuilder.class); + bridgeDomainsId = InstanceIdentifier.create(BridgeDomainsState.class); + registry.addStructuralReader(bridgeDomainsId, BridgeDomainsStateBuilder.class); // BridgeDomain registry.add(getBridgeDomainReader(jVpp, bdContext)); return registry.build(); @@ -127,27 +107,6 @@ public class VppStateTest implements FutureProducer, NamingContextHelper { readerRegistry = getVppStateReader(api, bdContext); } - private static Version getVersion() { - return new VersionBuilder() - .setName("test") - .setBuildDirectory("1") - .setBranch("2") - .setBuildDate("3") - .setPid(0L) - .build(); - } - - private void whenShowVersionThenReturn(final Version version) { - final ShowVersionReply reply = new ShowVersionReply(); - reply.buildDate = version.getBuildDate().getBytes(); - reply.program = version.getName().getBytes(); - reply.version = version.getBranch().getBytes(); - reply.buildDirectory = version.getBuildDirectory().getBytes(); - when(api.showVersion(any(ShowVersion.class))).thenReturn(future(reply)); - // Version Customizer uses ControlPing to obtain PID - when(api.send(any(ControlPing.class))).thenReturn(future(new ControlPingReply())); - } - private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> entryList) { final L2FibTableEntryReplyDump reply = new L2FibTableEntryReplyDump(); reply.l2FibTableEntry = entryList; @@ -171,9 +130,6 @@ public class VppStateTest implements FutureProducer, NamingContextHelper { @Test public void testReadAll() throws Exception { - final Version version = getVersion(); - whenShowVersionThenReturn(version); - final BridgeDomainDetails bridgeDomainDetails = new BridgeDomainDetails(); final BridgeDomainDetails bridgeDomainDetails2 = new BridgeDomainDetails(); bridgeDomainDetails2.bdId = 1; @@ -187,74 +143,23 @@ public class VppStateTest implements FutureProducer, NamingContextHelper { final Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> dataObjects = readerRegistry.readAll(ctx); assertEquals(dataObjects.size(), 1); - final VppState dataObject = - (VppState) Iterables.getOnlyElement(dataObjects.get(Iterables.getOnlyElement(dataObjects.keySet()))); - assertEquals(version, dataObject.getVersion()); - assertEquals(2, dataObject.getBridgeDomains().getBridgeDomain().size()); - } - - @Test - public void testReadSpecific() throws Exception { - final Version version = getVersion(); - whenShowVersionThenReturn(version); - whenBridgeDomainDumpThenReturn(Collections.emptyList()); - - final Optional<? extends DataObject> read = readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx); - assertTrue(read.isPresent()); - assertEquals(version, ((VppState) read.get()).getVersion()); + final BridgeDomainsState dataObject = + (BridgeDomainsState) Iterables.getOnlyElement(dataObjects.get(Iterables.getOnlyElement(dataObjects.keySet()))); + assertEquals(2, dataObject.getBridgeDomain().size()); } @Test public void testReadBridgeDomains() throws Exception { - final Version version = getVersion(); - whenShowVersionThenReturn(version); final BridgeDomainDetails details = new BridgeDomainDetails(); whenBridgeDomainDumpThenReturn(Collections.singletonList(details)); mockBdMapping(details, "bdn1"); - VppState readRoot = (VppState) readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx).get(); - - Optional<? extends DataObject> read = - readerRegistry.read(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class), ctx); - assertTrue(read.isPresent()); - assertEquals(readRoot.getBridgeDomains(), read.get()); - } - - /** - * L2fib does not have a dedicated reader, relying on auto filtering - */ - @Test - @Ignore("L2 FIB was moved to dedicated customizer. TODO: add infra test that covers such case") - @SuppressWarnings("unchecked") - public void testReadL2Fib() throws Exception { - final BridgeDomainDetails bd = new BridgeDomainDetails(); - bd.bdId = 0; - final String bdName = "bdn1"; - mockBdMapping(bd, bdName); - defineMapping(mappingContext, "eth1", 0, "ifc-test-instance"); + BridgeDomainsState readRoot = (BridgeDomainsState) readerRegistry.read(InstanceIdentifier.create(BridgeDomainsState.class), ctx).get(); - whenBridgeDomainDumpThenReturn(Collections.singletonList(bd)); - final L2FibTableEntry l2FibEntry = new L2FibTableEntry(); - l2FibEntry.bdId = 0; - l2FibEntry.mac = 0x0605040302010000L; - whenL2FibTableDumpThenReturn(Collections.singletonList(l2FibEntry)); - - // Deep child without a dedicated reader with specific l2fib key - final InstanceIdentifier<? extends DataObject> idExisting = - InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child( - BridgeDomain.class, new BridgeDomainKey("bdn1")).child(L2FibTable.class) - .child(L2FibEntry.class, new L2FibEntryKey(new PhysAddress("01:02:03:04:05:06"))); Optional<? extends DataObject> read = - readerRegistry.read(idExisting, ctx); + readerRegistry.read(InstanceIdentifier.create(BridgeDomainsState.class), ctx); assertTrue(read.isPresent()); - - // non existing l2fib - final InstanceIdentifier<? extends DataObject> idNonExisting = - InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child( - BridgeDomain.class, new BridgeDomainKey("bdn1")).child(L2FibTable.class) - .child(L2FibEntry.class, new L2FibEntryKey(new PhysAddress("FF:FF:FF:04:05:06"))); - read = readerRegistry.read(idNonExisting, ctx); - assertFalse(read.isPresent()); + assertEquals(readRoot.getBridgeDomain(), BridgeDomainsState.class.cast(read.get()).getBridgeDomain()); } private void mockBdMapping(final BridgeDomainDetails bd, final String bdName) { @@ -263,22 +168,20 @@ public class VppStateTest implements FutureProducer, NamingContextHelper { @Test public void testReadBridgeDomainAll() throws Exception { - final Version version = getVersion(); - whenShowVersionThenReturn(version); final BridgeDomainDetails details = new BridgeDomainDetails(); whenBridgeDomainDumpThenReturn(Collections.singletonList(details)); mockBdMapping(details, "bd2"); - VppState readRoot = (VppState) readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx).get(); + BridgeDomainsState readRoot = (BridgeDomainsState) readerRegistry.read(InstanceIdentifier.create(BridgeDomainsState.class), ctx).get(); final GenericListReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> bridgeDomainReader = getBridgeDomainReader(api, bdContext); final List<BridgeDomain> read = - bridgeDomainReader.readList(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child( + bridgeDomainReader.readList(InstanceIdentifier.create(BridgeDomainsState.class).child( BridgeDomain.class), ctx); - assertEquals(readRoot.getBridgeDomains().getBridgeDomain(), read); + assertEquals(readRoot.getBridgeDomain(), read); } @Test @@ -289,16 +192,15 @@ public class VppStateTest implements FutureProducer, NamingContextHelper { mockBdMapping(bd, bdName); whenBridgeDomainDumpThenReturn(Collections.singletonList(bd)); - whenShowVersionThenReturn(getVersion()); - VppState readRoot = (VppState) readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx).get(); + BridgeDomainsState readRoot = (BridgeDomainsState) readerRegistry.read(InstanceIdentifier.create(BridgeDomainsState.class), ctx).get(); final Optional<? extends DataObject> read = - readerRegistry.read(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child( + readerRegistry.read(InstanceIdentifier.create(BridgeDomainsState.class).child( BridgeDomain.class, new BridgeDomainKey(bdName)), ctx); assertTrue(read.isPresent()); - assertEquals(readRoot.getBridgeDomains().getBridgeDomain().stream().filter( + assertEquals(readRoot.getBridgeDomain().stream().filter( input -> input.getKey().getName().equals(bdName)).findFirst().get(), read.get()); } @@ -308,19 +210,7 @@ public class VppStateTest implements FutureProducer, NamingContextHelper { final String nonExistingBdName = "NOT EXISTING"; noMappingDefined(mappingContext, nonExistingBdName, BD_CTX_NAME); - readerRegistry.read(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child( + readerRegistry.read(InstanceIdentifier.create(BridgeDomainsState.class).child( BridgeDomain.class, new BridgeDomainKey(nonExistingBdName)), ctx); } - - @Test - public void testReadVersion() throws Exception { - whenShowVersionThenReturn(getVersion()); - whenBridgeDomainDumpThenReturn(Collections.emptyList()); - VppState readRoot = (VppState) readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx).get(); - - Optional<? extends DataObject> read = - readerRegistry.read(InstanceIdentifier.create(VppState.class).child(Version.class), ctx); - assertTrue(read.isPresent()); - assertEquals(readRoot.getVersion(), read.get()); - } }
\ No newline at end of file diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/rpc/CliInbandServiceTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/rpc/CliInbandServiceTest.java deleted file mode 100644 index baedba6fc..000000000 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/rpc/CliInbandServiceTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.rpc; - -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import io.fd.hc2vpp.common.test.util.FutureProducer; -import io.fd.vpp.jvpp.core.dto.CliInbandReply; -import io.fd.vpp.jvpp.core.future.FutureJVppCore; -import org.junit.Test; -import org.mockito.Mock; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.CliInbandInput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.CliInbandInputBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.CliInbandOutput; - -public class CliInbandServiceTest implements FutureProducer { - - @Mock - private FutureJVppCore api; - - @Test - public void testInvoke() throws Exception { - initMocks(this); - final String replyString = "CLI output"; - - final CliInbandService service = new CliInbandService(api); - final CliInbandReply reply = new CliInbandReply(); - reply.reply = replyString.getBytes(); - when(api.cliInband(any())).thenReturn(future(reply)); - - final CliInbandInput request = new CliInbandInputBuilder().setCmd("cmd").build(); - final CliInbandOutput response = service.invoke(request).toCompletableFuture().get(); - assertEquals(replyString, response.getReply()); - } -}
\ No newline at end of file diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/VersionCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/VersionCustomizerTest.java deleted file mode 100644 index 2f12cbde1..000000000 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/VersionCustomizerTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.vppstate; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; -import io.fd.hc2vpp.common.test.read.ReaderCustomizerTest; -import io.fd.vpp.jvpp.core.dto.ShowVersion; -import io.fd.vpp.jvpp.core.dto.ShowVersionReply; -import io.fd.vpp.jvpp.dto.ControlPing; -import io.fd.vpp.jvpp.dto.ControlPingReply; -import org.junit.Test; -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.vpp.state.Version; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.VersionBuilder; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -public class VersionCustomizerTest extends ReaderCustomizerTest<Version, VersionBuilder> { - - public VersionCustomizerTest() { - super(Version.class, VppStateBuilder.class); - } - - @Override - protected ReaderCustomizer<Version, VersionBuilder> initCustomizer() { - return new VersionCustomizer(api); - } - - @Test - public void testReadCurrentAttributes() throws Exception { - final ShowVersionReply reply = new ShowVersionReply(); - reply.version = new byte[] {}; - reply.program = new byte[] {}; - reply.buildDate = new byte[] {}; - reply.buildDirectory = new byte[] {}; - - when(api.showVersion(any(ShowVersion.class))).thenReturn(future(reply)); - when(api.send(any(ControlPing.class))).thenReturn(future(new ControlPingReply())); - getCustomizer().readCurrentAttributes(InstanceIdentifier.create(Version.class), new VersionBuilder(), ctx); - verify(api).showVersion(any(ShowVersion.class)); - verify(api).send(any(ControlPing.class)); - } -}
\ No newline at end of file diff --git a/v3po/v3po2vpp/src/test/resources/v3po.json b/v3po/v3po2vpp/src/test/resources/v3po.json deleted file mode 100644 index 9ea66efe8..000000000 --- a/v3po/v3po2vpp/src/test/resources/v3po.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "keepalive-delay": "30" -} |