Search in sources :

Example 1 with PcepNodeConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.config.rev171025.PcepNodeConfig in project bgpcep by opendaylight.

the class PCEPTopologyProviderUtil method contructSpeakersId.

static SpeakerIdMapping contructSpeakersId(final Topology topology) {
    final SpeakerIdMapping ret = SpeakerIdMapping.getSpeakerIdMap();
    topology.getNode().stream().filter(Objects::nonNull).filter(node -> node.getAugmentation(PcepNodeConfig.class) != null).filter(node -> node.getAugmentation(PcepNodeConfig.class).getSessionConfig() != null).filter(node -> node.getAugmentation(PcepNodeConfig.class).getSessionConfig().getAugmentation(PcepNodeSyncConfig.class) != null).forEach(node -> {
        final PcepNodeConfig config = node.getAugmentation(PcepNodeConfig.class);
        final PcepNodeSyncConfig nodeSyncConfig = config.getSessionConfig().getAugmentation(PcepNodeSyncConfig.class);
        final InetAddress address = InetAddresses.forString(node.getNodeId().getValue());
        ret.put(address, nodeSyncConfig.getSpeakerEntityIdValue());
    });
    return ret;
}
Also used : PcepNodeSyncConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.sync.optimizations.config.rev171025.PcepNodeSyncConfig) PcepNodeConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.config.rev171025.PcepNodeConfig) Logger(org.slf4j.Logger) KeyMapping(org.opendaylight.protocol.concepts.KeyMapping) TopologyTypes1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1) LoggerFactory(org.slf4j.LoggerFactory) Rfc2385Key(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key) InetSocketAddress(java.net.InetSocketAddress) StandardCharsets(java.nio.charset.StandardCharsets) InetAddress(java.net.InetAddress) Objects(java.util.Objects) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) TopologyTypes(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypes) IetfInetUtil(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) SpeakerIdMapping(org.opendaylight.protocol.pcep.SpeakerIdMapping) InetAddresses(com.google.common.net.InetAddresses) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) PcepNodeSyncConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.sync.optimizations.config.rev171025.PcepNodeSyncConfig) SpeakerIdMapping(org.opendaylight.protocol.pcep.SpeakerIdMapping) Objects(java.util.Objects) PcepNodeConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.config.rev171025.PcepNodeConfig) InetAddress(java.net.InetAddress)

Example 2 with PcepNodeConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.config.rev171025.PcepNodeConfig in project bgpcep by opendaylight.

the class PCEPTopologyProviderUtil method contructKeys.

static KeyMapping contructKeys(@Nonnull final Topology topology) {
    final KeyMapping ret = KeyMapping.getKeyMapping();
    topology.getNode().stream().filter(Objects::nonNull).filter(node -> node.getAugmentation(PcepNodeConfig.class) != null).filter(node -> node.getAugmentation(PcepNodeConfig.class).getSessionConfig() != null).filter(node -> node.getAugmentation(PcepNodeConfig.class).getSessionConfig().getPassword() != null).filter(node -> !node.getAugmentation(PcepNodeConfig.class).getSessionConfig().getPassword().getValue().isEmpty()).forEach(node -> {
        final PcepNodeConfig config = node.getAugmentation(PcepNodeConfig.class);
        final Rfc2385Key rfc2385KeyPassword = config.getSessionConfig().getPassword();
        final InetAddress address = InetAddresses.forString(node.getNodeId().getValue());
        ret.put(address, rfc2385KeyPassword.getValue().getBytes(StandardCharsets.US_ASCII));
    });
    return ret;
}
Also used : PcepNodeSyncConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.sync.optimizations.config.rev171025.PcepNodeSyncConfig) PcepNodeConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.config.rev171025.PcepNodeConfig) Logger(org.slf4j.Logger) KeyMapping(org.opendaylight.protocol.concepts.KeyMapping) TopologyTypes1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1) LoggerFactory(org.slf4j.LoggerFactory) Rfc2385Key(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key) InetSocketAddress(java.net.InetSocketAddress) StandardCharsets(java.nio.charset.StandardCharsets) InetAddress(java.net.InetAddress) Objects(java.util.Objects) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) TopologyTypes(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypes) IetfInetUtil(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) SpeakerIdMapping(org.opendaylight.protocol.pcep.SpeakerIdMapping) InetAddresses(com.google.common.net.InetAddresses) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) PcepNodeConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.config.rev171025.PcepNodeConfig) KeyMapping(org.opendaylight.protocol.concepts.KeyMapping) Rfc2385Key(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key) InetAddress(java.net.InetAddress)

Aggregations

InetAddresses (com.google.common.net.InetAddresses)2 InetAddress (java.net.InetAddress)2 InetSocketAddress (java.net.InetSocketAddress)2 StandardCharsets (java.nio.charset.StandardCharsets)2 Objects (java.util.Objects)2 Nonnull (javax.annotation.Nonnull)2 Nullable (javax.annotation.Nullable)2 KeyMapping (org.opendaylight.protocol.concepts.KeyMapping)2 SpeakerIdMapping (org.opendaylight.protocol.pcep.SpeakerIdMapping)2 IetfInetUtil (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil)2 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)2 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)2 Rfc2385Key (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key)2 PcepNodeConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.config.rev171025.PcepNodeConfig)2 TopologyTypes1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1)2 PcepNodeSyncConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.sync.optimizations.config.rev171025.PcepNodeSyncConfig)2 Topology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology)2 TopologyTypes (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypes)2 Logger (org.slf4j.Logger)2 LoggerFactory (org.slf4j.LoggerFactory)2