import javax.annotation.Nonnull;
import org.opendaylight.protocol.concepts.KeyMapping;
import org.opendaylight.protocol.pcep.SpeakerIdMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev171025.pcep.config.SessionConfig;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
private final SpeakerIdMapping speakerIds;
private final InstanceIdentifier<Topology> topology;
- public PCEPTopologyConfiguration(
- @Nonnull final InetSocketAddress address,
- @Nonnull final KeyMapping keys,
- @Nonnull final SpeakerIdMapping speakerIds,
- @Nonnull final TopologyId topologyId,
- final short rpcTimeout) {
- this.address = checkNotNull(address);
- this.keys = checkNotNull(keys);
- this.speakerIds = checkNotNull(speakerIds);
- this.topologyId = checkNotNull(topologyId);
- this.rpcTimeout = rpcTimeout;
+ public PCEPTopologyConfiguration(@Nonnull final SessionConfig config, @Nonnull final Topology topology) {
+ checkNotNull(topology);
+ this.address = PCEPTopologyProviderUtil
+ .getInetSocketAddress(checkNotNull(config.getListenAddress()), checkNotNull(config.getListenPort()));
+ this.keys = checkNotNull(PCEPTopologyProviderUtil.contructKeys(topology));
+ this.speakerIds = checkNotNull(PCEPTopologyProviderUtil.contructSpeakersId(topology));
+ this.topologyId = checkNotNull(topology.getTopologyId());
+ this.rpcTimeout = config.getRpcTimeout();
this.topology = InstanceIdentifier.builder(NetworkTopology.class)
.child(Topology.class, new TopologyKey(this.topologyId)).build();
}