use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology in project bgpcep by opendaylight.
the class PCEPTopologyDeployerImpl method removeTopologyProvider.
private synchronized void removeTopologyProvider(final Topology topology) {
if (!filterPcepTopologies(topology.getTopologyTypes())) {
return;
}
final TopologyId topologyId = topology.getTopologyId();
closeTopology(this.pcepTopologyServices.remove(topologyId), topologyId);
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology 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;
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology in project bgpcep by opendaylight.
the class NodeAttributesParser method parseTopologyId.
private static void parseTopologyId(final List<TopologyIdentifier> topologyMembership, final ByteBuf value) {
while (value.isReadable()) {
final TopologyIdentifier topId = new TopologyIdentifier(value.readUnsignedShort() & TlvUtil.TOPOLOGY_ID_OFFSET);
topologyMembership.add(topId);
LOG.debug("Parsed Topology Identifier: {}", topId);
}
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology in project bgpcep by opendaylight.
the class ServerSessionManager method takeNodeState.
synchronized TopologyNodeState takeNodeState(final InetAddress address, final TopologySessionListener sessionListener, final boolean retrieveNode) {
final NodeId id = createNodeId(address);
if (this.isClosed.get()) {
LOG.error("Server Session Manager is closed. Unable to create topology node {} with listener {}", id, sessionListener);
return null;
}
LOG.debug("Node {} requested by listener {}", id, sessionListener);
TopologyNodeState ret = this.state.get(id);
if (ret == null) {
ret = new TopologyNodeState(this.dependenciesProvider.getDataBroker(), this.topology, id, DEFAULT_HOLD_STATE_NANOS);
LOG.debug("Created topology node {} for id {} at {}", ret, id, ret.getNodeId());
this.state.put(id, ret);
}
// if another listener requests the same session, close it
final TopologySessionListener existingSessionListener = this.nodes.get(id);
if (existingSessionListener != null && !sessionListener.equals(existingSessionListener)) {
LOG.error("New session listener {} is in conflict with existing session listener {} on node {}," + " closing the existing one.", existingSessionListener, sessionListener, id);
existingSessionListener.close();
}
ret.taken(retrieveNode);
this.nodes.put(id, sessionListener);
LOG.debug("Node {} bound to listener {}", id, sessionListener);
return ret;
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology in project bgpcep by opendaylight.
the class TopologyNodeState method putTopologyNode.
private synchronized void putTopologyNode() {
final Node node = new NodeBuilder().setKey(this.nodeId.getKey()).setNodeId(this.nodeId.getKey().getNodeId()).build();
final WriteTransaction t = this.chain.newWriteOnlyTransaction();
LOG.trace("Put topology Node {}, value {}", this.nodeId, node);
t.merge(LogicalDatastoreType.OPERATIONAL, this.nodeId, node);
Futures.addCallback(t.submit(), new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
LOG.trace("Topology Node stored {}, value {}", TopologyNodeState.this.nodeId, node);
}
@Override
public void onFailure(final Throwable throwable) {
LOG.trace("Put topology Node failed {}, value {}, {}", TopologyNodeState.this.nodeId, node, throwable);
}
}, MoreExecutors.directExecutor());
}
Aggregations