On Fri, Mar 08, 2013 at 07:48:23AM +0900, FUJITA Tomonori wrote:
> On Thu,  7 Mar 2013 18:00:48 +0900
> Isaku Yamahata <[email protected]> wrote:
> 
> > This class implements direct API to ofconfig.
> > 
> > Signed-off-by: Isaku Yamahata <[email protected]>
> > ---
> >  ryu/lib/of_config/capable_switch.py |  106 
> > +++++++++++++++++++++++++++++++++++
> >  1 file changed, 106 insertions(+)
> >  create mode 100644 ryu/lib/of_config/capable_switch.py
> > 
> > diff --git a/ryu/lib/of_config/capable_switch.py 
> > b/ryu/lib/of_config/capable_switch.py
> > new file mode 100644
> > index 0000000..7d3823d
> > --- /dev/null
> > +++ b/ryu/lib/of_config/capable_switch.py
> > @@ -0,0 +1,106 @@
> > +# 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.
> > +
> > +import ncclient.manager
> > +import ncclient.xml_
> > +
> > +from ryu.lib import of_config
> > +from ryu.lib.of_config import constants as ofc_consts
> > +
> > +
> > +def get_ns_tag(tag):
> > +    if tag[0] == '{':
> > +        return tuple(tag[1:].split('}', 1))
> > +    return (None, tag)
> > +
> > +
> > +class CapableSwitch(object):
> 
> 'OpenFlow Capable Switch' in the spec sounds ok but I'm not sure
> if 'CapableSwitch' makes sense...

How about OFCapableSwitch?
OpenFlowCapableSwitch is a bit longer to type.


> 
> > +    def __init__(self, connect_method='connect_ssh', *args, **kwargs):
> > +        super(CapableSwitch, self).__init__()
> > +        self._connect_method = connect_method
> > +        self._connect_args = args
> > +        self._connect_kwargs = kwargs
> > +        self.netconf = None
> > +        self.version = None
> > +        self.namespace = None
> > +
> > +    def connect(self):
> > +        if self.netconf:
> > +            return
> > +        connect = getattr(ncclient.manager, self._connect_method)
> > +        self.netconf = connect(*self._connect_args, **self._connect_kwargs)
> 
> __init__ had better to establish a connection?

I'll move it to __init__.
-- 
yamahata

------------------------------------------------------------------------------
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