use of org.openkilda.adapter.FlowSourceAdapter in project open-kilda by telstra.
the class InputArpRuleGeneratorTest method buildArpRuleWithOverlappedEndpointsTest.
@Test
public void buildArpRuleWithOverlappedEndpointsTest() {
FlowEndpoint endpoint = new FlowEndpoint(SW.getSwitchId(), PORT_NUMBER_1, 0, 0, true, false);
FlowSideAdapter adapter = new FlowSourceAdapter(Flow.builder().flowId("some").srcSwitch(SW).destSwitch(buildSwitch("OF_13", Collections.emptySet())).detectConnectedDevices(DetectConnectedDevices.builder().srcArp(true).srcSwitchArp(true).build()).build());
InputArpRuleGenerator generator = InputArpRuleGenerator.builder().ingressEndpoint(endpoint).multiTable(true).overlappingIngressAdapters(Sets.newHashSet(adapter)).build();
assertEquals(0, generator.generateCommands(SW).size());
}
use of org.openkilda.adapter.FlowSourceAdapter in project open-kilda by telstra.
the class MultiTableIngressRuleGeneratorTest method buildMatchVlanEncapsulationSingleVlanTest.
@Test
public void buildMatchVlanEncapsulationSingleVlanTest() {
Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, 0);
MultiTableIngressRuleGenerator generator = buildGenerator(PATH, flow, VLAN_ENCAPSULATION);
Set<FieldMatch> match = generator.buildIngressMatch(new FlowSourceAdapter(flow).getEndpoint(), FEATURES);
RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(OUTER_VLAN_ID_1).build(SWITCH_1.getFeatures());
Set<FieldMatch> expectedMatch = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build(), FieldMatch.builder().field(Field.METADATA).value(metadata.getValue()).mask(metadata.getMask()).build());
assertEqualsMatch(expectedMatch, match);
}
use of org.openkilda.adapter.FlowSourceAdapter in project open-kilda by telstra.
the class RequestedFlowMapper method toFlowRequest.
/**
* Convert {@link Flow} to {@link FlowRequest}.
*/
public FlowRequest toFlowRequest(Flow flow) {
FlowRequest request = generatedMap(flow);
request.setSource(new FlowSourceAdapter(flow).getEndpoint());
request.setDestination(new FlowDestAdapter(flow).getEndpoint());
return request;
}
use of org.openkilda.adapter.FlowSourceAdapter in project open-kilda by telstra.
the class PingProducer method buildPing.
private Ping buildPing(PingContext pingContext, FlowDirection direction) {
Flow flow = pingContext.getFlow();
FlowEndpoint ingress;
FlowEndpoint egress;
int islPort;
if (FlowDirection.FORWARD == direction) {
ingress = new FlowSourceAdapter(flow).getEndpoint();
egress = new FlowDestAdapter(flow).getEndpoint();
islPort = getIslPort(flow, flow.getForwardPath());
} else if (FlowDirection.REVERSE == direction) {
ingress = new FlowDestAdapter(flow).getEndpoint();
egress = new FlowSourceAdapter(flow).getEndpoint();
islPort = getIslPort(flow, flow.getReversePath());
} else {
throw new IllegalArgumentException(String.format("Unexpected %s value: %s", FlowDirection.class.getCanonicalName(), direction));
}
return new Ping(new NetworkEndpoint(ingress.getSwitchId(), ingress.getPortNumber()), new NetworkEndpoint(egress.getSwitchId(), egress.getPortNumber()), pingContext.getTransitEncapsulation(), islPort);
}
Aggregations