Search in sources :

Example 1 with RoutingMetadata

use of org.openkilda.rulemanager.utils.RoutingMetadata in project open-kilda by telstra.

the class InputLldpRuleGenerator method buildLldpInputCustomerFlowCommand.

private SpeakerData buildLldpInputCustomerFlowCommand(Switch sw, FlowEndpoint endpoint) {
    RoutingMetadata metadata = RoutingMetadata.builder().lldpFlag(true).build(sw.getFeatures());
    FlowSpeakerDataBuilder<?, ?> builder = FlowSpeakerData.builder().switchId(endpoint.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new PortColourCookie(CookieType.LLDP_INPUT_CUSTOMER_TYPE, endpoint.getPortNumber())).table(OfTable.INPUT).priority(Constants.Priority.LLDP_INPUT_CUSTOMER_PRIORITY).match(Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(endpoint.getPortNumber()).build(), FieldMatch.builder().field(Field.ETH_TYPE).value(EthType.LLDP).build())).instructions(Instructions.builder().goToTable(OfTable.PRE_INGRESS).writeMetadata(new OfMetadata(metadata.getValue(), metadata.getMask())).build());
    // todo add RESET_COUNTERS flag
    return builder.build();
}
Also used : OfMetadata(org.openkilda.rulemanager.OfMetadata) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata) PortColourCookie(org.openkilda.model.cookie.PortColourCookie)

Example 2 with RoutingMetadata

use of org.openkilda.rulemanager.utils.RoutingMetadata in project open-kilda by telstra.

the class InputArpRuleGenerator method buildArpInputCustomerFlowCommand.

private SpeakerData buildArpInputCustomerFlowCommand(Switch sw, FlowEndpoint endpoint) {
    RoutingMetadata metadata = RoutingMetadata.builder().arpFlag(true).build(sw.getFeatures());
    FlowSpeakerDataBuilder<?, ?> builder = FlowSpeakerData.builder().switchId(endpoint.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new PortColourCookie(CookieType.ARP_INPUT_CUSTOMER_TYPE, endpoint.getPortNumber())).table(OfTable.INPUT).priority(Priority.ARP_INPUT_CUSTOMER_PRIORITY).match(Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(endpoint.getPortNumber()).build(), FieldMatch.builder().field(Field.ETH_TYPE).value(EthType.ARP).build())).instructions(Instructions.builder().goToTable(OfTable.PRE_INGRESS).writeMetadata(new OfMetadata(metadata.getValue(), metadata.getMask())).build());
    // todo add RESET_COUNTERS flag
    return builder.build();
}
Also used : OfMetadata(org.openkilda.rulemanager.OfMetadata) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata) PortColourCookie(org.openkilda.model.cookie.PortColourCookie)

Example 3 with RoutingMetadata

use of org.openkilda.rulemanager.utils.RoutingMetadata in project open-kilda by telstra.

the class MultiTableServer42IngressRuleGenerator method buildServer42IngressSingleVlanCommand.

private FlowSpeakerData buildServer42IngressSingleVlanCommand(Switch sw, FlowEndpoint ingressEndpoint) {
    RoutingMetadata metadata = RoutingMetadata.builder().inputPort(ingressEndpoint.getPortNumber()).outerVlanId(ingressEndpoint.getOuterVlanId()).build(sw.getFeatures());
    Set<FieldMatch> match = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(switchProperties.getServer42Port()).build(), FieldMatch.builder().field(Field.METADATA).value(metadata.getValue()).mask(metadata.getMask()).build());
    return buildServer42IngressCommand(sw, ingressEndpoint, match, SERVER_42_INGRESS_SINGLE_VLAN_FLOW_PRIORITY);
}
Also used : FieldMatch(org.openkilda.rulemanager.match.FieldMatch) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata)

Example 4 with RoutingMetadata

use of org.openkilda.rulemanager.utils.RoutingMetadata in project open-kilda by telstra.

the class ArpIngressRuleGenerator method generateCommands.

@Override
public List<SpeakerData> generateCommands(Switch sw) {
    RoutingMetadata metadata = buildMetadata(RoutingMetadata.builder().arpFlag(true), sw);
    Set<FieldMatch> match = Sets.newHashSet(FieldMatch.builder().field(Field.METADATA).value(metadata.getValue()).mask(metadata.getMask()).build());
    Instructions instructions = buildSendToControllerInstructions();
    Cookie cookie = new Cookie(ARP_INGRESS_COOKIE);
    return buildCommands(sw, cookie, OfTable.INGRESS, Priority.ARP_INGRESS_PRIORITY, match, instructions);
}
Also used : Cookie(org.openkilda.model.cookie.Cookie) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata) Instructions(org.openkilda.rulemanager.Instructions)

Example 5 with RoutingMetadata

use of org.openkilda.rulemanager.utils.RoutingMetadata in project open-kilda by telstra.

the class ArpPostIngressRuleGenerator method generateCommands.

@Override
public List<SpeakerData> generateCommands(Switch sw) {
    RoutingMetadata metadata = buildMetadata(RoutingMetadata.builder().arpFlag(true), sw);
    Set<FieldMatch> match = Sets.newHashSet(FieldMatch.builder().field(Field.METADATA).value(metadata.getValue()).mask(metadata.getMask()).build());
    Instructions instructions = buildSendToControllerInstructions();
    Cookie cookie = new Cookie(ARP_POST_INGRESS_COOKIE);
    return buildCommands(sw, cookie, OfTable.POST_INGRESS, Priority.ARP_POST_INGRESS_PRIORITY, match, instructions);
}
Also used : Cookie(org.openkilda.model.cookie.Cookie) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata) Instructions(org.openkilda.rulemanager.Instructions)

Aggregations

RoutingMetadata (org.openkilda.rulemanager.utils.RoutingMetadata)42 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)37 Test (org.junit.Test)18 Flow (org.openkilda.model.Flow)16 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)14 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)14 SpeakerData (org.openkilda.rulemanager.SpeakerData)14 Action (org.openkilda.rulemanager.action.Action)14 PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)14 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)14 Instructions (org.openkilda.rulemanager.Instructions)13 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)12 PushVxlanAction (org.openkilda.rulemanager.action.PushVxlanAction)12 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)12 Cookie (org.openkilda.model.cookie.Cookie)8 MeterSpeakerData (org.openkilda.rulemanager.MeterSpeakerData)8 FlowSideAdapter (org.openkilda.adapter.FlowSideAdapter)7 OfMetadata (org.openkilda.rulemanager.OfMetadata)7 FlowSourceAdapter (org.openkilda.adapter.FlowSourceAdapter)6 PortColourCookie (org.openkilda.model.cookie.PortColourCookie)6