use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder in project genius by opendaylight.
the class MdSalUtilTest method addFlowCapableNode.
public void addFlowCapableNode(NodeKey nodeKey) throws ExecutionException, InterruptedException {
Nodes nodes = new NodesBuilder().setNode(Collections.emptyList()).build();
final InstanceIdentifier<Node> flowNodeIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey);
FlowCapableNodeBuilder fcnBuilder = new FlowCapableNodeBuilder();
NodeBuilder nodeBuilder = new NodeBuilder();
nodeBuilder.setKey(nodeKey);
nodeBuilder.addAugmentation(FlowCapableNode.class, fcnBuilder.build());
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class), nodes);
writeTx.put(LogicalDatastoreType.OPERATIONAL, flowNodeIdentifier, nodeBuilder.build());
writeTx.put(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Nodes.class), nodes);
writeTx.put(LogicalDatastoreType.CONFIGURATION, flowNodeIdentifier, nodeBuilder.build());
assertCommit(writeTx.submit());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder in project bgpcep by opendaylight.
the class TunnelProgrammingTest method createNode.
private static Node createNode(final NodeId nodeId, final TpId tpId, final String ipv4Address) {
final TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
tpBuilder.setTpId(tpId);
tpBuilder.setKey(new TerminationPointKey(tpId));
tpBuilder.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder().setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder().setTerminationPointType(new IpBuilder().setIpAddress(Collections.singletonList(new IpAddress(new Ipv4Address(ipv4Address)))).build()).build()).build());
final NodeBuilder nodeBuilder = new NodeBuilder();
nodeBuilder.setNodeId(nodeId);
nodeBuilder.setKey(new NodeKey(nodeId));
nodeBuilder.setTerminationPoint(Lists.newArrayList(tpBuilder.build()));
final SupportingNode supportingNode = new SupportingNodeBuilder().setKey(new SupportingNodeKey(nodeId, new TopologyId("dummy"))).addAugmentation(SupportingNode1.class, new SupportingNode1Builder().setPathComputationClient(new PathComputationClientBuilder().setControlling(true).build()).build()).build();
nodeBuilder.setSupportingNode(Lists.newArrayList(supportingNode));
return nodeBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder in project bgpcep by opendaylight.
the class NodeChangedListener method createTP.
private InstanceIdentifier<TerminationPoint> createTP(final IpAddress addr, final InstanceIdentifier<Node> sni, final Boolean inControl, final ReadWriteTransaction trans) {
final String url = "ip://" + addr.toString();
final TerminationPointKey tpk = new TerminationPointKey(new TpId(url));
final TerminationPointBuilder tpb = new TerminationPointBuilder();
tpb.setKey(tpk).setTpId(tpk.getTpId());
tpb.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder().setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder().setTerminationPointType(new IpBuilder().setIpAddress(Lists.newArrayList(addr)).build()).build()).build());
final NodeKey nk = new NodeKey(new NodeId(url));
final NodeBuilder nb = new NodeBuilder();
nb.setKey(nk).setNodeId(nk.getNodeId());
nb.setTerminationPoint(Lists.newArrayList(tpb.build()));
if (sni != null) {
nb.setSupportingNode(Lists.newArrayList(createSupportingNode(InstanceIdentifier.keyOf(sni).getNodeId(), inControl)));
}
final InstanceIdentifier<Node> nid = this.target.child(Node.class, nb.getKey());
trans.put(LogicalDatastoreType.OPERATIONAL, nid, nb.build());
return nid.child(TerminationPoint.class, tpb.getKey());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder in project bgpcep by opendaylight.
the class LinkstateNlriParser method serializeNodeDescriptor.
private static void serializeNodeDescriptor(final CLinkstateDestinationBuilder builder, final ChoiceNode objectType) {
final NodeCaseBuilder nodeBuilder = new NodeCaseBuilder();
// node descriptors
nodeBuilder.setNodeDescriptors(NodeNlriParser.serializeNodeDescriptors((ContainerNode) objectType.getChild(NODE_DESCRIPTORS_NID).get()));
builder.setObjectType(nodeBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder in project bgpcep by opendaylight.
the class NodeNlriParser method serializeIsisPseudoNode.
private static IsisPseudonodeCase serializeIsisPseudoNode(final ContainerNode pseudoIsisNode) {
final IsIsRouterIdentifierBuilder isisRouterId = new IsIsRouterIdentifierBuilder();
if (pseudoIsisNode.getChild(ISIS_ROUTER_NID).isPresent()) {
final ContainerNode isisRouterNid = (ContainerNode) pseudoIsisNode.getChild(ISIS_ROUTER_NID).get();
if (isisRouterNid.getChild(ISO_SYSTEM_NID).isPresent()) {
isisRouterId.setIsoSystemId(new IsoSystemIdentifier((byte[]) isisRouterNid.getChild(ISO_SYSTEM_NID).get().getValue()));
}
}
final IsisPseudonodeBuilder nodeBuilder = new IsisPseudonodeBuilder();
nodeBuilder.setIsIsRouterIdentifier(isisRouterId.build());
if (pseudoIsisNode.getChild(PSN_NID).isPresent()) {
nodeBuilder.setPsn((Short) pseudoIsisNode.getChild(PSN_NID).get().getValue());
} else {
nodeBuilder.setPsn((short) 0);
}
return new IsisPseudonodeCaseBuilder().setIsisPseudonode(nodeBuilder.build()).build();
}
Aggregations