Committed by
Brian O'Connor
RESTCONF Server outline
Change-Id: Id93a647b35b24c47f2828763a799b56a50113faf
Showing
22 changed files
with
1021 additions
and
0 deletions
protocols/restconf/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | + | ||
18 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
19 | + <modelVersion>4.0.0</modelVersion> | ||
20 | + <parent> | ||
21 | + <groupId>org.onosproject</groupId> | ||
22 | + <artifactId>onos-protocols</artifactId> | ||
23 | + <version>1.8.0-SNAPSHOT</version> | ||
24 | + </parent> | ||
25 | + | ||
26 | + <artifactId>onos-restconf</artifactId> | ||
27 | + <packaging>pom</packaging> | ||
28 | + | ||
29 | + <modules> | ||
30 | + <module>server</module> | ||
31 | + </modules> | ||
32 | + | ||
33 | +</project> |
protocols/restconf/server/BUCK
0 → 100644
1 | +BUNDLES = [ | ||
2 | + '//protocols/restconf/server/api:onos-protocols-restconf-server-api', | ||
3 | + '//protocols/restconf/server/restconfmgr:onos-protocols-restconf-server-restconfmgr', | ||
4 | + '//protocols/restconf/server/rpp:onos-protocols-restconf-server-rpp', | ||
5 | +] | ||
6 | + | ||
7 | +onos_app ( | ||
8 | + title = 'RESTCONF Server Module', | ||
9 | + category = 'Utility', | ||
10 | + url = 'http://onosproject.org', | ||
11 | + included_bundles = BUNDLES, | ||
12 | +) |
protocols/restconf/server/api/BUCK
0 → 100644
protocols/restconf/server/api/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
18 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
20 | + <modelVersion>4.0.0</modelVersion> | ||
21 | + | ||
22 | + <parent> | ||
23 | + <groupId>org.onosproject</groupId> | ||
24 | + <artifactId>onos-restconf-server</artifactId> | ||
25 | + <version>1.8.0-SNAPSHOT</version> | ||
26 | + <relativePath>../pom.xml</relativePath> | ||
27 | + </parent> | ||
28 | + | ||
29 | + <artifactId>onos-restconf-server-api</artifactId> | ||
30 | + <packaging>bundle</packaging> | ||
31 | + | ||
32 | + <dependencies> | ||
33 | + <dependency> | ||
34 | + <groupId>org.osgi</groupId> | ||
35 | + <artifactId>org.osgi.compendium</artifactId> | ||
36 | + </dependency> | ||
37 | + <dependency> | ||
38 | + <groupId>org.onosproject</groupId> | ||
39 | + <artifactId>onos-api</artifactId> | ||
40 | + </dependency> | ||
41 | + <dependency> | ||
42 | + <groupId>org.onosproject</groupId> | ||
43 | + <artifactId>onos-core-serializers</artifactId> | ||
44 | + <version>${project.version}</version> | ||
45 | + </dependency> | ||
46 | + <dependency> | ||
47 | + <groupId>org.glassfish.jersey.containers</groupId> | ||
48 | + <artifactId>jersey-container-servlet</artifactId> | ||
49 | + </dependency> | ||
50 | + </dependencies> | ||
51 | + | ||
52 | +</project> | ||
53 | + |
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
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 | +package org.onosproject.protocol.restconf.server.api; | ||
17 | + | ||
18 | +import javax.ws.rs.WebApplicationException; | ||
19 | +import javax.ws.rs.core.Response; | ||
20 | + | ||
21 | +import static javax.ws.rs.core.Response.Status; | ||
22 | + | ||
23 | +/** | ||
24 | + * Exceptions raised during RESTCONF operations. This class extends | ||
25 | + * WebApplicationException. The design intention is to create a place holder | ||
26 | + * for RESTCONF specific errors and to be able to add more functions as the | ||
27 | + * subsystem grows. | ||
28 | + */ | ||
29 | +public class RestconfException extends WebApplicationException { | ||
30 | + | ||
31 | + // This is a randomly generated value. A WebApplicationException class is required to define it. | ||
32 | + private static final long SERIAL_VERSION_UID = 3275970397584007046L; | ||
33 | + | ||
34 | + /** | ||
35 | + * Constructs a new RESTCONF server error exception. The caller raising this | ||
36 | + * exception may pass in a HTTP error status code and an error message. The | ||
37 | + * error code will be displayed to the RESTCONF client as part of the | ||
38 | + * response from the RESTCONF server. The error message is a string which | ||
39 | + * may be saved in a log file and may be later retrieved by the | ||
40 | + * getMessage() method. | ||
41 | + * | ||
42 | + * @param message the detailed error message | ||
43 | + * @param status HTTP error status | ||
44 | + * @throws IllegalArgumentException in case the status code is null or is not from | ||
45 | + * javax.ws.rs.core.Response.Status.Family | ||
46 | + * status code family | ||
47 | + */ | ||
48 | + public RestconfException(String message, Status status) { | ||
49 | + super(message, null, Response.status(status).build()); | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * Constructs a new RESTCONF server error exception. The caller raising | ||
54 | + * this exception may pass in the numerical value of a HTTP error | ||
55 | + * status code, The error code will be displayed to the RESTCONF client | ||
56 | + * as a response from the RESTCONF server. | ||
57 | + * | ||
58 | + * @param status HTTP error status | ||
59 | + * @throws IllegalArgumentException in case the status code is not a valid | ||
60 | + * HTTP status code or if it is not from the | ||
61 | + * javax.ws.rs.core.Response.Status.Family | ||
62 | + * status code family | ||
63 | + */ | ||
64 | + public RestconfException(int status) { | ||
65 | + super((Throwable) null, Response.status(status).build()); | ||
66 | + } | ||
67 | +} |
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
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 | +package org.onosproject.protocol.restconf.server.api; | ||
17 | + | ||
18 | +import com.fasterxml.jackson.databind.node.ObjectNode; | ||
19 | +import org.glassfish.jersey.server.ChunkedOutput; | ||
20 | + | ||
21 | +/** | ||
22 | + * Abstraction of RESTCONF Server functionality according to the | ||
23 | + * RESTCONF RFC (no official RFC number yet). | ||
24 | + */ | ||
25 | +public interface RestconfService { | ||
26 | + /** | ||
27 | + * Processes a GET request against a data resource. The | ||
28 | + * target data resource is identified by its URI. | ||
29 | + * | ||
30 | + * @param uri URI of the target data resource | ||
31 | + * @return JSON representation of the data resource | ||
32 | + * @throws RestconfException if the GET operation cannot be fulfilled due | ||
33 | + * reasons such as the nonexistence of the target | ||
34 | + * resource. The proper HTTP error status code is | ||
35 | + * enclosed in the exception, so that the caller | ||
36 | + * may return it to the RESTCONF client | ||
37 | + */ | ||
38 | + ObjectNode runGetOperationOnDataResource(String uri) throws RestconfException; | ||
39 | + | ||
40 | + /** | ||
41 | + * Processes a POST request against a data resource. The location of | ||
42 | + * the target resource is passed in as a URI. And the resource's | ||
43 | + * content is passed in as a JSON ObjectNode. | ||
44 | + * | ||
45 | + * @param uri URI of the data resource to be created | ||
46 | + * @param rootNode JSON representation of the data resource | ||
47 | + * @throws RestconfException if the POST operation cannot be fulfilled due | ||
48 | + * reasons such as wrong URI or syntax error | ||
49 | + * in JSON payload. The proper HTTP error status | ||
50 | + * code is enclosed in the exception | ||
51 | + */ | ||
52 | + void runPostOperationOnDataResource(String uri, ObjectNode rootNode) throws RestconfException; | ||
53 | + | ||
54 | + /** | ||
55 | + * Processes a PUT request against a data resource. The location of | ||
56 | + * the target resource is passed in as a URI. And the resource's | ||
57 | + * content is passed in as a JSON ObjectNode. | ||
58 | + * | ||
59 | + * @param uri URI of the data resource to be created or updated | ||
60 | + * @param rootNode JSON representation of the data resource | ||
61 | + * @throws RestconfException if the PUT operation cannot be fulfilled due | ||
62 | + * reasons such as wrong URI or syntax error | ||
63 | + * in JSON payload. The proper HTTP error status | ||
64 | + * code is enclosed in the exception | ||
65 | + */ | ||
66 | + void runPutOperationOnDataResource(String uri, ObjectNode rootNode) throws RestconfException; | ||
67 | + | ||
68 | + /** | ||
69 | + * Processes the DELETE operation against a data resource. The target | ||
70 | + * data resource is identified by its URI. | ||
71 | + * | ||
72 | + * @param uri URI of the data resource to be deleted | ||
73 | + * @throws RestconfException if the DELETE operation cannot be fulfilled due | ||
74 | + * reasons such as the nonexistence of the target | ||
75 | + * resource. The proper HTTP error status code is | ||
76 | + * enclosed in the exception | ||
77 | + */ | ||
78 | + void runDeleteOperationOnDataResource(String uri) throws RestconfException; | ||
79 | + | ||
80 | + /** | ||
81 | + * Retrieves the RESTCONF Root directory. | ||
82 | + * | ||
83 | + * @return the RESTCONF Root directory | ||
84 | + */ | ||
85 | + String getRestconfRootPath(); | ||
86 | + | ||
87 | + /** | ||
88 | + * Handles an Event Stream subscription request. This function creates | ||
89 | + * a worker thread to listen to events and writes to a ChunkedOutput, | ||
90 | + * which is passed in from the caller. (The worker thread blocks if | ||
91 | + * no events arrive.) The ChuckedOutput is a pipe to which this | ||
92 | + * function acts as the writer and the caller the reader. | ||
93 | + * | ||
94 | + * @param streamId ID of the RESTCONF stream to subscribe | ||
95 | + * @param output A string data stream | ||
96 | + * @throws RestconfException if the Event Stream cannot be subscribed due to | ||
97 | + * reasons such as the nonexistence of the target | ||
98 | + * stream or unable to allocate any free worker | ||
99 | + * thread to handle the request | ||
100 | + */ | ||
101 | + void subscribeEventStream(String streamId, ChunkedOutput<String> output) throws RestconfException; | ||
102 | +} |
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
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 | + | ||
17 | +/** | ||
18 | + * RESTCONF Server Public Interface. All public interfaces/APIs that might be used by | ||
19 | + * external applications should be packaged here. | ||
20 | + */ | ||
21 | +package org.onosproject.protocol.restconf.server.api; |
protocols/restconf/server/app/app.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<app name="org.onosproject.protocols.restconfserver" origin="ON.Lab" version="${project.version}" | ||
18 | + category="Utility" url="http://onosproject.org" title="RESTCONF Service Module App" | ||
19 | + featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features" | ||
20 | + features="${project.artifactId}" > | ||
21 | + <description>${project.description}</description> | ||
22 | + <artifact>mvn:${project.groupId}/onos-restconf-server-api/${project.version}</artifact> | ||
23 | + <artifact>mvn:${project.groupId}/onos-restconf-server-restconfmanager/${project.version}</artifact> | ||
24 | + <artifact>mvn:${project.groupId}/onos-restconf-server-rpp/${project.version}</artifact> | ||
25 | +</app> |
protocols/restconf/server/app/features.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}"> | ||
18 | + <feature name="${project.artifactId}" version="${project.version}" | ||
19 | + description="${project.description}"> | ||
20 | + <feature>onos-api</feature> | ||
21 | + <bundle>mvn:${project.groupId}/onos-restconf-server-api/${project.version}</bundle> | ||
22 | + <bundle>mvn:${project.groupId}/onos-restconf-server-restconfmanager/${project.version}</bundle> | ||
23 | + <bundle>mvn:${project.groupId}/onos-restconf-server-rpp/${project.version}</bundle> | ||
24 | + </feature> | ||
25 | +</features> |
protocols/restconf/server/app/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
18 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
20 | + <modelVersion>4.0.0</modelVersion> | ||
21 | + | ||
22 | + <parent> | ||
23 | + <groupId>org.onosproject</groupId> | ||
24 | + <artifactId>onos-restconf-server</artifactId> | ||
25 | + <version>1.8.0-SNAPSHOT</version> | ||
26 | + <relativePath>../pom.xml</relativePath> | ||
27 | + </parent> | ||
28 | + | ||
29 | + <artifactId>onos-restconf-server-app</artifactId> | ||
30 | + <packaging>pom</packaging> | ||
31 | + | ||
32 | + <properties> | ||
33 | + <onos.app.readme>RESTCONF Server Module main Application.</onos.app.readme> | ||
34 | + </properties> | ||
35 | + | ||
36 | + <description>RESTCONF Service Module main Application</description> | ||
37 | + | ||
38 | + <dependencies> | ||
39 | + <dependency> | ||
40 | + <groupId>org.onosproject</groupId> | ||
41 | + <artifactId>onos-restconf-server-api</artifactId> | ||
42 | + <version>${project.version}</version> | ||
43 | + </dependency> | ||
44 | + <dependency> | ||
45 | + <groupId>org.onosproject</groupId> | ||
46 | + <artifactId>onos-restconf-server-restconfmanager</artifactId> | ||
47 | + <version>${project.version}</version> | ||
48 | + </dependency> | ||
49 | + <dependency> | ||
50 | + <groupId>org.onosproject</groupId> | ||
51 | + <artifactId>onos-restconf-server-rpp</artifactId> | ||
52 | + <version>${project.version}</version> | ||
53 | + </dependency> | ||
54 | + </dependencies> | ||
55 | +</project> |
protocols/restconf/server/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
18 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
20 | + <modelVersion>4.0.0</modelVersion> | ||
21 | + | ||
22 | + <parent> | ||
23 | + <groupId>org.onosproject</groupId> | ||
24 | + <artifactId>onos-restconf</artifactId> | ||
25 | + <version>1.8.0-SNAPSHOT</version> | ||
26 | + <relativePath>../pom.xml</relativePath> | ||
27 | + </parent> | ||
28 | + | ||
29 | + <artifactId>onos-restconf-server</artifactId> | ||
30 | + <packaging>pom</packaging> | ||
31 | + | ||
32 | + <modules> | ||
33 | + <module>api</module> | ||
34 | + <module>restconfmgr</module> | ||
35 | + <module>rpp</module> | ||
36 | + <module>app</module> | ||
37 | + </modules> | ||
38 | + | ||
39 | + <description>RESTCONF Server Module</description> | ||
40 | +</project> |
protocols/restconf/server/restconfmgr/BUCK
0 → 100644
1 | +COMPILE_DEPS = [ | ||
2 | + '//lib:CORE_DEPS', | ||
3 | + '//lib:jersey-client', | ||
4 | + '//lib:jersey-server', | ||
5 | + '//lib:javax.ws.rs-api', | ||
6 | + '//utils/rest:onlab-rest', | ||
7 | + '//core/store/serializers:onos-core-serializers', | ||
8 | + '//protocols/restconf/server/api:onos-protocols-restconf-server-api', | ||
9 | +] | ||
10 | + | ||
11 | +osgi_jar_with_tests ( | ||
12 | + deps = COMPILE_DEPS, | ||
13 | +) |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
18 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
20 | + <modelVersion>4.0.0</modelVersion> | ||
21 | + | ||
22 | + <parent> | ||
23 | + <groupId>org.onosproject</groupId> | ||
24 | + <artifactId>onos-restconf-server</artifactId> | ||
25 | + <version>1.8.0-SNAPSHOT</version> | ||
26 | + <relativePath>../pom.xml</relativePath> | ||
27 | + </parent> | ||
28 | + | ||
29 | + <artifactId>onos-restconf-server-restconfmanager</artifactId> | ||
30 | + <packaging>bundle</packaging> | ||
31 | + | ||
32 | + <dependencies> | ||
33 | + <dependency> | ||
34 | + <groupId>org.onosproject</groupId> | ||
35 | + <artifactId>onos-restconf-server-api</artifactId> | ||
36 | + <version>${project.version}</version> | ||
37 | + </dependency> | ||
38 | + <dependency> | ||
39 | + <groupId>org.onosproject</groupId> | ||
40 | + <artifactId>onos-rest</artifactId> | ||
41 | + <version>${project.version}</version> | ||
42 | + </dependency> | ||
43 | + <dependency> | ||
44 | + <groupId>org.onosproject</groupId> | ||
45 | + <artifactId>onlab-rest</artifactId> | ||
46 | + <version>${project.version}</version> | ||
47 | + </dependency> | ||
48 | + <dependency> | ||
49 | + <groupId>org.onosproject</groupId> | ||
50 | + <artifactId>onlab-misc</artifactId> | ||
51 | + <version>${project.version}</version> | ||
52 | + </dependency> | ||
53 | + <dependency> | ||
54 | + <groupId>org.glassfish.jersey.containers</groupId> | ||
55 | + <artifactId>jersey-container-servlet</artifactId> | ||
56 | + </dependency> | ||
57 | + <dependency> | ||
58 | + <groupId>org.apache.felix</groupId> | ||
59 | + <artifactId>org.apache.felix.scr.annotations</artifactId> | ||
60 | + </dependency> | ||
61 | + </dependencies> | ||
62 | + <build> | ||
63 | + <plugins> | ||
64 | + <plugin> | ||
65 | + <groupId>org.apache.felix</groupId> | ||
66 | + <artifactId>maven-scr-plugin</artifactId> | ||
67 | + </plugin> | ||
68 | + </plugins> | ||
69 | + </build> | ||
70 | +</project> |
This diff is collapsed. Click to expand it.
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
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 | + | ||
17 | +/** | ||
18 | + * RESTCONF Service Manager implementation. | ||
19 | + */ | ||
20 | +package org.onosproject.protocol.restconf.server.restconfmanager; |
protocols/restconf/server/rpp/BUCK
0 → 100644
1 | +COMPILE_DEPS = [ | ||
2 | + '//lib:CORE_DEPS', | ||
3 | + '//lib:jersey-client', | ||
4 | + '//lib:jersey-server', | ||
5 | + '//lib:javax.ws.rs-api', | ||
6 | + '//utils/rest:onlab-rest', | ||
7 | + '//protocols/restconf/server/api:onos-protocols-restconf-server-api', | ||
8 | + '//protocols/restconf/server/restconfmgr:onos-protocols-restconf-server-restconfmgr', | ||
9 | +] | ||
10 | + | ||
11 | +osgi_jar_with_tests ( | ||
12 | + deps = COMPILE_DEPS, | ||
13 | +) |
protocols/restconf/server/rpp/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
18 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
20 | + <modelVersion>4.0.0</modelVersion> | ||
21 | + | ||
22 | + <parent> | ||
23 | + <groupId>org.onosproject</groupId> | ||
24 | + <artifactId>onos-restconf-server</artifactId> | ||
25 | + <version>1.8.0-SNAPSHOT</version> | ||
26 | + <relativePath>../pom.xml</relativePath> | ||
27 | + </parent> | ||
28 | + | ||
29 | + <artifactId>onos-restconf-server-rpp</artifactId> | ||
30 | + <packaging>bundle</packaging> | ||
31 | + | ||
32 | + <properties> | ||
33 | + <web.context>/onos/restconf</web.context> | ||
34 | + <api.version>1.0.0</api.version> | ||
35 | + <api.title>YANG RESTCONF Protocol Stack</api.title> | ||
36 | + <api.description> | ||
37 | + RESTCONF Protocol Proxy | ||
38 | + </api.description> | ||
39 | + <api.package>org.onosproject.protocol.restconf.server.rpp</api.package> | ||
40 | + </properties> | ||
41 | + | ||
42 | + <dependencies> | ||
43 | + <dependency> | ||
44 | + <groupId>org.onosproject</groupId> | ||
45 | + <artifactId>onos-restconf-server-api</artifactId> | ||
46 | + <version>${project.version}</version> | ||
47 | + </dependency> | ||
48 | + <dependency> | ||
49 | + <groupId>org.onosproject</groupId> | ||
50 | + <artifactId>onos-restconf-server-restconfmanager</artifactId> | ||
51 | + <version>${project.version}</version> | ||
52 | + </dependency> | ||
53 | + <dependency> | ||
54 | + <groupId>org.onosproject</groupId> | ||
55 | + <artifactId>onos-rest</artifactId> | ||
56 | + <version>${project.version}</version> | ||
57 | + </dependency> | ||
58 | + <dependency> | ||
59 | + <groupId>org.onosproject</groupId> | ||
60 | + <artifactId>onlab-rest</artifactId> | ||
61 | + <version>${project.version}</version> | ||
62 | + </dependency> | ||
63 | + <dependency> | ||
64 | + <groupId>javax.ws.rs</groupId> | ||
65 | + <artifactId>javax.ws.rs-api</artifactId> | ||
66 | + <version>2.0.1</version> | ||
67 | + </dependency> | ||
68 | + <dependency> | ||
69 | + <groupId>org.glassfish.jersey.containers</groupId> | ||
70 | + <artifactId>jersey-container-servlet</artifactId> | ||
71 | + </dependency> | ||
72 | + <dependency> | ||
73 | + <groupId>com.fasterxml.jackson.core</groupId> | ||
74 | + <artifactId>jackson-databind</artifactId> | ||
75 | + </dependency> | ||
76 | + <dependency> | ||
77 | + <groupId>com.fasterxml.jackson.core</groupId> | ||
78 | + <artifactId>jackson-annotations</artifactId> | ||
79 | + </dependency> | ||
80 | + <dependency> | ||
81 | + <groupId>org.osgi</groupId> | ||
82 | + <artifactId>org.osgi.compendium</artifactId> | ||
83 | + </dependency> | ||
84 | + <dependency> | ||
85 | + <groupId>org.osgi</groupId> | ||
86 | + <artifactId>org.osgi.core</artifactId> | ||
87 | + </dependency> | ||
88 | + <dependency> | ||
89 | + <groupId>org.onosproject</groupId> | ||
90 | + <artifactId>onos-app-dhcp-api</artifactId> | ||
91 | + <version>${project.version}</version> | ||
92 | + </dependency> | ||
93 | + <dependency> | ||
94 | + <groupId>org.glassfish.jersey.core</groupId> | ||
95 | + <artifactId>jersey-client</artifactId> | ||
96 | + <version>2.22.2</version> | ||
97 | + </dependency> | ||
98 | + <dependency> | ||
99 | + <groupId>org.glassfish.jersey.core</groupId> | ||
100 | + <artifactId>jersey-common</artifactId> | ||
101 | + <version>2.22.2</version> | ||
102 | + </dependency> | ||
103 | + <dependency> | ||
104 | + <groupId>org.onosproject</groupId> | ||
105 | + <artifactId>onlab-misc</artifactId> | ||
106 | + <version>${project.version}</version> | ||
107 | + </dependency> | ||
108 | + <dependency> | ||
109 | + <groupId>org.apache.felix</groupId> | ||
110 | + <artifactId>org.apache.felix.scr.annotations</artifactId> | ||
111 | + <version>1.9.8</version> | ||
112 | + </dependency> | ||
113 | + <dependency> | ||
114 | + <groupId>javax.servlet</groupId> | ||
115 | + <artifactId>servlet-api</artifactId> | ||
116 | + <version>2.5</version> | ||
117 | + </dependency> | ||
118 | + </dependencies> | ||
119 | + | ||
120 | + <build> | ||
121 | + <plugins> | ||
122 | + <plugin> | ||
123 | + <groupId>org.apache.felix</groupId> | ||
124 | + <artifactId>maven-bundle-plugin</artifactId> | ||
125 | + <extensions>true</extensions> | ||
126 | + <configuration> | ||
127 | + <instructions> | ||
128 | + <_wab>src/main/webapp/</_wab> | ||
129 | + <Include-Resource> | ||
130 | + WEB-INF/classes/apidoc/swagger.json=target/swagger.json, | ||
131 | + {maven-resources} | ||
132 | + </Include-Resource> | ||
133 | + <Bundle-SymbolicName> | ||
134 | + ${project.groupId}.${project.artifactId} | ||
135 | + </Bundle-SymbolicName> | ||
136 | + <Import-Package> | ||
137 | + *,org.glassfish.jersey.servlet | ||
138 | + </Import-Package> | ||
139 | + <Web-ContextPath>${web.context}</Web-ContextPath> | ||
140 | + </instructions> | ||
141 | + </configuration> | ||
142 | + </plugin> | ||
143 | + </plugins> | ||
144 | + </build> | ||
145 | + | ||
146 | + | ||
147 | +</project> |
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
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 | +package org.onosproject.protocol.restconf.server.rpp; | ||
17 | + | ||
18 | +import org.onlab.rest.AbstractWebApplication; | ||
19 | + | ||
20 | +import java.util.Set; | ||
21 | + | ||
22 | +/** | ||
23 | + * RESTCONF Server front-end application. | ||
24 | + */ | ||
25 | +public class RestconfProtocolProxy extends AbstractWebApplication { | ||
26 | + | ||
27 | + @Override | ||
28 | + public Set<Class<?>> getClasses() { | ||
29 | + return getClasses(RestconfWebResource.class); | ||
30 | + } | ||
31 | +} |
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
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 | + | ||
17 | +package org.onosproject.protocol.restconf.server.rpp; | ||
18 | + | ||
19 | +import com.fasterxml.jackson.core.JsonProcessingException; | ||
20 | +import com.fasterxml.jackson.databind.node.ObjectNode; | ||
21 | +import org.glassfish.jersey.server.ChunkedOutput; | ||
22 | +import org.onosproject.protocol.restconf.server.api.RestconfException; | ||
23 | +import org.onosproject.protocol.restconf.server.api.RestconfService; | ||
24 | +import org.onosproject.rest.AbstractWebResource; | ||
25 | +import org.slf4j.Logger; | ||
26 | + | ||
27 | +import javax.ws.rs.Consumes; | ||
28 | +import javax.ws.rs.DELETE; | ||
29 | +import javax.ws.rs.GET; | ||
30 | +import javax.ws.rs.POST; | ||
31 | +import javax.ws.rs.PUT; | ||
32 | +import javax.ws.rs.Path; | ||
33 | +import javax.ws.rs.PathParam; | ||
34 | +import javax.ws.rs.Produces; | ||
35 | +import javax.ws.rs.core.Context; | ||
36 | +import javax.ws.rs.core.MediaType; | ||
37 | +import javax.ws.rs.core.Response; | ||
38 | +import javax.ws.rs.core.UriInfo; | ||
39 | +import java.io.IOException; | ||
40 | +import java.io.InputStream; | ||
41 | + | ||
42 | +import static org.slf4j.LoggerFactory.getLogger; | ||
43 | + | ||
44 | +/* | ||
45 | + * This class is the main implementation of the RESTCONF Protocol | ||
46 | + * Proxy module. Currently it only handles some basic operations | ||
47 | + * on data resource nodes. However, the design intention is to | ||
48 | + * create a code structure that allows new methods/functionality | ||
49 | + * to be easily added in future releases. | ||
50 | + */ | ||
51 | + | ||
52 | +/** | ||
53 | + * Implementation of the RESTCONF Protocol Proxy module. | ||
54 | + */ | ||
55 | +@Path("/") | ||
56 | +public class RestconfWebResource extends AbstractWebResource { | ||
57 | + | ||
58 | + @Context | ||
59 | + UriInfo uriInfo; | ||
60 | + | ||
61 | + private final RestconfService service = get(RestconfService.class); | ||
62 | + private final Logger log = getLogger(getClass()); | ||
63 | + | ||
64 | + /** | ||
65 | + * Handles a RESTCONF GET operation against a target data resource. If the | ||
66 | + * operation is successful, the JSON presentation of the resource plus HTTP | ||
67 | + * status code "200 OK" is returned. Otherwise, HTTP error status code | ||
68 | + * "400 Bad Request" is returned. | ||
69 | + * | ||
70 | + * @param uriString URI of the data resource. | ||
71 | + * @return HTTP response | ||
72 | + */ | ||
73 | + @GET | ||
74 | + @Produces(MediaType.APPLICATION_JSON) | ||
75 | + @Path("data/{identifier : .+}") | ||
76 | + public Response handleGetRequest(@PathParam("identifier") String uriString) { | ||
77 | + | ||
78 | + log.debug("handleGetRequest: {}", uriString); | ||
79 | + | ||
80 | + try { | ||
81 | + ObjectNode node = service.runGetOperationOnDataResource(uriString); | ||
82 | + return ok(node).build(); | ||
83 | + } catch (RestconfException e) { | ||
84 | + log.error("ERROR: handleGetRequest: {}", e.getMessage()); | ||
85 | + log.debug("Exception in handleGetRequest:", e); | ||
86 | + return e.getResponse(); | ||
87 | + } | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * Handles the RESTCONF Event Notification Subscription request. If the | ||
92 | + * subscription is successful, a ChunkedOutput stream is created and returned | ||
93 | + * to the caller. | ||
94 | + * <P></P> | ||
95 | + * This function is not blocked on streaming the data (so that it can handle | ||
96 | + * other incoming requests). Instead, a worker thread running in the background | ||
97 | + * does the data streaming. If errors occur during streaming, the worker thread | ||
98 | + * calls ChunkedOutput.close() to disconnect the session and terminates itself. | ||
99 | + * | ||
100 | + * @param streamId Event stream ID | ||
101 | + * @return A string data stream over HTTP keep-alive session | ||
102 | + */ | ||
103 | + @GET | ||
104 | + @Produces(MediaType.APPLICATION_JSON) | ||
105 | + @Path("streams/{streamId}") | ||
106 | + public ChunkedOutput<String> handleNotificationRegistration(@PathParam("streamId") String streamId) { | ||
107 | + final ChunkedOutput<String> output = new ChunkedOutput<String>(String.class); | ||
108 | + try { | ||
109 | + service.subscribeEventStream(streamId, output); | ||
110 | + } catch (RestconfException e) { | ||
111 | + log.error("ERROR: handleNotificationRegistration: {}", e.getMessage()); | ||
112 | + log.debug("Exception in handleNotificationRegistration:", e); | ||
113 | + try { | ||
114 | + output.close(); | ||
115 | + } catch (IOException ex) { | ||
116 | + log.error("ERROR: handleNotificationRegistration:", ex); | ||
117 | + } | ||
118 | + } | ||
119 | + | ||
120 | + return output; | ||
121 | + } | ||
122 | + | ||
123 | + /** | ||
124 | + * Handles a RESTCONF POST operation against a data resource. If the | ||
125 | + * operation is successful, HTTP status code "201 Created" is returned | ||
126 | + * and there is no response message-body. If the data resource already | ||
127 | + * exists, then the HTTP status code "409 Conflict" is returned. | ||
128 | + * | ||
129 | + * @param uriString URI of the data resource | ||
130 | + * @param stream Input JSON object | ||
131 | + * @return HTTP response | ||
132 | + */ | ||
133 | + @POST | ||
134 | + @Consumes(MediaType.APPLICATION_JSON) | ||
135 | + @Produces(MediaType.APPLICATION_JSON) | ||
136 | + @Path("data/{identifier : .+}") | ||
137 | + public Response handlePostRequest(@PathParam("identifier") String uriString, InputStream stream) { | ||
138 | + | ||
139 | + log.debug("handlePostRequest: {}", uriString); | ||
140 | + | ||
141 | + try { | ||
142 | + ObjectNode rootNode = (ObjectNode) mapper().readTree(stream); | ||
143 | + | ||
144 | + service.runPostOperationOnDataResource(uriString, rootNode); | ||
145 | + return Response.created(uriInfo.getRequestUri()).build(); | ||
146 | + } catch (JsonProcessingException e) { | ||
147 | + log.error("ERROR: handlePostRequest ", e); | ||
148 | + return Response.status(Response.Status.BAD_REQUEST).build(); | ||
149 | + } catch (RestconfException e) { | ||
150 | + log.error("ERROR: handlePostRequest: {}", e.getMessage()); | ||
151 | + log.debug("Exception in handlePostRequest:", e); | ||
152 | + return e.getResponse(); | ||
153 | + } catch (IOException ex) { | ||
154 | + log.error("ERROR: handlePostRequest ", ex); | ||
155 | + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); | ||
156 | + } | ||
157 | + } | ||
158 | + | ||
159 | + /** | ||
160 | + * Handles a RESTCONF PUT operation against a data resource. If a new | ||
161 | + * resource is successfully created, then the HTTP status code "201 Created" | ||
162 | + * is returned. If an existing resource is modified, then the HTTP | ||
163 | + * status code "204 No Content" is returned. If the input JSON payload | ||
164 | + * contains errors, then "400 Bad Request" is returned. If an exception | ||
165 | + * occurs during the operation, the status code enclosed in | ||
166 | + * the RestconfException object, such as "500 Internal Server Error", | ||
167 | + * is returned. | ||
168 | + * | ||
169 | + * @param uriString URI of the data resource. | ||
170 | + * @param stream Input JSON object | ||
171 | + * @return HTTP response | ||
172 | + */ | ||
173 | + @PUT | ||
174 | + @Consumes(MediaType.APPLICATION_JSON) | ||
175 | + @Produces(MediaType.APPLICATION_JSON) | ||
176 | + @Path("data/{identifier : .+}") | ||
177 | + public Response handlePutRequest(@PathParam("identifier") String uriString, InputStream stream) { | ||
178 | + | ||
179 | + log.debug("handlePutRequest: {}", uriString); | ||
180 | + | ||
181 | + try { | ||
182 | + ObjectNode rootNode = (ObjectNode) mapper().readTree(stream); | ||
183 | + | ||
184 | + service.runPutOperationOnDataResource(uriString, rootNode); | ||
185 | + return Response.created(uriInfo.getRequestUri()).build(); | ||
186 | + } catch (JsonProcessingException e) { | ||
187 | + log.error("ERROR: handlePutRequest ", e); | ||
188 | + return Response.status(Response.Status.BAD_REQUEST).build(); | ||
189 | + } catch (RestconfException e) { | ||
190 | + log.error("ERROR: handlePutRequest: {}", e.getMessage()); | ||
191 | + log.debug("Exception in handlePutRequest:", e); | ||
192 | + return e.getResponse(); | ||
193 | + } catch (IOException ex) { | ||
194 | + log.error("ERROR: handlePutRequest ", ex); | ||
195 | + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); | ||
196 | + } | ||
197 | + } | ||
198 | + | ||
199 | + /** | ||
200 | + * Handles the RESTCONF DELETION Operation against a data resource. If the | ||
201 | + * resource is successfully deleted, the HTTP status code "204 No Content" | ||
202 | + * is returned in the response. If an exception occurs, then the | ||
203 | + * HTTP status code enclosed in the RestconfException object is | ||
204 | + * returned. | ||
205 | + * | ||
206 | + * @param uriString URI of the data resource to be deleted. | ||
207 | + * @return HTTP response | ||
208 | + */ | ||
209 | + @DELETE | ||
210 | + @Produces(MediaType.APPLICATION_JSON) | ||
211 | + @Path("data/{identifier : .+}") | ||
212 | + public Response handleDeleteRequest(@PathParam("identifier") String uriString) { | ||
213 | + | ||
214 | + log.debug("handleDeleteRequest: {}", uriString); | ||
215 | + | ||
216 | + try { | ||
217 | + service.runDeleteOperationOnDataResource(uriString); | ||
218 | + return Response.ok().build(); | ||
219 | + } catch (RestconfException e) { | ||
220 | + log.error("ERROR: handleDeleteRequest: {}", e.getMessage()); | ||
221 | + log.debug("Exception in handleDeleteRequest:", e); | ||
222 | + return e.getResponse(); | ||
223 | + } | ||
224 | + } | ||
225 | + | ||
226 | +} |
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
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 | + | ||
17 | +/** | ||
18 | + * RESTCONF Protocol Proxy implementation. | ||
19 | + */ | ||
20 | +package org.onosproject.protocol.restconf.server.rpp; |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" | ||
18 | + xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | ||
19 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | ||
20 | + id="ONOS" version="2.5"> | ||
21 | + <display-name>ONOS RESTCONF Protocol Proxy</display-name> | ||
22 | + | ||
23 | + <servlet> | ||
24 | + <servlet-name>RESTCONF Protocol Proxy</servlet-name> | ||
25 | + <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> | ||
26 | + <init-param> | ||
27 | + <param-name>javax.ws.rs.Application</param-name> | ||
28 | + <param-value>org.onosproject.protocol.restconf.server.rpp.RestconfProtocolProxy</param-value> | ||
29 | + </init-param> | ||
30 | + <load-on-startup>1</load-on-startup> | ||
31 | + </servlet> | ||
32 | + | ||
33 | + <servlet-mapping> | ||
34 | + <servlet-name>RESTCONF Protocol Proxy</servlet-name> | ||
35 | + <url-pattern>/*</url-pattern> | ||
36 | + </servlet-mapping> | ||
37 | +</web-app> |
-
Please register or login to post a comment