Search in sources :

Example 6 with Vpls

use of org.onosproject.vpls.api.Vpls in project onos by opennetworkinglab.

the class VplsWebResource method deleteInterface.

/**
 * Removes a specified interface.
 *
 * @param vplsName Vpls name
 * @param interfaceName interface name
 * @return 204 NO CONTENT
 */
@DELETE
@Path("interface/{vplsName}/{interfaceName}")
public Response deleteInterface(@PathParam("vplsName") String vplsName, @PathParam("interfaceName") String interfaceName) {
    Vpls service = get(Vpls.class);
    InterfaceAdminService interfaceService = get(InterfaceAdminService.class);
    final VplsData vplsData = nullIsNotFound(service.getVpls(vplsName), VPLS_NOT_FOUND + vplsName);
    vplsData.interfaces().forEach(anInterface -> {
        if (anInterface.name().equals(interfaceName)) {
            interfaceService.remove(anInterface.connectPoint(), anInterface.name());
            service.removeInterface(vplsData, anInterface);
        }
    });
    return Response.noContent().build();
}
Also used : InterfaceAdminService(org.onosproject.net.intf.InterfaceAdminService) VplsData(org.onosproject.vpls.api.VplsData) Vpls(org.onosproject.vpls.api.Vpls) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Example 7 with Vpls

use of org.onosproject.vpls.api.Vpls in project onos by opennetworkinglab.

the class VplsWebResource method getVpls.

/**
 * Gets Vpls. Returns a Vpls by vplsName.
 * @param  vplsName  vpls name
 * @return 200 OK with a vpls, return 404 if no entry has been found
 * @onos.rsModel Vpls
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("{vplsName}")
public Response getVpls(@PathParam("vplsName") String vplsName) {
    ArrayNode vplsNode = root.putArray(VPLS);
    Vpls service = get(Vpls.class);
    final VplsData vplsData = nullIsNotFound(service.getVpls(vplsName), VPLS_NOT_FOUND + vplsName);
    vplsNode.add(codec(VplsData.class).encode(vplsData, this));
    return ok(root).build();
}
Also used : VplsData(org.onosproject.vpls.api.VplsData) Vpls(org.onosproject.vpls.api.Vpls) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 8 with Vpls

use of org.onosproject.vpls.api.Vpls in project onos by opennetworkinglab.

the class VplsWebResource method deleteVpls.

/**
 * Removes the specified vpls.
 *
 * @param vplsName Vpls name
 * @return 204 NO CONTENT
 */
@DELETE
@Path("{vplsName}")
public Response deleteVpls(@PathParam("vplsName") String vplsName) {
    Vpls service = get(Vpls.class);
    final VplsData vplsData = nullIsNotFound(service.getVpls(vplsName), VPLS_NOT_FOUND + vplsName);
    service.removeVpls(vplsData);
    return Response.noContent().build();
}
Also used : VplsData(org.onosproject.vpls.api.VplsData) Vpls(org.onosproject.vpls.api.Vpls) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Aggregations

Vpls (org.onosproject.vpls.api.Vpls)8 VplsData (org.onosproject.vpls.api.VplsData)7 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)3 InterfaceAdminService (org.onosproject.net.intf.InterfaceAdminService)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 IOException (java.io.IOException)2 Consumes (javax.ws.rs.Consumes)2 DELETE (javax.ws.rs.DELETE)2 GET (javax.ws.rs.GET)2 POST (javax.ws.rs.POST)2 UriBuilder (javax.ws.rs.core.UriBuilder)2 DeviceService (org.onosproject.net.device.DeviceService)2 Interface (org.onosproject.net.intf.Interface)2 Sets (com.google.common.collect.Sets)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Objects (java.util.Objects)1 Set (java.util.Set)1