use of org.projectfloodlight.openflow.protocol.OFFlowDelete in project open-kilda by telstra.
the class SwitchManager method deleteAllNonDefaultRules.
@Override
public List<Long> deleteAllNonDefaultRules(final DatapathId dpid) throws SwitchOperationException {
OFFlowStatsReply flowStats = dumpFlowTable(dpid);
IOFSwitch sw = lookupSwitch(dpid);
OFFactory ofFactory = sw.getOFFactory();
List<Long> removedRules = new ArrayList<>();
for (OFFlowStatsEntry flowStatsEntry : flowStats.getEntries()) {
long flowCookie = flowStatsEntry.getCookie().getValue();
if (flowCookie != DROP_RULE_COOKIE && flowCookie != VERIFICATION_BROADCAST_RULE_COOKIE && flowCookie != VERIFICATION_UNICAST_RULE_COOKIE) {
OFFlowDelete flowDelete = ofFactory.buildFlowDelete().setCookie(U64.of(flowCookie)).setCookieMask(NON_SYSTEM_MASK).build();
pushFlow(sw, "--DeleteFlow--", flowDelete);
removedRules.add(flowCookie);
}
}
return removedRules;
}
use of org.projectfloodlight.openflow.protocol.OFFlowDelete in project open-kilda by telstra.
the class SwitchManager method deleteFlow.
// Utility Methods
/**
* {@inheritDoc}
*/
@Override
public long deleteFlow(final DatapathId dpid, final String flowId, final Long cookie) throws SwitchOperationException {
logger.info("deleting flows {} from switch {}", flowId, dpid.toString());
IOFSwitch sw = lookupSwitch(dpid);
OFFactory ofFactory = sw.getOFFactory();
OFFlowDelete flowDelete = ofFactory.buildFlowDelete().setCookie(U64.of(cookie)).setCookieMask(NON_SYSTEM_MASK).build();
return pushFlow(sw, "--DeleteFlow--", flowDelete);
}
use of org.projectfloodlight.openflow.protocol.OFFlowDelete in project open-kilda by telstra.
the class SwitchManager method deleteRuleWithCookie.
@Override
public List<Long> deleteRuleWithCookie(final DatapathId dpid, final List<Long> cookiesToRemove) throws SwitchOperationException {
IOFSwitch sw = lookupSwitch(dpid);
OFFactory ofFactory = sw.getOFFactory();
for (long cookie : cookiesToRemove) {
OFFlowDelete dropFlowDelete = ofFactory.buildFlowDelete().setCookie(U64.of(cookie)).build();
pushFlow(sw, "--DeleteFlow--", dropFlowDelete);
}
// TODO: it'd be better to identify what was deleted and what wasn't there .. and confirm it is deleted.
return cookiesToRemove;
}
Aggregations