public OvsdbBridgeAugmentation extractBridgeAugmentation(Node node) { if (node == null) { return null; } return node.getAugmentation(OvsdbBridgeAugmentation.class); }
public boolean deleteBridge(Node ovsdbNode) { InstanceIdentifier<Node> bridgeIid = MdsalHelper.createInstanceIdentifier(ovsdbNode.getNodeId()); boolean result = mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, bridgeIid); LOG.info("deleteBridge node: {}, bridgeName: {} result : {}", ovsdbNode, ovsdbNode.getNodeId(),result); return result; }
public OvsdbBridgeAugmentation getBridgeFromConfig(Node node, String bridge) { OvsdbBridgeAugmentation ovsdbBridgeAugmentation = null; InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier(node.getKey(), bridge); Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, bridgeIid); if (bridgeNode != null) { ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class); } return ovsdbBridgeAugmentation; }
public List<TerminationPoint> extractTerminationPoints(Node node) { List<TerminationPoint> terminationPoints = new ArrayList<>(); OvsdbBridgeAugmentation ovsdbBridgeAugmentation = node.getAugmentation(OvsdbBridgeAugmentation.class); if (ovsdbBridgeAugmentation != null) { terminationPoints.addAll(node.getTerminationPoint()); } return terminationPoints; }
private NetconfNode getNodeAugmentation(Node node) { NetconfNode netconfNode = node.getAugmentation(NetconfNode.class); if (netconfNode == null) { LOG.warn("Node {} is not a netconf device", node.getNodeId().getValue()); return null; } return netconfNode; }
public NodeBuilder(Node base) { this.key = base.key(); this._nodeId = base.getNodeId(); this._supportingNode = base.getSupportingNode(); this._terminationPoint = base.getTerminationPoint(); if (base instanceof NodeImpl) { NodeImpl impl = (NodeImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") Map<Class<? extends Augmentation<Node>>, Augmentation<Node>> aug =((AugmentationHolder<Node>) base).augmentations(); if (!aug.isEmpty()) { this.augmentation = new HashMap<>(aug); } } }
@Override public void onSuccess(final Optional<Topology> data) { if(data.isPresent()) { final List<Node> nodes = data.get().getNode(); if(nodes != null){ for (final Node node : nodes) { if (nodeRegex.matcher(node.getNodeId().getValue()).matches()) { notifyNode(EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, node.getKey())); } } } } tx.close(); }
public NodeBuilder(Node base) { if (base.getKey() == null) { this._key = new NodeKey( base.getNodeId() ); this._nodeId = base.getNodeId(); } else { this._key = base.getKey(); this._nodeId = _key.getNodeId(); } this._supportingNode = base.getSupportingNode(); this._terminationPoint = base.getTerminationPoint(); if (base instanceof NodeImpl) { NodeImpl impl = (NodeImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
@Override public NodeKey getSourceNodeKey() { return mount.getNode().getKey(); }
public static Map<InstanceIdentifier<?>, DataObject> extractTerminationPointConfigurationChanges( final Node bridgeNode) { Map<InstanceIdentifier<?>, DataObject> changes = new HashMap<>(); final InstanceIdentifier<Node> bridgeNodeIid = SouthboundMapper.createInstanceIdentifier(bridgeNode.getNodeId()); changes.put(bridgeNodeIid, bridgeNode); List<TerminationPoint> terminationPoints = bridgeNode.getTerminationPoint(); if (terminationPoints != null && !terminationPoints.isEmpty()) { for (TerminationPoint tp : terminationPoints) { OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation != null) { final InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid = bridgeNodeIid .child(TerminationPoint.class, new TerminationPointKey(tp.getTpId())) .builder() .augmentation(OvsdbTerminationPointAugmentation.class) .build(); changes.put(tpIid, ovsdbTerminationPointAugmentation); } } } return changes; } }
public List<OvsdbTerminationPointAugmentation> extractTerminationPointAugmentations( Node node ) { List<OvsdbTerminationPointAugmentation> tpAugmentations = new ArrayList<>(); List<TerminationPoint> terminationPoints = node.getTerminationPoint(); if(terminationPoints != null && !terminationPoints.isEmpty()){ for(TerminationPoint tp : terminationPoints){ OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation != null) { tpAugmentations.add(ovsdbTerminationPointAugmentation); } } } return tpAugmentations; }
private void handleSni(final InstanceIdentifier<Node> sni, final Node n, 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 (n.getSupportingNode() != null) { for (final SupportingNode sn : n.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, n.getKey()).child( SupportingNode.class, sn.getKey()), sn); } } }
public static NodeId supportingNode(final Node node) { for (final SupportingNode n : node.getSupportingNode()) { final SupportingNode1 n1 = n.getAugmentation(SupportingNode1.class); if (n1 != null && n1.getPathComputationClient().isControlling()) { return n.getKey().getNodeRef(); } } return null; }
@Override public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event) { for (final Map.Entry<InstanceIdentifier<?>, DataObject> createdEntry : event.getCreatedData().entrySet()) { if (createdEntry.getValue() instanceof Node) { final Node node = (Node) createdEntry.getValue(); LOG.debug("Create node..."); if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) { LOG.debug("Matched..."); notifyNode(EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, node.getKey())); } } } for (final Map.Entry<InstanceIdentifier<?>, DataObject> changeEntry : event.getUpdatedData().entrySet()) { if (changeEntry.getValue() instanceof Node) { final Node node = (Node) changeEntry.getValue(); if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) { notifyNode(changeEntry.getKey()); } } } }
public List<TerminationPoint> extractTerminationPoints(Node node) { List<TerminationPoint> terminationPoints = new ArrayList<>(); OvsdbBridgeAugmentation ovsdbBridgeAugmentation = node.getAugmentation(OvsdbBridgeAugmentation.class); if (ovsdbBridgeAugmentation != null) { terminationPoints.addAll(node.getTerminationPoint()); } return terminationPoints; }
/** * Delete Bridge on the given Node. * * @param ovsdbNode the node object of the OVS instance * @param bridgeName the bridgename of the bridge to be removed * @return true if the bridge deleted is successful. */ private boolean deleteBridge(Node ovsdbNode, String bridgeName) { InstanceIdentifier<Node> bridgeIid = this.createInstanceIdentifier(ovsdbNode.getKey(), bridgeName); return mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, bridgeIid); }
public List<OvsdbTerminationPointAugmentation> extractTerminationPointAugmentations( Node node ) { List<OvsdbTerminationPointAugmentation> tpAugmentations = new ArrayList<>(); if (node == null) { LOG.error("extractTerminationPointAugmentations: Node value is null"); return Collections.<OvsdbTerminationPointAugmentation>emptyList(); } List<TerminationPoint> terminationPoints = node.getTerminationPoint(); if(terminationPoints != null && !terminationPoints.isEmpty()){ for(TerminationPoint tp : terminationPoints){ OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation != null) { tpAugmentations.add(ovsdbTerminationPointAugmentation); } } } return tpAugmentations; }
private void processNodeRemoved(Node node) { nodeCache.remove(node.getNodeId()); for (NodeCacheListener handler : handlers.values()) { try { handler.notifyNode(node, Action.DELETE); } catch (Exception e) { LOG.error("Failed notifying node remove event", e); } } LOG.warn("processNodeRemoved returns"); }
public OvsdbBridgeAugmentation extractBridgeAugmentation(Node node) { if (node == null) { return null; } return node.getAugmentation(OvsdbBridgeAugmentation.class); }
public OvsdbBridgeAugmentation getBridgeFromConfig(Node node, String bridge) { OvsdbBridgeAugmentation ovsdbBridgeAugmentation = null; InstanceIdentifier<Node> bridgeIid = MdsalHelper.createInstanceIdentifier(node.getKey(), bridge); Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, bridgeIid); if (bridgeNode != null) { ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class); } return ovsdbBridgeAugmentation; }