Search in sources :

Example 11 with NodeBuilder

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder in project openflowplugin by opendaylight.

the class OpenflowPluginBulkTransactionProvider method _modifyFlows.

public void _modifyFlows(CommandInterpreter ci) {
    NodeBuilder tn = createTestNode(ci.nextArgument());
    String flowtype = ci.nextArgument();
    Integer flowcnt = Integer.parseInt(flowtype);
    FlowBuilder tf;
    FlowBuilder tf1;
    FlowBuilder tf2;
    FlowBuilder tf3;
    switch(flowcnt) {
        case 1:
            tf = createTestFlow(tn, "f82", "10");
            tf1 = createTestFlow(tn, "f83", "11");
            tf2 = createTestFlow(tn, "f84", "12");
            tf3 = createTestFlow(tn, "f85", "13");
            break;
        case 2:
            tf = createTestFlow(tn, "f700", "3");
            tf1 = createTestFlow(tn, "f4", "4");
            tf2 = createTestFlow(tn, "f900", "5");
            tf3 = createTestFlow(tn, "f86", "6");
            break;
        case 3:
            // +
            tf = createTestFlow(tn, "f91", "7");
            tf1 = createTestFlow(tn, "f92", "8");
            tf2 = createTestFlow(tn, "f93", "9");
            tf3 = createTestFlow(tn, "f94", "10");
            break;
        case 4:
            // +ve scenario
            tf = createTestFlow(tn, "f230", "3");
            tf1 = createTestFlow(tn, "f99", "4");
            tf2 = createTestFlow(tn, "f100", "5");
            tf3 = createTestFlow(tn, "f101", "6");
            break;
        case 5:
            // -
            tf = createTestFlow(tn, "f23", "3");
            tf1 = createTestFlow(tn, "f99", "4");
            tf2 = createTestFlow(tn, "f100", "5");
            tf3 = createTestFlow(tn, "f101", "6");
            break;
        default:
            tf = createTestFlow(tn, "f87", "12");
            tf1 = createTestFlow(tn, "f88", "13");
            tf2 = createTestFlow(tn, "f89", "14");
            tf3 = createTestFlow(tn, "f90", "15");
    }
    writeFlow(ci, tf, tf1, tf2, tf3, tn);
}
Also used : BigInteger(java.math.BigInteger) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) NodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder)

Example 12 with NodeBuilder

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder in project openflowplugin by opendaylight.

the class OpenflowPluginBulkTransactionProvider method _addFlows.

public void _addFlows(CommandInterpreter ci) {
    NodeBuilder tn = createTestNode(ci.nextArgument());
    String flowtype = ci.nextArgument();
    Integer flowcnt = Integer.parseInt(flowtype);
    FlowBuilder tf;
    FlowBuilder tf1;
    FlowBuilder tf2;
    FlowBuilder tf3;
    switch(flowcnt) {
        case 1:
            tf = createTestFlow(tn, "f1", "10");
            tf1 = createTestFlow(tn, "f2", "11");
            tf2 = createTestFlow(tn, "f3", "12");
            tf3 = createTestFlow(tn, "f4", "13");
            break;
        case 2:
            tf = createTestFlow(tn, "f3", "3");
            tf1 = createTestFlow(tn, "f4", "4");
            tf2 = createTestFlow(tn, "f5", "5");
            tf3 = createTestFlow(tn, "f6", "6");
            break;
        case 3:
            tf = createTestFlow(tn, "f7", "7");
            tf1 = createTestFlow(tn, "f8", "8");
            tf2 = createTestFlow(tn, "f9", "9");
            tf3 = createTestFlow(tn, "f10", "10");
            break;
        case 4:
            // -ve scenario
            tf = createTestFlow(tn, "f23", "3");
            tf1 = createTestFlow(tn, "f34", "4");
            tf2 = createTestFlow(tn, "f35", "5");
            tf3 = createTestFlow(tn, "f36", "6");
            break;
        case 5:
            // +ve scenario
            // modify case 6 -ve
            tf = createTestFlow(tn, "f230", "3");
            tf1 = createTestFlow(tn, "f34", "4");
            tf2 = createTestFlow(tn, "f35", "5");
            tf3 = createTestFlow(tn, "f36", "6");
            break;
        default:
            tf = createTestFlow(tn, "f42", "42");
            tf1 = createTestFlow(tn, "f43", "43");
            tf2 = createTestFlow(tn, "f44", "44");
            tf3 = createTestFlow(tn, "f45", "45");
    }
    writeFlow(ci, tf, tf1, tf2, tf3, tn);
}
Also used : BigInteger(java.math.BigInteger) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) NodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder)

Example 13 with NodeBuilder

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder in project openflowplugin by opendaylight.

the class OpenflowpluginTableFeaturesTestCommandProvider method createTestNode.

private void createTestNode() {
    NodeBuilder builder = new NodeBuilder();
    builder.setId(new NodeId(OpenflowpluginTestActivator.NODE_ID));
    builder.setKey(new NodeKey(builder.getId()));
    testNode = builder.build();
}
Also used : NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)

Example 14 with NodeBuilder

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder in project openflowplugin by opendaylight.

the class OpenflowpluginTableFeaturesTestCommandProvider method createUserNode.

private void createUserNode(String nodeRef) {
    NodeBuilder builder = new NodeBuilder();
    builder.setId(new NodeId(nodeRef));
    builder.setKey(new NodeKey(builder.getId()));
    testNode = builder.build();
}
Also used : NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)

Example 15 with NodeBuilder

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder in project bgpcep by opendaylight.

the class NodeNlriParser method serializeOspfPseudoNode.

private static CRouterIdentifier serializeOspfPseudoNode(final ContainerNode ospfPseudonode) {
    final OspfPseudonodeCaseBuilder builder = new OspfPseudonodeCaseBuilder();
    final OspfPseudonodeBuilder nodeBuilder = new OspfPseudonodeBuilder();
    if (ospfPseudonode.getChild(LAN_IFACE_NID).isPresent()) {
        nodeBuilder.setLanInterface(new OspfInterfaceIdentifier((Long) ospfPseudonode.getChild(LAN_IFACE_NID).get().getValue()));
    }
    if (ospfPseudonode.getChild(OSPF_ROUTER_NID).isPresent()) {
        nodeBuilder.setOspfRouterId((Long) ospfPseudonode.getChild(OSPF_ROUTER_NID).get().getValue());
    }
    builder.setOspfPseudonode(nodeBuilder.build());
    return builder.build();
}
Also used : OspfPseudonodeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfPseudonodeCaseBuilder) OspfInterfaceIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.OspfInterfaceIdentifier) OspfPseudonodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.ospf.pseudonode._case.OspfPseudonodeBuilder)

Aggregations

NodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder)35 NodeBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder)30 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)21 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)21 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)18 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)17 Test (org.junit.Test)11 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)11 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)11 FlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder)11 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)11 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)11 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)10 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)8 ArrayList (java.util.ArrayList)7 Optional (com.google.common.base.Optional)6 BigInteger (java.math.BigInteger)6 TableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)6 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)6 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)5