public Group getGroup(GroupKey groupkey, NodeKey nodeKey ) { InstanceIdentifier<Group> lacpGId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Group.class, groupkey).toInstance(); ReadOnlyTransaction readTx = dataService.newReadOnlyTransaction(); try { Optional<Group> readGroup = readTx.read(LogicalDatastoreType.CONFIGURATION, lacpGId).get(); if (readGroup.isPresent()) { return readGroup.get(); } } catch (InterruptedException|ExecutionException e) { LOG.error(e.toString(), e); } LOG.warn("readgrp returning null"); return null; }
private InstanceIdentifier<Node> obtainNodeIdFromEntity(Entity entity) { LOG.debug ("in obtainNodeIdFromEntity for entity {}", entity.getId()); NodeIdentifierWithPredicates node = (NodeIdentifierWithPredicates)entity.getId().getLastPathArgument(); String nodeValue = (String)node.getKeyValues().values().iterator().next(); InstanceIdentifier<Node> nodeId = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(new NodeId(nodeValue))).toInstance(); LOG.debug("nodeid returned for entity {}", nodeId); return nodeId; }
private static NodeConnectorRef getNodeConnRef(final String nodeId, final String port) { StringBuilder _stringBuilder = new StringBuilder(nodeId); StringBuilder _append = _stringBuilder.append(":"); StringBuilder sBuild = _append.append(port); String _string = sBuild.toString(); NodeConnectorId _nodeConnectorId = new NodeConnectorId(_string); NodeConnectorKey _nodeConnectorKey = new NodeConnectorKey(_nodeConnectorId); NodeConnectorKey nConKey = _nodeConnectorKey; InstanceIdentifierBuilder<Nodes> _builder = InstanceIdentifier.<Nodes> builder(Nodes.class); NodeId _nodeId = new NodeId(nodeId); NodeKey _nodeKey = new NodeKey(_nodeId); InstanceIdentifierBuilder<Node> _child = _builder.<Node, NodeKey> child(Node.class, _nodeKey); InstanceIdentifierBuilder<NodeConnector> _child_1 = _child.<NodeConnector, NodeConnectorKey> child( NodeConnector.class, nConKey); InstanceIdentifier<NodeConnector> path = _child_1.toInstance(); NodeConnectorRef _nodeConnectorRef = new NodeConnectorRef(path); return _nodeConnectorRef; }
private LinkRemoved makeRemoveLink(Edge edge){ String headNodeIdStr = null, tailNodeIdStr = null, headNcIdStr = null, tailNcIdStr = null; boolean bool = TopologyServiceUtil.getNodeAndNcIdString(edge, headNodeIdStr, tailNodeIdStr, headNcIdStr, tailNcIdStr); if(bool == false){ logger.debug("ERROR: makeAddLink(): given Edge {}, call TopologyServiceUtil.getNodeAndNcIdString() fail", edge); return null; } NodeId localNodeId = new NodeId(headNodeIdStr); NodeConnectorId localNodeConnectorId = new NodeConnectorId(headNcIdStr); InstanceIdentifier<NodeConnector> localInstanceIdentifier = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(localNodeId)) .child(NodeConnector.class, new NodeConnectorKey(localNodeConnectorId)).toInstance(); NodeConnectorRef localNodeConnectorRef = new NodeConnectorRef(localInstanceIdentifier); NodeId remoteNodeId = new NodeId(tailNodeIdStr); NodeConnectorId remoteNodeConnectorId = new NodeConnectorId(tailNcIdStr); InstanceIdentifier<NodeConnector> remoteInstanceIdentifier = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(remoteNodeId)) .child(NodeConnector.class, new NodeConnectorKey(remoteNodeConnectorId)).toInstance(); NodeConnectorRef remoteNodeConnectorRef = new NodeConnectorRef(remoteInstanceIdentifier); LinkRemovedBuilder ldb = new LinkRemovedBuilder(); ldb.setSource(remoteNodeConnectorRef); ldb.setDestination(localNodeConnectorRef); return((ldb.build())); }
/** * Deletes a SFG Algorithm from the datastore <p> * @param serviceFunctionGroupAlgorithmName SFG Algorithm name * @return boolean success of failure */ protected static boolean deleteServiceFunctionGroupAlgorithm(String serviceFunctionGroupAlgorithmName) { boolean ret = false; printTraceStart(LOG); ServiceFunctionGroupAlgorithmKey serviceFunctionGroupAlgorithmKey = new ServiceFunctionGroupAlgorithmKey(serviceFunctionGroupAlgorithmName); InstanceIdentifier<ServiceFunctionGroupAlgorithm> sfgAlgEntryIID = InstanceIdentifier.builder(ServiceFunctionGroupAlgorithms.class).child(ServiceFunctionGroupAlgorithm.class, serviceFunctionGroupAlgorithmKey).toInstance(); if (SfcDataStoreAPI.deleteTransactionAPI(sfgAlgEntryIID, LogicalDatastoreType.CONFIGURATION)) { ret = true; } else { LOG.error("{}: Could not delete SFG Algorithm: {}", Thread.currentThread().getStackTrace()[1], serviceFunctionGroupAlgorithmName); } printTraceStop(LOG); return ret; }
public Future<RpcResult<Void>> sendPacketOut(BigInteger dpnId, byte[] payload, NodeConnectorRef ref) { NodeConnectorRef nodeConnectorRef = MDSALUtil.getNodeConnRef(dpnId, "0xfffffffd"); return packetProcessingService .transmitPacket(new TransmitPacketInputBuilder() .setPayload(payload) .setNode( new NodeRef(InstanceIdentifier .builder(Nodes.class) .child(Node.class, new NodeKey(new NodeId( "openflow:" + dpnId))) .toInstance())) .setIngress(nodeConnectorRef).setEgress(ref).build()); }
public Future<RpcResult<Void>> sendPacketOutWithActions(BigInteger dpnId, byte[] payload, NodeConnectorRef ref, List<Action> actions) { NodeConnectorRef nodeConnectorRef = MDSALUtil.getNodeConnRef(dpnId, "0xfffffffd"); return packetProcessingService .transmitPacket(new TransmitPacketInputBuilder() .setPayload(payload) .setNode( new NodeRef(InstanceIdentifier .builder(Nodes.class) .child(Node.class, new NodeKey(new NodeId( "openflow:" + dpnId))) .toInstance())) .setIngress(nodeConnectorRef).setEgress(ref) .setAction(actions).build()); }
public InstanceIdentifier<Node> nodeToInstanceId(Node node) { return InstanceIdentifier.builder(Nodes.class).child(Node.class, node.getKey()).toInstance(); }
public void addDownTime(String secKey, String downtime) { LowwatermarkKey seclwmKey = new LowwatermarkKey(secKey); InstanceIdentifier<Lowwatermark> secLwmId = InstanceIdentifier.builder(LWM.class).child(Lowwatermark.class, seclwmKey).toInstance(); WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction(); LowwatermarkBuilder lowWaterMarkBuilder = new LowwatermarkBuilder(); lowWaterMarkBuilder.setSecKey(secKey); lowWaterMarkBuilder.setDownwardTime(downtime); Lowwatermark lwmElements = lowWaterMarkBuilder.build(); lwmList.add(lwmElements); writeTransaction.merge(LogicalDatastoreType.OPERATIONAL, secLwmId, lwmElements); writeTransaction.commit(); LOG.debug("Downward Time is added for entry with key ", secKey); }
private InstanceIdentifier<DeviceTypeInfo> createPath(String name) { return InstanceIdentifier.<DeviceTypes> builder(DeviceTypes.class) .<DeviceTypeInfo, DeviceTypeInfoKey> child(DeviceTypeInfo.class, new DeviceTypeInfoKey(name)) .toInstance(); }
public static NodeRef toNodeRef(final org.opendaylight.controller.sal.core.Node node) { Preconditions.checkArgument(NodeIDType.OPENFLOW.equals(node.getType())); final Long nodeId = Arguments.<Long>checkInstanceOf(node.getID(), Long.class); final NodeKey nodeKey = new NodeKey(new NodeId(OPENFLOW_ID_PREFIX + nodeId)); final InstanceIdentifier<Node> nodePath = InstanceIdentifier.builder(Nodes.class).child(NODE_CLASS, nodeKey).toInstance(); return new NodeRef(nodePath); }
/** * Puts a SFG Algorithm in the datastore <p> * @param sfgAlg the ServiceFunctionGroupAlgorithm to put * @return boolean success or failure */ protected static boolean putServiceFunctionGroupAlgorithm(ServiceFunctionGroupAlgorithm sfgAlg) { boolean ret; printTraceStart(LOG); InstanceIdentifier<ServiceFunctionGroupAlgorithm> sfgAlgEntryIID = InstanceIdentifier.builder(ServiceFunctionGroupAlgorithms.class).child(ServiceFunctionGroupAlgorithm.class, sfgAlg.getKey()).toInstance(); ret = SfcDataStoreAPI.writePutTransactionAPI(sfgAlgEntryIID, sfgAlg, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return ret; }
public void addHwmDownTime(String secKey, String downtime) { HighwatermarkKey sechwmKey = new HighwatermarkKey(secKey); InstanceIdentifier<Highwatermark> secHwmId = InstanceIdentifier.builder(HWM.class).child(Highwatermark.class, sechwmKey).toInstance(); WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction(); HighwatermarkBuilder highWaterMarkBuilder = new HighwatermarkBuilder(); highWaterMarkBuilder.setSecKey(secKey); highWaterMarkBuilder.setDownwardTime(downtime); Highwatermark hwmElements = highWaterMarkBuilder.build(); hwmList.add(hwmElements); writeTransaction.merge(LogicalDatastoreType.OPERATIONAL, secHwmId, hwmElements); writeTransaction.commit(); LOG.debug("Downward Time is added for entry with key ", secKey); }
void addFlowExample() { DataBrokerService dataService = context.getSALService(DataBrokerService.class); DataModificationTransaction transaction = dataService.beginTransaction(); Flow flow = createSampleFlow("foo", null); InstanceIdentifier<Flow> path = InstanceIdentifier.builder().node(Flows.class).node(Flow.class, flow.getKey()) .toInstance(); transaction.putConfigurationData(path, flow); transaction.commit(); dataService.readConfigurationData(path); }
public void delHwmData(String secKey) { HighwatermarkKey sechwmKey = new HighwatermarkKey(secKey); InstanceIdentifier<Highwatermark> secHwmId = InstanceIdentifier.builder(HWM.class).child(Highwatermark.class, sechwmKey).toInstance(); WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction(); writeTransaction.delete(LogicalDatastoreType.OPERATIONAL, secHwmId); writeTransaction.commit(); LOG.debug("Data Store Entry is deleted for key ", secKey); }
private static final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow> flowPath( final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow flow, final NodeKey nodeKey) { return InstanceIdentifier.builder(Nodes.class) .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, nodeKey) .augmentation(FlowCapableNode.class) .child(Table.class, new TableKey(flow.getTableId())) .child(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow.class, new FlowKey(flow.getId())) .toInstance(); }
public void delData(String secKey) { LowwatermarkKey seclwmKey = new LowwatermarkKey(secKey); InstanceIdentifier<Lowwatermark> secLwmId = InstanceIdentifier.builder(LWM.class).child(Lowwatermark.class, seclwmKey).toInstance(); WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction(); writeTransaction.delete(LogicalDatastoreType.OPERATIONAL, secLwmId); writeTransaction.commit(); LOG.debug("Data Store Entry is deleted for key ", secKey); }
public InstanceIdentifier<Flows> apply() { InstanceIdentifierBuilder<? extends Object> _builder = InstanceIdentifier.builder(); InstanceIdentifierBuilder<Flows> _node = _builder.<Flows>node(Flows.class); InstanceIdentifier<Flows> _instance = _node.toInstance(); return _instance; } }.apply();
public static NodeRef toNodeRef(final org.opendaylight.controller.sal.core.Node node) { final NodeKey nodeKey = new NodeKey(new NodeId(InventoryMapping.toNodeId(node))); final InstanceIdentifier<Node> path = InstanceIdentifier.builder(Nodes.class) .child(Node.class, nodeKey).toInstance(); return new NodeRef(path); }
private org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector readConfigNodeConnector(final NodeConnector connector) { final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector> nodeConnectorRef = InstanceIdentifier.builder(Nodes.class) .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, InventoryMapping.toNodeKey(connector.getNode())) .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector.class, InventoryMapping.toNodeConnectorKey(connector)) .toInstance(); return((org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) startChange().readConfigurationData(nodeConnectorRef)); }