use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project openflowplugin by opendaylight.
the class MultipartReplyGroupFeaturesTest method testMultipartReplyGroupFeatures2.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
* (with different group types and capabilities).
*/
@Test
public void testMultipartReplyGroupFeatures2() {
ByteBuf bb = BufferHelper.buildBuffer(//
"00 08 00 01 00 00 00 00 " + // types
"00 00 00 00 " + // capabilities
"00 00 00 00 " + // max groups
"00 00 00 01 " + // max groups
"00 00 00 02 " + // max groups
"00 00 00 03 " + // max groups
"00 00 00 04 " + // actions bitmap (all actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyGroupFeaturesCase messageCase = (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();
MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();
Assert.assertEquals("Wrong group types", new GroupTypes(false, false, false, false), message.getTypes());
Assert.assertEquals("Wrong capabilities", new GroupCapabilities(false, false, false, false), message.getCapabilities());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project openflowplugin by opendaylight.
the class AbstractInstructionDeserializerTest method test.
/**
* Tests {@link AbstractInstructionDeserializer#deserializeHeader(ByteBuf)} with different
* instruction types.
*/
@Test
public void test() {
ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 00 04");
Instruction instruction = new GoToTableInstructionDeserializer().deserializeHeader(buffer);
Assert.assertTrue("Wrong type", instruction.getInstructionChoice() instanceof GotoTableCase);
buffer = ByteBufUtils.hexStringToByteBuf("00 02 00 04");
instruction = new WriteMetadataInstructionDeserializer().deserializeHeader(buffer);
Assert.assertTrue("Wrong type", instruction.getInstructionChoice() instanceof WriteMetadataCase);
buffer = ByteBufUtils.hexStringToByteBuf("00 03 00 04");
instruction = new WriteActionsInstructionDeserializer().deserializeHeader(buffer);
Assert.assertTrue("Wrong type", instruction.getInstructionChoice() instanceof WriteActionsCase);
buffer = ByteBufUtils.hexStringToByteBuf("00 04 00 04");
instruction = new ApplyActionsInstructionDeserializer().deserializeHeader(buffer);
Assert.assertTrue("Wrong type", instruction.getInstructionChoice() instanceof ApplyActionsCase);
buffer = ByteBufUtils.hexStringToByteBuf("00 05 00 04");
instruction = new ClearActionsInstructionDeserializer().deserializeHeader(buffer);
Assert.assertTrue("Wrong type", instruction.getInstructionChoice() instanceof ClearActionsCase);
buffer = ByteBufUtils.hexStringToByteBuf("00 06 00 04");
instruction = new MeterInstructionDeserializer().deserializeHeader(buffer);
Assert.assertTrue("Wrong type", instruction.getInstructionChoice() instanceof MeterCase);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project netvirt by opendaylight.
the class NeutronPortChangeListener method add.
@Override
public void add(InstanceIdentifier<Port> identifier, Port input) {
LOG.trace("Received port add event: port={}", input);
String portName = input.getUuid().getValue();
LOG.trace("Adding Port : key: {}, value={}", identifier, input);
Network network = neutronvpnUtils.getNeutronNetwork(input.getNetworkId());
if (network == null || !NeutronvpnUtils.isNetworkTypeSupported(network)) {
LOG.warn("neutron vpn received a port add() for a network without a provider extension augmentation " + "or with an unsupported network type for the port {} which is part of network {}", portName, network);
return;
}
neutronvpnUtils.addToPortCache(input);
String portStatus = NeutronUtils.PORT_STATUS_DOWN;
if (!Strings.isNullOrEmpty(input.getDeviceOwner()) && !Strings.isNullOrEmpty(input.getDeviceId())) {
if (NeutronConstants.DEVICE_OWNER_ROUTER_INF.equals(input.getDeviceOwner())) {
handleRouterInterfaceAdded(input);
NeutronUtils.createPortStatus(input.getUuid().getValue(), NeutronUtils.PORT_STATUS_ACTIVE, dataBroker);
return;
}
if (NeutronConstants.DEVICE_OWNER_GATEWAY_INF.equals(input.getDeviceOwner())) {
handleRouterGatewayUpdated(input, false);
portStatus = NeutronUtils.PORT_STATUS_ACTIVE;
} else if (NeutronConstants.DEVICE_OWNER_FLOATING_IP.equals(input.getDeviceOwner())) {
handleFloatingIpPortUpdated(null, input);
portStatus = NeutronUtils.PORT_STATUS_ACTIVE;
}
}
// in order to validate the supported vnic types from the hostconfig
if (input.getFixedIps() != null && !input.getFixedIps().isEmpty() && (!isPortTypeSwitchdev(input) || isPortBound(input))) {
handleNeutronPortCreated(input);
}
NeutronUtils.createPortStatus(input.getUuid().getValue(), portStatus, dataBroker);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project openflowplugin by opendaylight.
the class MultipartReplyGroupFeaturesTest method testMultipartReplyGroupFeatures.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyGroupFeatures() {
ByteBuf bb = BufferHelper.buildBuffer(//
"00 08 00 01 00 00 00 00 " + // types
"00 00 00 0F " + // capabilities
"00 00 00 0F " + // max groups
"00 00 00 01 " + // max groups
"00 00 00 02 " + // max groups
"00 00 00 03 " + // max groups
"00 00 00 04 " + // actions bitmap (all actions included)
"0F FF 98 01 " + // actions bitmap (no actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyGroupFeaturesCase messageCase = (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();
MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();
Assert.assertEquals("Wrong group types", new GroupTypes(true, true, true, true), message.getTypes());
Assert.assertEquals("Wrong capabilities", new GroupCapabilities(true, true, true, true), message.getCapabilities());
Assert.assertEquals("Wrong max groups", 1, message.getMaxGroups().get(0).intValue());
Assert.assertEquals("Wrong max groups", 2, message.getMaxGroups().get(1).intValue());
Assert.assertEquals("Wrong max groups", 3, message.getMaxGroups().get(2).intValue());
Assert.assertEquals("Wrong max groups", 4, message.getMaxGroups().get(3).intValue());
Assert.assertEquals("Wrong actions bitmap", new ActionType(true, true, true, true, false, true, true, true, true, true, true, true, true, true, true, true, true), message.getActionsBitmap().get(0));
Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(1));
Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(2));
Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(3));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project openflowplugin by opendaylight.
the class MeterConvertor method getBandsFromSAL.
private static void getBandsFromSAL(MeterBandHeaders meterBandHeaders, List<Bands> bands) {
for (MeterBandHeader meterBandHeader : meterBandHeaders.getMeterBandHeader()) {
// The band types :drop,DSCP_Remark or experimenter.
if (null != meterBandHeader.getMeterBandTypes() && null != meterBandHeader.getMeterBandTypes().getFlags()) {
if (meterBandHeader.getMeterBandTypes().getFlags().isOfpmbtDrop()) {
if (meterBandHeader.getBandType() != null) {
MeterBandDropBuilder meterBandDropBuilder = new MeterBandDropBuilder();
meterBandDropBuilder.setType(MeterBandType.OFPMBTDROP);
Drop drop = (Drop) meterBandHeader.getBandType();
meterBandDropBuilder.setBurstSize(drop.getDropBurstSize());
meterBandDropBuilder.setRate(drop.getDropRate());
MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
dropCaseBuilder.setMeterBandDrop(meterBandDropBuilder.build());
MeterBand meterBandItem = dropCaseBuilder.build();
BandsBuilder bandsB = new BandsBuilder();
bandsB.setMeterBand(meterBandItem);
// Bands list
bands.add(bandsB.build());
} else {
logBandTypeMissing(MeterBandType.OFPMBTDROP);
}
} else if (meterBandHeader.getMeterBandTypes().getFlags().isOfpmbtDscpRemark()) {
if (meterBandHeader.getBandType() != null) {
MeterBandDscpRemarkBuilder meterBandDscpRemarkBuilder = new MeterBandDscpRemarkBuilder();
meterBandDscpRemarkBuilder.setType(MeterBandType.OFPMBTDSCPREMARK);
DscpRemark dscpRemark = (DscpRemark) meterBandHeader.getBandType();
meterBandDscpRemarkBuilder.setBurstSize(dscpRemark.getDscpRemarkBurstSize());
meterBandDscpRemarkBuilder.setRate(dscpRemark.getDscpRemarkRate());
meterBandDscpRemarkBuilder.setPrecLevel(dscpRemark.getPrecLevel());
MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
dscpCaseBuilder.setMeterBandDscpRemark(meterBandDscpRemarkBuilder.build());
MeterBand meterBandItem = dscpCaseBuilder.build();
BandsBuilder bandsB = new BandsBuilder();
bandsB.setMeterBand(meterBandItem);
// Bands list
bands.add(bandsB.build());
} else {
logBandTypeMissing(MeterBandType.OFPMBTDSCPREMARK);
}
} else if (meterBandHeader.getMeterBandTypes().getFlags().isOfpmbtExperimenter()) {
if (meterBandHeader.getBandType() != null) {
MeterBandExperimenterBuilder meterBandExperimenterBuilder = new MeterBandExperimenterBuilder();
meterBandExperimenterBuilder.setType(MeterBandType.OFPMBTEXPERIMENTER);
Experimenter experimenter = (Experimenter) meterBandHeader.getBandType();
meterBandExperimenterBuilder.setBurstSize(experimenter.getExperimenterBurstSize());
meterBandExperimenterBuilder.setRate(experimenter.getExperimenterRate());
ExperimenterIdMeterBandBuilder expBuilder = new ExperimenterIdMeterBandBuilder();
expBuilder.setExperimenter(new ExperimenterId(experimenter.getExperimenter()));
meterBandExperimenterBuilder.addAugmentation(ExperimenterIdMeterBand.class, expBuilder.build());
// TODO - implement / finish experimenter meter band translation
MeterBandExperimenterCaseBuilder experimenterCaseBuilder = new MeterBandExperimenterCaseBuilder();
experimenterCaseBuilder.setMeterBandExperimenter(meterBandExperimenterBuilder.build());
MeterBand meterBandItem = experimenterCaseBuilder.build();
BandsBuilder bandsB = new BandsBuilder();
bandsB.setMeterBand(meterBandItem);
// Bands list
bands.add(bandsB.build());
} else {
logBandTypeMissing(MeterBandType.OFPMBTEXPERIMENTER);
}
}
} else {
LOG.error("Invalid meter band data found.");
}
}
}
Aggregations