Re: [Ryu-devel] Official NAT App
Ok, but I don't understand how to used it. What this means ? range_ipv4_min = "10.1.12.0", range_ipv4_max = "10.1.13.255", range_proto_min = 1, range_proto_max = 1023 How this works with source/port --> destination/port approach ? 2016-09-11 19:43 GMT-06:00 Shinpei Muraoka: > Hi, > > Ryu does not have any official NAT application. > If you want to use NAT, please refer to the following. > > http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu. > ofproto.ofproto_v1_3_parser.NXActionNAT > > > Thanks, > > On 2016年09月11日 02:11, Luis Zárate wrote: > >> Is there any official nat app for ryu ? If Is not, is there any NAT >> (dnat and snat) app that I can use in my lab? >> >> >> >> -- >> "La utopía sirve para caminar" Fernando Birri >> >> >> >> >> >> >> -- >> >> >> >> ___ >> Ryu-devel mailing list >> Ryu-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/ryu-devel >> >> -- "La utopía sirve para caminar" Fernando Birri -- ___ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel
Re: [Ryu-devel] error simple_switch_stp_13 and forty switch
Hi, The output of "sudo ss -ntlp" command shows that "ovs-vswitchd" is running on the port 6653 of "c0", and Ryu cannot bind this port. "ovs-vswitchd" seems to use the port from 6634 and increment it for each switch instance. So, if the number of switch instances becomes more than 20, "ovs-vswitchd" may hit the port 6653. Then, how about the specify the ofp port number of Ryu as following? With this option, Ryu will bind the port 6633 only. e.g.) $ ryu-manager --ofp-tcp-listen-port 6633 Thanks, Iwase On 2016年09月13日 17:53, wesam kh wrote: > hi IwaseI have same error and I am using two application in separately > you see the attachments > > > > > > > > Wisam Maala > > > On Tuesday, September 13, 2016 7:51 AM, Iwase Yusuke >wrote: > > > Hi, > >> File "/usr/lib/python2.7/socket.py", line 224, in meth >> return getattr(self._sock,name)(*args) >> error: [Errno 98] Address already in use > > This messages means another application is already using the port 6633 or > 6653, > which is the default ofp listen port of Ryu. > Please check if another application is running on these ports or not. > > e.g.) > $ sudo ss -ntlp > State Recv-Q Send-Q Local Address:PortPeer > Address:Port > ...(snip) > LISTEN0 50 *:6633 > *:* users:(("ryu-manager",pid=7608,fd=4)) > ...(snip) > LISTEN0 50 *:6653 > *:* users:(("ryu-manager",pid=7608,fd=6)) > ...(snip) > > > Thanks, > Iwase > > > On 2016年09月12日 18:30, wesam kh wrote: >> hi every oneI have error when apply the simple_switch_stp_13.py with >> custom network contain forty switch !this problem just with this network >> any help >> you see the attachments >> >> >> >> >> >> Wisam Maala >> >> >> >> -- >> >> >> >> ___ >> Ryu-devel mailing list >> Ryu-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/ryu-devel >> > > -- > ___ > Ryu-devel mailing list > Ryu-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ryu-devel > > > > -- ___ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel
Re: [Ryu-devel] Ho to extract message type (e.g. pktIN/pktOut) from OpenFlow v1.3 header structure?
Hi, @set_ev_cls() can be used only at the reception. By performing the following modifications, you can process separately each message types when controller sends a message. diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py index 8300f1a..0911789 100644 --- a/ryu/controller/controller.py +++ b/ryu/controller/controller.py @@ -293,9 +293,11 @@ class Datapath(ofproto_protocol.ProtocolDesc): def _send_loop(self): try: while self.state != DEAD_DISPATCHER: -buf = self.send_q.get() +msg = self.send_q.get() self._send_q_sem.release() -self.socket.sendall(buf) +ev = ofp_event.ofp_msg_to_ev(msg) +self.ofp_brick.send_event_to_observers(ev, self.state) +self.socket.sendall(msg.buf) except SocketTimeout: LOG.debug("Socket timed out while sending data to switch at address %s", self.address) @@ -318,11 +320,11 @@ class Datapath(ofproto_protocol.ProtocolDesc): # Finally, ensure the _recv_loop terminates. self.close() -def send(self, buf): +def send(self, msg): msg_enqueued = False self._send_q_sem.acquire() if self.send_q: -self.send_q.put(buf) +self.send_q.put(msg) msg_enqueued = True else: self._send_q_sem.release() @@ -343,7 +345,7 @@ class Datapath(ofproto_protocol.ProtocolDesc): self.set_xid(msg) msg.serialize() # LOG.debug('send_msg %s', msg) -return self.send(msg.buf) +return self.send(msg) def _echo_request_loop(self): if not self.max_unreplied_echo_requests: The following is an example of when to send the FlowMod. diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py index 3e7c598..aef4cfd 100644 --- a/ryu/app/simple_switch_13.py +++ b/ryu/app/simple_switch_13.py @@ -63,6 +63,13 @@ class SimpleSwitch13(app_manager.RyuApp): match=match, instructions=inst) datapath.send_msg(mod) +@set_ev_cls(ofp_event.EventOFPFlowMod, MAIN_DISPATCHER) +def _flow_mod_handler(self, ev): +msg = ev.msg +ofproto = msg.datapath.ofproto +self.logger.info("msg.msg_type == ofproto.OFPT_FLOW_MOD : %s", + msg.msg_type == ofproto.OFPT_FLOW_MOD) + @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER) def _packet_in_handler(self, ev): # If you hit this you might want to increase Please refer to the following about the event. http://ryu.readthedocs.io/en/latest/ryu_app_api.html?highlight=set_ev_cls#openflow-event-classes Please refer to the following about set_ev_cls. http://ryu.readthedocs.io/en/latest/ryu_app_api.html?highlight=set_ev_cls#ryu-controller-handler-set-ev-cls Thanks, On 2016年09月13日 17:53, Maurizio Marrocco wrote: > Hi > Thank you for fast reply. I need decision of message type because I > would to implement a state machine based on that decision: arriving of > packetOut to switch. > In fact, I would to intercept PktOut. And how to do with @set_ev_cls()? > Maurizio. > > > > > *Da:* Shinpei Muraoka> *Inviato:* martedì 13 settembre 2016 04.59 > *A:* soldie...@hotmail.it; ryu-devel@lists.sourceforge.net > *Oggetto:* Re: [Ryu-devel] Ho to extract message type (e.g. > pktIN/pktOut) from OpenFlow v1.3 header structure? > > Hi, > > sorry. I responded a difficult answer. > > The following is example of the message type check. > > > diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py > index 3e7c598..89dedb9 100644 > --- a/ryu/app/simple_switch_13.py > +++ b/ryu/app/simple_switch_13.py > @@ -76,6 +76,9 @@ class SimpleSwitch13(app_manager.RyuApp): > parser = datapath.ofproto_parser > in_port = msg.match['in_port'] > > +self.logger.info("msg.msg_type == ofproto.OFPT_PACKET_IN : %s", > + msg.msg_type == ofproto.OFPT_PACKET_IN) > + > pkt = packet.Packet(msg.data) > eth = pkt.get_protocols(ethernet.ethernet)[0] > > > Message type for the check is defined in ofproto/ofproto_v1_3.py. > > Why do you need a decision of the message type? > I think it can check of message type by @set_ev_cls(). > > Thanks, > > On 2016年09月12日 20:50, Maurizio Marrocco wrote: >> Hi, Shinpei. Sorry if I'm disturbing. >> I read the documentation >> (http://ryu.readthedocs.io/en/latest/ofproto_base.html#base-class-for-openflow-messages) >> but could not find examples of how to pick the type of message from the >> header OpenFlow. >> You could give me a hand? For example in simple_switch_13.py script, how >> can I use the class: class ryu.ofproto.ofproto_parser.MsgBase (* args, >> ** kwargs) to take msg_type == pktOut
Re: [Ryu-devel] Ryu app
I don't know if you understood my question all i need to do is to load simple_switch_13.py in my module directly from the Python code...i used AppManager methods but it doesn't start as i launch from the shell i want to load the module simple_switch_13 when i check something in my other module that we can call mymodule what you said i've yet done to bring all dpids...this is my code to run simple_switch_13.py but i got even assertion error app_mgr=AppManager.get_instance() From ryu.app import wsgi app_mgr.load_apps(['ryu.app.simple_switch_13']) contexts=app_mgr.create_contexts() services=[] services.extend(app_mgr.instantiate_apps(**contexts)) we=wsgi.start_service(app_mgr) If wsgi: services.append(hub.spawn(we)) It loads simple_switch_13 and instantiate it correctly but got in assertion error i think maybe for double OFPHandler instance...so i want to start simple_switch_13 manually from the Python code this is my goal so can you help me doing this? > Il giorno 13/set/2016, alle ore 03:19, Iwase Yusuke> ha scritto: > > Hi, > > How about skipping the ofp event processing for the specific dpid > at the top of each event handler? > > e.g.) If dpid is registered, do switch_features_handler, otherwise skip. > $ git diff > diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py > index 3e7c598..c8a9291 100644 > --- a/ryu/app/simple_switch_13.py > +++ b/ryu/app/simple_switch_13.py > @@ -30,8 +30,12 @@ class SimpleSwitch13(app_manager.RyuApp): >super(SimpleSwitch13, self).__init__(*args, **kwargs) >self.mac_to_port = {} > +self.registered_dpids = [1, 2, 3] # specify the range of dpid > + >@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER) >def switch_features_handler(self, ev): > +if ev.msg.datapath.id not in self.registered_dpids: > +return >datapath = ev.msg.datapath >ofproto = datapath.ofproto >parser = datapath.ofproto_parser > > >> On 2016年09月06日 18:47, Francesco Murador wrote: >> Hi i have a question...i need to start stplib when i check a thing how can i >> start it? Not at the begin of my program with _CONTEXTS...i have to check if >> some values in a switch are out of range if they aren't i need to start the >> spanning tree because all i want is to block a dpid but if i don't block a >> dpid i have a topology with loops so normal simple_switch will not work so i >> had to run the stplib >> -- >> ___ >> Ryu-devel mailing list >> Ryu-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/ryu-devel >> -- ___ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel
Re: [Ryu-devel] Ho to extract message type (e.g. pktIN/pktOut) from OpenFlow v1.3 header structure?
Hi Thank you for fast reply. I need decision of message type because I would to implement a state machine based on that decision: arriving of packetOut to switch. In fact, I would to intercept PktOut. And how to do with @set_ev_cls()? Maurizio. Da: Shinpei MuraokaInviato: martedì 13 settembre 2016 04.59 A: soldie...@hotmail.it; ryu-devel@lists.sourceforge.net Oggetto: Re: [Ryu-devel] Ho to extract message type (e.g. pktIN/pktOut) from OpenFlow v1.3 header structure? Hi, sorry. I responded a difficult answer. The following is example of the message type check. diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py index 3e7c598..89dedb9 100644 --- a/ryu/app/simple_switch_13.py +++ b/ryu/app/simple_switch_13.py @@ -76,6 +76,9 @@ class SimpleSwitch13(app_manager.RyuApp): parser = datapath.ofproto_parser in_port = msg.match['in_port'] +self.logger.info("msg.msg_type == ofproto.OFPT_PACKET_IN : %s", + msg.msg_type == ofproto.OFPT_PACKET_IN) + pkt = packet.Packet(msg.data) eth = pkt.get_protocols(ethernet.ethernet)[0] Message type for the check is defined in ofproto/ofproto_v1_3.py. Why do you need a decision of the message type? I think it can check of message type by @set_ev_cls(). Thanks, On 2016?09?12? 20:50, Maurizio Marrocco wrote: > Hi, Shinpei. Sorry if I'm disturbing. > I read the documentation > (http://ryu.readthedocs.io/en/latest/ofproto_base.html#base-class-for-openflow-messages) > but could not find examples of how to pick the type of message from the > header OpenFlow. > You could give me a hand? For example in simple_switch_13.py script, how > can I use the class: class ryu.ofproto.ofproto_parser.MsgBase (* args, > ** kwargs) to take msg_type == pktOut ? > Thanks so much. > Maurizio > > > > > > > *Da:* Shinpei Muraoka > *Inviato:* lunedì 12 settembre 2016 03.15 > *A:* soldie...@hotmail.it; ryu-devel@lists.sourceforge.net; > ryu-devel@lists.sourceforge.net > *Oggetto:* Re: [Ryu-devel] Ho to extract message type (e.g. > pktIN/pktOut) from OpenFlow v1.3 header structure? > > Hi, > > Please refer to the following for extraction method of the type of > OpenFlow message. > http://ryu.readthedocs.io/en/latest/ofproto_base.html#base-class-for-openflow-messages > > Also, Please refer to the chapter 7.1.1 of OpenFlow Spec version 1.3.5 > for the type of OpenFlow message. > > Thanks, > > On 2016?09?10? 22:55, Maurizio Marrocco wrote: >> Hi Ryu team. >> The question is the following: How to extract message ofp_type (e.g. >> OFPT_PACKET_OUT or OFPT_PACKET_IN) from openflow v1.3 ofp_header structure? >> I would to do this statement: >> >> if(header(received PDU)==PacketOut) >> do something. >> >> Have some reference in the documentation about this and in general to >> process the packets? >> PS: I'm using RYU 3.29 >> Thanks. >> Maurizio. >> >> >> >> -- >> >> >> >> ___ >> Ryu-devel mailing list >> Ryu-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/ryu-devel >> -- ___ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel
[Ryu-devel] [PATCH] Add Nicira extension vlan_tci field
This Nicira extension field is VLAN VID+CFI+PCP. OXM_OF_VLAN_VID and OXM_OF_VLAN_PCP should work fine in theory, but in OvS it seems vlan_tci must be used to access the CFI bit from NX_LEARN actions. Signed-off-by: IWAMOTO Toshihiro--- ryu/ofproto/nicira_ext.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ryu/ofproto/nicira_ext.py b/ryu/ofproto/nicira_ext.py index e2fca47..ef44ccf 100644 --- a/ryu/ofproto/nicira_ext.py +++ b/ryu/ofproto/nicira_ext.py @@ -431,6 +431,8 @@ eth_src_nxm MAC address Ethernet source address. eth_type_nxm Integer 16bit Ethernet type. Needed to support Nicira extensions that require the eth_type to be set. (i.e. tcp_flags_nxm) +vlan_tci Integer 16bit VLAN TCI. Basically same as vlan_vid plus + vlan_pcp. ip_proto_nxm Integer 8bitIP protocol. Needed to support Nicira extensions that require the ip_proto to be set. (i.e. tcp_flags_nxm) @@ -482,6 +484,7 @@ oxm_types = [ oxm_fields.NiciraExtended0('eth_dst_nxm', 1, type_desc.MacAddr), oxm_fields.NiciraExtended0('eth_src_nxm', 2, type_desc.MacAddr), oxm_fields.NiciraExtended0('eth_type_nxm', 3, type_desc.Int2), +oxm_fields.NiciraExtended0('vlan_tci', 4, type_desc.Int2), oxm_fields.NiciraExtended0('ip_proto_nxm', 6, type_desc.Int1), oxm_fields.NiciraExtended1('tunnel_id_nxm', 16, type_desc.Int8), oxm_fields.NiciraExtended1('tun_ipv4_src', 31, type_desc.IPv4Addr), -- 2.1.4 -- ___ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel