Java Code Examples for org.opendaylight.yangtools.yang.binding.InstanceIdentifier#child()
The following examples show how to use
org.opendaylight.yangtools.yang.binding.InstanceIdentifier#child() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArpSenderTest.java From atrium-odl with Apache License 2.0 | 6 votes |
@Test public void testSendArpResponse() { Ipv4Address srcIpv4Address = Ipv4Address.getDefaultInstance("192.168.20.1"); Ipv4Address dstIpv4Address = Ipv4Address.getDefaultInstance("192.168.10.1"); MacAddress srcMacAddress = new MacAddress("aa:bb:cc:dd:ee:00"); MacAddress dstMacAddress = new MacAddress("aa:bb:cc:dd:ee:ff"); ArpMessageAddress senderAddress = new ArpMessageAddress(srcMacAddress, srcIpv4Address); ArpMessageAddress receiverAddress = new ArpMessageAddress(dstMacAddress, dstIpv4Address); InstanceIdentifier<Node> instanceId = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(new NodeId("node_001"))).toInstance(); NodeConnectorKey nodeConnectorKey = new NodeConnectorKey(new NodeConnectorId("node_001:0xfffffffc")); InstanceIdentifier<NodeConnector> egressNc = instanceId.child(NodeConnector.class, nodeConnectorKey); Future<RpcResult<Void>> futureTransmitPacketResult = mock(Future.class); when(packetProcessingService.transmitPacket(any(TransmitPacketInput.class))) .thenReturn(futureTransmitPacketResult); arpSender.sendArpResponse(senderAddress, receiverAddress, egressNc, null); verify(packetProcessingService, times(1)).transmitPacket(any(TransmitPacketInput.class)); }
Example 2
Source File: BridgeConfigReconciliationTaskTest.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
private Map<InstanceIdentifier<?>, DataObject> createExpectedConfigurationChanges(final Node bridgeNode) { OvsdbBridgeAugmentation ovsdbBridge = bridgeNode.augmentation(OvsdbBridgeAugmentation.class); Map<InstanceIdentifier<?>, DataObject> changes = new HashMap<>(); final InstanceIdentifier<Node> bridgeNodeIid = SouthboundMapper.createInstanceIdentifier(bridgeNode.getNodeId()); final InstanceIdentifier<OvsdbBridgeAugmentation> ovsdbBridgeIid = bridgeNodeIid.builder().augmentation(OvsdbBridgeAugmentation.class).build(); changes.put(bridgeNodeIid, bridgeNode); changes.put(ovsdbBridgeIid, ovsdbBridge); for (ProtocolEntry protocolEntry : ovsdbBridge.getProtocolEntry().values()) { KeyedInstanceIdentifier<ProtocolEntry, ProtocolEntryKey> protocolIid = ovsdbBridgeIid.child(ProtocolEntry.class, protocolEntry.key()); changes.put(protocolIid, protocolEntry); } for (ControllerEntry controller : ovsdbBridge.getControllerEntry().values()) { KeyedInstanceIdentifier<ControllerEntry, ControllerEntryKey> controllerIid = ovsdbBridgeIid.child(ControllerEntry.class, controller.key()); changes.put(controllerIid, controller); } return changes; }
Example 3
Source File: NodeChangedListener.java From bgpcep with Eclipse Public License 1.0 | 6 votes |
private InstanceIdentifier<TerminationPoint> createTP(final IpAddress addr, final InstanceIdentifier<Node> sni, final Boolean inControl, final ReadWriteTransaction trans) { final String url = "ip://" + addr.toString(); final TerminationPointKey tpk = new TerminationPointKey(new TpId(url)); final TerminationPointBuilder tpb = new TerminationPointBuilder(); tpb.withKey(tpk).setTpId(tpk.getTpId()); tpb.addAugmentation(new TerminationPoint1Builder() .setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder() .setTerminationPointType(new IpBuilder().setIpAddress(Lists.newArrayList(addr)).build()) .build()) .build()); final NodeKey nk = new NodeKey(new NodeId(url)); final NodeBuilder nb = new NodeBuilder(); nb.withKey(nk).setNodeId(nk.getNodeId()); nb.setTerminationPoint(Lists.newArrayList(tpb.build())); if (sni != null) { nb.setSupportingNode(Lists.newArrayList(createSupportingNode(InstanceIdentifier.keyOf(sni).getNodeId(), inControl))); } final InstanceIdentifier<Node> nid = this.target.child(Node.class, nb.key()); trans.put(LogicalDatastoreType.OPERATIONAL, nid, nb.build()); return nid.child(TerminationPoint.class, tpb.key()); }
Example 4
Source File: PhysicalPortUpdateCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
public void updatePhysicalPort(final TransactionBuilder transaction, final InstanceIdentifier<Node> psNodeiid, final List<TerminationPoint> listPort) { if (listPort != null) { for (TerminationPoint port : listPort) { LOG.debug("Processing port {}", port); InstanceIdentifier<TerminationPoint> tpIId = psNodeiid.child(TerminationPoint.class, port.key()); HwvtepPhysicalPortAugmentation hwvtepPhysicalPortAugmentation = port.augmentation(HwvtepPhysicalPortAugmentation.class); if (hwvtepPhysicalPortAugmentation != null) { onConfigUpdate(transaction, psNodeiid, port, tpIId); } } } }
Example 5
Source File: TopologyNodeState.java From bgpcep with Eclipse Public License 1.0 | 5 votes |
TopologyNodeState(final DataBroker broker, final InstanceIdentifier<Topology> topology, final NodeId id, final long holdStateNanos) { Preconditions.checkArgument(holdStateNanos >= 0); this.nodeId = topology.child(Node.class, new NodeKey(id)); this.holdStateNanos = holdStateNanos; this.chain = broker.createMergingTransactionChain(this); }
Example 6
Source File: OvsdbPortUpdateCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
@SuppressWarnings("unchecked") @VisibleForTesting InstanceIdentifier<TerminationPoint> getInstanceIdentifier(InstanceIdentifier<Node> bridgeIid,Port port) { if (port.getExternalIdsColumn() != null && port.getExternalIdsColumn().getData() != null && port.getExternalIdsColumn().getData().containsKey(SouthboundConstants.IID_EXTERNAL_ID_KEY)) { String iidString = port.getExternalIdsColumn().getData().get(SouthboundConstants.IID_EXTERNAL_ID_KEY); return (InstanceIdentifier<TerminationPoint>) instanceIdentifierCodec.bindingDeserializerOrNull(iidString); } else { return bridgeIid.child(TerminationPoint.class, new TerminationPointKey(new TpId(port.getName()))); } }
Example 7
Source File: OvsdbQosUpdateCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
private void removeOldQueues(ReadWriteTransaction transaction, QosEntriesBuilder qosEntryBuilder, Map<Long, UUID> oldQueueList, Qos qos, InstanceIdentifier<Node> nodeIId) { InstanceIdentifier<QosEntries> qosIId = nodeIId .augmentation(OvsdbNodeAugmentation.class) .child(QosEntries.class, qosEntryBuilder.build().key()); Collection<Long> queueListKeys = oldQueueList.keySet(); for (Long queueListKey : queueListKeys) { KeyedInstanceIdentifier<QueueList, QueueListKey> otherIId = qosIId.child(QueueList.class, new QueueListKey(Long.valueOf(queueListKey.toString()))); transaction.delete(LogicalDatastoreType.OPERATIONAL, otherIId); } }
Example 8
Source File: OvsdbQosUpdateCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
private void removeOldExternalIds(ReadWriteTransaction transaction, QosEntriesBuilder qosEntryBuilder, Map<String, String> oldExternalIds, Qos qos, InstanceIdentifier<Node> nodeIId) { InstanceIdentifier<QosEntries> qosIId = nodeIId .augmentation(OvsdbNodeAugmentation.class) .child(QosEntries.class, qosEntryBuilder.build().key()); Set<String> externalIdsKeys = oldExternalIds.keySet(); for (String extIdKey : externalIdsKeys) { KeyedInstanceIdentifier<QosExternalIds, QosExternalIdsKey> externalIId = qosIId .child(QosExternalIds.class, new QosExternalIdsKey(extIdKey)); transaction.delete(LogicalDatastoreType.OPERATIONAL, externalIId); } }
Example 9
Source File: BridgeConfigReconciliationTask.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
private static Map<InstanceIdentifier<?>, DataObject> extractBridgeConfigurationChanges( final Node bridgeNode, final OvsdbBridgeAugmentation ovsdbBridge) { Map<InstanceIdentifier<?>, DataObject> changes = new HashMap<>(); final InstanceIdentifier<Node> bridgeNodeIid = SouthboundMapper.createInstanceIdentifier(bridgeNode.getNodeId()); final InstanceIdentifier<OvsdbBridgeAugmentation> ovsdbBridgeIid = bridgeNodeIid.builder().augmentation(OvsdbBridgeAugmentation.class).build(); changes.put(bridgeNodeIid, bridgeNode); changes.put(ovsdbBridgeIid, ovsdbBridge); final Map<ProtocolEntryKey, ProtocolEntry> protocols = ovsdbBridge.getProtocolEntry(); if (protocols != null) { for (ProtocolEntry protocol : protocols.values()) { if (SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocol.getProtocol()) != null) { KeyedInstanceIdentifier<ProtocolEntry, ProtocolEntryKey> protocolIid = ovsdbBridgeIid.child(ProtocolEntry.class, protocol.key()); changes.put(protocolIid, protocol); } else { throw new IllegalArgumentException("Unknown protocol " + protocol.getProtocol()); } } } final Map<ControllerEntryKey, ControllerEntry> controllers = ovsdbBridge.getControllerEntry(); if (controllers != null) { for (ControllerEntry controller : controllers.values()) { KeyedInstanceIdentifier<ControllerEntry, ControllerEntryKey> controllerIid = ovsdbBridgeIid.child(ControllerEntry.class, controller.key()); changes.put(controllerIid, controller); } } return changes; }
Example 10
Source File: OvsdbQosUpdateCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
private void removeOldConfigs(ReadWriteTransaction transaction, QosEntriesBuilder qosEntryBuilder, Map<String, String> oldOtherConfigs, Qos qos, InstanceIdentifier<Node> nodeIId) { InstanceIdentifier<QosEntries> qosIId = nodeIId .augmentation(OvsdbNodeAugmentation.class) .child(QosEntries.class, qosEntryBuilder.build().key()); Set<String> otherConfigKeys = oldOtherConfigs.keySet(); for (String otherConfigKey : otherConfigKeys) { KeyedInstanceIdentifier<QosOtherConfig, QosOtherConfigKey> otherIId = qosIId .child(QosOtherConfig.class, new QosOtherConfigKey(otherConfigKey)); transaction.delete(LogicalDatastoreType.OPERATIONAL, otherIId); } }
Example 11
Source File: OpenVSwitchUpdateCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
@VisibleForTesting void removeExternalIds(ReadWriteTransaction transaction, Map<String, String> oldExternalIds, OpenVSwitch ovs) { InstanceIdentifier<OvsdbNodeAugmentation> nodeAugmentataionIid = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)) .child(Node.class, new NodeKey(getNodeId(ovs))) .augmentation(OvsdbNodeAugmentation.class); Set<String> externalIdKeys = oldExternalIds.keySet(); for (String externalIdKey : externalIdKeys) { KeyedInstanceIdentifier<OpenvswitchExternalIds, OpenvswitchExternalIdsKey> externalIid = nodeAugmentataionIid .child(OpenvswitchExternalIds.class, new OpenvswitchExternalIdsKey(externalIdKey)); transaction.delete(LogicalDatastoreType.OPERATIONAL, externalIid); } }
Example 12
Source File: OvsdbQueueUpdateCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
private void removeOldConfigs(ReadWriteTransaction transaction, QueuesBuilder queuesBuilder, Map<String, String> oldOtherConfigs, Queue queue, InstanceIdentifier<Node> nodeIId) { InstanceIdentifier<Queues> queueIId = nodeIId .augmentation(OvsdbNodeAugmentation.class) .child(Queues.class, queuesBuilder.build().key()); Set<String> otherConfigKeys = oldOtherConfigs.keySet(); for (String otherConfigKey : otherConfigKeys) { KeyedInstanceIdentifier<QueuesOtherConfig, QueuesOtherConfigKey> otherIId = queueIId .child(QueuesOtherConfig.class, new QueuesOtherConfigKey(otherConfigKey)); transaction.delete(LogicalDatastoreType.OPERATIONAL, otherIId); } }
Example 13
Source File: OvsdbQueueUpdateCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
private void removeOldExternalIds(ReadWriteTransaction transaction, QueuesBuilder queuesBuilder, Map<String, String> oldExternalIds, Queue queue, InstanceIdentifier<Node> nodeIId) { InstanceIdentifier<Queues> queueIId = nodeIId .augmentation(OvsdbNodeAugmentation.class) .child(Queues.class, queuesBuilder.build().key()); Set<String> externalIdsKeys = oldExternalIds.keySet(); for (String extIdKey : externalIdsKeys) { KeyedInstanceIdentifier<QueuesExternalIds, QueuesExternalIdsKey> externalIId = queueIId .child(QueuesExternalIds.class, new QueuesExternalIdsKey(extIdKey)); transaction.delete(LogicalDatastoreType.OPERATIONAL, externalIId); } }
Example 14
Source File: HwvtepSouthboundMapper.java From ovsdb with Eclipse Public License 1.0 | 4 votes |
public static InstanceIdentifier<TerminationPoint> createInstanceIdentifier(InstanceIdentifier<Node> nodeIid, PhysicalLocator physicalLocator) { return nodeIid.child(TerminationPoint.class, getTerminationPointKey(physicalLocator)); }
Example 15
Source File: TestBuilders.java From ovsdb with Eclipse Public License 1.0 | 4 votes |
public static InstanceIdentifier<TerminationPoint> buildTpId(InstanceIdentifier<Node> nodeIid,String tepIp) { String tpKeyStr = VXLAN_OVER_IPV4 + ':' + tepIp; TerminationPointKey tpKey = new TerminationPointKey(new TpId(tpKeyStr)); return nodeIid.child(TerminationPoint.class, tpKey); }
Example 16
Source File: NodeChangedListener.java From bgpcep with Eclipse Public License 1.0 | 4 votes |
public static InstanceIdentifier<Link> linkIdentifier(final InstanceIdentifier<Topology> topology, final NodeId node, final String name) { return topology.child(Link.class, new LinkKey(new LinkId(node.getValue() + "/lsp/" + name))); }
Example 17
Source File: TunnelProgrammingUtil.java From bgpcep with Eclipse Public License 1.0 | 4 votes |
public static InstanceIdentifier<Link> linkIdentifier(final InstanceIdentifier<Topology> topology, final BaseTunnelInput input) { requireNonNull(input.getLinkId()); return topology.child(Link.class, new LinkKey(input.getLinkId())); }
Example 18
Source File: AbstractRIBSupportTest.java From bgpcep with Eclipse Public License 1.0 | 4 votes |
private InstanceIdentifier<S> routesIId() { final InstanceIdentifier<Tables> tables = tablesIId(); return tables.child(this.abstractRIBSupport.routesCaseClass(), this.abstractRIBSupport.routesContainerClass()); }
Example 19
Source File: AbstractTopologySessionListener.java From bgpcep with Eclipse Public License 1.0 | 4 votes |
@Override public final synchronized void onSessionUp(final PCEPSession psession) { /* * The session went up. Look up the router in Inventory model, * create it if it is not there (marking that fact for later * deletion), and mark it as synchronizing. Also create it in * the topology model, with empty LSP list. */ final InetAddress peerAddress = psession.getRemoteAddress(); this.syncOptimization = new SyncOptimization(psession); final TopologyNodeState state = this.serverSessionManager.takeNodeState(peerAddress, this, isLspDbRetreived()); // takeNodeState(..) may fail when the server session manager is being restarted due to configuration change if (state == null) { LOG.error("Unable to fetch topology node state for PCEP session. Closing session {}", psession); psession.close(TerminationReason.UNKNOWN); this.onSessionTerminated(psession, new PCEPCloseTermination(TerminationReason.UNKNOWN)); return; } if (this.session != null || this.nodeState != null) { LOG.error("PCEP session is already up with {}. Closing session {}", psession.getRemoteAddress(), psession); psession.close(TerminationReason.UNKNOWN); this.onSessionTerminated(psession, new PCEPCloseTermination(TerminationReason.UNKNOWN)); return; } this.session = psession; this.nodeState = state; LOG.trace("Peer {} resolved to topology node {}", peerAddress, state.getNodeId()); // Our augmentation in the topology node final PathComputationClientBuilder pccBuilder = new PathComputationClientBuilder(); onSessionUp(psession, pccBuilder); this.synced.set(isSynchronized()); pccBuilder.setIpAddress(IetfInetUtil.INSTANCE.ipAddressNoZoneFor(peerAddress)); final InstanceIdentifier<Node1> topologyAugment = state.getNodeId().augmentation(Node1.class); this.pccIdentifier = topologyAugment.child(PathComputationClient.class); final Node initialNodeState = state.getInitialNodeState(); final boolean isNodePresent = isLspDbRetreived() && initialNodeState != null; if (isNodePresent) { loadLspData(initialNodeState, this.lspData, this.lsps, isIncrementalSynchro()); pccBuilder.setReportedLsp(initialNodeState.augmentation(Node1.class) .getPathComputationClient().getReportedLsp()); } state.storeNode(topologyAugment, new Node1Builder().setPathComputationClient(pccBuilder.build()).build(), this.session); this.listenerState.init(psession); this.serverSessionManager.bind(this.nodeState.getNodeId(), this.listenerState); LOG.info("Session with {} attached to topology node {}", psession.getRemoteAddress(), state.getNodeId()); }
Example 20
Source File: CreateTunnelInstructionExecutor.java From bgpcep with Eclipse Public License 1.0 | 4 votes |
TpReader(final ReadTransaction rt, final InstanceIdentifier<Topology> topo, final TpReference ref) { this.rt = requireNonNull(rt); this.nii = topo.child(Node.class, new NodeKey(ref.getNode())); this.tii = this.nii.child(TerminationPoint.class, new TerminationPointKey(ref.getTp())); }