Search in sources :

Example 6 with EthType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project openflowplugin by opendaylight.

the class OpenflowPluginBulkGroupTransactionProvider method createEthernetMatch.

private static MatchBuilder createEthernetMatch() {
    // ethernettype
    EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
    // match
    EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
    EtherType type = new EtherType(0x0800L);
    ethmatch.setEthernetType(ethtype.setType(type).build());
    // ethernet
    EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder();
    // macaddress
    // match
    MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
    ethdest.setAddress(macdest);
    // ethdest.setMask(mask1);
    ethmatch.setEthernetDestination(ethdest.build());
    EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
    MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
    ethsrc.setAddress(macsrc);
    // ethsrc.setMask(mask2);
    ethmatch.setEthernetSource(ethsrc.build());
    MatchBuilder match = new MatchBuilder();
    match.setEthernetMatch(ethmatch.build());
    return match;
}
Also used : EthernetDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder) EthernetSourceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder) EthernetTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder) 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) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)

Example 7 with EthType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project openflowplugin by opendaylight.

the class PushMplsActionDeserializerTest 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(PushMplsActionCase.class.isInstance(action));
    assertEquals(ethType, PushMplsActionCase.class.cast(action).getPushMplsAction().getEthernetType().shortValue());
    assertEquals(0, in.readableBytes());
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action) ByteBuf(io.netty.buffer.ByteBuf) PushMplsActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase) Test(org.junit.Test)

Example 8 with EthType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project openflowplugin by opendaylight.

the class PopMplsActionSerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final int ethType = 10;
    final Action action = new PopMplsActionCaseBuilder().setPopMplsAction(new PopMplsActionBuilder().setEthernetType(ethType).build()).build();
    assertAction(action, out -> {
        assertEquals(out.readUnsignedShort(), ethType);
        out.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
    });
}
Also used : PopMplsActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action) PopMplsActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder) Test(org.junit.Test)

Example 9 with EthType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project openflowplugin by opendaylight.

the class PushPbbActionDeserializerTest 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(PushPbbActionCase.class.isInstance(action));
    assertEquals(ethType, PushPbbActionCase.class.cast(action).getPushPbbAction().getEthernetType().shortValue());
    assertEquals(0, in.readableBytes());
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action) PushPbbActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 10 with EthType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project openflowplugin by opendaylight.

the class FlowCreatorUtilTest method createMatch.

/**
 * Create a flow match that specifies ethernet type.
 *
 * @param etherType An ethernet type value.
 * @return A flow match that specifies the given ethernet type.
 */
private static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match createMatch(final long etherType) {
    final EthernetTypeBuilder ethType = new EthernetTypeBuilder().setType(new EtherType(etherType));
    final EthernetMatchBuilder ether = new EthernetMatchBuilder().setEthernetType(ethType.build());
    return new MatchBuilder().setEthernetMatch(ether.build()).build();
}
Also used : EthernetTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder) EtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) 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