I don't see how this is connected to Open vSwitch. Do you have a
question related to Open vSwitch?
On Thu, Nov 03, 2016 at 05:14:38AM -0400, Ajinkya D Kadam wrote:
> HI All,
>
> I am doing a simple experiment to add a default table miss flow entry to a
> hardware OpenFlow Switch. Below are the details of the tools I am using
>
> Controller : RYU
> OpenFlow Switch : FortiCore 3700E
> OF_version : 1.3
>
> I am using the example code (example_switch_13.py) available in ryu/app.
>
>
> *ERROR :*
>
> loading app ryu/ryu/app/example_switch_13.py
> loading app ryu.controller.ofp_handler
> instantiating app ryu/ryu/app/example_switch_13.py of ExampleSwitch13
> instantiating app ryu.controller.ofp_handler of OFPHandler
> BRICK ExampleSwitch13
> CONSUMES EventOFPPacketIn
> CONSUMES EventOFPSwitchFeatures
> BRICK ofp_event
> PROVIDES EventOFPPacketIn TO {'ExampleSwitch13': set(['main'])}
> PROVIDES EventOFPSwitchFeatures TO {'ExampleSwitch13': set(['config'])}
> CONSUMES EventOFPSwitchFeatures
> CONSUMES EventOFPErrorMsg
> CONSUMES EventOFPEchoRequest
> CONSUMES EventOFPEchoReply
> CONSUMES EventOFPHello
> CONSUMES EventOFPPortStatus
> CONSUMES EventOFPPortDescStatsReply
> connected socket:<eventlet.greenio.base.GreenSocket object at
> 0x7fddad9259d0> address:('10.2.1.35', 25656)
> hello ev <ryu.controller.ofp_event.EventOFPHello object at 0x7fddad932290>
> move onto config mode
> EVENT ofp_event->ExampleSwitch13 EventOFPSwitchFeatures
> switch features ev version=0x4,msg_type=0x6,msg_len=0x20,xid=0xa5440ccd,
> OFPSwitchFeatures(auxiliary_id=0,capabilities=5,datapath_
> id=158796421868064,n_buffers=0,n_tables=1)
>
>
> This is the port : 4294967293
> Buffer Id is : 65535
>
>
>
> Actions : [OFPActionOutput(len=16,max_len=65535,port=6633,type=0)]
>
>
> Instructions : [OFPInstructionActions(actions=[OFPActionOutput(len=
> 16,max_len=65535,port=6633,type=0)],type=4)]
>
>
> modification : version=None,msg_type=None,msg_len=None,xid=None,
> OFPFlowMod(buffer_id=65535,command=0,cookie=0,cookie_
> mask=0,flags=0,hard_timeout=0,idle_timeout=0,instructions=[
> OFPInstructionActions(actions=[OFPActionOutput(len=16,max_
> len=65535,port=6633,type=0)],type=4)],match=OFPMatch(oxm_
> fields={}),out_group=0,out_port=0,priority=0,table_id=0)
>
> move onto main mode
> EventOFPErrorMsg received.
> version=0x4, msg_type=0x1, msg_len=0x4c, xid=0xa5440ccf
> `-- msg_type: OFPT_ERROR(1)
> OFPErrorMsg(type=0x5, code=0x0, data=b'\x04\x0e\x00\x50\xa5\
> x44\x0c\xcf\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
> x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
> x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
> x00\x00\x01\x00\x04\x00\x00\x00\x00\x00\x04\x00\x18\x00\x00\x00\x00')
> |-- type: OFPET_FLOW_MOD_FAILED(5)
> |-- code: OFPFMFC_UNKNOWN(0)
> `-- data: version=0x4, msg_type=0xe, msg_len=0x50, xid=0xa5440ccf
> `-- msg_type: OFPT_FLOW_MOD(14)
>
>
>
> Modified Application Script is attached. I have printed out the values of
> the variables however I am not able to figure out whats going wrong when I
> am sending the* flow_mod. *
>
> Can someone please suggest me how i can resolve this error ?
>
> Thanks in advance.
> # Copyright (C) 2016 Nippon Telegraph and Telephone Corporation.
> #
> # 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.base import app_manager
> from ryu.controller import ofp_event
> from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
> from ryu.controller.handler import set_ev_cls
> from ryu.ofproto import ofproto_v1_3
> from ryu.lib.packet import packet
> from ryu.lib.packet import ethernet
>
>
> class ExampleSwitch13(app_manager.RyuApp):
> OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
>
> def __init__(self, *args, **kwargs):
> super(ExampleSwitch13, self).__init__(*args, **kwargs)
> # initialize mac address table.
> self.mac_to_port = {}
>
> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
> def switch_features_handler(self, ev):
> datapath = ev.msg.datapath
> ofproto = datapath.ofproto
> parser = datapath.ofproto_parser
>
> print
> print
> print "This is the port : ", str(ofproto.OFPP_CONTROLLER)
> print "Buffer Id is : ", ofproto.OFPCML_NO_BUFFER
> print
> print
>
> # install the table-miss flow entry.
> match = parser.OFPMatch()
> actions = [parser.OFPActionOutput(6633,
> ofproto.OFPCML_NO_BUFFER)]
>
> print
> print "Actions : ", actions
> print
> self.add_flow(datapath, 0, match, actions)
>
> def add_flow(self, datapath, priority, match, actions):
> ofproto = datapath.ofproto
> parser = datapath.ofproto_parser
>
> # construct flow_mod message and send it.
> inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,
> actions)]
>
> print
> print "Instructions : ", inst
> print
> mod = parser.OFPFlowMod(datapath=datapath,
> table_id=0,priority=priority,
> buffer_id=ofproto.OFPCML_NO_BUFFER,
> match=match, instructions=inst)
> print
> print "modification : ", mod
> print
> datapath.send_msg(mod)
>
> @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
> def _packet_in_handler(self, ev):
> msg = ev.msg
> datapath = msg.datapath
> ofproto = datapath.ofproto
> parser = datapath.ofproto_parser
>
> # get Datapath ID to identify OpenFlow switches.
> dpid = datapath.id
> self.mac_to_port.setdefault(dpid, {})
>
> # analyse the received packets using the packet library.
> pkt = packet.Packet(msg.data)
> eth_pkt = pkt.get_protocol(ethernet.ethernet)
> dst = eth_pkt.dst
> src = eth_pkt.src
>
> # get the received port number from packet_in message.
> in_port = msg.match['in_port']
>
> self.logger.info("packet in %s %s %s %s", dpid, src, dst, in_port)
>
> # learn a mac address to avoid FLOOD next time.
> self.mac_to_port[dpid][src] = in_port
>
> # if the destination mac address is already learned,
> # decide which port to output the packet, otherwise FLOOD.
> if dst in self.mac_to_port[dpid]:
> out_port = self.mac_to_port[dpid][dst]
> else:
> out_port = ofproto.OFPP_FLOOD
>
> # construct action list.
> actions = [parser.OFPActionOutput(out_port)]
>
> # install a flow to avoid packet_in next time.
> if out_port != ofproto.OFPP_FLOOD:
> match = parser.OFPMatch(in_port=in_port, eth_dst=dst)
> self.add_flow(datapath, 1, match, actions)
>
> # construct packet_out message and send it.
> out = parser.OFPPacketOut(datapath=datapath,
> buffer_id=ofproto.OFP_NO_BUFFER,
> in_port=in_port, actions=actions,
> data=msg.data)
> datapath.send_msg(out)
> _______________________________________________
> discuss mailing list
> [email protected]
> http://openvswitch.org/mailman/listinfo/discuss
_______________________________________________
discuss mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/discuss