Hi Murphy,

Thank you for the reply.

   - *Here's part of my controller's code where I install the entry. I
   marked the line which leads to the bug.*

 def install_flow(self, packet, packet_in):
    msg = of.ofp_flow_mod()
    aggre = 1

    p=packet.next

    if isinstance(p, ipv4):
      nw_src = p.srcip
      nw_dst = p.dstip
      p = p.next
    elif isinstance(p, arp):
      if p.opcode <= 255:
        nw_src = p.protosrc
        nw_dst = p.protodst
      else:
        return
    else:
      return
   # only install entries for 10.0.0.14
    if nw_src.toStr() != "10.0.0.14":
          return
    msg.match.nw_src = nw_src
    if nw_src.toStr() != "10.0.0.14":
      return
    if self.state==0:
      if nw_dst.toStr() in {"10.0.0.8", "10.0.0.9"}:
        aggre = 0
        msg.match.nw_dst = nw_dst
    elif self.state==1:
      if nw_dst.toStr() in {"10.0.0.6", "10.0.0.7"}:
        aggre = 0
        msg.match.nw_dst = nw_dst
    elif self.state==2:
      if nw_dst.toStr() in {"10.0.0.4", "10.0.0.5"}:
        aggre = 0
        msg.match.nw_dst = nw_dst
    else:
      if nw_dst.toStr() in {"10.0.0.2", "10.0.0.3"}:
        aggre = 0
        msg.match.nw_dst = nw_dst
    if aggre==1:
      msg.match.nw_dst = nw_dst.toStr()+"/31"
      msg.priority = 2
    else:
      msg.priority = 1
    print "install flow for switch1"
    msg.command = of.OFPFC_ADD
    # msg.hard_timeout = LIFE
    msg.flags = of.OFPFF_SEND_FLOW_REM
    msg.match.in_port=packet_in.in_port
    *msg.match.dl_type = packet.type *
    msg.match.dl_src = packet.src
    msg.wildcards =
of.OFPFW_NW_DST_SHIFT#+of.OFPFW_DL_TYPE+of.OFPFW_NW_PROTO
    msg.actions.append(of.ofp_action_output(port =
self.mac_to_port[nw_dst.toStr()]))
    self.connection.send(msg)
    if self.prestate != self.state:
      Timer(LIFE, self.handle_timer_elapse, args = ["Hello"])
    self.prestate=self.state
    print "install done!"

*With the above line, I got entries like:*

*[image: 内嵌图片 1]
*

*I want the above two entries to be in one entry.*


   - *I'm not quite sure what kind of switch I'm using. I'm using mininet
   to generate the network by typing: sudo mn --custom
   ~/mininet/custom/example.py --topo mytopo*
   - *Where can I see the version of POX? I just downloaded it according to
   the instructions on Openflow tutorial.*


Liyuan

*
*

2012/11/21 Murphy McCauley <[email protected]>

> Can you post some additional information?  Some things that would be
> useful:
> * Your not-quite-working code
> * Which version of POX you're using (branch or hash)
> * What type of switches you're using
>
> -- Murphy
>
> On Nov 21, 2012, at 1:03 AM, Liyuan Wang wrote:
>
> Hi all,
>
> Can anyone give me a link to a sample program of how to install an entry
> with matching field as "10.0.0.2/31"?
>
> I tried myself after reading openflow-spec and pox programs.
> However, my bug is that I have to specify the l2 protocol type in the
> matching field. Therefore, if the first packet from 10.0.0.3 is ARP, then
> other different kinds of packets from 10.0.0.3 will not be counted by the
> entry I installed.
>
> Thanks,
> Liyuan
>
>
>

<<image.png>>

Reply via email to