blob: f1e9af79a57e25cbcb8cbc14f6d0fedf0f8d0edb [file] [log] [blame]
Lee Yongjae6dc7e4f2017-12-06 16:17:51 +09001/*
2 * Copyright 2017-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.simplefabric;
18
19import org.onosproject.rest.AbstractWebResource;
20
21import java.io.ByteArrayOutputStream;
22import javax.ws.rs.GET;
23import javax.ws.rs.PUT;
24import javax.ws.rs.Path;
25import javax.ws.rs.core.Response;
26
27/**
28 * Manage SIMPLE_FABRIC Status.
29 */
30@Path("")
31public class SimpleFabricWebResource extends AbstractWebResource {
32
33 /**
34 * SIMPLE_FABRIC Show Status; dummy for now.
35 *
36 * @return 200 OK
37 */
38 @GET
39 @Path("status")
40 public Response queryStatus() {
41 return Response.ok("ok").build();
42 }
43
44 /**
45 * SIMPLE_FABRIC Show Configurations.
46 *
47 * @return 200 OK
48 */
49 @GET
50 @Path("show")
51 public Response queryShow() {
52 ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
53 get(SimpleFabricService.class).dumpToStream("show", outputStream);
54 return Response.ok(outputStream.toString()).build();
55 }
56
57 /**
58 * SIMPLE_FABRIC Intents Infos.
59 *
60 * @return 200 OK
61 */
62 @GET
63 @Path("intents")
64 public Response queryIntents() {
65 ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
66 get(SimpleFabricService.class).dumpToStream("intents", outputStream);
67 return Response.ok(outputStream.toString()).build();
68 }
69
70 /**
71 * SIMPLE_FABRIC Reactive Intents Infos.
72 *
73 * @return 200 OK
74 */
75 @GET
76 @Path("reactive-intents")
77 public Response queryReactiveIntents() {
78 ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
79 get(SimpleFabricService.class).dumpToStream("reactive-intents", outputStream);
80 return Response.ok(outputStream.toString()).build();
81 }
82
83 /**
84 * Trigger SimpleFabric Service Refresh.
85 *
86 * @return 204 No Content
87 */
88 @PUT
89 @Path("refresh")
90 public Response triggerRefresh() {
91 get(SimpleFabricService.class).triggerRefresh();
92 return Response.status(204).build();
93 }
94
95 /**
96 * Trigger SimpleFabric Service Flush Reactive Intents.
97 *
98 * @return 204 No Content
99 */
100 @PUT
101 @Path("flush")
102 public Response triggerFlush() {
103 get(SimpleFabricService.class).triggerFlush();
104 return Response.status(204).build();
105 }
106
107}
108