X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-remoterpc-connector%2Fintegrationtest%2Ftest-nb%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Ftests%2Fzmqrouter%2Frest%2FRouter.java;h=e97be52f3d1b422ed8bd540c625a0a77654ad86b;hp=6c9ec4e788827a6c375d4da4964578622a9ea47b;hb=14f3e1124c15c173bb1d2e7e16043ad4438be81c;hpb=97a4294baa44125d53a7ee2a3646f8a1c8da73e6 diff --git a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqrouter/rest/Router.java b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqrouter/rest/Router.java index 6c9ec4e788..e97be52f3d 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqrouter/rest/Router.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/src/main/java/org/opendaylight/controller/tests/zmqrouter/rest/Router.java @@ -1,10 +1,16 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.tests.zmqrouter.rest; import org.opendaylight.controller.sal.connector.api.RpcRouter; import org.opendaylight.controller.sal.connector.remoterpc.api.RoutingTable; import org.opendaylight.controller.sal.connector.remoterpc.api.RoutingTableException; import org.opendaylight.controller.sal.connector.remoterpc.api.SystemException; -import org.opendaylight.controller.sal.connector.remoterpc.dto.CompositeNodeImpl; import org.opendaylight.controller.sal.connector.remoterpc.impl.RoutingTableImpl; import org.opendaylight.controller.sal.connector.remoterpc.util.XmlUtils; import org.opendaylight.controller.sample.zeromq.consumer.ExampleConsumer; @@ -13,7 +19,8 @@ import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.data.api.CompositeNode; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; -import org.osgi.framework.*; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -70,7 +77,7 @@ public class Router { _logger.info("Invoking RPC"); ExampleConsumer consumer = getConsumer(); - RpcResult result = consumer.invokeRpc(QNAME, new CompositeNodeImpl()); + RpcResult result = consumer.invokeRpc(QNAME, consumer.getValidCompositeNodeWithOneSimpleChild()); _logger.info("Result [{}]", result.isSuccessful()); return stringify(result); @@ -111,7 +118,7 @@ public class Router { _logger.debug("Could not get routing table impl reference"); return "Could not get routingtable referen "; } - RoutingTable routingTable = (RoutingTableImpl) ctx.getService(routingTableServiceReference); + RoutingTableImpl routingTable = (RoutingTableImpl) ctx.getService(routingTableServiceReference); if (routingTable == null) { _logger.info("Could not get routing table service"); return "Could not get routing table service"; @@ -128,16 +135,14 @@ public class Router { _logger.error("error in adding routing identifier" + e.getMessage()); } - Set routes = routingTable.getRoutes(rii.toString()); + String result = routingTable.dumpRoutingTableCache(); - StringBuilder stringBuilder = new StringBuilder(); - for (String route : routes) { - stringBuilder.append(route); - } - _logger.info("Result [{}] routes added for route" + rii + stringBuilder.toString()); - return stringBuilder.toString(); + + _logger.info("Result [{}] routes added for route" + rii + result); + + return result; } @GET @@ -242,5 +247,27 @@ public class Router { public org.opendaylight.yangtools.yang.data.api.InstanceIdentifier getRoute() { return InstanceIdentifier.of(instance); } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + RoutingIdentifierImpl that = (RoutingIdentifierImpl) o; + + if (!QNAME.equals(that.QNAME)) return false; + if (!instance.equals(that.instance)) return false; + if (!namespace.equals(that.namespace)) return false; + + return true; + } + + @Override + public int hashCode() { + int result = namespace.hashCode(); + result = 31 * result + QNAME.hashCode(); + result = 31 * result + instance.hashCode(); + return result; + } } }