On Wed, 09 May 2018 04:44:12 +0900, nail göksel wrote: > > [1 <multipart/alternative (7bit)>] > [1.1 <text/plain; UTF-8 (7bit)>] > Hello everyone, > > I'm new on ryu. I want to collect port statistics and match them connected > hosts for a security project. However, i couldn't find any method for > collecting information about hosts and corresponding switch ports > (including host mac and switch dpid-port). > > Below my code, I can collect host information, learn mac address of the > host and corresponding dpid. But the portid is always "1". I need the > correct connected switch port information. > > self.raw_switches = copy.copy(get_switch(self, None)) > self.raw_links = copy.copy(get_link(self, None)) > self.raw_hosts = copy.copy(get_host(self, None)) > > self.logger.info(" \t" + "Current Links:") > for l in self.raw_links: > print(" \t\t" + str(l)) > > self.logger.info(" \t" + "Current Hosts:") > for h in self.raw_hosts: > print(" \t\t PortHw:" + str(h.port.hw_addr) + " Port Dpid:" + > str(h.port.dpid) + " Port Name:" + str(h.port.name) + " Host Mac:" + > str(h.mac)) > > The output is like this > > PortHw:72:6f:15:ea:f5:33Port Dpid:3 Port Name:s3-eth1 Host > Mac:00:00:00:00:00:03 > PortHw:7e:ca:7c:3a:59:38Port Dpid:4 Port Name:s4-eth1 Host > Mac:00:00:00:00:00:02 > PortHw:7e:ca:7c:3a:59:38Port Dpid:4 Port Name:s4-eth1 Host > Mac:00:00:00:00:00:01 > PortHw:72:6f:15:ea:f5:33Port Dpid:3 Port Name:s3-eth1 Host > Mac:00:00:00:00:00:04 > > As you can see the connected port is always "eth1" independent from which > switch port is connected. > > And from the get_link method, the link information are never collected.
I guess you are using get_link, get_host etc from ryu.topology.api. The information you need is not defined in OpenFlow and AFAIK ryu.topology.api relies on LLDP to do the work. What is your OpenFlow switch and what are connected to the switch? -- IWAMOTO Toshihiro ------------------------------------------------------------------------------ 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 Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel