Search in sources :

Example 81 with NodeKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey in project controller by opendaylight.

the class EventSourceTopologyTest method registerEventSourceTest.

@Test
public void registerEventSourceTest() throws Exception {
    topicTestHelper();
    Node nodeMock = mock(Node.class);
    EventSource eventSourceMock = mock(EventSource.class);
    NodeId nodeId = new NodeId("nodeIdValue1");
    nodeKey = new NodeKey(nodeId);
    doReturn(nodeKey).when(nodeMock).getKey();
    doReturn(nodeKey).when(eventSourceMock).getSourceNodeKey();
    BindingAwareBroker.RoutedRpcRegistration routedRpcRegistrationMock = mock(BindingAwareBroker.RoutedRpcRegistration.class);
    doReturn(routedRpcRegistrationMock).when(rpcProviderRegistryMock).addRoutedRpcImplementation(EventSourceService.class, eventSourceMock);
    doNothing().when(routedRpcRegistrationMock).registerPath(eq(NodeContext.class), any(KeyedInstanceIdentifier.class));
    assertNotNull("Return value has not been created correctly.", eventSourceTopology.registerEventSource(eventSourceMock));
}
Also used : BindingAwareBroker(org.opendaylight.controller.sal.binding.api.BindingAwareBroker) EventSource(org.opendaylight.controller.messagebus.spi.EventSource) NodeContext(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey) Test(org.junit.Test)

Example 82 with NodeKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey in project bgpcep by opendaylight.

the class TunnelProgrammingTest method createNode.

private static Node createNode(final NodeId nodeId, final TpId tpId, final String ipv4Address) {
    final TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    tpBuilder.setTpId(tpId);
    tpBuilder.setKey(new TerminationPointKey(tpId));
    tpBuilder.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder().setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder().setTerminationPointType(new IpBuilder().setIpAddress(Collections.singletonList(new IpAddress(new Ipv4Address(ipv4Address)))).build()).build()).build());
    final NodeBuilder nodeBuilder = new NodeBuilder();
    nodeBuilder.setNodeId(nodeId);
    nodeBuilder.setKey(new NodeKey(nodeId));
    nodeBuilder.setTerminationPoint(Lists.newArrayList(tpBuilder.build()));
    final SupportingNode supportingNode = new SupportingNodeBuilder().setKey(new SupportingNodeKey(nodeId, new TopologyId("dummy"))).addAugmentation(SupportingNode1.class, new SupportingNode1Builder().setPathComputationClient(new PathComputationClientBuilder().setControlling(true).build()).build()).build();
    nodeBuilder.setSupportingNode(Lists.newArrayList(supportingNode));
    return nodeBuilder.build();
}
Also used : SupportingNodeBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeBuilder) TerminationPointKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey) PathComputationClientBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.tunnel.pcep.supporting.node.attributes.PathComputationClientBuilder) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) SupportingNode(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode) SupportingNode1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.SupportingNode1) NodeBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder) SupportingNodeBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeBuilder) SupportingNode1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.SupportingNode1Builder) IpBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.igp.termination.point.attributes.termination.point.type.IpBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) SupportingNodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeKey) IgpTerminationPointAttributesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.IgpTerminationPointAttributesBuilder) SupportingNodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeKey) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey) TerminationPoint1Builder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.TerminationPoint1Builder) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 83 with NodeKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey in project bgpcep by opendaylight.

the class TopologyStatsProviderImpl method close.

@Override
public synchronized void close() throws Exception {
    LOG.info("Closing TopologyStatsProvider service.", this);
    this.scheduleTask.cancel(true);
    final WriteTransaction wTx = this.transactionChain.newWriteOnlyTransaction();
    for (final KeyedInstanceIdentifier<Node, NodeKey> statId : this.statsMap.keySet()) {
        wTx.delete(LogicalDatastoreType.OPERATIONAL, statId);
    }
    wTx.submit().get();
    this.statsMap.clear();
    this.transactionChain.close();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)

Example 84 with NodeKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey in project bgpcep by opendaylight.

the class TopologyStatsProviderImpl method updatePcepStats.

private synchronized void updatePcepStats() {
    final WriteTransaction tx = TopologyStatsProviderImpl.this.transactionChain.newWriteOnlyTransaction();
    for (final Map.Entry<KeyedInstanceIdentifier<Node, NodeKey>, PcepSessionState> entry : this.statsMap.entrySet()) {
        final PcepTopologyNodeStatsAug nodeStatsAug = new PcepTopologyNodeStatsAugBuilder().setPcepSessionState(new PcepSessionStateBuilder(entry.getValue()).build()).build();
        final InstanceIdentifier<PcepTopologyNodeStatsAug> statId = entry.getKey().augmentation(PcepTopologyNodeStatsAug.class);
        tx.put(LogicalDatastoreType.OPERATIONAL, statId, nodeStatsAug);
    }
    tx.submit();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) PcepTopologyNodeStatsAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.stats.rev171113.PcepTopologyNodeStatsAugBuilder) PcepTopologyNodeStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.stats.rev171113.PcepTopologyNodeStatsAug) PcepSessionState(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.PcepSessionState) PcepSessionStateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.grouping.PcepSessionStateBuilder) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) HashMap(java.util.HashMap) Map(java.util.Map)

Example 85 with NodeKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey in project bgpcep by opendaylight.

the class NodeChangedListener method handleSni.

private void handleSni(final InstanceIdentifier<Node> sni, final Node node, final Boolean inControl, final ReadWriteTransaction trans) {
    if (sni != null) {
        final NodeKey k = InstanceIdentifier.keyOf(sni);
        boolean have = false;
        /*
             * We may have found a termination point which has been created as a destination,
             * so it does not have a supporting node pointer. Since we now know what it is,
             * fill it in.
             */
        if (node.getSupportingNode() != null) {
            for (final SupportingNode sn : node.getSupportingNode()) {
                if (sn.getNodeRef().equals(k.getNodeId())) {
                    have = true;
                    break;
                }
            }
        }
        if (!have) {
            final SupportingNode sn = createSupportingNode(k.getNodeId(), inControl);
            trans.put(LogicalDatastoreType.OPERATIONAL, this.target.child(Node.class, node.getKey()).child(SupportingNode.class, sn.getKey()), sn);
        }
    }
}
Also used : SupportingNode(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode) SupportingNodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeKey) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)

Aggregations

NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)98 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)64 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)63 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)55 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)47 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)42 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)33 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)31 Test (org.junit.Test)26 NodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder)19 Before (org.junit.Before)18 NetworkTopology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology)18 TopologyKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey)18 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)16 NodeConnectorRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef)15 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)14 NodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector)14 NodeConnectorKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)14 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)12 ArrayList (java.util.ArrayList)11