• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NodeConnector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setupHostService

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

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
public Host(ConnectorAddress addrs, NodeConnector nodeConnector) throws InvalidParameterException {
	this();
	List<ConnectorAddress> setAddrs = new ArrayList<>();
	if (addrs != null) {
		setAddrs.add(addrs);
	}
	hostNodeBuilder.setConnectorAddress(setAddrs);
	HostId hId = createHostId(addrs);
	if (hId == null) {
		throw new InvalidParameterException(
				"This host doesn't contain a valid MAC address to assign a valid HostId");
	}
	hostNodeBuilder.setId(hId);
	if (nodeConnector != null) {
		AttachmentPointsBuilder apb = createAPsfromNodeConnector(nodeConnector);
		apb.setActive(Boolean.TRUE);
		apbs.add(apb);
	}
	nodeBuilder = createNodeBuilder(hostNodeBuilder, apbs);
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:21,代码来源:Host.java


示例4: packetReceived

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
public void packetReceived(ConnectorAddress addrs, InstanceIdentifier<?> ii) {
	InstanceIdentifier<NodeConnector> iinc = ii.firstIdentifierOf(NodeConnector.class);
	InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node> iin//
	= ii.firstIdentifierOf(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class);

	ListenableFuture<Optional<NodeConnector>> futureNodeConnector;
	ListenableFuture<Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node>> futureNode;
	try (ReadOnlyTransaction readTx = dataService.newReadOnlyTransaction()) {
		futureNodeConnector = readTx.read(LogicalDatastoreType.OPERATIONAL, iinc);
		futureNode = readTx.read(LogicalDatastoreType.OPERATIONAL, iin);
		readTx.close();
	}
	Optional<NodeConnector> opNodeConnector = null;
	Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node> opNode = null;
	try {
		opNodeConnector = futureNodeConnector.get();
		opNode = futureNode.get();
	} catch (ExecutionException | InterruptedException ex) {
		LOG.warn(ex.getLocalizedMessage());
	}
	if (opNode != null && opNode.isPresent() && opNodeConnector != null && opNodeConnector.isPresent()) {
		processHost(opNode.get(), opNodeConnector.get(), addrs);
	}
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:25,代码来源:HostMonitor.java


示例5: sendArpResponse

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
public ListenableFuture<RpcResult<Void>> sendArpResponse(ArpMessageAddress senderAddress,
		ArpMessageAddress receiverAddress, InstanceIdentifier<NodeConnector> egressNc, Header8021q vlan) {
	checkNotNull(senderAddress);
	checkNotNull(receiverAddress);
	checkNotNull(egressNc);
	final Ethernet arpFrame = createArpFrame(senderAddress, receiverAddress, vlan);
	byte[] arpFrameAsBytes;
	try {
		arpFrameAsBytes = arpFrame.serialize();
	} catch (PacketException e) {
		LOG.warn("Serializition of ARP packet is not successful.", e);
		if (LOG.isDebugEnabled()) {
			LOG.debug("ARP packet: {}", ArpUtils.getArpFrameToStringFormat(arpFrame));
		}
		return Futures.immediateFailedFuture(e);
	}
	// Generate packet with destination switch and port
	LOG.debug("Egress for ARP packetOut: " + new NodeConnectorRef(egressNc).toString());
	TransmitPacketInput packet = new TransmitPacketInputBuilder().setEgress(new NodeConnectorRef(egressNc))
			.setNode(new NodeRef(egressNc.firstIdentifierOf(Node.class))).setPayload(arpFrameAsBytes).build();
	if (LOG.isTraceEnabled()) {
		LOG.trace("Sending ARP RESPONSE \n{}", ArpUtils.getArpFrameToStringFormat(arpFrame));
	}
	Future<RpcResult<Void>> futureTransmitPacketResult = packetProcessingService.transmitPacket(packet);
	return JdkFutureAdapters.listenInPoolThread(futureTransmitPacketResult);
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:27,代码来源:ArpSender.java


示例6: testSendArpResponse

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


示例7: getNodes

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


示例8: execute

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
@Override
public void execute(final Intent intent, final FlowAction flowAction) throws IntentInvalidException {
    if(intent == null) {
        throw new IntentInvalidException(INTENT_NULL_MESSAGE);
    }
    final List<String> endPointGroups = IntentUtils.extractEndPointGroup(intent);
    Action actionContainer = IntentUtils.getAction(intent);

    intentFlowManager.setEndPointGroups(endPointGroups);
    intentFlowManager.setAction(actionContainer);
    intentFlowManager.setIntent(intent);
    //Get all node Id's
    final Map<Node, List<NodeConnector>> nodeMap = TopologyUtils.getNodes(dataBroker);
    for (Map.Entry<Node, List<NodeConnector>> entry : nodeMap.entrySet()) {
        //Push flow to every node for now
        intentFlowManager.pushFlow(entry.getKey().getId(), flowAction);
    }
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:19,代码来源:DefaultExecutor.java


示例9: setUp

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


示例10: transmitRouterAdvertisement

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


示例11: getNodeCountersDirect

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
public CounterResultDataStructure getNodeCountersDirect(Node node) {
    List<CounterResultDataStructure> countersResults = new ArrayList<>();
    List<CompletableFuture<NodeConnectorStatisticsSupplierOutput>> futureList = new ArrayList<>();
    for (NodeConnector nodeConnector : node.getNodeConnector()) {
        GetNodeConnectorStatisticsInput gncsi =
                getNodeConnectorStatisticsInputBuilder(node.getId(), nodeConnector.getId());
        futureList.add(CompletableFuture.supplyAsync(
                new NodeConnectorStatisticsSupplier(odlDirectStatsService, gncsi, nodeConnector.getId())));
    }
    try {
        CompletableFuture<Void> allOf = CompletableFuture.allOf(futureList.toArray(new CompletableFuture[0]));
        allOf.get(nodeResultTimeout, TimeUnit.SECONDS);
        for (int i = 0; i < futureList.size(); i++) {
            CompletableFuture<NodeConnectorStatisticsSupplierOutput> completableCurrentResult = futureList.get(i);
            if (completableCurrentResult == null) {
                LOG.warn("Unable to retrieve node counters");
                counters.failedGettingNodeCounters.inc();
                return null;
            }
            RpcResult<GetNodeConnectorStatisticsOutput> currentResult =
                    completableCurrentResult.get().getNodeConnectorStatisticsOutput();
            if (currentResult != null && currentResult.isSuccessful() && currentResult.getResult() != null) {
                GetNodeConnectorStatisticsOutput nodeConnectorStatsOutput = currentResult.getResult();
                countersResults.add(createNodeConnectorResultMapDirect(nodeConnectorStatsOutput,
                        completableCurrentResult.get().getNodeConnectrId()));
            } else {
                counters.failedGettingNodeCounters.inc();
                LOG.warn("Unable to retrieve node counters");
                return null;
            }
        }
    } catch (InterruptedException | ExecutionException | TimeoutException e) {
        counters.failedGettingNodeCounters.inc();
        LOG.warn("Unable to retrieve node counters");
        return null;
    }

    return mergeCountersResults(countersResults);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:40,代码来源:CounterRetriever.java


示例12: processIntfFilters

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
/**
 * Process intf filters.
 *
 * @param install
 *            the install
 * @param intfs
 *            the intfs
 */
private void processIntfFilters(boolean install, Set<AtriumInterface> intfs) {
	LOG.info("Processing {} router interfaces", intfs.size());
	for (AtriumInterface intf : intfs) {
		NodeConnector connector = intf.connectPoint();
		if (connector == null) {
			continue;
		}
		String dpn = AtriumUtils.getDpnFromNodeConnectorId(connector.getId());
		BigInteger dpnId = new BigInteger(dpn);
		LOG.info("DpnId: " + deviceId);
		NodeId routerId = AtriumUtils.buildDpnNodeId(dpnId);
		LOG.info("RouterId: " + routerId);
		if (!routerId.equals(deviceId)) {
			// Ignore interfaces if they are not on the router switch
			continue;
		}

		NodeRef nodeRef = new NodeRef(
				InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(deviceId)).build());

		FilterObjectiveBuilder filterObjBuilder = gnerateFilterObjectiveBuilder(intf);

		FilterInputBuilder filterBuilder = new FilterInputBuilder();
		filterBuilder.setFilterObjective(filterObjBuilder.build());
		filterBuilder.setNode(nodeRef);
		LOG.info("Invoking filter objective with values: " + filterBuilder.build());
		flowObjectivesService.filter(filterBuilder.build());
	}

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


示例13: setupBgpSpeakers

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
/**
 * Sets up the details of bgp speakers
 */
private void setupBgpSpeakers() {
	BgpSpeakers bgps = mock(BgpSpeakers.class);
	BgpSpeaker bgp = mock(BgpSpeaker.class);
	InterfaceAddresses intfAddress = mock(InterfaceAddresses.class);

	NodeConnectorId ncId = new NodeConnectorId("openflow:20:17");
	List<InterfaceAddresses> interfaceAddresses = new ArrayList<InterfaceAddresses>();
	interfaceAddresses.add(intfAddress);

	when(bgp.getInterfaceAddresses()).thenReturn(interfaceAddresses);
	when(intfAddress.getOfPortId()).thenReturn(ncId);
	when(bgp.getAttachmentDpId()).thenReturn(NodeId.getDefaultInstance("00:00:00:00:00:00:00:bb"));

	List<BgpSpeaker> bgpSpeakers = new ArrayList<BgpSpeaker>();
	bgpSpeakers.add(bgp);

	NodeConnector connectPoint = mock(NodeConnector.class);

	when(connectPoint.getId()).thenReturn(ncId);

	Set<AtriumInterfaceIpAddress> ipAddresses = new HashSet<AtriumInterfaceIpAddress>();

	AtriumIpAddress ipAddress = AtriumIpAddress.valueOf("192.168.10.1");
	AtriumIpPrefix prefix = AtriumIp4Prefix.valueOf("1.1.1.0/24");
	AtriumInterfaceIpAddress intfIp = new AtriumInterfaceIpAddress(ipAddress, prefix);
	ipAddresses.add(intfIp);

	MacAddress mac = new MacAddress("aa:bb:cc:dd:ee:0f");
	AtriumVlanId vlanId = mock(AtriumVlanId.class);

	AtriumInterface intf = new AtriumInterface(connectPoint, ipAddresses, mac, vlanId);

	Set<AtriumInterface> interfaces = new HashSet<AtriumInterface>();
	interfaces.add(intf);

	when(routingConfigService.getBgpSpeakers()).thenReturn(bgps);
	when(bgps.getBgpSpeaker()).thenReturn(bgpSpeakers);
	when(routingConfigService.getInterfaces()).thenReturn(interfaces);
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:43,代码来源:BgprouterTest.java


示例14: getNodeConnector

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
/**
 * Gets the node connector.
 *
 * @param dataBroker
 *            the data broker
 * @param ncRef
 *            the nc ref
 * @return the node connector
 */
public static NodeConnector getNodeConnector(DataBroker dataBroker, NodeConnectorRef ncRef) {
	NodeConnector nc = null;
	ReadOnlyTransaction readOnlyTransaction = dataBroker.newReadOnlyTransaction();
	try {
		Optional<NodeConnector> dataObjectOptional = readOnlyTransaction
				.read(LogicalDatastoreType.OPERATIONAL, (InstanceIdentifier<NodeConnector>) ncRef.getValue()).get();
		if (dataObjectOptional.isPresent())
			nc = dataObjectOptional.get();
	} catch (Exception e) {
		throw new RuntimeException("Error reading from configuration store, node connector : " + ncRef, e);
	}
	return nc;

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


示例15: processHost

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
private void processHost(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node node,
		NodeConnector nodeConnector, ConnectorAddress addrs) {
	if (!isNodeConnectorInternal(nodeConnector)) {
		Host host = new Host(addrs, nodeConnector);
		addHost(addrs, nodeConnector);
	}
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:8,代码来源:HostMonitor.java


示例16: isNodeConnectorInternal

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
private boolean isNodeConnectorInternal(NodeConnector nodeConnector) {
	TpId tpId = new TpId(nodeConnector.getKey().getId().getValue());
	InstanceIdentifier<NetworkTopology> ntII = InstanceIdentifier.builder(NetworkTopology.class).build();
	ListenableFuture<Optional<NetworkTopology>> lfONT;
	try (ReadOnlyTransaction rot = dataService.newReadOnlyTransaction()) {
		lfONT = rot.read(LogicalDatastoreType.OPERATIONAL, ntII);
		rot.close();
	}
	Optional<NetworkTopology> oNT;
	try {
		oNT = lfONT.get();
	} catch (InterruptedException | ExecutionException ex) {
		LOG.warn(ex.getLocalizedMessage());
		return false;
	}
	if (oNT != null && oNT.isPresent()) {
		NetworkTopology networkTopo = oNT.get();
		for (Topology t : networkTopo.getTopology()) {
			if (t.getLink() != null) {
				for (Link l : t.getLink()) {
					if ((l.getSource().getSourceTp().equals(tpId)
							&& !l.getDestination().getDestTp().getValue().startsWith(Host.NODE_PREFIX))
							|| (l.getDestination().getDestTp().equals(tpId)
									&& !l.getSource().getSourceTp().getValue().startsWith(Host.NODE_PREFIX))) {
						return true;
					}
				}
			}
		}
	}
	return false;
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:33,代码来源:HostMonitor.java


示例17: sendArp

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
/**
 * Sends ARP Request as packet-out from the given port (node connector).
 *
 * @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 egressNc
 *            the path to node connector from where the ARP packet will be
 *            sent
 * @return future result about success of packet-out
 */
public ListenableFuture<RpcResult<Void>> sendArp(ArpMessageAddress senderAddress, Ipv4Address tpa,
		InstanceIdentifier<NodeConnector> egressNc) {
	checkNotNull(senderAddress);
	checkNotNull(tpa);
	checkNotNull(egressNc);
	final Ethernet arpFrame = createArpFrame(senderAddress, tpa);
	byte[] arpFrameAsBytes;
	try {
		arpFrameAsBytes = arpFrame.serialize();
	} catch (PacketException e) {
		LOG.warn("Serializition of ARP packet is not successful.", e);
		if (LOG.isDebugEnabled()) {
			LOG.debug("ARP packet: {}", ArpUtils.getArpFrameToStringFormat(arpFrame));
		}
		return Futures.immediateFailedFuture(e);
	}
	// Generate packet with destination switch and port

	TransmitPacketInput packet = new TransmitPacketInputBuilder().setEgress(new NodeConnectorRef(egressNc))
			.setNode(new NodeRef(egressNc.firstIdentifierOf(Node.class))).setPayload(arpFrameAsBytes).build();
	if (LOG.isTraceEnabled()) {
		LOG.trace("Sending ARP REQUEST \n{}", ArpUtils.getArpFrameToStringFormat(arpFrame));
	}
	Future<RpcResult<Void>> futureTransmitPacketResult = packetProcessingService.transmitPacket(packet);
	return JdkFutureAdapters.listenInPoolThread(futureTransmitPacketResult);
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:40,代码来源:ArpSender.java


示例18: sendDataflow

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
public Dataflow sendDataflow(final Dataflow dataflow) throws ExecutionException {
    final FlowBuilder flowBuilder = ofRuleWithMeterManager.createFlow(dataflow);
    final Map<Node, List<NodeConnector>> nodeMap = TopologyUtils.getNodes(dataBroker);
    for (Map.Entry<Node, List<NodeConnector>> entry : nodeMap.entrySet()) {
        ofRuleWithMeterManager.sendToMdsal(flowBuilder, entry.getKey().getId());
    }
    return dataflow;
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:9,代码来源:OFRendererFlowManagerProvider.java


示例19: removeDataflow

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
private Dataflow removeDataflow(final Dataflow dataflow) throws ExecutionException {
    final String dataflowId = dataflow.getId().getValue();
    final FlowBuilder flowBuilder = ofRuleWithMeterManager.createFlow(dataflow);
    final Map<Node, List<NodeConnector>> nodeMap = TopologyUtils.getNodes(dataBroker);
    for (Map.Entry<Node, List<NodeConnector>> entry : nodeMap.entrySet()) {
        ofRuleWithMeterManager.removeFromMdsal(flowBuilder, entry.getKey().getId());
    }
    removeMeter(dataflow.getMeterId().longValue(), dataflowId);
    return dataflow;
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:11,代码来源:OFRendererFlowManagerProvider.java


示例20: removeMeter

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; //导入依赖的package包/类
public Future<RpcResult<Void>> removeMeter(final Long meterId, String dataflowId) throws MeterRemovalExeption {
    boolean result = false;
    final MeterId id = new MeterId(meterId);
    final Future<RpcResult<Void>> releaseMeterResult = meterQueueService.releaseMeterId(dataflowId);
    final Map<Node, List<NodeConnector>> nodeListMap = TopologyUtils.getNodes(dataBroker);
    for (Map.Entry<Node, List<NodeConnector>> entry : nodeListMap.entrySet()) {
        final InstanceIdentifier<Meter> instanceIdentifier = retrieveMeterIdentifier(id,
                entry.getKey());
        result = mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, instanceIdentifier);
    }
    if (!result) {
        throw new MeterRemovalExeption(Long.toString(meterId));
    }
    return releaseMeterResult;
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:16,代码来源:MeterExecutor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InterDatanodeProtocolServerSideTranslatorPB类代码示例发布时间:2022-05-23
下一篇:
Java Instruction类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap