Search in sources :

Example 56 with Of

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.Of in project openflowplugin by opendaylight.

the class LLDPDiscoveryListener method onPacketReceived.

@Override
public void onPacketReceived(PacketReceived lldp) {
    NodeConnectorRef src = LLDPDiscoveryUtils.lldpToNodeConnectorRef(lldp.getPayload(), true);
    if (src != null) {
        final NodeKey nodeKey = lldp.getIngress().getValue().firstKeyOf(Node.class);
        LOG.debug("LLDP packet received for destination node {}", nodeKey);
        if (nodeKey != null) {
            LinkDiscoveredBuilder ldb = new LinkDiscoveredBuilder();
            ldb.setDestination(lldp.getIngress());
            ldb.setSource(new NodeConnectorRef(src));
            LinkDiscovered ld = ldb.build();
            lldpLinkAger.put(ld);
            if (LLDPDiscoveryUtils.isEntityOwned(this.eos, nodeKey.getId().getValue())) {
                LOG.debug("Publish add event for link {}", ld);
                notificationService.publish(ld);
            } else {
                LOG.trace("Skip publishing the add event for link because controller is non-owner of the " + "node {}. Link : {}", nodeKey.getId().getValue(), ld);
            }
        } else {
            LOG.debug("LLDP packet ignored. Unable to extract node-key from packet-in ingress.");
        }
    }
}
Also used : NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) LinkDiscoveredBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscoveredBuilder) LinkDiscovered(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered)

Example 57 with Of

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.Of in project openflowplugin by opendaylight.

the class MatchEntriesInitializer method registerMatchEntrySerializers.

/**
 * Registers match entry serializers into provided registry.
 * @param serializerRegistry registry to be initialized with match entry serializers
 */
