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.");
}
}
}
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());
}
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());
}
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);
}
}
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));
}
Aggregations