Discussion:
[Ryu-devel] OFPPacketOut
Edison Albuquerque
2017-07-09 00:31:04 UTC
Permalink
Hi.
I wrote a simple code to send a packet through the switch.
I caught the switch datapath from FeaturesReply message and from datapath I
found the ofproto and parser, which is openflow 1.3;
But when I print the message the controller is sending out, the common
header shows None to all it's fields as follows:

printing:
out = parser.OFPPacketOut(datapath=datapath, buffer_id=buffer_id,
in_port=in_port, actions=actions, data=None)

shows:
version=None,msg_type=None,msg_len=None,xid=None,OFPPacketOut(actions=[OFPActionOutput(len=16,max_len=65509,port=3,type=0)],actions_len=0,buffer_id=4294967295,data=None,in_port=1)

Please help me understand why is that.

Tks, Edison.
--
*Todos querem um mundo melhor. Poucos colaboram.*

Prof. Edison de Queiroz Albuquerque, BSc, Msc, Dr.
Adjunto da Escola Politécnica de Pernambuco, Universidade de Pernambuco
(POLI/UPE)
Professor do Curso de Engenharia de Computação
Líder do Grupo de Pesquisa em Protocolos de Redes de Computadores
Membro do IEEE (ComSoc), do SBrT, do IECOM e da APEET

Universidade de Pernambuco/Escola Politécnica de Pernambuco
Rua Benfica, 455 (Bl. 'C' 2. andar) - Bairro: Madalena
CEP 50720-001 - Recife, Pernambuco - Brasil
Fone: +55 81 3184-7542 - Fax: +55 81 3184-7581
Iwase Yusuke
2017-07-10 00:26:23 UTC
Permalink
Hi Edison,
Post by Edison Albuquerque
Hi.
I wrote a simple code to send a packet through the switch.
I caught the switch datapath from FeaturesReply message and from datapath I found the ofproto and
parser, which is openflow 1.3;
But when I print the message the controller is sending out, the common header shows None to all it's
out = parser.OFPPacketOut(datapath=datapath, buffer_id=buffer_id, in_port=in_port, actions=actions,
data=None)
version=None,msg_type=None,msg_len=None,xid=None,OFPPacketOut(actions=[OFPActionOutput(len=16,max_len=65509,port=3,type=0)],actions_len=0,buffer_id=4294967295,data=None,in_port=1)
Please help me understand why is that.
For the header fields in OFP messages, Ryu will fill them when serializing messages.
You can see these filed after serialization.

$ git diff
diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
index 3e7c598..8b66f18 100644
--- a/ryu/app/simple_switch_13.py
+++ b/ryu/app/simple_switch_13.py
@@ -61,7 +61,11 @@ class SimpleSwitch13(app_manager.RyuApp):
else:
mod = parser.OFPFlowMod(datapath=datapath, priority=priority,
match=match, instructions=inst)
+
+ self.logger.info('Before: %s', mod)
datapath.send_msg(mod)
+ # Message should be serialized in datapath.send_msg()
+ self.logger.info('After: %s', mod)

@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
def _packet_in_handler(self, ev):


$ ryu-manager ryu/app/simple_switch_13.py
...(snip)...
Before:
version=None,msg_type=None,msg_len=None,xid=None,OFPFlowMod(buffer_id=4294967295,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=4294967293,type=0)],type=4)],match=OFPMatch(oxm_fields={}),out_group=0,out_port=0,priority=0,table_id=0)
After:
version=0x4,msg_type=0xe,msg_len=0x50,xid=0x3b00d2f8,OFPFlowMod(buffer_id=4294967295,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=4294967293,type=0)],len=24,type=4)],match=OFPMatch(oxm_fields={}),out_group=0,out_port=0,priority=0,table_id=0)
...(snip)...


