2 * Copyright © 2016 AT&T and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.transportpce.networkmodel.util;
11 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev201012.network.nodes.NodeInfo;
12 import org.opendaylight.yang.gen.v1.http.org.openroadm.clli.network.rev191129.Node1;
13 import org.opendaylight.yang.gen.v1.http.org.openroadm.clli.network.rev191129.Node1Builder;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeBuilder;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeKey;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
21 public final class ClliNetwork {
23 private static final Logger LOG = LoggerFactory.getLogger(ClliNetwork.class);
25 private ClliNetwork() {
29 * Create single node entry for CLLI topology.
31 * @param deviceId device ID
32 * @param nodeInfo Some important and general data from device
34 * @return node builder status
36 public static Node createNode(String deviceId, NodeInfo nodeInfo) {
38 * Create node in the CLLI layer of the network model
39 * with nodeId equal to the clli attribute in the device
40 * model's info subtree
42 NodeBuilder nodeBldr = new NodeBuilder();
44 * create clli node augmentation
45 * defined in openroadm-clli-network.yang
48 if (nodeInfo.getNodeClli() != null) {
49 nodeBldr.setNodeId(new NodeId(nodeInfo.getNodeClli()))
50 .withKey(new NodeKey(new NodeId(nodeInfo.getNodeClli())));
51 Node1 clliAugmentation = new Node1Builder()
52 .setClli(nodeInfo.getNodeClli())
54 nodeBldr.addAugmentation(clliAugmentation);
56 LOG.warn("No CLLI configured in configuration of {}", deviceId);
58 return nodeBldr.build();