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;
}
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;
}
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));
}
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());
}
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());
}
Aggregations