use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project netvirt by opendaylight.
the class NeutronPortChangeListener method add.
@Override
protected void add(InstanceIdentifier<Port> identifier, 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 (input.getDeviceOwner().equals(NeutronConstants.DEVICE_OWNER_ROUTER_INF)) {
handleRouterInterfaceAdded(input);
NeutronUtils.createPortStatus(input.getUuid().getValue(), NeutronUtils.PORT_STATUS_ACTIVE, dataBroker);
return;
}
if (NeutronConstants.DEVICE_OWNER_GATEWAY_INF.equals(input.getDeviceOwner())) {
handleRouterGatewayUpdated(input);
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.rev171207.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.rev171207.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.rev171207.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project bgpcep by opendaylight.
the class AbstractFlowspecNlriParser method createTypes.
private static List<Types> createTypes(final UnkeyedListNode typesData) {
final List<Types> types = new ArrayList<>();
for (final UnkeyedListEntryNode node : typesData.getValue()) {
final TypesBuilder typesBuilder = new TypesBuilder();
final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
if (opValue.isPresent()) {
typesBuilder.setOp(NumericOneByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
if (valueNode.isPresent()) {
typesBuilder.setValue((Short) valueNode.get().getValue());
}
types.add(typesBuilder.build());
}
return types;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types in project bgpcep by opendaylight.
the class FSIcmpTypeHandler method parseIcmpType.
private static List<Types> parseIcmpType(final ByteBuf nlri) {
final List<Types> icmps = new ArrayList<>();
boolean end = false;
// we can do this as all fields will be rewritten in the cycle
final TypesBuilder builder = new TypesBuilder();
while (!end) {
final byte b = nlri.readByte();
final NumericOperand op = NumericOneByteOperandParser.INSTANCE.parse(b);
builder.setOp(op);
builder.setValue(nlri.readUnsignedByte());
end = op.isEndOfList();
icmps.add(builder.build());
}
return icmps;
}
Aggregations