Search in sources :

Example 11 with Node

use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.node.data.Node in project netvirt by opendaylight.

the class HAOpNodeListener method readAndCopyChildPsOpToParent.

private void readAndCopyChildPsOpToParent(Node childNode, ReadWriteTransaction tx) {
    String childGlobalNodeId = childNode.getNodeId().getValue();
    List<InstanceIdentifier> childPsIids = new ArrayList<>();
    HwvtepGlobalAugmentation hwvtepGlobalAugmentation = childNode.getAugmentation(HwvtepGlobalAugmentation.class);
    if (hwvtepGlobalAugmentation == null || HwvtepHAUtil.isEmpty(hwvtepGlobalAugmentation.getSwitches())) {
        haOpClusteredListener.getConnectedNodes().stream().filter((connectedIid) -> IS_PS_CHILD_TO_GLOBAL_NODE.test(childGlobalNodeId, connectedIid)).forEach((connectedIid) -> childPsIids.add(connectedIid));
    } else {
        hwvtepGlobalAugmentation.getSwitches().forEach((switches) -> childPsIids.add(switches.getSwitchRef().getValue()));
    }
    if (childPsIids.isEmpty()) {
        LOG.info("No child ps found for global {}", childGlobalNodeId);
    }
    childPsIids.forEach((psIid) -> {
        try {
            InstanceIdentifier<Node> childPsIid = psIid;
            Optional<Node> childPsNode = tx.read(LogicalDatastoreType.OPERATIONAL, childPsIid).checkedGet();
            if (childPsNode.isPresent()) {
                LOG.debug("Child oper PS node found");
                onPsNodeAdd(childPsIid, childPsNode.get(), tx);
            } else {
                LOG.debug("Child oper ps node not found {}", childPsIid);
            }
        } catch (ReadFailedException e) {
            LOG.error("Failed to read child ps node {}", psIid);
        }
    });
}
Also used : IHAEventHandler(org.opendaylight.netvirt.elan.l2gw.ha.handlers.IHAEventHandler) HAEventHandler(org.opendaylight.netvirt.elan.l2gw.ha.handlers.HAEventHandler) LoggerFactory(org.slf4j.LoggerFactory) Singleton(javax.inject.Singleton) OPERATIONAL(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.OPERATIONAL) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) Strings(com.google.common.base.Strings) BiPredicate(java.util.function.BiPredicate) HwvtepHAUtil(org.opendaylight.netvirt.elan.l2gw.ha.HwvtepHAUtil) Optional(com.google.common.base.Optional) DataObjectModification(org.opendaylight.controller.md.sal.binding.api.DataObjectModification) NodeCopier(org.opendaylight.netvirt.elan.l2gw.ha.handlers.NodeCopier) Logger(org.slf4j.Logger) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) Predicate(java.util.function.Predicate) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) Set(java.util.Set) Collectors(java.util.stream.Collectors) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) HwvtepGlobalAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation) List(java.util.List) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) ReadWriteTransaction(org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) ArrayList(java.util.ArrayList) HwvtepGlobalAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier)

Example 12 with Node

use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.node.data.Node in project netvirt by opendaylight.

the class HwvtepNodeBaseListener method processConnectedNodes.

void processConnectedNodes(Collection<DataTreeModification<Node>> changes, ReadWriteTransaction tx) throws ReadFailedException {
    for (DataTreeModification<Node> change : changes) {
        InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier();
        DataObjectModification<Node> mod = change.getRootNode();
        Node node = HwvtepHAUtil.getCreated(mod);
        String nodeId = key.firstKeyOf(Node.class).getNodeId().getValue();
        if (node != null) {
            if (!nodeId.contains(HwvtepHAUtil.PHYSICALSWITCH)) {
                LOG.trace("Handle global node add {}", node.getNodeId().getValue());
                onGlobalNodeAdd(key, node, tx);
            } else {
                LOG.trace("Handle ps node add {}", node.getNodeId().getValue());
                onPsNodeAdd(key, node, tx);
            }
        }
    }
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)

Example 13 with Node

use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.node.data.Node in project netvirt by opendaylight.

the class ClassifierEntryTest method suppressNodeEntry.

@Test
public void suppressNodeEntry() throws Exception {
    NodeId nodeId = new NodeId("node");
    ClassifierEntry entry = ClassifierEntry.buildNodeEntry(nodeId);
    entry.suppress(renderer);
    verify(renderer).suppressNode(nodeId);
    verifyNoMoreInteractions(renderer);
}
Also used : NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) Test(org.junit.Test)

Example 14 with Node

use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.node.data.Node in project netvirt by opendaylight.

the class ClassifierEntryTest method suppressPathEntry.

@Test
public void suppressPathEntry() throws Exception {
    NodeId nodeId = new NodeId("node");
    Long nsp = 2L;
    short nsi = (short) 254;
    short nsl = (short) 252;
    String firstHopIp = "127.0.0.1";
    ClassifierEntry entry = ClassifierEntry.buildPathEntry(nodeId, nsp, nsi, nsl, firstHopIp);
    entry.suppress(renderer);
    verify(renderer).suppressPath(nodeId, nsp, nsi, nsl, firstHopIp);
    verifyNoMoreInteractions(renderer);
}
Also used : NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) Test(org.junit.Test)

Example 15 with Node

use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.node.data.Node in project netvirt by opendaylight.

the class ClassifierEntryTest method suppressMatchEntry.

@Test
public void suppressMatchEntry() throws Exception {
    NodeId nodeId = new NodeId("node");
    String connector = "openflow:0123456789:1";
    Long nsp = 2L;
    Short nsi = (short) 254;
    Matches matches = new MatchesBuilder().build();
    ClassifierEntry entry = ClassifierEntry.buildMatchEntry(nodeId, connector, matches, nsp, nsi);
    entry.suppress(renderer);
    verify(renderer).suppressMatch(nodeId, connector, matches, nsp, nsi);
    verifyNoMoreInteractions(renderer);
}
Also used : Matches(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.Matches) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) MatchesBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.MatchesBuilder) Test(org.junit.Test)

Aggregations

Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)220 ArrayList (java.util.ArrayList)160 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)160 Test (org.junit.Test)115 ExecutionException (java.util.concurrent.ExecutionException)108 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)108 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)105 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)93 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)89 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)88 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)81 TerminationPoint (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)61 NodeBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder)60 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)60 List (java.util.List)59 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)57 Topology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology)54 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)53 HwvtepGlobalAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation)53 Logger (org.slf4j.Logger)52