public static void registerMatchEntrySerializers(SerializerRegistry serializerRegistry) {
    // register OF v1.3 OpenflowBasicClass match entry serializers
    Class<OpenflowBasicClass> oxmClass = OpenflowBasicClass.class;
    MatchEntrySerializerRegistryHelper<OpenflowBasicClass> helper = new MatchEntrySerializerRegistryHelper<>(EncodeConstants.OF13_VERSION_ID, oxmClass, serializerRegistry);
    helper.registerSerializer(InPort.class, new OxmInPortSerializer());
    helper.registerSerializer(InPhyPort.class, new OxmInPhyPortSerializer());
    helper.registerSerializer(Metadata.class, new OxmMetadataSerializer());
    helper.registerSerializer(EthDst.class, new OxmEthDstSerializer());
    helper.registerSerializer(EthSrc.class, new OxmEthSrcSerializer());
    helper.registerSerializer(EthType.class, new OxmEthTypeSerializer());
    helper.registerSerializer(VlanVid.class, new OxmVlanVidSerializer());
    helper.registerSerializer(VlanPcp.class, new OxmVlanPcpSerializer());
    helper.registerSerializer(IpDscp.class, new OxmIpDscpSerializer());
    helper.registerSerializer(IpEcn.class, new OxmIpEcnSerializer());
    helper.registerSerializer(IpProto.class, new OxmIpProtoSerializer());
    helper.registerSerializer(Ipv4Src.class, new OxmIpv4SrcSerializer());
    helper.registerSerializer(Ipv4Dst.class, new OxmIpv4DstSerializer());
    helper.registerSerializer(TcpSrc.class, new OxmTcpSrcSerializer());
    helper.registerSerializer(TcpDst.class, new OxmTcpDstSerializer());
    helper.registerSerializer(UdpSrc.class, new OxmUdpSrcSerializer());
    helper.registerSerializer(UdpDst.class, new OxmUdpDstSerializer());
    helper.registerSerializer(SctpSrc.class, new OxmSctpSrcSerializer());
    helper.registerSerializer(SctpDst.class, new OxmSctpDstSerializer());
    helper.registerSerializer(Icmpv4Type.class, new OxmIcmpv4TypeSerializer());
    helper.registerSerializer(Icmpv4Code.class, new OxmIcmpv4CodeSerializer());
    helper.registerSerializer(ArpOp.class, new OxmArpOpSerializer());
    helper.registerSerializer(ArpSpa.class, new OxmArpSpaSerializer());
    helper.registerSerializer(ArpTpa.class, new OxmArpTpaSerializer());
    helper.registerSerializer(ArpSha.class, new OxmArpShaSerializer());
    helper.registerSerializer(ArpTha.class, new OxmArpThaSerializer());
    helper.registerSerializer(Ipv6Src.class, new OxmIpv6SrcSerializer());
    helper.registerSerializer(Ipv6Dst.class, new OxmIpv6DstSerializer());
    helper.registerSerializer(Ipv6Flabel.class, new OxmIpv6FlabelSerializer());
    helper.registerSerializer(Icmpv6Type.class, new OxmIcmpv6TypeSerializer());
    helper.registerSerializer(Icmpv6Code.class, new OxmIcmpv6CodeSerializer());
    helper.registerSerializer(Ipv6NdTarget.class, new OxmIpv6NdTargetSerializer());
    helper.registerSerializer(Ipv6NdSll.class, new OxmIpv6NdSllSerializer());
    helper.registerSerializer(Ipv6NdTll.class, new OxmIpv6NdTllSerializer());
    helper.registerSerializer(MplsLabel.class, new OxmMplsLabelSerializer());
    helper.registerSerializer(MplsTc.class, new OxmMplsTcSerializer());
    helper.registerSerializer(MplsBos.class, new OxmMplsBosSerializer());
    helper.registerSerializer(PbbIsid.class, new OxmPbbIsidSerializer());
    helper.registerSerializer(TunnelId.class, new OxmTunnelIdSerializer());
    helper.registerSerializer(Ipv6Exthdr.class, new OxmIpv6ExtHdrSerializer());
    // Register approved openflow match entry serializers
    helper.registerExperimenterSerializer(TcpFlags.class, EncodeConstants.ONF_EXPERIMENTER_ID, new OnfOxmTcpFlagsSerializer());
}
Also used : OxmArpTpaSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpTpaSerializer) OxmIpv6NdTargetSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTargetSerializer) OxmArpSpaSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializer) OxmIcmpv6TypeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6TypeSerializer) OxmEthTypeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthTypeSerializer) OxmUdpDstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpDstSerializer) OxmIpv6SrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6SrcSerializer) OpenflowBasicClass(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass) OxmTcpDstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpDstSerializer) OxmEthDstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthDstSerializer) OxmIpDscpSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpDscpSerializer) OxmMplsLabelSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsLabelSerializer) OxmUdpSrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpSrcSerializer) OxmIcmpv4CodeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4CodeSerializer) OxmIcmpv4TypeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4TypeSerializer) OxmSctpSrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpSrcSerializer) OxmMetadataSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMetadataSerializer) OxmVlanPcpSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanPcpSerializer) OxmIpv4SrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4SrcSerializer) OxmSctpDstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpDstSerializer) OxmIcmpv6CodeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6CodeSerializer) OxmTcpSrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpSrcSerializer) OxmVlanVidSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanVidSerializer) OxmIpProtoSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpProtoSerializer) OxmIpv4DstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4DstSerializer) OxmArpShaSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializer) OxmIpv6NdSllSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdSllSerializer) OxmArpThaSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpThaSerializer) OxmIpv6NdTllSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTllSerializer) OxmIpv6FlabelSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6FlabelSerializer) OxmInPortSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPortSerializer) OxmIpv6DstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6DstSerializer) MatchEntrySerializerRegistryHelper(org.opendaylight.openflowjava.protocol.impl.util.MatchEntrySerializerRegistryHelper) OxmInPhyPortSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPhyPortSerializer) OxmMplsTcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsTcSerializer) OxmPbbIsidSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmPbbIsidSerializer) OxmEthSrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthSrcSerializer) OxmArpOpSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpOpSerializer) OxmMplsBosSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsBosSerializer) OxmIpEcnSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpEcnSerializer) OxmTunnelIdSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTunnelIdSerializer) OxmIpv6ExtHdrSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6ExtHdrSerializer) OnfOxmTcpFlagsSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.ext.OnfOxmTcpFlagsSerializer)

Example 58 with Of

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.Of in project openflowplugin by opendaylight.

the class OF10DeviceInitializer method initializeNodeInformation.

@Override
protected Future<Void> initializeNodeInformation(@Nonnull final DeviceContext deviceContext, final boolean switchFeaturesMandatory, final boolean skipTableFeatures, @Nullable final MultipartWriterProvider multipartWriterProvider, @Nullable final ConvertorExecutor convertorExecutor) {
    final ConnectionContext connectionContext = Preconditions.checkNotNull(deviceContext.getPrimaryConnectionContext());
    final DeviceState deviceState = Preconditions.checkNotNull(deviceContext.getDeviceState());
    final DeviceInfo deviceInfo = Preconditions.checkNotNull(deviceContext.getDeviceInfo());
    final CapabilitiesV10 capabilitiesV10 = connectionContext.getFeatures().getCapabilitiesV10();
    // Set capabilities for this device based on capabilities of connection context
    LOG.debug("Setting capabilities for device {}", deviceInfo);
    DeviceStateUtil.setDeviceStateBasedOnV10Capabilities(deviceState, capabilitiesV10);
    final ListenableFuture<Boolean> future = requestMultipart(MultipartType.OFPMPDESC, deviceContext);
    Futures.addCallback(future, new FutureCallback<Boolean>() {

        @Override
        public void onSuccess(@Nullable final Boolean result) {
            if (Boolean.TRUE.equals(result)) {
                LOG.debug("Creating empty flow capable node: {}", deviceInfo);
                makeEmptyFlowCapableNode(deviceContext, deviceInfo);
                LOG.debug("Creating empty tables for {}", deviceInfo);
                DeviceInitializationUtil.makeEmptyTables(deviceContext, deviceInfo, deviceContext.getPrimaryConnectionContext().getFeatures().getTables());
            }
        }

        @Override
        public void onFailure(@Nonnull final Throwable throwable) {
            LOG.warn("Error occurred in preparation node {} for protocol 1.0", deviceInfo);
            LOG.trace("Error for node {} : ", deviceInfo, throwable);
        }
    }, MoreExecutors.directExecutor());
    return Futures.transform(future, new Function<Boolean, Void>() {

        @Nullable
        @Override
        public Void apply(@Nullable final Boolean input) {
            LOG.debug("Writing physical port information for {}", deviceInfo);
            writePhyPortInformation(deviceContext);
            return null;
        }
    }, MoreExecutors.directExecutor());
}
Also used : DeviceState(org.opendaylight.openflowplugin.api.openflow.device.DeviceState) DeviceInfo(org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo) ConnectionContext(org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext) CapabilitiesV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.CapabilitiesV10) Nullable(javax.annotation.Nullable)

Example 59 with Of

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.Of in project openflowplugin by opendaylight.

the class DeviceInitializationUtil method makeEmptyNodes.

/**
 * Merge empty nodes to operational DS to predict any problems with missing parent for node.
 *
 * @param dataBroker the data broker
 */
public static void makeEmptyNodes(final DataBroker dataBroker) {
    final WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
    try {
        tx.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class), new NodesBuilder().setNode(Collections.emptyList()).build());
        tx.submit().get();
    } catch (ExecutionException | InterruptedException e) {
        LOG.error("Creation of node failed.", e);
        throw new IllegalStateException(e);
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) NodesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder) ExecutionException(java.util.concurrent.ExecutionException) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)

Example 60 with Of

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.Of in project openflowplugin by opendaylight.

the class MplsBosEntrySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final short mplsBos = (short) 1;
    final Match mplsBosMatch = new MatchBuilder().setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setMplsBos(mplsBos).build()).build();
    // TODO: Why are we using short in models instead of boolean?
    assertMatch(mplsBosMatch, false, (out) -> assertEquals(out.readBoolean(), mplsBos != 0));
}
Also used : ProtocolMatchFieldsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)376 Test (org.junit.Test)275 ByteBuf (io.netty.buffer.ByteBuf)262 ExecutionException (java.util.concurrent.ExecutionException)130 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)123 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)121 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)114 InstructionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)100 InstructionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder)99 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)98 ApplyActionsCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder)93 ApplyActionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder)91 SetVlanIdActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder)85 GroupActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder)83 BigInteger (java.math.BigInteger)82 List (java.util.List)82 DropActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder)82 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)82 ControllerActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder)81 DropAction (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction)81