Dear Iwase,

could you please me help me out, how to "set-field action" to set vlan_vid
 for OpenFlow 1.3 version (HP openFlow Switch). It throws an error when
I followed the example "http://ryu.readthedocs.io/en/
latest/app/ofctl_rest.html?highlight=ofctl#example-of-vlan-id-match-field".

I am trying to install through ofctl_rest.py

for example, I would like to set  vlan_vid:2? how can I set it please let
me know.

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py", line 490,
in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/ryu/app/wsgi.py", line 230,
in __call__
    return super(wsgify_hack, self).__call__(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in
__call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in
call_func
    return self.func(req, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ryu/app/wsgi.py", line 284,
in __call__
    return controller(req)
  File "/usr/local/lib/python2.7/dist-packages/ryu/app/wsgi.py", line 154,
in __call__
    return getattr(self, action)(req, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ryu/app/ofctl_rest.py", line
276, in wrapper
    method(self, req, dp, ofctl, body, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ryu/app/ofctl_rest.py", line
432, in mod_flow_entry
    ofctl.mod_flow_entry(dp, flow, mod_cmd)
  File "/usr/local/lib/python2.7/dist-packages/ryu/lib/ofctl_v1_3.py", line
1066, in mod_flow_entry
    ofctl_utils.send_msg(dp, flow_mod, LOG)
  File "/usr/local/lib/python2.7/dist-packages/ryu/lib/ofctl_utils.py",
line 239, in send_msg
    dp.send_msg(msg)
  File
"/usr/local/lib/python2.7/dist-packages/ryu/controller/controller.py", line
344, in send_msg
    msg.serialize()
  File
"/usr/local/lib/python2.7/dist-packages/ryu/ofproto/ofproto_parser.py",
line 220, in serialize
    self._serialize_body()
  File
"/usr/local/lib/python2.7/dist-packages/ryu/ofproto/ofproto_v1_3_parser.py",
line 2695, in _serialize_body
    inst.serialize(self.buf, offset)
  File
"/usr/local/lib/python2.7/dist-packages/ryu/ofproto/ofproto_v1_3_parser.py",
line 2884, in serialize
    a.serialize(buf, action_offset)
  File
"/usr/local/lib/python2.7/dist-packages/ryu/ofproto/ofproto_v1_3_parser.py",
line 3339, in serialize
    n, value, mask = ofproto.oxm_from_user(self.key, self.value)
  File "/usr/local/lib/python2.7/dist-packages/ryu/ofproto/oxx_fields.py",
line 72, in _from_user
    value = t.from_user(value)
  File "/usr/local/lib/python2.7/dist-packages/ryu/lib/type_desc.py", line
43, in from_user
    binary = six.int2byte(i & 255) + binary
TypeError: unsupported operand type(s) for &: 'str' and 'int'


thanks
Hari


>
> On 30 January 2017 at 06:39, Iwase Yusuke <[email protected]> wrote:
>
>> Hi raghu,
>>
>> Sorry, I could not see your code expectedly, because there are some
>> invalid indentations.
>>
>>
>> On 2017年01月28日 00:21, raghu rathode wrote:
>> > Dear Iwase,
>> >
>> > Thank you for the above information. I attached the file to my email
>> and can you point out where I am doing wrong? I am doing wrong?
>> >
>> > 1. I am facing an error:
>> > 2. I would like to call the function "Configurerules" after a certain
>> time period? How can I implement?
>> >
>> > L2learningswitch: Exception occurred during handler processing.
>> Backtrace from offending handler [switch_features_handler] servicing event
>> [EventOFPSwitchFeatures] follows.
>> >
>> > Traceback (most recent call last):
>> >
>> >   File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py",
>> line 290, in _event_loop
>> >
>> >     handler(ev)
>> >
>> >   File "/usr/local/lib/python2.7/dist-packages/ryu/app/Simple_l2Ryu.py",
>> line 42, in switch_features_handler
>> >
>> >     self.configurerules(ev, lruleset=self.CONF.ruleset)
>> >
>> >   File "/usr/local/lib/python2.7/dist-packages/ryu/app/Simple_l2Ryu.py",
>> line 127,in configurerules
>> >
>> >    match = parser.OFPMatch(eth_type=eth_type, eth_src=eth_src1,
>> eth_dst=eth_dst1, ipv4_src=ipv4_src1, ipv4_dst=ipv4_dst1, in_port=in_port1,
>> vlan_vid=(0x1000))
>> >
>> > NameError: global name 'eth_src1' is not defined.
>>
>> The above message shows just the value named 'eth_src1' cannot be
>> accessed at line 127.
>>
>>
>> I recommend you to fix the indentation up and try some inspection tools
>> (e.g. pylint or
>> PyCharm IDE, Eclipse IDE, ...).
>> It might be very helpful for your happy coding.
>>
>>
>> Thanks,
>> Iwase
>>
>> >
>> > On 27 January 2017 at 03:21, Iwase Yusuke <[email protected]
>> <mailto:[email protected]>> wrote:
>> >
>> >     FYI, for the syntax of JSON is similar to the input of ofctl_rest.
>> >       http://ryu.readthedocs.io/en/latest/app/ofctl_rest.html#mod
>> ify-all-matching-flow-entries <http://ryu.readthedocs.io/en/
>> latest/app/ofctl_rest.html#modify-all-matching-flow-entries>
>> >
>> >
>> >     On 2017年01月27日 11:20, Iwase Yusuke wrote:
>> >     > Hi,
>> >     >
>> >     > Currently, Ryu does not provides such feature, you need to
>> implement it.
>> >     >
>> >     > But just an idea,
>> >     > JSON representation is might be convenient for such purpose, I
>> guess.
>> >     > "ryu.lib.ofctl_v1_3" can accept JSON like dictionary as input,
>> >     > so you can describe flows as JSON.
>> >     >
>> >     > The following example installs flows at switch connection from
>> JSON file.
>> >     >
>> >     > e.g.)
>> >     > $ cat sample_flows.json
>> >     > [
>> >     >   {
>> >     >     "dpid": 1,
>> >     >     "match": {
>> >     >       "in_port": 1
>> >     >     },
>> >     >     "actions": [
>> >     >       {
>> >     >         "type": "OUTPUT",
>> >     >         "port": 2
>> >     >       }
>> >     >     ]
>> >     >   },
>> >     >   {
>> >     >     "dpid": 1,
>> >     >     "match": {
>> >     >       "in_port": 2
>> >     >     },
>> >     >     "actions": [
>> >     >       {
>> >     >         "type": "OUTPUT",
>> >     >         "port": 1
>> >     >       }
>> >     >     ]
>> >     >   }
>> >     > ]
>> >     >
>> >     >
>> >     > $ git diff
>> >     > diff --git a/ryu/app/simple_switch_13.py
>> b/ryu/app/simple_switch_13.py
>> >     > index 3e7c598..dba09e5 100644
>> >     > --- a/ryu/app/simple_switch_13.py
>> >     > +++ b/ryu/app/simple_switch_13.py
>> >     > @@ -13,6 +13,8 @@
>> >     >  # See the License for the specific language governing
>> permissions and
>> >     >  # limitations under the License.
>> >     >
>> >     > +import json
>> >     > +
>> >     >  from ryu.base import app_manager
>> >     >  from ryu.controller import ofp_event
>> >     >  from ryu.controller.handler import CONFIG_DISPATCHER,
>> MAIN_DISPATCHER
>> >     > @@ -21,6 +23,7 @@ from ryu.ofproto import ofproto_v1_3
>> >     >  from ryu.lib.packet import packet
>> >     >  from ryu.lib.packet import ethernet
>> >     >  from ryu.lib.packet import ether_types
>> >     > +from ryu.lib import ofctl_v1_3
>> >     >
>> >     >
>> >     >  class SimpleSwitch13(app_manager.RyuApp):
>> >     > @@ -48,6 +51,10 @@ class SimpleSwitch13(app_manager.RyuApp):
>> >     >
>> ofproto.OFPCML_NO_BUFFER)]
>> >     >          self.add_flow(datapath, 0, match, actions)
>> >     >
>> >     > +        for flow in json.load(open('sample_flows.json')):
>> >     > +            if datapath.id <http://datapath.id> ==
>> flow.get('dpid', 0):
>> >     > +                ofctl_v1_3.mod_flow_entry(datapath, flow,
>> ofproto.OFPFC_ADD)
>> >     > +
>> >     >      def add_flow(self, datapath, priority, match, actions,
>> buffer_id=None):
>> >     >          ofproto = datapath.ofproto
>> >     >          parser = datapath.ofproto_parser
>> >     >
>> >     >
>> >     > Thanks,
>> >     > Iwase
>> >     >
>> >     >
>> >     > On 2017年01月24日 20:58, raghu rathode wrote:
>> >     >> Dear Sir/Madam,
>> >     >>
>> >     >> I would like to know, how to pass text file as an argument to
>> Ryu application. Which contains a set of rules to install on OpenFlow
>> switches.
>> >     >>
>> >     >> For Example:
>> >     >>
>> >     >> Switch 00-00-00-00-00-01:
>> >     >> dl_type=0x0800, nw_src=10.1.0.1/16 <http://10.1.0.1/16> <
>> http://10.1.0.1/16>, nw_dst=10.2.0.1/16 <http://10.2.0.1/16> <
>> http://10.2.0.1/16>, in_port=4, actions=mod_dl_src:00:00:12:00:01:03,
>> mod_dl_dst:00:00:00:00:00:02, output:3
>> >     >> dl_type=0x0800, dl_src=00:00:00:00:00:02,
>> dl_dst=00:00:12:00:01:03, in_port=3, nw_src=10.1.0.1/16 <
>> http://10.1.0.1/16> <http://10.1.0.1/16>, nw_dst=10.2.0.1/16 <
>> http://10.2.0.1/16> <http://10.2.0.1/16>, 
>> actions=mod_dl_src:00:00:12:00:01:02,
>> mod_dl_dst:00:00:12:00:04:01, output:2
>> >     >> dl_type=0x0800, dl_src=00:00:12:00:02:01,
>> dl_dst=00:00:12:00:01:01, in_port=1, nw_src=10.3.0.1/16 <
>> http://10.3.0.1/16> <http://10.3.0.1/16>, nw_dst=10.4.0.1/16 <
>> http://10.4.0.1/16> <http://10.4.0.1/16>, actions=mod_dl_src:00:00:12:
>> >     >>
>> >     >>
>> >     >> --
>> >     >> Thanks and Regards
>> >     >> Hari Raghavendar Rao Bandari
>> >     >> App 10,
>> >     >> Karolinenweg 20,
>> >     >> 37075 Goettingen,
>> >     >> Germany.
>> >     >>
>> >     >>
>> >     >> ------------------------------------------------------------
>> ------------------
>> >     >> Check out the vibrant tech community on one of the world's most
>> >     >> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> >     >>
>> >     >>
>> >     >>
>> >     >> _______________________________________________
>> >     >> Ryu-devel mailing list
>> >     >> [email protected] <mailto:[email protected]
>> forge.net>
>> >     >> https://lists.sourceforge.net/lists/listinfo/ryu-devel <
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel>
>> >     >>
>> >
>> >
>> >
>> >
>> > --
>> > Thanks and Regards
>> > Hari Raghavendar Rao Bandari
>> > App 10,
>> > Karolinenweg 20,
>> > 37075 Goettingen,
>> > Germany.
>> >
>> >
>> > ------------------------------------------------------------
>> ------------------
>> > Check out the vibrant tech community on one of the world's most
>> > engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> >
>> >
>> >
>> > _______________________________________________
>> > Ryu-devel mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/ryu-devel
>> >
>>
>
>
>
> --
> Thanks and Regards
> Hari Raghavendar Rao Bandari
> App 10,
> Karolinenweg 20,
> 37075 Goettingen,
> Germany.
>



-- 
Thanks and Regards
Hari Raghavendar Rao Bandari
App 10,
Karolinenweg 20,
37075 Goettingen,
Germany.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to