> 2014/1/24 YAMAMOTO Takashi <[email protected]>
>
>> Signed-off-by: YAMAMOTO Takashi <[email protected]>
>> ---
>> ryu/app/ofctl/service.py | 18 ++++++++++++++----
>> 1 file changed, 14 insertions(+), 4 deletions(-)
>>
>> diff --git a/ryu/app/ofctl/service.py b/ryu/app/ofctl/service.py
>> index eac8d68..0b53d99 100644
>> --- a/ryu/app/ofctl/service.py
>> +++ b/ryu/app/ofctl/service.py
>> @@ -45,16 +45,26 @@ class OfctlService(app_manager.RyuApp):
>> datapath = ev.msg.datapath
>> id = datapath.id
>> assert isinstance(id, (int, long))
>> - self.logger.info('add dpid %s datapath %s' % (id, datapath))
>> - self._switches[datapath.id] = _SwitchInfo(datapath=datapath)
>> + old_info = self._switches.get(id, None)
>> + new_info = _SwitchInfo(datapath=datapath)
>> + self.logger.info('add dpid %s datapath %s new_info %s old_info
>> %s' %
>> + (id, datapath, new_info, old_info))
>> + self._switches[id] = new_info
>>
>> @set_ev_cls(ofp_event.EventOFPStateChange, DEAD_DISPATCHER)
>> def _handle_dead(self, ev):
>> datapath = ev.datapath
>> id = datapath.id
>> self.logger.info('del dpid %s datapath %s' % (id, datapath))
>> - datapath2 = self._switches.pop(id)
>> - assert datapath2 == datapath
>> + if id is None:
>> + return
>> + try:
>> + info = self._switches[id]
>> + except KeyError:
>> + return
>>
>
> Probably, this might want to use pre-check.
>
> if not id in self._switches:
> return
sounds like a matter of prefence/style.
i have no strong preference for either ways.
do we (ryu project) have any?
YAMAMOTO Takashi
>
>
>> + if info.datapath is datapath:
>> + self.logger.info('forget info %s' % (info,))
>> + self._switches.pop(id)
>>
>> @set_ev_cls(event.GetDatapathRequest, MAIN_DISPATCHER)
>> def _handle_get_datapath(self, req):
>> --
>> 1.8.3.1
>>
>>
>>
>> ------------------------------------------------------------------------------
>> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
>> Learn Why More Businesses Are Choosing CenturyLink Cloud For
>> Critical Workloads, Development Environments & Everything In Between.
>> Get a Quote or Start a Free Trial Today.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Ryu-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
>
>
>
> --
> Satoshi Kobayashi <[email protected]>
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel