Search in sources :

Example 51 with 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 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);
}
Also used : LabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.LabelCase) Label(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.label._case.Label) ByteBuf(io.netty.buffer.ByteBuf)

Example 52 with 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 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);
}
Also used : Type1Label(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.type1.label._case.Type1Label) Type1LabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.Type1LabelCase) ByteBuf(io.netty.buffer.ByteBuf)

Example 53 with 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 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);
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match) Test(org.junit.Test)

Example 54 with 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");
        }
    }
}
Also used : Counter(org.opendaylight.infrautils.metrics.Counter) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector)

Example 55 with 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 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");
            }
        }
    }
}
Also used : Counter(org.opendaylight.infrautils.metrics.Counter) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector)

Aggregations

ArrayList (java.util.ArrayList)44 BigInteger (java.math.BigInteger)38 VrfEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry)24 VpnInstanceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry)20 ByteBuf (io.netty.buffer.ByteBuf)19 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)16 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)16 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)16 List (java.util.List)15 ExecutionException (java.util.concurrent.ExecutionException)14 Optional (com.google.common.base.Optional)13 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)13 RouteOrigin (org.opendaylight.netvirt.fibmanager.api.RouteOrigin)13 VrfTablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey)13 Adjacency (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency)13 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)13 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)12 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)12 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)12 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)12