+/*
+ * Copyright (c) 2014, 2015 Red Hat, 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.ovsdb.northbound;
import com.fasterxml.jackson.databind.SerializationFeature;
import java.io.InputStream;
+import java.util.Collections;
import java.util.List;
import javax.ws.rs.Consumes;
import org.opendaylight.controller.northbound.commons.RestMessages;
import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
import org.opendaylight.ovsdb.lib.OvsdbClient;
import org.opendaylight.ovsdb.plugin.api.Connection;
import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
public Response getNodes() throws JsonProcessingException {
OvsdbConnectionService connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
List<Node> nodes = connectionService.getNodes();
- if (nodes == null) return Response.noContent().build();
+ if (nodes == null) {
+ return Response.noContent().build();
+ }
List<String> nodeIds = Lists.newArrayList();
for (Node node : nodes) {
- nodeIds.add(node.toString());
+ nodeIds.add(node.getId().getValue());
}
+ Collections.sort(nodeIds);
String response = objectMapper.writeValueAsString(nodeIds);
return Response.status(Response.Status.OK)