+/*
+ * 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;
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;
_logger.info("Invoking RPC");
ExampleConsumer consumer = getConsumer();
- RpcResult<CompositeNode> result = consumer.invokeRpc(QNAME, new CompositeNodeImpl());
+ RpcResult<CompositeNode> result = consumer.invokeRpc(QNAME, consumer.getValidCompositeNodeWithOneSimpleChild());
_logger.info("Result [{}]", result.isSuccessful());
return stringify(result);
_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";
_logger.error("error in adding routing identifier" + e.getMessage());
}
- Set<String> 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
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;
+ }
}
}