use of org.onosproject.net.flow.DefaultFlowEntry in project onos by opennetworkinglab.
the class FlowRuleManagerTest method getFlowEntry.
@Test
public void getFlowEntry() {
assertTrue("store should be empty", Sets.newHashSet(service.getFlowEntries(DID)).isEmpty());
FlowRule f1 = addFlowRule(1);
FlowRule f2 = addFlowRule(2);
FlowEntry fe1 = new DefaultFlowEntry(f1);
FlowEntry fe2 = new DefaultFlowEntry(f2);
assertEquals("2 rules should exist", 2, flowCount());
FlowEntry actual1 = service.getFlowEntry(f1);
FlowEntry actual2 = service.getFlowEntry(f2);
assertEquals(fe1, actual1);
assertEquals(fe2, actual2);
}
use of org.onosproject.net.flow.DefaultFlowEntry in project onos by opennetworkinglab.
the class ECFlowRuleStoreTest method testPurgeFlowAppId.
/**
* Tests purge flow for a device and an application.
*/
@Test
public void testPurgeFlowAppId() {
FlowEntry flowEntry1 = new DefaultFlowEntry(flowRule1);
flowStoreImpl.addOrUpdateFlowRule(flowEntry1);
FlowEntry flowEntry2 = new DefaultFlowEntry(flowRule2);
flowStoreImpl.addOrUpdateFlowRule(flowEntry2);
FlowEntry flowEntry3 = new DefaultFlowEntry(flowRule3);
flowStoreImpl.addOrUpdateFlowRule(flowEntry3);
assertFlowsOnDevice(deviceId, 2);
assertFlowsOnDevice(deviceId2, 1);
flowStoreImpl.purgeFlowRules(deviceId, APP_ID_2);
assertFlowsOnDevice(deviceId, 1);
assertFlowsOnDevice(deviceId2, 1);
}
use of org.onosproject.net.flow.DefaultFlowEntry 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;
}
use of org.onosproject.net.flow.DefaultFlowEntry in project onos by opennetworkinglab.
the class TapiFlowRuleProgrammable method getFlowEntries.
@Override
public Collection<FlowEntry> getFlowEntries() {
DeviceId deviceId = did();
// TODO this is a blocking call on ADVA OLS, right now using cache.
// return getFlowsFromConnectivityServices(deviceId);
List<FlowEntry> entries = new ArrayList<>();
Set<FlowRule> rules = getConnectionCache().get(deviceId);
if (rules != null) {
rules.forEach(rule -> {
entries.add(new DefaultFlowEntry(rule, FlowEntry.FlowEntryState.ADDED, 0, 0, 0));
});
}
return entries;
}
use of org.onosproject.net.flow.DefaultFlowEntry in project onos by opennetworkinglab.
the class TapiFlowRuleProgrammable method getFlowsFromConnectivityServices.
// Currently uused because get is a blocking call on ADVA
private Collection<FlowEntry> getFlowsFromConnectivityServices(DeviceId deviceId) {
Set<String> uuids = getUuids(deviceId, handler());
if (uuids.isEmpty()) {
return ImmutableList.of();
}
DeviceConnectionCache cache = getConnectionCache();
if (cache.get(deviceId) == null) {
return ImmutableList.of();
}
List<FlowEntry> entries = new ArrayList<>();
uuids.forEach(uuid -> {
FlowRule rule = cache.get(deviceId, uuid);
if (rule != null) {
entries.add(new DefaultFlowEntry(rule, FlowEntry.FlowEntryState.ADDED, 0, 0, 0));
} else {
log.info("Non existing rule for uuid {}", uuid);
}
});
return entries;
}
Aggregations