当前位置: 首页>>代码示例>>Java>>正文


Java NodeKey类代码示例

本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey的典型用法代码示例。如果您正苦于以下问题:Java NodeKey类的具体用法?Java NodeKey怎么用?Java NodeKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NodeKey类属于org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes包,在下文中一共展示了NodeKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: remove

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的package包/类
@Override
protected void remove(InstanceIdentifier<FlowCapableNode> key, FlowCapableNode dataObjectModification) {
    NodeKey nodeKey = key.firstKeyOf(Node.class);
    BigInteger dpnId = MDSALUtil.getDpnIdFromNodeName(nodeKey.getId());
    if (!aclDataUtil.doesDpnHaveAclInterface(dpnId)) {
        // serialize ACL pool deletion per switch
        jobCoordinator.enqueueJob(String.valueOf(dpnId), () -> {
            this.aclServiceUtils.deleteAclIdPools(dpnId);
            return Collections.emptyList();
        });
        LOG.debug("On FlowCapableNode remove event, ACL pools for dpid: {} are deleted.", dpnId);
    } else {
        LOG.info("On FlowCapableNode remove event, ACL pools for dpid: {} are not deleted "
            + "because ACL ports are associated.", dpnId);
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:17,代码来源:AclNodeListener.java

示例2: getNodeResult

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的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();
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:19,代码来源:StatisticsImpl.java

示例3: getNodeAggregatedResult

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的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();

}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:21,代码来源:StatisticsImpl.java

示例4: deleteFibEntry

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的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;
		}
	}

}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:31,代码来源:Bgprouter.java

示例5: addArpFlowToController

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的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());

	}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:26,代码来源:Bgprouter.java

示例6: getNodeConnRef

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的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;
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:27,代码来源:AtriumUtils.java

示例7: testFloodArp

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的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));
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:19,代码来源:ArpSenderTest.java

示例8: testSendArpResponse

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的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));
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:25,代码来源:ArpSenderTest.java

示例9: removeTap

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的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);
}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:18,代码来源:TutorialTapProvider.java

示例10: add

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的package包/类
@Override
protected void add(InstanceIdentifier<FlowCapableNode> key, FlowCapableNode dataObjectModification) {
    LOG.trace("FlowCapableNode Added: key: {}", key);
    NodeKey nodeKey = key.firstKeyOf(Node.class);
    BigInteger dpnId = MDSALUtil.getDpnIdFromNodeName(nodeKey.getId());
    createTableDefaultEntries(dpnId);
    // serialize ACL pool creation per switch
    jobCoordinator.enqueueJob(String.valueOf(dpnId), () -> {
        this.aclServiceUtils.createAclIdPools(dpnId);
        return Collections.emptyList();
    });
    LOG.trace("FlowCapableNode (dpid: {}) add event is processed.", dpnId);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:14,代码来源:AclNodeListener.java

示例11: pollDirectStatisticsForAllNodes

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的package包/类
private void pollDirectStatisticsForAllNodes() {
    LOG.trace("Polling direct statistics from nodes");

    for (Entry<BigInteger, ConcurrentMap<String, QosAlertPortData>> entry : qosAlertDpnPortNumberMap.entrySet()) {
        BigInteger dpn = entry.getKey();
        LOG.trace("Polling DPN ID {}", dpn);
        GetNodeConnectorStatisticsInputBuilder input = new GetNodeConnectorStatisticsInputBuilder()
                .setNode(new NodeRef(InstanceIdentifier.builder(Nodes.class)
                        .child(Node.class, new NodeKey(new NodeId(IfmConstants.OF_URI_PREFIX + dpn))).build()))
                .setStoreStats(false);
        Future<RpcResult<GetNodeConnectorStatisticsOutput>> rpcResultFuture =
                odlDirectStatisticsService.getNodeConnectorStatistics(input.build());

        RpcResult<GetNodeConnectorStatisticsOutput> rpcResult = null;
        try {
            rpcResult = rpcResultFuture.get();
        } catch (InterruptedException | ExecutionException e) {
            LOG.error("Exception {} occurred with node {} Direct-Statistics get", e, dpn);
        }
        if (rpcResult != null && rpcResult.isSuccessful() && rpcResult.getResult() != null) {

            GetNodeConnectorStatisticsOutput nodeConnectorStatisticsOutput = rpcResult.getResult();

            List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatisticsAndPortNumberMapList =
                    nodeConnectorStatisticsOutput.getNodeConnectorStatisticsAndPortNumberMap();

            ConcurrentMap<String, QosAlertPortData> portDataMap = entry.getValue();
            for (NodeConnectorStatisticsAndPortNumberMap stats : nodeConnectorStatisticsAndPortNumberMapList) {
                QosAlertPortData portData = portDataMap.get(stats.getNodeConnectorId().getValue());
                if (portData != null) {
                    portData.updatePortStatistics(stats);
                }
            }
        } else {
            LOG.error("Direct-Statistics not available for node {}", dpn);
        }

    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:40,代码来源:QosAlertManager.java

示例12: remove

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的package包/类
@Override
public void remove(Node dataObjectModification) {
    NodeKey nodeKey = dataObjectModification.getKey();
    BigInteger dpnId = MDSALUtil.getDpnIdFromNodeName(nodeKey.getId());
    LOG.info("Dpn removed {}", dpnId);
    centralizedSwitchScheduler.removeSwitch(dpnId);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:8,代码来源:SnatNodeEventListener.java

示例13: add

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的package包/类
@Override
public void add(Node dataObjectModification) {
    NodeKey nodeKey = dataObjectModification.getKey();
    BigInteger dpnId = MDSALUtil.getDpnIdFromNodeName(nodeKey.getId());
    LOG.info("Dpn added {}", dpnId);
    centralizedSwitchScheduler.addSwitch(dpnId);

}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:9,代码来源:SnatNodeEventListener.java

示例14: getSwitchStatus

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的package包/类
public boolean getSwitchStatus(BigInteger switchId) {
    NodeId nodeId = new NodeId("openflow:" + switchId);
    LOG.debug("getSwitchStatus : Querying switch with dpnId {} is up/down", nodeId);
    InstanceIdentifier<Node> nodeInstanceId = InstanceIdentifier.builder(Nodes.class)
        .child(Node.class, new NodeKey(nodeId)).build();
    Optional<Node> nodeOptional =
            SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker,
                    LogicalDatastoreType.OPERATIONAL, nodeInstanceId);
    if (nodeOptional.isPresent()) {
        LOG.debug("getSwitchStatus : Switch {} is up", nodeId);
        return true;
    }
    LOG.debug("getSwitchStatus : Switch {} is down", nodeId);
    return false;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:16,代码来源:NaptSwitchHA.java

示例15: appendFlowForCreate

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; //导入依赖的package包/类
public void appendFlowForCreate(NodeId node, Flow flow, WriteTransaction tx) {
    NodeKey nodeKey = new NodeKey(node);
    InstanceIdentifier<Flow> iidFlow = InstanceIdentifier.builder(Nodes.class)
        .child(Node.class, nodeKey)
        .augmentation(FlowCapableNode.class)
        .child(Table.class, new TableKey(flow.getTableId()))
        .child(Flow.class, flow.getKey())
        .build();

    tx.put(LogicalDatastoreType.CONFIGURATION, iidFlow, flow, WriteTransaction.CREATE_MISSING_PARENTS);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:12,代码来源:OpenFlow13Provider.java


注:本文中的org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。