On Jun 5, 2014, at 11:36 PM, Chanthan Hel <hel.chantha...@gmail.com> wrote:
> Dear all > I really need your help. I want to install many flow entries in flow table. > So I write the function to modify flow. > The idea is when controller receives packet, it will check the udp > destination port. > If udp dest == 7, the flow will be installed for packet that have udp dest == > 3, 4 , 5, 6,7 and src mac=="00:00:00:00:00:01". So next packet that have udp > dest == 3, 4 , 5, 6 or 7 and src mac=="00:00:00:00:00:01"will be matched in > flow table. I wrote the code below but it is does not work. > Can u give any idea > #install fow at switch data > def install_flow_switch (event, out_port=1, dstport=44, > requester="00:00:00:00:00:01"): > msg = of.ofp_flow_mod()and src mac=="00:00:00:00:00:01" > msg.data = event.ofp > msg.match.dl_dst = EthAddr(requester) > msg.match.tp_dst = dstport Aside from any other errors, the above match specification won't do what you want it to. Unless you're working with an ancient version of POX, you should have gotten a warning to that effect. A FAQ entry explains the problem and solution in detail. > msg.actions.append(of.ofp_action_output(port = out_port)) > event.connection.send(msg) > > # do layer searching for getting udp_src _port > if packet.type == packet.IP_TYPE: > ip_packet = packet.payload > if ip_packet.protocol == ipv4.UDP_PROTOCOL: > udp_packet = ip_packet.payload > content_name = udp_packet.srcport # Name of data packet requested > idr = udp_packet.dstport # Id for tagging of flow matching > > if idr==7:#first interest packet then we install flow > install_flow_switch_re (event, out_port=2, dstport=3, > requester="00:00:00:00:00:01") > install_flow_switch_re (event, out_port=2, dstport=4, > requester="00:00:00:00:00:01") > install_flow_switch_re (event, out_port=2, dstport=5, > requester="00:00:00:00:00:01") > install_flow_switch_re (event, out_port=2, dstport=6, > requester="00:00:00:00:00:01") > install_flow_switch_re (event, out_port=2, dstport=7, > requester="00:00:00:00:00:01") > > -- > Mr. Chanthan Hel > Electrical engineering, Faculty of Engineering, > Chulalongkorn University (CU) > > *Phone: +66 81 456 84 27* >