Search in sources :

Example 86 with MacAddress

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.

the class OpenflowpluginTestCommandProvider method createMatch3.

private static MatchBuilder createMatch3() {
    final MatchBuilder match = new MatchBuilder();
    final EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
    final EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
    ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
    ethernetMatch.setEthernetSource(ethSourceBuilder.build());
    match.setEthernetMatch(ethernetMatch.build());
    return match;
}
Also used : EthernetSourceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder) 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) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)

Example 87 with MacAddress

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress 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 88 with MacAddress

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.

the class AddressNormalizationUtilTest method normalizeMacAddress.

@Test
public void normalizeMacAddress() throws Exception {
    final MacAddress left = new MacAddress("01:23:45:AB:CD:EF");
    final MacAddress right = new MacAddress("01:23:45:ab:cd:ef");
    assertEquals(right, AddressNormalizationUtil.normalizeMacAddress(left));
}
Also used : MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Test(org.junit.Test)

Example 89 with MacAddress

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.

the class MatchNormalizationUtilTest method normalizeIpv6Match.

@Test
public void normalizeIpv6Match() {
    final Ipv6Prefix leftPrefix = new Ipv6Prefix("1E3D:5678:9ABC::/24");
    final Ipv6Prefix rightPrefix = new Ipv6Prefix("1e3d:5600:0:0:0:0:0:0/24");
    final MacAddress leftMac = new MacAddress("01:23:45:AB:CD:EF");
    final MacAddress rightMac = new MacAddress("01:23:45:ab:cd:ef");
    final Ipv6Address leftAddress = new Ipv6Address("1E3D:5678:9ABC::");
    final Ipv6Address rightAddress = new Ipv6Address("1e3d:5678:9abc:0:0:0:0:0");
    final MatchBuilder matchBuilder = MatchNormalizationUtil.normalizeIpv6Match(new MatchBuilder().setLayer3Match(new Ipv6MatchBuilder().setIpv6NdSll(leftMac).setIpv6NdTll(leftMac).setIpv6NdTarget(leftAddress).setIpv6Source(leftPrefix).setIpv6Destination(leftPrefix).build()));
    assertEquals(rightMac, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6NdSll());
    assertEquals(rightMac, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6NdTll());
    assertEquals(rightPrefix, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Source());
    assertEquals(rightPrefix, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Destination());
    assertEquals(rightAddress, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6NdTarget());
}
Also used : 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) TunnelIpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder) 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) 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) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) Test(org.junit.Test)

Example 90 with MacAddress

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.

the class MatchNormalizationUtilTest method normalizeArpMatch.

@Test
public void normalizeArpMatch() {
    final int arpOp = 10;
    final String source = "192.168.1.2/24";
    final String destination = "192.168.2.2/24";
    final MacAddress sourceHw = new MacAddress("01:23:45:AB:CD:EF");
    final MacAddress dstHw = new MacAddress("01:23:45:AB:C0:EF");
    final MacAddress mask = new MacAddress("FF:FF:FF:FF:FF:FF");
    final MatchBuilder matchBuilder = MatchNormalizationUtil.normalizeArpMatch(new MatchBuilder().setLayer3Match(new ArpMatchBuilder().setArpOp(10).setArpSourceTransportAddress(new Ipv4Prefix(source)).setArpTargetTransportAddress(new Ipv4Prefix(destination)).setArpTargetHardwareAddress(new ArpTargetHardwareAddressBuilder().setAddress(dstHw).setMask(mask).build()).setArpSourceHardwareAddress(new ArpSourceHardwareAddressBuilder().setAddress(sourceHw).setMask(mask).build()).build()));
    assertEquals(arpOp, ArpMatch.class.cast(matchBuilder.getLayer3Match()).getArpOp().intValue());
}
Also used : ArpSourceHardwareAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder) ArpTargetHardwareAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddressBuilder) ArpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch) 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) TunnelIpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder) 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) 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) ArpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder) Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix) Test(org.junit.Test)

Aggregations

MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)213 ArrayList (java.util.ArrayList)84 Test (org.junit.Test)79 BigInteger (java.math.BigInteger)52 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)37 ByteBuf (io.netty.buffer.ByteBuf)33 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)33 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)33 EthernetMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)26 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)23 List (java.util.List)22 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)21 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)20 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)20 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)20 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)20 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)19 Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)19 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)18 Ipv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder)17