use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.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);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.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);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.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;
}
Aggregations