use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId in project bgpcep by opendaylight.
the class TunnelProviderDeployer method createTunnelTopologyProvider.
private synchronized void createTunnelTopologyProvider(final Topology topology) {
if (!filterPcepTopologies(topology.getTopologyTypes())) {
return;
}
final TopologyId topologyId = topology.getTopologyId();
if (this.pcepTunnelServices.containsKey(topology.getTopologyId())) {
LOG.warn("Tunnel Topology {} already exist. New instance won't be created", topologyId);
return;
}
LOG.debug("Create Tunnel Topology {}", topologyId);
final PcepTunnelTopologyConfig config = topology.getAugmentation(PcepTunnelTopologyConfig.class);
final String pcepTopoID = StringUtils.substringBetween(config.getPcepTopologyReference().getValue(), "=\"", "\"");
final InstanceIdentifier<Topology> pcepTopoRef = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(new TopologyId(pcepTopoID))).build();
final PCEPTunnelClusterSingletonService tunnelTopoCss = new PCEPTunnelClusterSingletonService(this.dependencies, pcepTopoRef, topologyId);
this.pcepTunnelServices.put(topology.getTopologyId(), tunnelTopoCss);
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId in project bgpcep by opendaylight.
the class TunnelProviderDeployer method removeTunnelTopologyProvider.
private synchronized void removeTunnelTopologyProvider(final Topology topo) {
if (!filterPcepTopologies(topo.getTopologyTypes())) {
return;
}
final TopologyId topologyId = topo.getTopologyId();
final PCEPTunnelClusterSingletonService topology = this.pcepTunnelServices.remove(topologyId);
closeTopology(topology, topologyId);
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId in project bgpcep by opendaylight.
the class PcepStateUtils method readNodeFromDataStore.
private static Node readNodeFromDataStore(final DataBroker dataBroker, final String topologyId, final String nodeId) {
final InstanceIdentifier<Node> topology = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(new TopologyId(topologyId))).child(Node.class, new NodeKey(new NodeId(nodeId))).build();
final ReadOnlyTransaction rot = dataBroker.newReadOnlyTransaction();
try {
return rot.read(LogicalDatastoreType.OPERATIONAL, topology).get().orNull();
} catch (final InterruptedException | ExecutionException e) {
LOG.warn("Failed to read node {}", nodeId, e);
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId in project bgpcep by opendaylight.
the class PcepStateUtils method displayNodeState.
private static void displayNodeState(final String topologyId, final String nodeId, final PcepSessionState pcepSessionState, final PrintStream stream) {
final ShellTable table = new ShellTable();
table.column("Attribute").alignLeft();
table.column("Value").alignLeft();
showNodeState(table, topologyId, nodeId, pcepSessionState);
addHeader(table, "Local preferences");
final LocalPref localPref = pcepSessionState.getLocalPref();
showPreferences(table, localPref);
final PcepEntityIdStatsAug entAug = localPref.getAugmentation(PcepEntityIdStatsAug.class);
if (entAug != null) {
table.addRow().addContent("Speaker Entity Identifier", Arrays.toString(entAug.getSpeakerEntityIdValue()));
}
addHeader(table, "Peer preferences");
final PeerPref peerPref = pcepSessionState.getPeerPref();
showPreferences(table, peerPref);
showCapabilities(table, pcepSessionState.getPeerCapabilities());
final Messages messages = pcepSessionState.getMessages();
showMessages(table, messages);
final ErrorMessages error = messages.getErrorMessages();
showErrorMessages(table, error);
final ReplyTime reply = messages.getReplyTime();
showReplyMessages(table, reply);
table.print(stream);
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId in project bgpcep by opendaylight.
the class PcepStateUtilsTest method createDefaultProtocol.
private void createDefaultProtocol() throws ExecutionException, InterruptedException {
final WriteTransaction wt = getDataBroker().newWriteOnlyTransaction();
final Node node = new NodeBuilder().setNodeId(new NodeId(NODE_ID)).addAugmentation(PcepTopologyNodeStatsAug.class, new PcepTopologyNodeStatsAugBuilder().setPcepSessionState(createPcepSessionState()).build()).build();
final InstanceIdentifier<Node> topology = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(new TopologyId(PCEP_TOPOLOGY))).child(Node.class, new NodeKey(new NodeId(NODE_ID))).build();
wt.put(LogicalDatastoreType.OPERATIONAL, topology, node, true);
wt.submit().get();
}
Aggregations