Hi,

Let's try this :
    /**
     * remove all flow entries
     * @param sw
     */
    private void removeAllFlows(IOFSwitch sw) {
        try {
            
            OFMatch match = new OFMatch().setWildcards(OFMatch.OFPFW_ALL);
            OFMessage fm = ((OFFlowMod) sw.getInputStream().getMessageFactory()
                .getMessage(OFType.FLOW_MOD))
                .setMatch(match)
                .setCommand(OFFlowMod.OFPFC_DELETE)
                .setOutPort(OFPort.OFPP_NONE)
                .setLength(U16.t(OFFlowMod.MINIMUM_LENGTH));
            sw.getOutputStream().write(fm);
            
            logger.info("Remove all flow entries of Switch DPID = " + 
sw.getId());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

It works with me.

------------------- 
NGUYEN Xuan Nam 
Planete Team INRIA Sophia 
Email : xuan-nam.ngu...@inria.fr 


----- Original Message -----
> From: "Matteo Gerola" <matteo.ger...@create-net.org>
> To: openflow-discuss@lists.stanford.edu
> Sent: Tuesday, April 17, 2012 3:32:42 PM
> Subject: [openflow-discuss] Problem with flow removal
> Dear all,
> I'm trying to remove all the flows from a switch (something similar to
> the first flow_mod from the NOX controller during the initialization).
> I have a flow (udp stream) that flows in my network.
> After a while I want to change the path. My idea is to remove the flow
> from the switch so the switch will ask again to the controller, and
> the controller will send the new path. It's difficult to explain, but
> I cannot modify the flow, so I need to delete and the reinstall
> another one.
> Here is my code. As you can see I set the command to delete, and the
> wildcard to all to match all the packet in the switch.
> It matches the flow (I have only one flow in the switch), it installs
> a drop rule to that flow. So the result is not what I expected: all
> the packet that match the rule are dropped, and I'm not able to
> install the new flow∑
> Is there a way to remove the flow without adding the drop rule for the
> new packets?
> FVFlowMod flowMod=new FVFlowMod();
> OFMatch match = new OFMatch();
> match.fromString(currentFlow);
> flowMod.setCommand(OFFlowMod.OFPFC_DELETE);
> flowMod.setCookie(0);
> flowMod.setFlags((short) 0);
> match.setWildcards(OFMatch.OFPFW_ALL);
> flowMod.setMatch(match);
> flowMod.setOutPort((short) OFPort.OFPP_NONE.getValue());
> flowMod.setPriority((short) 0);
> flowMod.setHardTimeout((short)0);
> flowMod.setIdleTimeout((short)0);
> List<OFAction> actions = new LinkedList<OFAction>();
> flowMod.setActions(actions);
> flowMod.setLength(U16.t(flowMod.getLength()));
> 
> 
> --------------------------------------------------------
> Matteo Gerola
> CREATE-NET
> Engineering and Fast Prototyping
> Research Engineer
> Via alla Cascata 56/D - 38123 Povo Trento (Italy)
> e-mail: matteo.ger...@create-net.org
> Tel: (+39) 0461 408400 - interno/extension 1312
> Fax: (+39) 0461 421157
> Skype: matteo.gerola
> www.create-net.org
> --------------------------------------------------------
> The information transmitted is intended only for the person or entity
> to which it is addressed and may contain confidential and/or
> privileged material. Any review, retransmission, dissemination or
> other use of, or taking of any action in reliance upon, this
> information by persons or entities other than the intended recipient
> is prohibited according to the Italian Law 196/2003 of the
> Legislature. If you received this in error, please contact the sender
> and delete the material from any computer.
> Le informazioni contenute in questo messaggio di posta elettronica e
> nei file allegati sono da considerarsi strettamente riservate. Il loro
> utilizzo e' consentito esclusivamente al destinatario del messaggio,
> per le finalità indicate nel messaggio stesso. Qualora riceveste
> questo messaggio senza esserne il destinatario, Vi preghiamo
> cortesemente di darcene notizia via e-mail e di procedere alla
> cancellazione del messaggio stesso dal Vostro sistema. Trattenere il
> messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri
> soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce
> comportamento contrario ai principi dettati dal D. Lgs. 196/2003.
> 
> _______________________________________________
> openflow-discuss mailing list
> openflow-discuss@lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/openflow-discuss
_______________________________________________
openflow-discuss mailing list
openflow-discuss@lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/openflow-discuss

Reply via email to