Hi,
Problem solved by this code:
from ryu.lib import dpid as dpid_lib
dp_str = dpid_lib.dpid_to_str(datapath.id)
print(dp_str)
sw = [dp_str[i:i+4] for i in range(0, len(dp_str), 4)]
print('kazkas:%s',sw)
if sw[1] == '1458': #vendor (product) mac address prefix
print('HP')
table_id=100
Regards,
Vilius.
-----Original Message-----
From: Vilius Palubinskas [mailto:[email protected]]
Sent: Friday, December 12, 2014 9:58 AM
To: [email protected]
Subject: [Ryu-devel] detect SW vendor
Hi,
I found that OVS and HP use different flow tables for setting flow rules.
It's possible to determinate switch vendor? I was using mininet OVS. And
what waitress do? I tried this code:
@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER) def
miss_flow (self, ev):
datapath = ev.msg.datapath
desc = ofctl_v1_3.get_desc_stats(datapath)
print('desc=%s', desc.hw_desc)
In console get this error:
CONSUMES EventOFPEchoRequest
CONSUMES EventOFPPortDescStatsReply
CONSUMES EventOFPSwitchFeatures
connected socket:<eventlet.greenio.GreenSocket object at 0xb678572c>
address:('127.0.0.1', 48609) hello ev
<ryu.controller.ofp_event.EventOFPHello object at 0xb6785a0c> move onto
config mode EVENT ofp_event->SimpleSwitch113 EventOFPSwitchFeatures switch
features ev version: 0x4 msg_type 0x6 xid 0xa595dcc6
OFPSwitchFeatures(auxiliary_id=0,capabilities=71,datapath_id=1,n_buffers=256
,n_tables=254)
hub: uncaught exception: Traceback (most recent call last):
File "/home/vilpalu/ryu/ryu/lib/hub.py", line 52, in _launch
func(*args, **kwargs)
File "/home/vilpalu/ryu/ryu/base/app_manager.py", line 274, in _event_loop
handler(ev)
File "/home/vilpalu/ryu/ryu/app/test2.py", line 45, in miss_flow
desc = ofctl_v1_3.get_desc_stats(datapath)
TypeError: get_desc_stats() takes exactly 2 arguments (1 given)
move onto main mode
----------------------------------------------------------------------------
-----------------
Please help.
Regards,
Vilius.
----------------------------------------------------------------------------
--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from
Actuate! Instantly Supercharge Your Business Reports and Dashboards with
Interactivity, Sharing, Native Excel Exports, App Integration & more Get
technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel