knowing the first switch and port from the packet track

  • 1 Replies
  • 2041 Views
knowing the first switch and port from the packet track
« on: March 27, 2018, 03:09:21 AM »
Hi all,

In my topology, I need to send some Packets from the edge switch into a controller through some switches. So, to know whose the first switch in the track and the host connected port, I use the simple _switch_13 code  with some modifications as follows:

I added

from ryu.topology.switches import Switch
from ryu.topology.api import get_switch, get_link


and I added into the def _packet_in_handler(self, ev):

B = get_switch(self, None)       
obj = Switch(B)
A = obj.to_dict()


and I get the next error :

Traceback (most recent call last):
  File "/home/mininet/ryu/ryu/base/app_manager.py", line 290, in _event_loop
    handler(ev)
  File "/home/mininet/ryu/ryu/app/C2.py", line 85, in _packet_in_handler
    A = obj.to_dict()
  File "/home/mininet/ryu/ryu/topology/switches.py", line 124, in to_dict
    d = {'dpid': dpid_to_str(self.dp.id),
AttributeError: 'list' object has no attribute 'id'

any solution ?

« Last Edit: March 27, 2018, 03:16:03 AM by Abdullah Soliman »

*

Paul Zanna

  • Moderator
  • Sr. Member
  • *****
  • 370
    • View Profile
    • Northbound Networks
Re: knowing the first switch and port from the packet track
« Reply #1 on: April 01, 2018, 05:53:57 PM »
The error seems to be in the line A = obj.to_dict(), it looks like the value obj is not being set correctly. Try printing it out to verify it has the correct value.

Regards,
Paul