本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes类的典型用法代码示例。如果您正苦于以下问题:Java Nodes类的具体用法?Java Nodes怎么用?Java Nodes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Nodes类属于org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819包,在下文中一共展示了Nodes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeTunnelTableEntry
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
private void removeTunnelTableEntry(BigInteger dpId, long label, WriteTransaction tx) {
FlowEntity flowEntity;
LOG.debug("remove terminatingServiceActions called with DpnId = {} and label = {}", dpId, label);
List<MatchInfo> mkMatches = new ArrayList<>();
// Matching metadata
mkMatches.add(new MatchTunnelId(BigInteger.valueOf(label)));
flowEntity = MDSALUtil.buildFlowEntity(dpId,
NwConstants.INTERNAL_TUNNEL_TABLE,
getTableMissFlowRef(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, (int) label),
5, String.format("%s:%d", "TST Flow Entry ", label), 0, 0,
COOKIE_TUNNEL.add(BigInteger.valueOf(label)), mkMatches, null);
Node nodeDpn = FibUtil.buildDpnNode(flowEntity.getDpnId());
FlowKey flowKey = new FlowKey(new FlowId(flowEntity.getFlowId()));
InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(flowEntity.getTableId())).child(Flow.class, flowKey).build();
tx.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
LOG.debug("Terminating service Entry for dpID {} : label : {} removed successfully", dpId, label);
}
示例2: getListOfDpns
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
public static List<BigInteger> getListOfDpns(DataBroker broker) {
List<BigInteger> dpnsList = new LinkedList<>();
InstanceIdentifier<Nodes> nodesInstanceIdentifier = InstanceIdentifier.builder(Nodes.class).build();
Optional<Nodes> nodesOptional =
MDSALUtil.read(broker, LogicalDatastoreType.OPERATIONAL, nodesInstanceIdentifier);
if (!nodesOptional.isPresent()) {
return dpnsList;
}
Nodes nodes = nodesOptional.get();
List<Node> nodeList = nodes.getNode();
for (Node node : nodeList) {
NodeId nodeId = node.getId();
if (nodeId == null) {
continue;
}
BigInteger dpnId = MDSALUtil.getDpnIdFromNodeName(nodeId);
dpnsList.add(dpnId);
}
return dpnsList;
}
示例3: getNodeResult
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
private boolean getNodeResult(List<CounterResult> counters, BigInteger dpId) {
InstanceIdentifier<Node> nodeInstanceIdentifier = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, new NodeKey(new NodeId(CountersUtils.getNodeId(dpId)))).build();
Optional<Node> nodeOptional = MDSALUtil.read(db, LogicalDatastoreType.OPERATIONAL, nodeInstanceIdentifier);
if (!nodeOptional.isPresent()) {
return false;
}
Node node = nodeOptional.get();
CounterResultDataStructure counterResultDS = counterRetriever.getNodeCountersDirect(node);
if (counterResultDS == null) {
return false;
}
createCounterResults(counters, counterResultDS);
return !counters.isEmpty();
}
示例4: getNodeAggregatedResult
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
private boolean getNodeAggregatedResult(List<CounterResult> aggregatedCounters, BigInteger dpId) {
InstanceIdentifier<Node> nodeInstanceIdentifier = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, new NodeKey(new NodeId(CountersUtils.getNodeId(dpId)))).build();
Optional<Node> nodeOptional = MDSALUtil.read(db, LogicalDatastoreType.OPERATIONAL, nodeInstanceIdentifier);
if (!nodeOptional.isPresent()) {
return false;
}
Node node = nodeOptional.get();
CounterResultDataStructure counters = counterRetriever.getNodeCountersDirect(node);
if (counters == null || counters.isEmpty()) {
return false;
}
CounterResultDataStructure aggregatedResultsDS =
CountersUtils.aggregateCounters(counters, CountersUtils.getNodeId(dpId));
createCounterResults(aggregatedCounters, aggregatedResultsDS);
return !aggregatedCounters.isEmpty();
}
示例5: deleteFibEntry
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
/**
* Delete fib entry.
*
* @param withdraws
* the withdraws
*/
private synchronized void deleteFibEntry(Collection<AtriumFibUpdate> withdraws) {
for (AtriumFibUpdate update : withdraws) {
AtriumFibEntry entry = update.entry();
NodeRef nodeRef = new NodeRef(
InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(deviceId)).build());
ForwardingObjectiveBuilder forwardingObjBuilder = generateRibForwardingObj(entry.prefix(), null);
if (forwardingObjBuilder != null) {
ForwardInputBuilder inputBuilder = new ForwardInputBuilder();
forwardingObjBuilder.setOperation(Operation.Remove);
inputBuilder.setNode(nodeRef);
inputBuilder.setForwardingObjective(forwardingObjBuilder.build());
LOG.info("Invoking forward objective in DIDM for fibEntry delete");
LOG.info("FIB Entry: " + forwardingObjBuilder.build());
flowObjectivesService.forward(inputBuilder.build());
FibDataModelWriter.deleteFib(update, dataBroker);
} else {
continue;
}
}
}
示例6: addArpFlowToController
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
public void addArpFlowToController(NodeId dpnId) {
NodeRef nodeRef = new NodeRef(
InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(dpnId)).build());
ForwardingObjectiveBuilder fwdObjBuilder = new ForwardingObjectiveBuilder();
fwdObjBuilder.setOperation(Operation.Add);
fwdObjBuilder.setFlag(Flag.Versatile);
MatchBuilder matchBuilder = new MatchBuilder();
EthernetMatch etherMatch = AtriumUtils.getEtherMatch(Bgprouter.ARP_ETH_TYPE);
matchBuilder.setEthernetMatch(etherMatch);
ActionData puntAction = new ActionData(ActionUtils.punt_to_controller, new String[] { null });
fwdObjBuilder.setMatch(matchBuilder.build());
List<Action> actions = new ArrayList<>();
actions.add(puntAction.buildAction());
fwdObjBuilder.setAction(actions);
ForwardInputBuilder forwardInputBuilderSrc = new ForwardInputBuilder();
forwardInputBuilderSrc.setNode(nodeRef);
forwardInputBuilderSrc.setForwardingObjective(fwdObjBuilder.build());
flowObjectivesService.forward(forwardInputBuilderSrc.build());
}
示例7: getNodeConnRef
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
/**
* Gets the node conn ref.
*
* @param nodeId
* the node id
* @param port
* the port
* @return the node conn ref
*/
public static NodeConnectorRef getNodeConnRef(final NodeId nodeId, final Long port) {
StringBuilder _stringBuilder = new StringBuilder(nodeId.getValue());
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);
NodeConnectorRef _nodeConnectorRef = new NodeConnectorRef(_child_1.build());
return _nodeConnectorRef;
}
示例8: testFloodArp
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
@Test
public void testFloodArp() {
Ipv4Address srcIpv4Address = Ipv4Address.getDefaultInstance("192.168.10.1");
Ipv4Address dstIpv4Address = Ipv4Address.getDefaultInstance("192.168.20.1");
MacAddress macAddress = new MacAddress("aa:bb:cc:dd:ee:ff");
ArpMessageAddress senderAddress = new ArpMessageAddress(macAddress, srcIpv4Address);
InstanceIdentifier<Node> instanceId = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, new NodeKey(new NodeId("node_001"))).toInstance();
Future<RpcResult<Void>> futureTransmitPacketResult = mock(Future.class);
when(packetProcessingService.transmitPacket(any(TransmitPacketInput.class)))
.thenReturn(futureTransmitPacketResult);
arpSender.floodArp(senderAddress, dstIpv4Address, instanceId);
verify(packetProcessingService, times(1)).transmitPacket(any(TransmitPacketInput.class));
}
示例9: testSendArpResponse
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
@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));
}
示例10: getGroup
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
private Group getGroup(GroupBuilder groupBuilder, NodeBuilder nodeBuilder) {
InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class)
.child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class,
nodeBuilder.getKey())
.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(groupBuilder.getGroupId()))
.build();
DataBroker databroker = getDataBroker();
ReadOnlyTransaction readTx = databroker.newReadOnlyTransaction();
try {
Optional<Group> data = readTx.read(LogicalDatastoreType.CONFIGURATION, path1).get();
if (data.isPresent()) {
return data.get();
}
} catch (InterruptedException | ExecutionException e) {
LOG.error(e.getMessage(), e);
}
LOG.debug("Cannot find data for Group " + groupBuilder.getGroupName());
return null;
}
示例11: writeGroup
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
private void writeGroup(GroupBuilder groupBuilder, NodeBuilder nodeBuilder) {
DataBroker databroker = getDataBroker();
ReadWriteTransaction modification = databroker.newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class)
.child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class,
nodeBuilder.getKey())
.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(groupBuilder.getGroupId()))
.build();
// modification.put(LogicalDatastoreType.CONFIGURATION, path1,
// groupBuilder.build(), true /*createMissingParents*/);
modification.merge(LogicalDatastoreType.CONFIGURATION, path1, groupBuilder.build(),
true /* createMissingParents */);
CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
try {
commitFuture.get();
LOG.debug("Transaction success for write of Group " + groupBuilder.getGroupName());
} catch (InterruptedException | ExecutionException e) {
LOG.error(e.getMessage(), e);
}
}
示例12: removeGroup
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
private void removeGroup(GroupBuilder groupBuilder, NodeBuilder nodeBuilder) {
DataBroker databroker = getDataBroker();
WriteTransaction modification = databroker.newWriteOnlyTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class)
.child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class,
nodeBuilder.getKey())
.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(groupBuilder.getGroupId()))
.build();
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
try {
commitFuture.get();
LOG.debug("Transaction success for deletion of Group " + groupBuilder.getGroupName());
} catch (InterruptedException | ExecutionException e) {
LOG.error(e.getMessage(), e);
}
}
示例13: getNodes
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
/**
* Retrieve all the {@link Node} along with a list of their
* associated {@link NodeConnector}.
* @return nodes A map with {@link Node} as the key and a {@link List} of {@link NodeConnector}.
*/
public static Map<Node, List<NodeConnector>> getNodes(final DataBroker dataBroker) {
Map<Node, List<NodeConnector>> nodeMap = new HashMap<Node, List<NodeConnector>>();
Nodes nodeList = new NodesBuilder().build();
ReadTransaction tx = dataBroker.newReadOnlyTransaction();
try {
final InstanceIdentifier<Nodes> nodesIdentifier = InstanceIdentifier.create(Nodes.class);
final CheckedFuture<Optional<Nodes>, ReadFailedException> txCheckedFuture = tx.read(LogicalDatastoreType
.OPERATIONAL, nodesIdentifier);
nodeList = txCheckedFuture.checkedGet().get();
for (Node node : nodeList.getNode()) {
LOG.info("Node ID : {}", node.getId());
List<NodeConnector> nodeConnector = node.getNodeConnector();
nodeMap.put(node, nodeConnector);
}
} catch (ReadFailedException e) {
//TODO: Perform fail over
LOG.error("Error reading Nodes from MD-SAL", e);
}
return nodeMap;
}
示例14: setUp
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
@Before
public void setUp() throws IntentInvalidException, ReadFailedException {
PowerMockito.mockStatic(IntentUtils.class);
PowerMockito.mockStatic(TopologyUtils.class);
PowerMockito.mockStatic(InstanceIdentifier.class);
final List<Actions> actions = Arrays.asList(actionsMock);
final List<NodeConnector> nodeConnectors = Arrays.asList(nodeConnectorMock);
final Map<Node, List<NodeConnector>> nodeConnectorsByNode = new HashMap<>();
nodeConnectorsByNode.put(nodeMock, nodeConnectors);
Mockito.when(intentMock.getActions()).thenReturn(actions);
Mockito.when(actionsMock.getAction()).thenReturn(actionMock);
Mockito.when(intentMock.getId()).thenReturn(Uuid.getDefaultInstance(UUID.randomUUID().toString()));
Mockito.when(TopologyUtils.getNodes(dataBrokerMock)).thenReturn(nodeConnectorsByNode);
Mockito.when(dataBrokerMock.newReadOnlyTransaction()).thenReturn(readOnlyTransactionMock);
Mockito.when(InstanceIdentifier.create(Nodes.class)).thenReturn(instanceIdentifierMock);
Mockito.when(readOnlyTransactionMock.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifierMock)).thenReturn(checkedFutureMock);
Mockito.when(checkedFutureMock.checkedGet()).thenReturn(nodesOptionalMock);
Mockito.when(nodesOptionalMock.get()).thenReturn(nodeListMock);
defaultExecutorMock = new DefaultExecutor(intentFlowManagerMock, dataBrokerMock);
}
示例15: removeTap
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入依赖的package包/类
private void removeTap(Tap tap) {
NodeId nodeId = tap.getNode();
String tapId = tap.getId();
String flowIdStr = "Tap_" + tapId + "SrcPort_"; // TODO: Concat srcNodeConnector to each flow;
FlowId flowId = new FlowId(flowIdStr);
FlowBuilder flowBuilder = new FlowBuilder()
.setKey(new FlowKey(flowId))
.setId(flowId)
.setTableId((short)0);
InstanceIdentifier<Flow> flowIID = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, new NodeKey(nodeId))
.augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(flowBuilder.getTableId()))
.child(Flow.class, flowBuilder.getKey())
.build();
GenericTransactionUtils.writeData(dataBroker, LogicalDatastoreType.CONFIGURATION, flowIID, flowBuilder.build(), false);
}