use of org.onosproject.net.flow.FlowEntry in project onos by opennetworkinglab.
the class ECFlowRuleStoreTest method testRemoveFlow.
/**
* Tests flow removal.
*/
@Test
public void testRemoveFlow() {
Iterable<FlowEntry> flows1 = flowStoreImpl.getFlowEntries(deviceId);
for (FlowEntry flow : flows1) {
flowStoreImpl.removeFlowRule(flow);
}
assertFlowsOnDevice(deviceId, 0);
}
use of org.onosproject.net.flow.FlowEntry in project onos by opennetworkinglab.
the class ECFlowRuleStoreTest method assertFlowsOnDevice.
private void assertFlowsOnDevice(DeviceId deviceId, int nFlows) {
Iterable<FlowEntry> flows1 = flowStoreImpl.getFlowEntries(deviceId);
int sum1 = 0;
for (FlowEntry flowEntry : flows1) {
sum1++;
}
assertThat(sum1, is(nFlows));
}
use of org.onosproject.net.flow.FlowEntry in project onos by opennetworkinglab.
the class PolatisInternalConnectivity method filterUsedPorts.
private Set<PortNumber> filterUsedPorts(Set<PortNumber> ports, Collection<FlowEntry> flowEntries) {
if (ports.isEmpty() || flowEntries.isEmpty()) {
return ports;
}
for (FlowEntry flowEntry : flowEntries) {
PortNumber inputPort = ((PortCriterion) flowEntry.selector().getCriterion(Criterion.Type.IN_PORT)).port();
ports.remove(inputPort);
PortNumber outputPort = ((OutputInstruction) flowEntry.treatment().allInstructions().get(0)).port();
ports.remove(outputPort);
log.debug("Cross-connection {}-{} removed from output port list", inputPort, outputPort);
}
log.debug("Ports after filtering out used ones: " + ports);
return ports;
}
use of org.onosproject.net.flow.FlowEntry in project onos by opennetworkinglab.
the class FlowRuleManager method getFlowRulesByGroupId.
@Override
public Iterable<FlowRule> getFlowRulesByGroupId(ApplicationId appId, short groupId) {
checkPermission(FLOWRULE_READ);
Set<FlowRule> matches = Sets.newHashSet();
long toLookUp = ((long) appId.id() << 16) | groupId;
for (Device d : deviceService.getDevices()) {
for (FlowEntry flowEntry : store.getFlowEntries(d.id())) {
if ((flowEntry.id().value() >>> 32) == toLookUp) {
matches.add(flowEntry);
}
}
}
return matches;
}
use of org.onosproject.net.flow.FlowEntry in project onos by opennetworkinglab.
the class OplinkOpticalFlowRuleProgrammable method parseConnections.
private Collection<FlowEntry> parseConnections() {
log.debug("Fetch connections...");
String reply = netconfGet(handler(), getConnectionsFilter());
List<HierarchicalConfiguration> subtrees = configsAt(reply, KEY_DATA_CONNS);
Collection<FlowEntry> list = new ArrayList<>();
for (HierarchicalConfiguration connection : subtrees) {
list.add(new DefaultFlowEntry(parseConnection(connection), FlowEntry.FlowEntryState.ADDED));
}
return list;
}
Aggregations