Search in sources :

Example 11 with EthType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.type._case.EthType in project openflowplugin by opendaylight.

the class PushVlanActionDeserializerTest method testDeserialize.

@Test
public void testDeserialize() throws Exception {
    final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
    final short ethType = 10;
    writeHeader(in);
    in.writeShort(ethType);
    in.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
    final Action action = deserializeAction(in);
    assertTrue(PushVlanActionCase.class.isInstance(action));
    assertEquals(ethType, PushVlanActionCase.class.cast(action).getPushVlanAction().getEthernetType().shortValue());
    assertEquals(0, in.readableBytes());
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action) PushVlanActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 12 with EthType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.type._case.EthType in project genius by opendaylight.

the class AlivenessMonitor method getExistingProfileId.

private Long getExistingProfileId(MonitorProfileGetInput input) {
    org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.get.input.Profile profile = input.getProfile();
    final Long failureThreshold = profile.getFailureThreshold();
    final Long monitorInterval = profile.getMonitorInterval();
    final Long monitorWindow = profile.getMonitorWindow();
    final EtherTypes ethType = profile.getProtocolType();
    LOG.debug("getExistingProfileId for profile : {}", input.getProfile());
    String idKey = getUniqueProfileKey(failureThreshold, monitorInterval, monitorWindow, ethType);
    LOG.debug("Obtained existing profile ID for profile : {}", input.getProfile());
    return (long) getUniqueId(idKey);
}
Also used : EtherTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes)

Example 13 with EthType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.type._case.EthType in project genius by opendaylight.

the class AlivenessMonitor method releaseIdForMonitoringInfo.

private void releaseIdForMonitoringInfo(MonitoringInfo info) {
    Long monitorId = info.getId();
    EndpointType source = info.getSource().getEndpointType();
    String interfaceName = getInterfaceName(source);
    if (!Strings.isNullOrEmpty(interfaceName)) {
        Optional<MonitorProfile> optProfile = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, getMonitorProfileId(info.getProfileId()));
        if (optProfile.isPresent()) {
            EtherTypes ethType = optProfile.get().getProtocolType();
            EndpointType destination = info.getDestination() != null ? info.getDestination().getEndpointType() : null;
            String idKey = getUniqueKey(interfaceName, ethType.toString(), source, destination);
            releaseId(idKey);
        } else {
            LOG.warn("Could not release monitorId {}. No profile associated with it", monitorId);
        }
    }
}
Also used : MonitorProfile(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile) EndpointType(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.EndpointType) EtherTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes)

Example 14 with EthType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.type._case.EthType in project openflowplugin by opendaylight.

the class MatchResponseConvertorTest method toOfEthernetType.

private static MatchEntry toOfEthernetType(final int ethType) {
    MatchEntryBuilder builder = new MatchEntryBuilder();
    builder.setOxmClass(OpenflowBasicClass.class);
    builder.setHasMask(false);
    builder.setOxmMatchField(EthType.class);
    EthTypeCaseBuilder ethTypeCaseBuilder = new EthTypeCaseBuilder();
    EthTypeBuilder ethTypeBuilder = new EthTypeBuilder();
    EtherType etherType = new EtherType(ethType);
    ethTypeBuilder.setEthType(etherType);
    ethTypeCaseBuilder.setEthType(ethTypeBuilder.build());
    builder.setMatchEntryValue(ethTypeCaseBuilder.build());
    return builder.build();
}
Also used : EthTypeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthTypeCaseBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) EtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType) EthTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.type._case.EthTypeBuilder)

Example 15 with EthType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.type._case.EthType in project openflowplugin by opendaylight.

the class OpenflowpluginTestCommandProvider method createArpMatch.

private static MatchBuilder createArpMatch() {
    final MatchBuilder match = new MatchBuilder();
    final EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
    final MacAddress macdest = new MacAddress(DEST_MAC_ADDRESS);
    final MacAddress macsrc = new MacAddress(SRC_MAC_ADDRESS);
    final EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
    final EtherType type = new EtherType(0x0806L);
    ethmatch.setEthernetType(ethtype.setType(type).build());
    // ipv4 match
    final Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10");
    final Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
    // arp match
    final ArpMatchBuilder arpmatch = new ArpMatchBuilder();
    final ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
    arpsrc.setAddress(macsrc);
    arpsrc.setMask(new MacAddress("ff:ff:ff:00:00:00"));
    final ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
    arpdst.setAddress(macdest);
    arpdst.setMask(new MacAddress("ff:ff:00:00:00:00"));
    arpmatch.setArpOp(2);
    arpmatch.setArpSourceHardwareAddress(arpsrc.build());
    arpmatch.setArpTargetHardwareAddress(arpdst.build());
    arpmatch.setArpSourceTransportAddress(srcip);
    arpmatch.setArpTargetTransportAddress(dstip);
    match.setEthernetMatch(ethmatch.build());
    match.setLayer3Match(arpmatch.build());
    return match;
}
Also used : ArpSourceHardwareAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder) EthernetTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder) ArpTargetHardwareAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddressBuilder) EtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) ArpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder) Icmpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder) TunnelIpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder) VlanMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) TcpFlagsMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder) Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder) SctpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder) UdpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix) ArpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)

Aggregations

Test (org.junit.Test)10 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action)8 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)8 EtherType (org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType)8 EthernetTypeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder)8 EthernetMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)8 Ipv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder)5 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)4 EtherTypes (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes)4 Icmpv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder)4 IpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)4 Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)4 ByteBuf (io.netty.buffer.ByteBuf)3 MonitorProfile (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile)3 Icmpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder)3 TcpFlagsMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder)3 VlanMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder)3 ArpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder)3 TunnelIpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder)3 SctpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder)3