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


Java NodeCreator类代码示例

本文整理汇总了Java中org.opendaylight.controller.sal.utils.NodeCreator的典型用法代码示例。如果您正苦于以下问题:Java NodeCreator类的具体用法?Java NodeCreator怎么用?Java NodeCreator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testCreateNodeBean

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
@Test
public void testCreateNodeBean() {
        Topology topology = new Topology();
        Node node = NodeCreator.createOFNode(new Long(3));
        String description = "foo";

        NodeBean bean = topology.createNodeBean(description, node);

        assertNotNull(bean);
        assertEquals(bean.id, node.toString());
        assertEquals(bean.name, "foo");

        bean = topology.createNodeBean(null, node);

        assertNotNull(bean);
        assertEquals(bean.id, node.toString());
        assertEquals(bean.name, bean.id);

        bean = topology.createNodeBean("   ", node);

        assertNotNull(bean);
        assertEquals(bean.id, node.toString());
        assertEquals(bean.name, bean.id);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:25,代码来源:TopologyTest.java

示例2: testFlowEntryInstall

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
@Test
public void testFlowEntryInstall() throws UnknownHostException {
    Node node = NodeCreator.createOFNode(1L);
    FlowEntry pol = new FlowEntry("polTest", null, getSampleFlowV6(node), node);
    FlowEntry pol2 = new FlowEntry("polTest2", null, getSampleFlowV6(node), node);
    FlowEntryInstall fei = new FlowEntryInstall(pol.clone(), null);
    FlowEntryInstall fei2 = new FlowEntryInstall(pol.clone(), null);
    FlowEntryInstall fei3 = new FlowEntryInstall(pol2.clone(), null);
    Assert.assertTrue(fei.getOriginal().equals(pol));
    Assert.assertTrue(fei.getInstall().equals(pol));
    Assert.assertTrue(fei.getFlowName().equals(pol.getFlowName()));
    Assert.assertTrue(fei.getGroupName().equals(pol.getGroupName()));
    Assert.assertTrue(fei.getNode().equals(pol.getNode()));
    Assert.assertFalse(fei.isDeletePending());
    fei.toBeDeleted();
    Assert.assertTrue(fei.isDeletePending());
    Assert.assertNull(fei.getContainerFlow());
    Assert.assertTrue(fei.equalsByNodeAndName(pol.getNode(), pol.getFlowName()));

    Assert.assertTrue(fei.equals(fei2));
    Assert.assertFalse(fei.equals(null));
    Assert.assertTrue(fei.equals(fei3));

}
 
开发者ID:lbchen,项目名称:ODL,代码行数:25,代码来源:frmTest.java

示例3: testFlowEntries

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
@Test
public void testFlowEntries() {
    Flow flow = new Flow();

    Match match = new Match();
    try {
        match.setField(MatchType.NW_DST, InetAddress.getByName("1.1.1.1"));
    } catch (UnknownHostException e) {
    }
    flow.setMatch(match);
    Action action = new Drop();

    List<Action> actions = new ArrayList<Action>();
    actions.add(action);
    flow.setActions(actions);

    Node node = NodeCreator.createOFNode(1L);
    FlowEntry fe = new FlowEntry("g1", "f1", flow, node);

    Status stat = manager.installFlowEntry(fe);

    // OF plugin is not there in integration testing mode
    Assert.assertTrue(stat.getCode() == StatusCode.NOSERVICE);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:25,代码来源:ForwardingRulesManagerIT.java

示例4: testFlowActions

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
@Test
public void testFlowActions() throws UnknownHostException {
    Node node = NodeCreator.createOFNode(55l);
    Flow flow = getSampleFlowV6(node);

    List<Action> actions = flow.getActions();
    actions.add(new Loopback());

    Assert.assertTrue(flow.getActions() != actions);
    Assert.assertTrue(!flow.getActions().equals(actions));

    flow.addAction(new Loopback());
    Assert.assertTrue(flow.getActions().equals(actions));

    actions.remove(new Loopback());
    flow.removeAction(new Loopback());
    Assert.assertTrue(flow.getActions().equals(actions));

    // Add a malformed action
    Assert.assertFalse(flow.addAction(new PushVlan(EtherTypes.CISCOQINQ, 3,
            3, 8000)));
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:23,代码来源:FlowTest.java

示例5: testNodeTableStatisticsMethods

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
@Test
public void testNodeTableStatisticsMethods() {
    NodeTable nt = NodeTableCreator.createNodeTable(Byte.valueOf("2") , NodeCreator.createOFNode((long)20));
    NodeTableStatistics ntStats = new NodeTableStatistics();

    ntStats.setNodeTable(nt);
    ntStats.setActiveCount(100);
    ntStats.setLookupCount(200);
    ntStats.setMatchedCount(500);
    ntStats.setName("Test");

    Assert.assertTrue(ntStats.getNodeTable().equals(nt));
    Assert.assertTrue(ntStats.getActiveCount() == 100);
    Assert.assertTrue(ntStats.getLookupCount() == 200);
    Assert.assertTrue(ntStats.getMatchedCount() == 500);
    Assert.assertTrue(ntStats.getName().equals("Test"));
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:18,代码来源:NodeTableStatisticsTest.java

示例6: testNodeTableOpenFlowOfWrongType

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
@Test
public void testNodeTableOpenFlowOfWrongType() {
    try {
        Node node = NodeCreator.createOFNode((long) 20);
        NodeTable of1 = new NodeTable(NodeTable.NodeTableIDType.OPENFLOW, "name", node);

        // If we reach this point the exception was not raised
        // which should have been the case
        Assert.assertTrue(false);
    } catch (ConstructionException e) {
        // If we reach this point the exception has been raised
        // and so test passed
        System.out.println("Got exception as expected!:" + e);
        Assert.assertTrue(true);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:17,代码来源:NodeTableTest.java

示例7: testNodeTableOpenFlowOfCorrectType

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
@Test
public void testNodeTableOpenFlowOfCorrectType() {
    try {
        Node node = NodeCreator.createOFNode((long) 20);
        NodeTable of1 = new NodeTable(NodeTable.NodeTableIDType.OPENFLOW, Byte.valueOf("10"), node);

        // If we reach this point the exception has not been
        // raised so we passed the test
        System.out.println("Got node table:" + of1);
        Assert.assertTrue(true);
    } catch (ConstructionException e) {
        // If we reach this point the exception was raised
        // which is not expected
        Assert.assertTrue(false);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:17,代码来源:NodeTableTest.java

示例8: testNodeConnectorProperties

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
@Test
public void testNodeConnectorProperties() {
        Node node = NodeCreator.createOFNode(1L);
NodeConnector port = NodeConnectorCreator.createOFNodeConnector(
        (short) 24, node);

NodeConnectorProperties ncp= new NodeConnectorProperties(port, null);
        Assert.assertTrue(ncp.getProperties() == null);
        Assert.assertTrue(ncp.getNodeConnector().equals(port));

NodeConnector port2 = NodeConnectorCreator.createOFNodeConnector(
        (short) 33, node);
        ncp.setNodeConnector(port2);
        Assert.assertTrue(ncp.getNodeConnector().equals(port2));

        Set<Property> props = new HashSet<Property>();
        ncp.setProperties(props);
        Assert.assertTrue(ncp.getProperties().equals(props));
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:20,代码来源:SwitchManagerNorthboundTest.java

示例9: testFlowStatistics

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
@Test
public void testFlowStatistics() {
    List<FlowOnNode> fon = new ArrayList<FlowOnNode>();
    Node node = NodeCreator.createOFNode(1L);
    FlowStatistics fs = new FlowStatistics(node, fon);
    Assert.assertTrue(fs.getNode().equals(node));
    Assert.assertTrue(fs.getFlowStats().equals(fon));

    Node node2 = NodeCreator.createOFNode(2L);
    fs.setNode(node2);
    Assert.assertTrue(fs.getNode().equals(node2));
    fs.setNode(node2);
    Assert.assertTrue(fs.getNode().equals(node2));
    fs.setFlowStats(null);
    Assert.assertTrue(fs.getFlowStats() == null);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:17,代码来源:StatisticsNorthboundTest.java

示例10: filterPortListPerContainer

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
/**
 * Filters a list of OFStatistics elements based on the container
 *
 * @param container
 * @param nodeId
 * @param list
 * @return
 */
public List<OFStatistics> filterPortListPerContainer(String container, long switchId, List<OFStatistics> list) {
    if (list == null) {
        return null;
    }

    // Create new filtered list of flows
    List<OFStatistics> newList = new ArrayList<OFStatistics>();

    for (OFStatistics stat : list) {
        OFPortStatisticsReply target = (OFPortStatisticsReply) stat;
        NodeConnector nc = NodeConnectorCreator.createOFNodeConnector(
                target.getPortNumber(), NodeCreator.createOFNode(switchId));
        if (containerOwnsNodeConnector(container, nc)) {
            newList.add(target);
        }
    }

    return newList;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:28,代码来源:ReadServiceFilter.java

示例11: filterTableListPerContainer

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
public List<OFStatistics> filterTableListPerContainer(
        String container, long switchId, List<OFStatistics> list) {
    if (list == null) {
        return null;
    }

    // Create new filtered list of node tables
    List<OFStatistics> newList = new ArrayList<OFStatistics>();

    for (OFStatistics stat : list) {
        OFTableStatistics target = (OFTableStatistics) stat;
        NodeTable nt = NodeTableCreator.createOFNodeTable(target.getTableId(), NodeCreator.createOFNode(switchId));
        if (containerOwnsNodeTable(container, nt)) {
            newList.add(target);
        }
    }

    return newList;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:20,代码来源:ReadServiceFilter.java

示例12: flowStatisticsRefreshed

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
@Override
public void flowStatisticsRefreshed(Long switchId, List<OFStatistics> flows) {
    String container;
    IReadFilterInternalListener listener;
    Node node = NodeCreator.createOFNode(switchId);
    for (Map.Entry<String, IReadFilterInternalListener> l : readFilterInternalListeners.entrySet()) {
        container = l.getKey();
        listener = l.getValue();

        // Convert and filter the statistics per container
        List<FlowOnNode> flowOnNodeList = new FlowStatisticsConverter(flows).getFlowOnNodeList(node);
        flowOnNodeList = filterFlowListPerContainer(container, node, flowOnNodeList);

        // notify listeners
        listener.nodeFlowStatisticsUpdated(node, flowOnNodeList);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:18,代码来源:ReadServiceFilter.java

示例13: portStatisticsRefreshed

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
@Override
public void portStatisticsRefreshed(Long switchId, List<OFStatistics> ports) {
    String container;
    IReadFilterInternalListener listener;
    Node node = NodeCreator.createOFNode(switchId);
    for (Map.Entry<String, IReadFilterInternalListener> l : readFilterInternalListeners.entrySet()) {
        container = l.getKey();
        listener = l.getValue();

        // Convert and filter the statistics per container
        List<OFStatistics> filteredPorts = filterPortListPerContainer(container, switchId, ports);
        List<NodeConnectorStatistics> ncStatsList = new PortStatisticsConverter(switchId, filteredPorts)
                .getNodeConnectorStatsList();

        // notify listeners
        listener.nodeConnectorStatisticsUpdated(node, ncStatsList);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:19,代码来源:ReadServiceFilter.java

示例14: tableStatisticsRefreshed

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
@Override
public void tableStatisticsRefreshed(Long switchId, List<OFStatistics> tables) {
    String container;
    Node node = NodeCreator.createOFNode(switchId);
    for (Map.Entry<String, IReadFilterInternalListener> l : readFilterInternalListeners.entrySet()) {
        container = l.getKey();

        // Convert and filter the statistics per container
        List<OFStatistics> filteredList = filterTableListPerContainer(container, switchId, tables);
        List<NodeTableStatistics> tableStatsList = new TableStatisticsConverter(switchId, filteredList)
                .getNodeTableStatsList();

        // notify listeners
        l.getValue().nodeTableStatisticsUpdated(node, tableStatsList);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:17,代码来源:ReadServiceFilter.java

示例15: handlePortStatusMessage

import org.opendaylight.controller.sal.utils.NodeCreator; //导入依赖的package包/类
protected void handlePortStatusMessage(ISwitch sw, OFPortStatus m) {
    Node node = NodeCreator.createOFNode(sw.getId());
    NodeConnector nodeConnector = PortConverter.toNodeConnector(
        m.getDesc().getPortNumber(), node);
    // get node connector properties
    Set<Property> props = InventoryServiceHelper.OFPortToProps(m.getDesc());

    UpdateType type = null;
    if (m.getReason() == (byte) OFPortReason.OFPPR_ADD.ordinal()) {
        type = UpdateType.ADDED;
        nodeConnectorProps.put(nodeConnector, props);
    } else if (m.getReason() == (byte) OFPortReason.OFPPR_DELETE.ordinal()) {
        type = UpdateType.REMOVED;
        nodeConnectorProps.remove(nodeConnector);
    } else if (m.getReason() == (byte) OFPortReason.OFPPR_MODIFY.ordinal()) {
        type = UpdateType.CHANGED;
        nodeConnectorProps.put(nodeConnector, props);
    }

    logger.trace("handlePortStatusMessage {} type {}", nodeConnector, type);

    if (type != null) {
        notifyInventoryShimListener(nodeConnector, type, props);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:26,代码来源:InventoryServiceShim.java


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