diff options
author | YAMAMOTO Takashi <yamamoto@valinux.co.jp> | 2013-11-14 18:11:11 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2013-11-15 09:11:50 +0900 |
commit | 8d4d74ac42aab0d90a774409135abf2f6d73f14c (patch) | |
tree | 65839c11826bb4ac784908d1e8b430804b96c0ae | |
parent | be9ebaf43192f10ff62a7eff06a00df3cb82dd66 (diff) |
dpset: add some docstrings
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/controller/dpset.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ryu/controller/dpset.py b/ryu/controller/dpset.py index 259eed68..1a4de334 100644 --- a/ryu/controller/dpset.py +++ b/ryu/controller/dpset.py @@ -83,6 +83,11 @@ class PortState(dict): # this depends on controller::Datapath and dispatchers in handler class DPSet(app_manager.RyuApp): + """ + DPSet application manages a set of switches (datapaths) + connected to this controller. + """ + def __init__(self): super(DPSet, self).__init__() self.name = 'dpset' @@ -117,9 +122,23 @@ class DPSet(app_manager.RyuApp): del self.port_state[dp.id] def get(self, dp_id): + """ + This method returns the ryu.controller.controller.Datapath + instance for the given Datapath ID. + Raises KeyError if no such a datapath connected to this controller. + """ return self.dps.get(dp_id) def get_all(self): + """ + This method returns a list of tuples which represents + instances for switches connected to this controller. + The tuple consists of a Datapath Id and an instance of + ryu.controller.controller.Datapath. + A return value looks like the following: + + [ (dpid_A, Datapath_A), (dpid_B, Datapath_B), ... ] + """ return self.dps.items() def _port_added(self, datapath, port): @@ -177,6 +196,12 @@ class DPSet(app_manager.RyuApp): self.send_event_to_observers(EventPortModify(datapath, port)) def get_port(self, dpid, port_no): + """ + This method returns the ryu.controller.dpset.PortState + instance for the given Datapath ID and the port number. + Raises ryu_exc.PortNotFound if no such a datapath connected to + this controller or no such a port exists. + """ try: return self.port_state[dpid][port_no] except KeyError: @@ -184,4 +209,9 @@ class DPSet(app_manager.RyuApp): network_id=None) def get_ports(self, dpid): + """ + This method returns a list of ryu.controller.dpset.PortState + instances for the given Datapath ID. + Raises KeyError if no such a datapath connected to this controller. + """ return self.port_state[dpid].values() |