use of org.onosproject.net.topology.Topology in project onos by opennetworkinglab.
the class TopologyWebResource method getConnectPointInfrastructure.
/**
* Tests if a connect point is infrastructure or edge.
*
* @param connectPointString deviceid:portnumber
* @return 200 OK with JSON representation of true if the connect point is broadcast,
* false otherwise
* @onos.rsModel TopologyInfrastructure
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("infrastructure/{connectPoint}")
public Response getConnectPointInfrastructure(@PathParam("connectPoint") String connectPointString) {
Topology topology = get(TopologyService.class).currentTopology();
DeviceId deviceId = DeviceId.deviceId(getDeviceId(connectPointString));
nullIsNotFound(get(DeviceService.class).getDevice(deviceId), "Device not found " + connectPointString);
PortNumber portNumber = PortNumber.portNumber(getPortNumber(connectPointString));
nullIsNotFound(get(DeviceService.class).getPort(deviceId, portNumber), "Port not found " + connectPointString);
ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber);
boolean isInfrastructure = get(TopologyService.class).isInfrastructure(topology, connectPoint);
return ok(mapper().createObjectNode().put("infrastructure", isInfrastructure)).build();
}
use of org.onosproject.net.topology.Topology in project onos by opennetworkinglab.
the class TopologyWebResource method getTopology.
/**
* Gets overview of current topology.
*
* @return 200 OK with topology overview
* @onos.rsModel Topology
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getTopology() {
Topology topology = get(TopologyService.class).currentTopology();
ObjectNode root = codec(Topology.class).encode(topology, this);
return ok(root).build();
}
use of org.onosproject.net.topology.Topology in project onos by opennetworkinglab.
the class TopologyWebResource method getCluster.
/**
* Gets details of a specific SCC.
*
* @param clusterId id of the cluster to query
* @return 200 OK with topology cluster details
* @onos.rsModel TopologyCluster
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("clusters/{id}")
public Response getCluster(@PathParam("id") int clusterId) {
Topology topology = get(TopologyService.class).currentTopology();
TopologyCluster cluster = getTopologyCluster(clusterId, topology);
ObjectNode root = codec(TopologyCluster.class).encode(cluster, this);
return ok(root).build();
}
use of org.onosproject.net.topology.Topology in project onos by opennetworkinglab.
the class TopologyWebResource method getConnectPointBroadcast.
/**
* Tests if a connect point is in broadcast set.
*
* @param connectPointString deviceid:portnumber
* @return 200 OK with JSON representation of true if the connect point is
* broadcast, false otherwise
* @onos.rsModel TopologyBroadcast
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("broadcast/{connectPoint}")
public Response getConnectPointBroadcast(@PathParam("connectPoint") String connectPointString) {
Topology topology = get(TopologyService.class).currentTopology();
DeviceId deviceId = DeviceId.deviceId(getDeviceId(connectPointString));
nullIsNotFound(get(DeviceService.class).getDevice(deviceId), "Device not found " + connectPointString);
PortNumber portNumber = PortNumber.portNumber(getPortNumber(connectPointString));
nullIsNotFound(get(DeviceService.class).getPort(deviceId, portNumber), "Port not found " + connectPointString);
ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber);
boolean isBroadcast = get(TopologyService.class).isBroadcastPoint(topology, connectPoint);
return ok(mapper().createObjectNode().put("broadcast", isBroadcast)).build();
}
Aggregations