use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.label._case.Label in project bgpcep by opendaylight.
the class RROLabelSubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
requireNonNull(subobject.getSubobjectType(), "Subobject type cannot be empty.");
final Label label = ((LabelCase) subobject.getSubobjectType()).getLabel();
final ByteBuf body = Unpooled.buffer();
this.registry.serializeLabel(label.isUniDirectional(), label.isGlobal(), label.getLabelType(), body);
RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.label._case.Label in project bgpcep by opendaylight.
the class Type1LabelParser method serializeLabel.
@Override
public void serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject, final ByteBuf buffer) {
Preconditions.checkArgument(subobject instanceof Type1LabelCase, "Unknown Label Subobject instance. Passed {}. Needed Type1LabelCase.", subobject.getClass());
final ByteBuf body = Unpooled.buffer(LABEL_LENGTH);
final Type1Label type1Label = ((Type1LabelCase) subobject).getType1Label();
Preconditions.checkArgument(type1Label != null, "Type1Label is mandatory.");
writeUnsignedInt(type1Label.getType1Label(), body);
LabelUtil.formatLabel(CTYPE, unidirectional, global, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.label._case.Label in project openflowplugin by opendaylight.
the class OF13MatchSerializerTest method testIpv6Flabel.
/**
* Test for correct serialization of Ipv4Address match entry.
*/
@Test
public void testIpv6Flabel() {
Match match = buildIpv6FLabelMatch(0x0f9e8dL, false, null);
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
matchSerializer.serialize(match, out);
Assert.assertEquals("Wrong type", 1, out.readUnsignedShort());
out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
Assert.assertEquals("Wrong class", 0x8000, out.readUnsignedShort());
Assert.assertEquals("Wrong field and mask", 56, out.readUnsignedByte());
out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
byte[] label = new byte[4];
out.readBytes(label);
LOG.debug("label: {}", ByteBufUtils.bytesToHexString(label));
Assert.assertArrayEquals("Wrong ipv6FLabel", new byte[] { 0, 0x0f, (byte) 0x9e, (byte) 0x8d }, label);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.label._case.Label in project genius by opendaylight.
the class FlowNodeConnectorInventoryTranslatorImpl method remove.
@Override
public void remove(InstanceIdentifier<FlowCapableNodeConnector> identifier, FlowCapableNodeConnector del, InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
Counter counter;
if (compareInstanceIdentifierTail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) {
String nodeConnectorIdentifier = getNodeConnectorId(String.valueOf(nodeConnIdent.firstKeyOf(NodeConnector.class).getId()));
long dataPathId = getDpIdFromPortName(nodeConnectorIdentifier);
if (dpnToPortMultiMap.containsKey(dataPathId)) {
LOG.debug("Node Connector {} removed", nodeConnectorIdentifier);
dpnToPortMultiMap.remove(dataPathId, nodeConnectorIdentifier);
counter = packetInCounter.label("OFSwitch").label(String.valueOf(dataPathId)).label("portsperswitch");
counter.decrement();
PortNameMapping.updatePortMap("openflow:" + dataPathId + ":" + del.getName(), nodeConnectorIdentifier, "DELETE");
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.label._case.Label in project genius by opendaylight.
the class FlowNodeConnectorInventoryTranslatorImpl method add.
@Override
public void add(InstanceIdentifier<FlowCapableNodeConnector> identifier, FlowCapableNodeConnector add, InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
Counter counter;
if (compareInstanceIdentifierTail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) {
String nodeConnectorIdentifier = getNodeConnectorId(String.valueOf(nodeConnIdent.firstKeyOf(NodeConnector.class).getId()));
long dataPathId = getDpIdFromPortName(nodeConnectorIdentifier);
if (entityOwnershipUtils.isEntityOwner(FcapsConstants.SERVICE_ENTITY_TYPE, getNodeId(dataPathId))) {
if (!dpnToPortMultiMap.containsEntry(dataPathId, nodeConnectorIdentifier)) {
LOG.debug("Node Connector {} added", nodeConnectorIdentifier);
dpnToPortMultiMap.put(dataPathId, nodeConnectorIdentifier);
counter = packetInCounter.label("OFSwitch").label(String.valueOf(dataPathId)).label("portsperswitch");
counter.increment();
PortNameMapping.updatePortMap("openflow:" + dataPathId + ":" + add.getName(), nodeConnectorIdentifier, "ADD");
} else {
LOG.error("Duplicate Event.Node Connector already added");
}
}
}
}
Aggregations