Dear All,

 

I am currently working on a project to implement multicast using SDN. As
part of the module I am required to identify the immediate neighbours of a
switch. 

 

Following is the code sample which I have written. The sample shall return
all the links irrespective of the switch.

 

Can you please tell me if there is a way I can only derive immediate
neighbours of a switch.

 

SNIPPET:

 

            dpid_list=[]

            for dp in self.datapaths.values():

                dpid_list.append(dp.id)

        dpid_list.sort()

        for x in dpid_list:

 

            switch_id=x

            list_of_links=get_link(self,dpid=switch_id)

            print 'Switch---'+str(switch_id)

            #print list_of_links

            for link in list_of_links:

                print str(link.src)+'----------'+str(link.dst)

 

OUTPUT

 

Switch---1

Port<dpid=1, port_no=2, LIVE>----------Port<dpid=6, port_no=1, LIVE>

Port<dpid=1, port_no=2, LIVE>----------Port<dpid=5, port_no=2, LIVE>

Port<dpid=1, port_no=1, LIVE>----------Port<dpid=4, port_no=2, LIVE>

Port<dpid=1, port_no=1, LIVE>----------Port<dpid=3, port_no=3, LIVE>

Port<dpid=1, port_no=1, LIVE>----------Port<dpid=2, port_no=2, LIVE>

Port<dpid=1, port_no=2, LIVE>----------Port<dpid=7, port_no=1, LIVE>

Switch---2

Port<dpid=2, port_no=3, LIVE>----------Port<dpid=4, port_no=2, LIVE>

Port<dpid=2, port_no=1, LIVE>----------Port<dpid=3, port_no=3, LIVE>

Port<dpid=2, port_no=2, LIVE>----------Port<dpid=6, port_no=1, LIVE>

Port<dpid=2, port_no=2, LIVE>----------Port<dpid=5, port_no=2, LIVE>

Port<dpid=2, port_no=2, LIVE>----------Port<dpid=1, port_no=1, LIVE>

Port<dpid=2, port_no=2, LIVE>----------Port<dpid=7, port_no=1, LIVE>

Switch---3

Port<dpid=3, port_no=3, LIVE>----------Port<dpid=2, port_no=1, LIVE>

Port<dpid=3, port_no=3, LIVE>----------Port<dpid=4, port_no=2, LIVE>

Port<dpid=3, port_no=3, LIVE>----------Port<dpid=7, port_no=1, LIVE>

Port<dpid=3, port_no=3, LIVE>----------Port<dpid=5, port_no=2, LIVE>

Port<dpid=3, port_no=3, LIVE>----------Port<dpid=6, port_no=1, LIVE>

Port<dpid=3, port_no=3, LIVE>----------Port<dpid=1, port_no=1, LIVE>

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to