diff --git a/apps/config/src/main/java/org/onosproject/config/DynamicConfigService.java b/apps/config/src/main/java/org/onosproject/config/DynamicConfigService.java index 790951a019..1ac8303d2e 100755 --- a/apps/config/src/main/java/org/onosproject/config/DynamicConfigService.java +++ b/apps/config/src/main/java/org/onosproject/config/DynamicConfigService.java @@ -20,6 +20,11 @@ import com.google.common.annotations.Beta; import org.onosproject.yang.model.DataNode; import org.onosproject.yang.model.ResourceId; import org.onosproject.event.ListenerService; +import org.onosproject.yang.model.RpcCaller; +import org.onosproject.yang.model.RpcCommand; +import org.onosproject.yang.model.RpcHandler; +import org.onosproject.yang.model.RpcInput; +import org.onosproject.yang.model.RpcOutput; /** * Service for storing and distributing dynamic configuration data. diff --git a/apps/config/src/main/java/org/onosproject/config/RpcCaller.java b/apps/config/src/main/java/org/onosproject/config/RpcCaller.java deleted file mode 100644 index 5791e9fa0c..0000000000 --- a/apps/config/src/main/java/org/onosproject/config/RpcCaller.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2016-present Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.config; - -import com.google.common.annotations.Beta; - -/** - * Service for entities that would invoke RPCs and receive RPC responses, - * through the Dynamic Config brokerage. - */ -@Beta -public interface RpcCaller { - /* - * Receives an RPC response. - * - * @param msgId of a previously invoked RPC - * @param output from the RPC execution - */ - void receiveResponse(Integer msgId, RpcOutput output); -} \ No newline at end of file diff --git a/apps/config/src/main/java/org/onosproject/config/RpcCommand.java b/apps/config/src/main/java/org/onosproject/config/RpcCommand.java deleted file mode 100644 index 7c144c61e2..0000000000 --- a/apps/config/src/main/java/org/onosproject/config/RpcCommand.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2016-present Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.config; - -import com.google.common.annotations.Beta; -import org.onosproject.yang.model.ResourceId; -/** - * Abstract implementation of an RPC command. - */ -@Beta -public abstract class RpcCommand { - /** - * Identifier of an RPC command. - */ - ResourceId cmdId; - - /** - * Creates an instance of RpcCommand. - * - * @param cmdId of RPC command - */ - public RpcCommand(ResourceId cmdId) { - this.cmdId = cmdId; - } - - /** - * Returns the RPC command id. - * - * @return cmdId - */ - public ResourceId cmdId() { - return this.cmdId; - } - /** - * Executes the RPC command. - * - * @param input input data to the RPC command. - */ - public abstract void execute(RpcInput input); -} \ No newline at end of file diff --git a/apps/config/src/main/java/org/onosproject/config/RpcHandler.java b/apps/config/src/main/java/org/onosproject/config/RpcHandler.java deleted file mode 100644 index d9b185b704..0000000000 --- a/apps/config/src/main/java/org/onosproject/config/RpcHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2016-present Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.config; - -import com.google.common.annotations.Beta; - -/** - * Service for entities that would execute RPC methods invoked through - * Dynamic Config RPC brokerage. - */ -@Beta -public interface RpcHandler { - /* - * Executes the RPC. - * - * @param msgId of the RPC message to be executed - * @param cmd to be executed - * @param input data to the RPC command - */ - void executeRpc(Integer msgId, RpcCommand cmd, RpcInput input); -} \ No newline at end of file diff --git a/apps/config/src/main/java/org/onosproject/config/RpcInput.java b/apps/config/src/main/java/org/onosproject/config/RpcInput.java deleted file mode 100644 index 96ec581f40..0000000000 --- a/apps/config/src/main/java/org/onosproject/config/RpcInput.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2016-present Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.config; - -import com.google.common.annotations.Beta; -import org.onosproject.yang.model.DataNode; - -/** - * Abstraction for RPC input. - */ -@Beta -public class RpcInput { - /** - * Input data to the RPC execution. - */ - DataNode input; - - /** - * TODO - * Any other meta data or contextual information - * to help the RPC execution can be here. - * Examples: List to provide multiple inputs - * Additional info for the broker, to choose a suitable executor - */ - - /** - * Creates an instance of RpcInput. - * - * @param input to RPC execution - */ - public RpcInput(DataNode input) { - this.input = input; - } - - /** - * Returns RPC input. - * - * @return DataNode - */ - public DataNode input() { - return this.input; - } -} \ No newline at end of file diff --git a/apps/config/src/main/java/org/onosproject/config/RpcOutput.java b/apps/config/src/main/java/org/onosproject/config/RpcOutput.java deleted file mode 100644 index f0d98a02f1..0000000000 --- a/apps/config/src/main/java/org/onosproject/config/RpcOutput.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2016-present Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.config; - -import com.google.common.annotations.Beta; -import org.onosproject.yang.model.DataNode; - -/** - * Abstraction for RPC output. - */ -@Beta -public class RpcOutput { - public enum Status { - /** - * RPC execution was successful. - */ - RPC_SUCCESS, - /** - * RPC execution failed. - */ - RPC_FAILURE, - /** - * RPC execution don't have any output data. - */ - RPC_NODATA, - /** - * Failed to receive a response from the receiver, within the broker specified timeout. - */ - RPC_TIMEOUT, - } - - /** - * Status of RPC execution. - */ - Status status; - /** - * Output data from the RPC execution. - */ - DataNode output; - - /** - * Creates an instance of RpcOutput. - * - * @param status of RPC execution - * @param output of RPC execution - */ - public RpcOutput(Status status, DataNode output) { - this.status = status; - this.output = output; - } - - /** - * Returns RPC status. - * - * @return Status - */ - public RpcOutput.Status status() { - return this.status; - } - - /** - * Returns RPC output. - * - * @return DataNode - */ - public DataNode output() { - return this.output; - } -} \ No newline at end of file diff --git a/apps/config/src/main/java/org/onosproject/config/impl/DynamicConfigManager.java b/apps/config/src/main/java/org/onosproject/config/impl/DynamicConfigManager.java index 1307de3f92..bc8800758a 100644 --- a/apps/config/src/main/java/org/onosproject/config/impl/DynamicConfigManager.java +++ b/apps/config/src/main/java/org/onosproject/config/impl/DynamicConfigManager.java @@ -29,11 +29,11 @@ import org.onosproject.config.DynamicConfigStore; import org.onosproject.config.DynamicConfigStoreDelegate; import org.onosproject.config.FailedException; import org.onosproject.config.Filter; -import org.onosproject.config.RpcCaller; -import org.onosproject.config.RpcCommand; -import org.onosproject.config.RpcHandler; -import org.onosproject.config.RpcInput; -import org.onosproject.config.RpcOutput; +import org.onosproject.yang.model.RpcCaller; +import org.onosproject.yang.model.RpcCommand; +import org.onosproject.yang.model.RpcHandler; +import org.onosproject.yang.model.RpcInput; +import org.onosproject.yang.model.RpcOutput; import org.onosproject.yang.model.DataNode; import org.onosproject.yang.model.ResourceId; import org.onosproject.event.AbstractListenerManager;