List<InstanceIdentifier<Flow>> notStatReportedConfigFlows() { if (configFlows != null) { final List<InstanceIdentifier<Flow>> returnList = new ArrayList<>(configFlows.size()); for (final Flow confFlow : configFlows) { final InstanceIdentifier<Flow> confFlowIdent = tableRef.child(Flow.class, confFlow.getKey()); returnList.add(confFlowIdent); } return returnList; } return Collections.emptyList(); } }
/** * Create a {@link InstanceIdentifier} {@link OvsdbBridgeAugmentation} based on the Topology * {@link NodeId} * * @param nodeId A topology {@link NodeId} * @return InstanceIdentifier<OvsdbBridgeAugmentation> */ public static InstanceIdentifier<OvsdbBridgeAugmentation> buildOvsdbBridgeIID(NodeId nodeId) { InstanceIdentifier<OvsdbBridgeAugmentation> bridgeEntryIID = InstanceIdentifier.create(NetworkTopology.class) .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)) .child(Node.class, new NodeKey(nodeId)) .augmentation(OvsdbBridgeAugmentation.class); return bridgeEntryIID; }
private void insert(final KeyedInstanceIdentifier<Node, NodeKey> sourcePath) { final NodeKey nodeKey = sourcePath.getKey(); final InstanceIdentifier<Node1> augmentPath = sourcePath.augmentation(Node1.class); final Node1 nodeAgument = new Node1Builder().setEventSourceNode( new NodeId(nodeKey.getNodeId().getValue())).build(); putData(OPERATIONAL, augmentPath, nodeAgument); }
void removeUnreportedFlows(final ReadWriteTransaction tx) { final InstanceIdentifier<Node> nodeIdent = tableRef.firstIdentifierOf(Node.class); final List<InstanceIdentifier<Flow>> listMissingConfigFlows = notStatReportedConfigFlows(); final Map<InstanceIdentifier<Flow>, Integer> nodeDeleteMap = mapNodesForDelete.get(nodeIdent); final Map<FlowHashIdMapKey, FlowId> listForRemove = getRemovalList(); for (final Entry<FlowHashIdMapKey, FlowId> entryForRemove : listForRemove.entrySet()) { final FlowKey flowKey = new FlowKey(entryForRemove.getValue()); final InstanceIdentifier<Flow> flowRef = tableRef.child(Flow.class, flowKey); if (nodeDeleteMap != null && flowKey.getId().getValue().startsWith(ALIEN_SYSTEM_FLOW_ID)) { final Integer lifeIndex = nodeDeleteMap.get(flowRef); if (lifeIndex != null && lifeIndex > 0) { break; } else { nodeDeleteMap.remove(flowRef); } } else { if (listMissingConfigFlows.remove(flowRef)) { // it is probable that some multipart message was lost break; } } final InstanceIdentifier<FlowHashIdMap> flHashIdent = tableRef.augmentation(FlowHashIdMapping.class).child(FlowHashIdMap.class, entryForRemove.getKey()); tx.delete(LogicalDatastoreType.OPERATIONAL, flowRef); tx.delete(LogicalDatastoreType.OPERATIONAL, flHashIdent); } }
private void remove(final KeyedInstanceIdentifier<Node, NodeKey> sourcePath) { final InstanceIdentifier<Node1> augmentPath = sourcePath.augmentation(Node1.class); deleteData(OPERATIONAL, augmentPath); }
KeyedInstanceIdentifierV2(final KeyedInstanceIdentifier<T, K> source) { super(source); key = source.getKey(); }
private InstanceIdentifier<IgpNodeAttributes> ensureNodePresent(final ReadWriteTransaction trans, final NodeId ni) { final NodeUsage present = this.nodes.get(ni); if (present != null) { return present.attrId; } final KeyedInstanceIdentifier<Node, NodeKey> nii = nodeInstanceId(ni); final InstanceIdentifier<IgpNodeAttributes> ret = nii.builder().augmentation(Node1.class).child(IgpNodeAttributes.class).build(); trans.merge(LogicalDatastoreType.OPERATIONAL, nii, new NodeBuilder().setKey(nii.getKey()).setNodeId(ni) .addAugmentation(Node1.class, new Node1Builder().setIgpNodeAttributes( new IgpNodeAttributesBuilder().setPrefix(Collections.<Prefix>emptyList()).build()).build()).build()); this.nodes.put(ni, new NodeUsage(ret)); return ret; }
public ProgrammingServiceImpl(final DataBroker dataProvider, final NotificationProviderService notifs, final ListeningExecutorService executor, final Timer timer, final InstructionsQueueKey instructionsQueueKey) { this.dataProvider = Preconditions.checkNotNull(dataProvider); this.notifs = Preconditions.checkNotNull(notifs); this.executor = Preconditions.checkNotNull(executor); this.timer = Preconditions.checkNotNull(timer); this.qid = KeyedInstanceIdentifier.builder(InstructionsQueue.class, instructionsQueueKey).build(); final WriteTransaction t = dataProvider.newWriteOnlyTransaction(); t.put(LogicalDatastoreType.OPERATIONAL, this.qid, new InstructionsQueueBuilder().setKey(instructionsQueueKey).setInstruction( Collections.<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.instruction.queue.Instruction> emptyList()).build()); t.submit(); }
void removeUnreportedFlows(final ReadWriteTransaction tx) { final InstanceIdentifier<Node> nodeIdent = tableRef.firstIdentifierOf(Node.class); final List<InstanceIdentifier<Flow>> listMissingConfigFlows = notStatReportedConfigFlows(); final Map<InstanceIdentifier<Flow>, Integer> nodeDeleteMap = mapNodesForDelete.get(nodeIdent); final Map<FlowHashIdMapKey, FlowId> listForRemove = getRemovalList(); for (final Entry<FlowHashIdMapKey, FlowId> entryForRemove : listForRemove.entrySet()) { final FlowKey flowKey = new FlowKey(entryForRemove.getValue()); final InstanceIdentifier<Flow> flowRef = tableRef.child(Flow.class, flowKey); if (nodeDeleteMap != null && flowKey.getId().getValue().startsWith(ALIEN_SYSTEM_FLOW_ID)) { final Integer lifeIndex = nodeDeleteMap.get(flowRef); if (lifeIndex > 0) { break; } else { nodeDeleteMap.remove(flowRef); } } else { if (listMissingConfigFlows.remove(flowRef)) { break; // we probably lost some multipart msg } } final InstanceIdentifier<FlowHashIdMap> flHashIdent = tableRef.augmentation(FlowHashIdMapping.class).child(FlowHashIdMap.class, entryForRemove.getKey()); tx.delete(LogicalDatastoreType.OPERATIONAL, flowRef); tx.delete(LogicalDatastoreType.OPERATIONAL, flHashIdent); } }
private void remove(final KeyedInstanceIdentifier<Node, NodeKey> sourcePath){ final InstanceIdentifier<Node1> augmentPath = sourcePath.augmentation(Node1.class); deleteData(OPERATIONAL, augmentPath); }
/** * Return the key associated with the last component of the specified identifier. * * @param id instance identifier * @return key associated with the last component * @throws IllegalArgumentException if the supplied identifier type cannot have a key. * @throws NullPointerException if id is null. */ public static <N extends Identifiable<K> & DataObject, K extends Identifier<N>> K keyOf(final InstanceIdentifier<N> id) { Preconditions.checkNotNull(id); Preconditions.checkArgument(id instanceof KeyedInstanceIdentifier, "%s does not have a key", id); @SuppressWarnings("unchecked") final K ret = ((KeyedInstanceIdentifier<N, K>)id).getKey(); return ret; }
@Deprecated public final InstanceIdentifier<Tables> tableInstanceIdentifier(final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) { return this.locRibReference.getInstanceIdentifier().builder().child(LocRib.class).child(Tables.class, new TablesKey(afi, safi)).build(); }
public static InstanceIdentifier<NodeConnector> nodeConnectorInstanceIdentifierFromDatapathIdPortno( final BigInteger datapathId, final Long portNo, final OpenflowVersion ofVersion, final KeyedInstanceIdentifier<Node, NodeKey> nodePath) { NodeConnectorId nodeConnectorId = nodeConnectorIdfromDatapathPortNo(datapathId, portNo, ofVersion); return nodePath.child(NodeConnector.class, new NodeConnectorKey(nodeConnectorId)); }
/** * Generates an Instance Identifier for an OVSDB QoS other config entry. * @param ovsdbNodeId the desired node id * @param qosEntryKey the key of the desired QoS entry * @return instance identifier */ public static InstanceIdentifier<QosOtherConfig> getQosOtherConfigIid(NodeId ovsdbNodeId, QosEntriesKey qosEntryKey) { InstanceIdentifier<QosOtherConfig> qosOtherConfigIid = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(UnimgrConstants.OVSDB_TOPOLOGY_ID)) .child(Node.class, new NodeKey(ovsdbNodeId)) .augmentation(OvsdbNodeAugmentation.class) .child(QosEntries.class, qosEntryKey) .child(QosOtherConfig.class, new QosOtherConfigKey(UnimgrConstants.QOS_MAX_RATE)); return qosOtherConfigIid; }
public static InstanceIdentifier<FabricNode> createFabricIId(FabricId fabricId) { return Constants.DOM_FABRICS_PATH.child(Node.class, new NodeKey(fabricId)) .augmentation(FabricNode.class); }
private void insert(final KeyedInstanceIdentifier<Node, NodeKey> sourcePath) { final NodeKey nodeKey = sourcePath.getKey(); final InstanceIdentifier<Node1> augmentPath = sourcePath.augmentation(Node1.class); final Node1 nodeAgument = new Node1Builder().setEventSourceNode(new NodeId(nodeKey.getNodeId().getValue())).build(); putData(OPERATIONAL, augmentPath, nodeAgument); }
/** * Return the key associated with the last component of the specified identifier. * * @param id instance identifier * @return key associated with the last component * @throws IllegalArgumentException if the supplied identifier type cannot have a key. * @throws NullPointerException if id is null. */ public static <N extends Identifiable<K> & DataObject, K extends Identifier<N>> K keyOf( final InstanceIdentifier<N> id) { requireNonNull(id); checkArgument(id instanceof KeyedInstanceIdentifier, "%s does not have a key", id); @SuppressWarnings("unchecked") final K ret = ((KeyedInstanceIdentifier<N, K>)id).getKey(); return ret; }
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 static InstanceIdentifier<TerminationPoint> createTpPath(TopologyId topoId, NodeId nodeId, TpId tpId) { return InstanceIdentifier.create(NetworkTopology.class) .child(Topology.class, new TopologyKey(topoId)) .child(Node.class, new NodeKey(nodeId)) .child(TerminationPoint.class, new TerminationPointKey(tpId)); }
/** * Generates an Instance Identifier for an OVSDB queue other config entry. * @param ovsdbNodeId the desired node id * @param queuesKey the key of the desired queue entry * @return instance identifier */ public static InstanceIdentifier<QueuesOtherConfig> getQueuesOtherConfigIid(NodeId ovsdbNodeId, QueuesKey queuesKey) { InstanceIdentifier<QueuesOtherConfig> queuesOtherConfig = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(UnimgrConstants.OVSDB_TOPOLOGY_ID)) .child(Node.class, new NodeKey(ovsdbNodeId)) .augmentation(OvsdbNodeAugmentation.class) .child(Queues.class, queuesKey) .child(QueuesOtherConfig.class, new QueuesOtherConfigKey(UnimgrConstants.QOS_MAX_RATE)); return queuesOtherConfig; }