Thanks,
Iwase
Post by Edison Albuquerque
Tks, Edison.
--
/_Todos querem um mundo melhor. Poucos colaboram.
_/
Prof. Edison de Queiroz Albuquerque, BSc, Msc, Dr.
Adjunto da Escola Politécnica de Pernambuco, Universidade de Pernambuco (POLI/UPE)
Professor do Curso de Engenharia de Computação
Líder do Grupo de Pesquisa em Protocolos de Redes de Computadores
Membro do IEEE (ComSoc), do SBrT, do IECOM e da APEET
Universidade de Pernambuco/Escola Politécnica de Pernambuco
Rua Benfica, 455 (Bl. 'C' 2. andar) - Bairro: Madalena
CEP 50720-001 - Recife, Pernambuco - Brasil
Fone: +55 81 3184-7542 - Fax: +55 81 3184-7581
------------------------------------------------------------------------------
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
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Edison Albuquerque
2017-07-10 01:11:15 UTC
Permalink
Thanks a lot for your ligthting fast answer. I am not confused anymore. You
are the man. Best wishes Edison.
Post by Iwase Yusuke
Hi Edison,
Post by Edison Albuquerque
Hi.
I wrote a simple code to send a packet through the switch.
I caught the switch datapath from FeaturesReply message and from datapath
I found the ofproto and parser, which is openflow 1.3;
But when I print the message the controller is sending out, the common
out = parser.OFPPacketOut(datapath=datapath, buffer_id=buffer_id,
in_port=in_port, actions=actions, data=None)
version=None,msg_type=None,msg_len=None,xid=None,OFPPacketOu
t(actions=[OFPActionOutput(len=16,max_len=65509,port=3,
type=0)],actions_len=0,buffer_id=4294967295,data=None,in_port=1)
Please help me understand why is that.
For the header fields in OFP messages, Ryu will fill them when serializing messages.
You can see these filed after serialization.
$ git diff
diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
index 3e7c598..8b66f18 100644
--- a/ryu/app/simple_switch_13.py
+++ b/ryu/app/simple_switch_13.py
mod = parser.OFPFlowMod(datapath=datapath, priority=priority,
match=match, instructions=inst)
+
+ self.logger.info('Before: %s', mod)
datapath.send_msg(mod)
+ # Message should be serialized in datapath.send_msg()
+ self.logger.info('After: %s', mod)
@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
$ ryu-manager ryu/app/simple_switch_13.py
...(snip)...
Before: version=None,msg_type=None,msg_len=None,xid=None,OFPFlowMod(
buffer_id=4294967295,command=0,cookie=0,cookie_mask=0,
flags=0,hard_timeout=0,idle_timeout=0,instructions=[OFPIns
tructionActions(actions=[OFPActionOutput(len=16,max_len
=65535,port=4294967293,type=0)],type=4)],match=OFPMatch(oxm_
fields={}),out_group=0,out_port=0,priority=0,table_id=0)
After: version=0x4,msg_type=0xe,msg_len=0x50,xid=0x3b00d2f8,OFPFlow
Mod(buffer_id=4294967295,command=0,cookie=0,cookie_
mask=0,flags=0,hard_timeout=0,idle_timeout=0,instructions=[O
FPInstructionActions(actions=[OFPActionOutput(len=16,max_len
=65535,port=4294967293,type=0)],len=24,type=4)],match=
OFPMatch(oxm_fields={}),out_group=0,out_port=0,priority=0,table_id=0)
...(snip)...
Thanks,
Iwase
Post by Edison Albuquerque
Tks, Edison.
--
/_Todos querem um mundo melhor. Poucos colaboram.
_/
Prof. Edison de Queiroz Albuquerque, BSc, Msc, Dr.
Adjunto da Escola Politécnica de Pernambuco, Universidade de Pernambuco
(POLI/UPE)
Professor do Curso de Engenharia de Computação
Líder do Grupo de Pesquisa em Protocolos de Redes de Computadores
Membro do IEEE (ComSoc), do SBrT, do IECOM e da APEET
Universidade de Pernambuco/Escola Politécnica de Pernambuco
Rua Benfica, 455 (Bl. 'C' 2. andar) - Bairro: Madalena
CEP 50720-001 - Recife, Pernambuco - Brasil
Fone: +55 81 3184-7542 - Fax: +55 81 3184-7581
------------------------------------------------------------
------------------
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
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Loading...