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 LinkstateTopologyBuilderTest method testOspfLinkstateTopologyBuilder.
@Test
public void testOspfLinkstateTopologyBuilder() throws TransactionCommitFailedException, ReadFailedException {
// create node
updateLinkstateRoute(createLinkstateNodeRoute(ProtocolId.Ospf, "node1", NODE_1_AS, ROUTER_1_ID));
readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
assertEquals(1, topology.getNode().size());
final Node node1 = topology.getNode().get(0);
assertEquals(NODE_1_OSPF_ID, node1.getNodeId().getValue());
final IgpNodeAttributes igpNode1 = node1.getAugmentation(Node1.class).getIgpNodeAttributes();
assertEquals(ROUTER_1_ID, igpNode1.getRouterId().get(0).getIpv4Address().getValue());
assertEquals("node1", igpNode1.getName().getValue());
assertNull(igpNode1.getAugmentation(IgpNodeAttributes1.class));
assertEquals(ROUTER_1_ID, igpNode1.getAugmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpNodeAttributes1.class).getOspfNodeAttributes().getTed().getTeRouterIdIpv4().getValue());
return topology;
});
// update node with prefix
updateLinkstateRoute(createLinkstatePrefixRoute(ProtocolId.Ospf, NODE_1_AS, NODE_1_PREFIX, 500L, ROUTER_1_ID));
readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
final IgpNodeAttributes igpNode2 = topology.getNode().get(0).getAugmentation(Node1.class).getIgpNodeAttributes();
assertEquals(1, igpNode2.getPrefix().size());
final Prefix prefix = igpNode2.getPrefix().get(0);
assertEquals(NODE_1_PREFIX, prefix.getPrefix().getIpv4Prefix().getValue());
assertEquals(500L, prefix.getMetric().longValue());
return topology;
});
// create link
updateLinkstateRoute(createLinkstateLinkRoute(ProtocolId.Ospf, NODE_1_AS, NODE_2_AS, "link1"));
readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
assertEquals(1, topology.getLink().size());
final Link link1 = topology.getLink().get(0);
assertEquals(2, topology.getNode().size());
assertEquals(1, topology.getNode().get(0).getTerminationPoint().size());
assertEquals(1, topology.getNode().get(1).getTerminationPoint().size());
assertEquals("bgpls://Ospf:1/type=link&local-as=1&local-router=0000.0102.0304&remote-as=2&mt=1", link1.getLinkId().getValue());
assertEquals(NODE_1_OSPF_ID, link1.getSource().getSourceNode().getValue());
assertEquals(NODE_2_OSPF_ID, link1.getDestination().getDestNode().getValue());
final IgpLinkAttributes igpLink1 = link1.getAugmentation(Link1.class).getIgpLinkAttributes();
assertEquals("link1", igpLink1.getName());
assertNull(igpLink1.getAugmentation(IgpLinkAttributes1.class));
assertEquals((short) 1, igpLink1.getAugmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpLinkAttributes1.class).getOspfLinkAttributes().getMultiTopologyId().shortValue());
assertEquals(2, igpLink1.getAugmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpLinkAttributes1.class).getOspfLinkAttributes().getTed().getSrlg().getSrlgValues().size());
return topology;
});
}
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 AbstractBgpTopologyProvider method createInstance.
private TopologyReferenceSingletonService createInstance(final Topology topology) {
final RibReference ribReference = new DefaultRibReference(InstanceIdentifier.create(BgpRib.class).child(Rib.class, new RibKey(topology.getAugmentation(Topology1.class).getRibId())));
final AbstractTopologyBuilder<?> topologyBuilder = createTopologyBuilder(this.dataBroker, ribReference, topology.getTopologyId());
return new TopologyReferenceSingletonServiceImpl(topologyBuilder, this.deployer, topology);
}
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 BgpTopologyDeployerImpl method registerService.
@Override
@SuppressWarnings("checkstyle:IllegalCatch")
public AbstractRegistration registerService(final TopologyReferenceSingletonService topologyProviderService) {
final Dictionary<String, String> properties = new Hashtable<>();
properties.put("topology-id", topologyProviderService.getInstanceIdentifier().firstKeyOf(Topology.class).getTopologyId().getValue());
final ServiceRegistration<?> registerService = this.context.registerService(new String[] { TopologyReference.class.getName() }, topologyProviderService, properties);
final ClusterSingletonServiceRegistration registerClusterSingletonService = registerSingletonService(topologyProviderService);
return new AbstractRegistration() {
@Override
protected void removeRegistration() {
try {
registerClusterSingletonService.close();
} catch (final Exception e) {
LOG.warn("Failed to close ClusterSingletonServiceRegistration {} for TopologyBuilder {}", registerClusterSingletonService, topologyProviderService.getInstanceIdentifier(), e);
} finally {
registerService.unregister();
}
}
};
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology in project openflowplugin by opendaylight.
the class NodeChangeListenerImpl method processAddedNode.
private void processAddedNode(final DataTreeModification<FlowCapableNode> modification) {
final InstanceIdentifier<FlowCapableNode> iiToNodeInInventory = modification.getRootPath().getRootIdentifier();
final NodeId nodeIdInTopology = provideTopologyNodeId(iiToNodeInInventory);
if (nodeIdInTopology != null) {
final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node> iiToTopologyNode = provideIIToTopologyNode(nodeIdInTopology);
sendToTransactionChain(prepareTopologyNode(nodeIdInTopology, iiToNodeInInventory), iiToTopologyNode);
} else {
LOG.debug("Inventory node key is null. Data can't be written to topology");
}
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology in project openflowplugin by opendaylight.
the class TerminationPointChangeListenerImpl method processAddedTerminationPoints.
private void processAddedTerminationPoints(final DataTreeModification<FlowCapableNodeConnector> modification) {
final InstanceIdentifier<FlowCapableNodeConnector> iiToNodeInInventory = modification.getRootPath().getRootIdentifier();
TpId terminationPointIdInTopology = provideTopologyTerminationPointId(iiToNodeInInventory);
if (terminationPointIdInTopology != null) {
InstanceIdentifier<TerminationPoint> iiToTopologyTerminationPoint = provideIIToTopologyTerminationPoint(terminationPointIdInTopology, iiToNodeInInventory);
TerminationPoint point = prepareTopologyTerminationPoint(terminationPointIdInTopology, iiToNodeInInventory);
sendToTransactionChain(point, iiToTopologyTerminationPoint);
removeLinks(modification.getRootNode().getDataAfter(), point);
} else {
LOG.debug("Inventory node connector key is null. Data can't be written to topology termination point");
}
}
Aggregations