<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="line-height: 1.7;"><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">Hello, </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">I am trying to redirect `ofp_packet_in` packet among multiple controllers. For example, suppose there are two controllers `c1,c2` and one switch `s1`. `s1` is assigned to `c1`. Now, `c1` receives a `Packet_In` from switch `s1`. Generally, `s1` should dispose of this `Packet_In`. **What I am trying to do is to send this `Packet_In` to `c2` and let `c2` process this `Packet_In`**.</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">I am trying to implement my idea by POX, but I got some mistakes.</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">This is the code of `c1`, only `_handle_packet_in` is shown:</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">##################################################################</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    def _handle_PacketIn(self, event):</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        log.debug("Switch %s has a PacketIn: [port: %d, ...]", event.dpid, event.port)</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        self._redirect_packet(event)</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    def _redirect_packet(self, event):</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        log.debug("Send packet to 6634!")</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        TCP_IP = '10.0.2.15'</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        TCP_PORT = 6634</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        BUFFER_SIZE = 1024</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        packet = event.ofp</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        # I attach all the payload of OpenFlow Packet_In to the new packet</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        MESSAGE = packet.pack() </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        # MESSAGE = MESSAGE + 'Hello world'</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        s.connect((TCP_IP, TCP_PORT))</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        s.send(MESSAGE)</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        # s.close()</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">#################################################################</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">Then I start Mininet and build the topology. (Here the topology has little difference with the formal description, however, it is clear and modified from Mininet example controllers2.py)</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">#################################################################</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    from mininet.net import Mininet</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    from mininet.node import Controller, OVSSwitch</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    from mininet.cli import CLI</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    from mininet.log import setLogLevel</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    from mininet.node import RemoteController</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    def multiControllerNet():</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        "Create a network from semi-scratch with multiple controllers."</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        net = Mininet( controller=Controller, switch=OVSSwitch, autoSetMacs=True )</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        print "*** Creating (reference) controllers"</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        # c1 = net.addController( 'c1', port=6633 )</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        # c2 = net.addController( 'c2', port=6634 )</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        c1 = net.addController('c1', controller=RemoteController, ip='10.0.2.15', port=6633)</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        c2 = net.addController('c2', controller=RemoteController, ip='10.0.2.15', port=6634)</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        print "*** Creating switches"</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        s1 = net.addSwitch( 's1' )</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        s2 = net.addSwitch( 's2' )</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        print "*** Creating hosts"</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        hosts1 = [ net.addHost( 'h%d' % n ) for n in 3, 4 ]</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        hosts2 = [ net.addHost( 'h%d' % n ) for n in 5, 6 ]</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        print "*** Creating links"</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        for h in hosts1:</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">            net.addLink( s1, h )</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        for h in hosts2:</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">            net.addLink( s2, h )</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        net.addLink( s1, s2 )</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        print "*** Starting network"</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        net.build()</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        # c1.start()</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        c2.start()</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        s1.start( [ c1 ] )</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        # s1.start([c2])</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        s2.start( [ c2 ] )</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        # s2.start([c2])</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        # print "*** Testing network"</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        # net.pingAll()</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        print "*** Running CLI"</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        CLI( net )</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        print "*** Stopping network"</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        net.stop()</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    </div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">    if __name__ == '__main__':</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        setLogLevel( 'info' )  # for CLI output</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">        multiControllerNet()</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">#################################################################</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">Then, I start two controllers at my host with different ports, `6633, 6634`. Open `c1`:</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">```</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">../pox.py openflow.of_01 --port=6633 --address=10.0.2.15 openflow_test log.level --DEBUG</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">```</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">and, open `c2`</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">```</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">../pox.py openflow.of_01 --port=6634 --address=10.0.2.15 openflow_test_2 log.level --DEBUG</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">```</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">`c1` has only the `_handle_packet_in` handler which is shown above. `c2` has no function.</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">I try to `ping` between `h3` (controlled by `c1`) to `h5` (controller by `c2`), in order to trigger `_handle_packet_in` handler.</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">I use Wireshark to capture the `of_packet_in` packet, and the new **redirect** packet. It is clear that they have the same payload (OpenFlow packet).</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">However, `c2` doesn't accept this packet, and warn that this is dummy OpenFlowNexus. This is the error:</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">###################################################</div><div style=""><div style="">WARNING:openflow.of_01:<class 'pox.openflow.PacketIn'> raised on dummy OpenFlow nexus</div><div style="">INFO:openflow.of_01:[None 8] closed</div></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">###################################################</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">I guess, even if `c1` sends a **legal** OpenFlow `of_packet_in` to `c2`, `c2` has no idea about **"who is `c1`"**, for `c1` has **not** registered to `c1` using OpenFlow `of_hello`, `of_features_request`,.... Therefore, `c2` discard the OpenFlow `of_packet_in` sent by `c1`, and say **dummy**.</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">I only want to let `c2` process the `Packet_In` redirected by `c1`. In this way, `c2` can calculate and install table entries for `table-miss` event happened in `s1`.</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">Maybe I can use other controllers, like floodlight, ONOS..., to solve this problem. Maybe this problem cannot be solved. Thank you for sharing your idea, best wishes.</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">I am using POX 0.2.0 (carp)</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">Best wishes,</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">Xia</div></div><br><br><span title="neteasefooter"><p> </p></span></div><br><br><span title="neteasefooter"><p> </p></span>