Hi,
I want setting VLAN_ID to OpenFlow by nox controller, so I edit pyswitch.py,
see below:
-----------------------------------------------------------------------
def forward_l2_packet(dpid, inport, packet, buf, bufid):
dstaddr = packet.dst.tostring()
print "test"
if not ord(dstaddr[0]) & 1 and inst.st[dpid].has_key(dstaddr):
prt = inst.st[dpid][dstaddr]
if prt[0] == inport:
log.err('**warning** learned port = inport', system="pyswitch")
inst.send_openflow(dpid, bufid, buf, openflow.OFPP_FLOOD, inport)
else:
# We know the outport, set up a flow
log.msg('installing flow for ' + str(packet), system="pyswitch")
flow = extract_flow(packet)
flow[core.IN_PORT] = inport
#actions = [[openflow.OFPAT_OUTPUT, [0, prt[0]]]]
####################modification#####################
actions = [[openflow.OFPAT_SET_VLAN_VID, 2]]
###################################################
inst.install_datapath_flow(dpid, flow, CACHE_TIMEOUT,
openflow.OFP_FLOW_PERMANENT, actions,
bufid, openflow.OFP_DEFAULT_PRIORITY,
inport, buf)
---------------------------------------------------------------------------
Then I execute nox controller and OpenFlow
Execution in NOX controller:
./nox_core -i ptcp:6633 pyswitch -v
Execution in OpenFlow switch:
ofdatapath punix:/var/run/testa -d 004E46000000 -i nf2c0,nf2c1,nf2c2,nf2c3 &
ofprotocol unix:/var/run/testa --out-of-band --stp tcp:xxx.xxx.xxx.xxx:6633 -l
ptcp:5566
Then, I got some errors in OpenFlow:
Mar 07 00:35:09|00001|secchan|INFO|OpenFlow reference implementation version
1.0.0
Mar 07 00:35:09|00002|secchan|INFO|OpenFlow protocol version 0x01
Mar 07 00:35:09|00003|secchan|WARN|new management connection will receive
asynchronous messages
Mar 07 00:35:09|00004|rconn|INFO|unix:/var/run/testa: connecting...
Mar 07 00:35:09|00005|rconn|INFO|tcp:xxx.xxx.xxx.xxx:6633: connecting...
Mar 07 00:35:09|00006|rconn|INFO|unix:/var/run/testa: connected
Mar 07 00:35:09|00007|port_watcher|INFO|Datapath id is 004e46000000
Mar 07 00:35:09|00008|port_watcher|INFO|Identified data path local port as
"tap0".
...
Mar 07 00:35:09|00013|rconn|INFO|tcp:xxx.xxx.xxx.xxx:6633: connected
Mar 07 00:35:09|00001|datapath|WARN|unknown vendor: 0x2320
...
ofdatapath: lib/ofpbuf.c:168: ofpbuf_prealloc_headroom: Assertion `size <=
ofpbuf_headroom(b)' failed.
Mar 07 00:35:12|00002|fault|EMER|Caught signal 6.
0xbf9425c8
Mar 07 00:35:12|00003|fault|EMER|Caught signal 11.
0x00000000
Mar 07 00:35:12|00018|netdev|ERR|ioctl(SIOCGIFFLAGS) on tap0 device failed: No
such device
Mar 07 00:35:12|00019|port_watcher|WARN|could not get flags for tap0
Mar 07 00:35:12|00020|netdev|ERR|ioctl(SIOCGIFFLAGS) on tap0 device failed: No
such device
Mar 07 00:35:12|00021|port_watcher|WARN|could not get flags for tap0
Mar 07 00:35:12|00022|rconn|WARN|unix:/var/run/testa: connection dropped
(Connection reset by peer)
Mar 07 00:35:13|00023|rconn|INFO|unix:/var/run/testa: connecting...
Mar 07 00:35:13|00024|vconn_unix|ERR|/tmp/vconn-unix.7349.1: connection to
/var/run/testa failed: Connection refused
Mar 07 00:35:13|00025|rconn|WARN|unix:/var/run/testa: connection failed
(Connection refused)
Mar 07 00:35:13|00026|rconn|INFO|unix:/var/run/testa: waiting 2 seconds before
reconnect
Can anybody tell me how to solve this problem?
Any suggest will be helpful. Thank you.
Yi-Shou
_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev