Define events which are used for request/reply of ofconfig operation.

Signed-off-by: Isaku Yamahata <[email protected]>
---
 ryu/lib/of_config/events.py |   70 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 ryu/lib/of_config/events.py

diff --git a/ryu/lib/of_config/events.py b/ryu/lib/of_config/events.py
new file mode 100644
index 0000000..ffe2d7b
--- /dev/null
+++ b/ryu/lib/of_config/events.py
@@ -0,0 +1,70 @@
+# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
+# Copyright (C) 2013 Isaku Yamahata <yamahata at private email ne jp>
+#
+# 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.
+
+
+from ryu.controller import event
+
+
+# returns session-id
+# This is internal id (!= netconf session id)
+# Actually = id(capable_switch)
+class EventOFConfigRequestConnect(event.EventRequestBase):
+    def __init__(self, dst, args, kwargs):
+        super(EventOFConfigRequestConnect, self).__init__(dst)
+        self.args = args
+        self.kwargs = kwargs
+
+
+# ServerCapabilities
+# ClientCapabilities
+# KillSession
+# Get
+# GetConfig
+# EditConfig
+# CopyConfig
+# DeleteConfig
+# Lock
+# Unlock
+# Commit
+# DiscardChanges
+# CancelCommit
+# Validate
+# PoweroffMachine
+# Rebootmachine
+class EventOFConfigRequest(event.EventRequestBase):
+    def __init__(self, dst, method, session_id, kwargs):
+        super(EventOFConfigRequest, self).__init__(dst)
+        self.method = method
+        self.session_id = session_id
+        self.kwargs = kwargs
+
+
+class EventOFConfigRequestCloseSession(EventOFConfigRequest):
+    def __init__(self, dst, session_id):
+        super(EventOFConfigRequestCloseSession, self).__init__(
+            dst, 'close_session', session_id, {})
+
+
+class EventOFConfigReply(event.EventReplyBase):
+    def __init__(self, dst, success, value):
+        super(EventOFConfigReply, self).__init__(dst)
+        self.success = success
+        self.value = value
+
+    def __call__(self):
+        if self.success:
+            return self.value
+        raise self.value
-- 
1.7.10.4


------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to