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


Java NodeConnectorKey类代码示例

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


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

示例1: setupHostService

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; //导入依赖的package包/类
/**
 * Sets up the host service with details of some hosts.
 */
private void setupHostService() {
	IpAddress host1Address = new IpAddress(Ipv4Address.getDefaultInstance("192.168.10.1"));
	long now = new Date().getTime();
	ConnectorAddress ipv4Address = new ConnectorAddressBuilder().setLastSeen(now).setFirstSeen(now)
			.setMac(new MacAddress("aa:bb:cc:dd:ee:ff")).setIp(host1Address).build();
	NodeConnector nc1 = new NodeConnectorBuilder().setKey(new NodeConnectorKey(new NodeConnectorId("1"))).build();
	Host host1 = new Host(ipv4Address, nc1);
	when(hostService.getHost(new HostId("192.168.10.1"))).thenReturn(host1);

	IpAddress host2Address = new IpAddress(Ipv6Address.getDefaultInstance("2000::1"));
	long time = new Date().getTime();
	ConnectorAddress ipv6Address = new ConnectorAddressBuilder().setLastSeen(time).setFirstSeen(time)
			.setMac(new MacAddress("aa:bb:cc:dd:ee:00")).setIp(host2Address).build();
	NodeConnector nc2 = new NodeConnectorBuilder().setKey(new NodeConnectorKey(new NodeConnectorId("2"))).build();
	Host host2 = new Host(ipv6Address, nc2);
	when(hostService.getHost(new HostId("2000::1"))).thenReturn(host2);
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:21,代码来源:RibManagerTest.java

示例2: getNodeConnRef

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

示例3: testSendArpResponse

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

示例4: transmitRouterAdvertisement

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; //导入依赖的package包/类
private void transmitRouterAdvertisement(VirtualPort intf, Ipv6RtrAdvertType advType) {
    Ipv6RouterAdvt ipv6RouterAdvert = new Ipv6RouterAdvt(packetService);

    LOG.debug("in transmitRouterAdvertisement for {}", advType);
    VirtualNetwork vnet = getNetwork(intf.getNetworkID());
    if (vnet != null) {
        String nodeName;
        String outPort;
        Collection<VirtualNetwork.DpnInterfaceInfo> dpnIfaceList = vnet.getDpnIfaceList();
        for (VirtualNetwork.DpnInterfaceInfo dpnIfaceInfo : dpnIfaceList) {
            nodeName = Ipv6Constants.OPENFLOW_NODE_PREFIX + dpnIfaceInfo.getDpId();
            List<NodeConnectorRef> ncRefList = new ArrayList<>();
            for (Long ofPort: dpnIfaceInfo.ofPortList) {
                outPort = nodeName + ":" + ofPort;
                LOG.debug("Transmitting RA {} for node {}, port {}", advType, nodeName, outPort);
                InstanceIdentifier<NodeConnector> outPortId = InstanceIdentifier.builder(Nodes.class)
                        .child(Node.class, new NodeKey(new NodeId(nodeName)))
                        .child(NodeConnector.class, new NodeConnectorKey(new NodeConnectorId(outPort)))
                        .build();
                ncRefList.add(new NodeConnectorRef(outPortId));
            }
            if (!ncRefList.isEmpty()) {
                ipv6RouterAdvert.transmitRtrAdvertisement(advType, intf, ncRefList, null);
            }
        }
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:28,代码来源:IfMgr.java

示例5: getNodeConnectorRef

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; //导入依赖的package包/类
public static NodeConnectorRef getNodeConnectorRef(NodeConnectorId nodeConnectorId) {
	NodeId nodeId = getNodeId(nodeConnectorId);
    return new NodeConnectorRef(InstanceIdentifier.builder(Nodes.class)
            .child(Node.class, new NodeKey(nodeId))
            .child(NodeConnector.class, new NodeConnectorKey(nodeConnectorId))
            .build());
}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:8,代码来源:InventoryUtils.java

示例6: measureNodeStatistics

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; //导入依赖的package包/类
public void measureNodeStatistics(String nodeId, String nodeConnectorId) {

		LOG.info("Checking src node {} and interface {} statistics. ", nodeId,
				nodeConnectorId);
		float packetLoss = 0.0f;
		float bw = 0.0f;

		NodeConnector nc = null;
		try {
			InstanceIdentifier<NodeConnector> nodeConnectorIid = InstanceIdentifier
					.builder(Nodes.class)
					.child(Node.class, new NodeKey(new NodeId(nodeId)))
					.child(NodeConnector.class,
							new NodeConnectorKey(new NodeConnectorId(
									nodeConnectorId))).build();
			ReadOnlyTransaction nodesTransaction = db.newReadOnlyTransaction();
			CheckedFuture<Optional<NodeConnector>, ReadFailedException> nodeConnectorFuture = nodesTransaction
					.read(LogicalDatastoreType.OPERATIONAL, nodeConnectorIid);
			Optional<NodeConnector> nodeConnectorOptional = Optional.absent();
			nodeConnectorOptional = nodeConnectorFuture.checkedGet();

			if (nodeConnectorOptional != null
					&& nodeConnectorOptional.isPresent()) {
				nc = nodeConnectorOptional.get();
			}

			if (nc != null) {

				FlowCapableNodeConnectorStatisticsData statData = nc
						.getAugmentation(FlowCapableNodeConnectorStatisticsData.class);
				FlowCapableNodeConnectorStatistics statistics = statData
						.getFlowCapableNodeConnectorStatistics();
				BigInteger packetsTransmitted = statistics.getPackets()
						.getTransmitted();
				BigInteger packetErrorsTransmitted = statistics
						.getTransmitErrors();

				packetLoss = (packetsTransmitted.floatValue() == 0) ? 0
						: packetErrorsTransmitted.floatValue()
								/ packetsTransmitted.floatValue();

				FlowCapableNodeConnector fnc = nc
						.getAugmentation(FlowCapableNodeConnector.class);
				bw = fnc.getCurrentSpeed();
			}

		} catch (Exception e) {
			LOG.error("Source node statistics reading failed:", e);
		}

		LOG.info("Packet loss {} ", packetLoss);
		LOG.info("Bw {} ", bw);

	}
 
开发者ID:geopet85,项目名称:virtuwind-example,代码行数:55,代码来源:NodeMonitor.java

示例7: getNodeConnectorBuilder

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; //导入依赖的package包/类
public static NodeConnectorBuilder getNodeConnectorBuilder(NodeConnectorId nodeConnectorId) {
    NodeConnectorBuilder builder = new NodeConnectorBuilder()
    	.setId(nodeConnectorId)
    	.setKey(new NodeConnectorKey(nodeConnectorId));
    return builder;
}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:7,代码来源:InventoryUtils.java

示例8: getNodeConnectorId

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; //导入依赖的package包/类
public static NodeConnectorId getNodeConnectorId(NodeConnectorRef nodeConnectorRef) {
       return nodeConnectorRef.getValue()
           .firstKeyOf(NodeConnector.class, NodeConnectorKey.class)
           .getId();
}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:6,代码来源:InventoryUtils.java

示例9: floodArp

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; //导入依赖的package包/类
/**
 * Sends ARP Request as packet-out from all openflow physical ports on the
 * given node.
 *
 * @param senderAddress
 *            the addresses used in sender part of ARP packet
 * @param tpa
 *            the target protocol address, in this case IPv4 address for
 *            which MAC should be discovered
 * @param nodeIid
 *            the path to node from where the ARP packet will be flooded
 * @return future result about success of packet-out
 */
public ListenableFuture<RpcResult<Void>> floodArp(ArpMessageAddress senderAddress, Ipv4Address tpa,
		InstanceIdentifier<Node> nodeIid) {
	checkNotNull(senderAddress);
	checkNotNull(tpa);
	checkNotNull(nodeIid);
	// node connector representing all physical ports on node
	NodeConnectorKey nodeConnectorKey = new NodeConnectorKey(
			createNodeConnectorId(OFPP_ALL, nodeIid.firstKeyOf(Node.class, NodeKey.class).getId()));
	InstanceIdentifier<NodeConnector> egressNc = nodeIid.child(NodeConnector.class, nodeConnectorKey);
	return sendArp(senderAddress, tpa, egressNc);
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:25,代码来源:ArpSender.java


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