Search in sources :

Example 21 with K8sNetwork

use of org.onosproject.k8snetworking.api.K8sNetwork in project onos by opennetworkinglab.

the class K8sNetworkWebResource method hasNetwork.

/**
 * Checks whether the network exists with given network id.
 *
 * @param id network identifier
 * @return 200 OK with true/false result
 */
@GET
@Path("exist/{id}")
public Response hasNetwork(@PathParam("id") String id) {
    log.trace(String.format(MESSAGE, "QUERY " + id));
    ObjectNode root = mapper().createObjectNode();
    K8sNetwork network = adminService.network(id);
    if (network == null) {
        root.put(RESULT, false);
    } else {
        root.put(RESULT, true);
    }
    return Response.ok(root).build();
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) K8sNetwork(org.onosproject.k8snetworking.api.K8sNetwork) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

K8sNetwork (org.onosproject.k8snetworking.api.K8sNetwork)21 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)6 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)6 TrafficSelector (org.onosproject.net.flow.TrafficSelector)6 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)6 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)5 Path (javax.ws.rs.Path)4 K8sNetworkService (org.onosproject.k8snetworking.api.K8sNetworkService)4 K8sPort (org.onosproject.k8snetworking.api.K8sPort)4 Set (java.util.Set)3 IpAddress (org.onlab.packet.IpAddress)3 MacAddress (org.onlab.packet.MacAddress)3 DefaultK8sNetwork (org.onosproject.k8snetworking.api.DefaultK8sNetwork)3 K8sNetworkJsonMatcher.matchesK8sNetwork (org.onosproject.k8snetworking.codec.K8sNetworkJsonMatcher.matchesK8sNetwork)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ExecutorService (java.util.concurrent.ExecutorService)2 Collectors (java.util.stream.Collectors)2 GET (javax.ws.rs.GET)2 Produces (javax.ws.rs.Produces)2 VlanId (org.onlab.packet.VlanId)2