2 * Copyright © 2017 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.inventory;
11 import static java.util.Objects.requireNonNull;
12 import static org.opendaylight.transportpce.inventory.utils.StringUtils.getCurrentTimestamp;
13 import static org.opendaylight.transportpce.inventory.utils.StringUtils.prepareDashString;
14 import static org.opendaylight.transportpce.inventory.utils.StringUtils.prepareEmptyString;
16 import java.sql.Connection;
17 import java.sql.PreparedStatement;
18 import java.sql.ResultSet;
19 import java.sql.SQLException;
20 import java.util.Optional;
21 import java.util.concurrent.ExecutionException;
22 import javax.sql.DataSource;
23 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
24 import org.opendaylight.transportpce.common.Timeouts;
25 import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
26 import org.opendaylight.transportpce.inventory.query.Queries;
27 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.CpSlots;
28 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.Ports;
29 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.packs.CircuitPacks;
30 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.external.links.ExternalLink;
31 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.Interface;
32 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.internal.links.InternalLink;
33 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.OrgOpenroadmDevice;
34 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.ConnectionMap;
35 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.Degree;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.Info;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.Protocols;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnections;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.SharedRiskGroup;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.physical.links.PhysicalLink;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.shelf.Slots;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.shelves.Shelves;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev161014.Interface1;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev161014.ethernet.container.EthernetBuilder;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.Protocols1;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.lldp.container.lldp.PortConfig;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.lldp.container.lldp.nbr.list.IfName;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.och.container.OchBuilder;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.ots.container.OtsBuilder;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.odu.attributes.Tcm;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.odu.container.OduBuilder;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.opu.opu.msi.ExpMsi;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.opu.opu.msi.RxMsi;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.opu.opu.msi.TxMsi;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.otu.container.OtuBuilder;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.wavelength.map.rev161014.wavelength.map.g.Wavelengths;
57 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
58 import org.slf4j.Logger;
59 import org.slf4j.LoggerFactory;
61 public class INode121 {
63 private static final Logger LOG = LoggerFactory.getLogger(INode121.class);
65 private final DataSource dataSource;
66 private final DeviceTransactionManager deviceTransactionManager;
68 public INode121(DataSource dataSource, DeviceTransactionManager deviceTransactionManager) {
69 this.dataSource = dataSource;
70 this.deviceTransactionManager = deviceTransactionManager;
73 public boolean addNode(String deviceId) {
75 InstanceIdentifier<Info> infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class);
76 Optional<Info> infoOpt =
77 deviceTransactionManager.getDataFromDevice(deviceId, LogicalDatastoreType.OPERATIONAL, infoIID,
78 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
80 if (infoOpt.isPresent()) {
81 deviceInfo = infoOpt.get();
83 LOG.warn("Could not get device info from DataBroker");
86 boolean sqlResult = false;
87 String query = Queries.getQuery().deviceInfoInsert().get();
88 LOG.info("Running {} query ", query);
89 try (Connection connection = dataSource.getConnection();
90 PreparedStatement preparedStatement = connection.prepareStatement(query)) {
91 Object[] prepareParameters = prepareDeviceInfoParameters(deviceInfo);
92 for (int i = 0; i < prepareParameters.length; i++) {
93 LOG.debug("Parameter {} has value {}", i + 1, prepareParameters[i]);
94 preparedStatement.setObject(i + 1, prepareParameters[i]);
97 int executeUpdate = preparedStatement.executeUpdate();
98 LOG.info("{} entries were added", executeUpdate);
101 LOG.debug("iNode AddNode call complete");
102 getRoadmShelves(deviceId);
103 LOG.debug("iNode getRoadmShelves call complete");
104 getCircuitPacks(deviceId);
105 LOG.debug("iNode getCircuitPacks call complete");
107 LOG.debug("iNode persist interfaces call");
108 persistDevInterfaces(deviceId, connection);
109 LOG.debug("iNode persist interfaces call complete");
112 LOG.debug("iNode persist protocols call");
113 persistDevProtocols(deviceId, connection);
114 LOG.debug("iNode persist protocols call complete");
117 LOG.debug("iNode persist wavelength map call");
118 persistDevWavelengthMap(deviceId, connection);
119 LOG.debug("iNode persist wavelength map call complete");
121 LOG.debug("iNode persist internal links map call");
122 persistDevInternalLinks(deviceId, connection);
123 LOG.debug("iNode persist internal links map call complete");
125 LOG.debug("iNode persist Physical links map call");
126 persistDevPhysicalLinks(deviceId, connection);
127 LOG.debug("iNode persist Physical links map call complete");
129 LOG.debug("iNode persist External links map call");
130 persistDevExternalLinks(deviceId, connection);
131 LOG.debug("iNode persist External links map call complete");
133 LOG.debug("iNode persist degree map call");
134 persistDevDegree(deviceId, connection);
135 LOG.debug("iNode persist degree map call complete");
137 LOG.debug("iNode persist srg map call");
138 persistDevSrg(deviceId, connection);
139 LOG.debug("iNode persist srg map call complete");
141 LOG.debug("iNode persist Roadm Connections call");
142 persistDevRoadmConnections(deviceId, connection);
143 LOG.debug("iNode persist Roadm Connections call complete");
145 LOG.debug("iNode persist Connection Map call");
146 persistDevConnectionMap(deviceId, connection);
147 LOG.debug("iNode persist Connection Map call complete");
149 } catch (SQLException | InterruptedException | ExecutionException e) {
150 LOG.error("Something wrong when storing node into DB", e);
155 public boolean nodeExists(String nodeId) {
156 String selectTableSQL = "select count(*) node_exists from inv_dev_info where node_id = ?";
158 LOG.info("Checking if {} exists in DB", nodeId);
159 try (Connection connection = dataSource.getConnection();
160 PreparedStatement preparedStmt = connection.prepareStatement(selectTableSQL)) {
161 preparedStmt.setString(1, nodeId);
162 try (ResultSet rs = preparedStmt.executeQuery()) {
164 nodeExists = rs.getInt("node_exists");
165 LOG.debug("Found {} devices matching {}", nodeExists, nodeId);
168 } catch (SQLException e) {
169 LOG.error("Something wrong when fetching node in DB", e);
171 return nodeExists == 0 ? false : true;
174 public void getRoadmShelves(String nodeId) throws InterruptedException, ExecutionException {
175 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
176 Optional<OrgOpenroadmDevice> deviceObject = deviceTransactionManager.getDataFromDevice(nodeId,
177 LogicalDatastoreType.OPERATIONAL, deviceIID, Timeouts.DEVICE_READ_TIMEOUT,
178 Timeouts.DEVICE_READ_TIMEOUT_UNIT);
180 LOG.info("Shelves size {}", deviceObject.get().getShelves().size());
181 try (Connection connection = requireNonNull(dataSource.getConnection())) {
182 for (int i = 0; i < deviceObject.get().getShelves().size(); i++) {
183 Shelves shelve = deviceObject.get().getShelves().get(i);
184 String shelfName = shelve.getShelfName();
186 LOG.info("Getting Shelve Details of {}", shelfName);
187 if (shelve.getSlots() != null) {
188 LOG.info("Slot Size {} ", shelve.getSlots().size());
189 persistShelveSlots(nodeId, shelve, connection);
191 LOG.info("No Slots for shelf {}", shelfName);
194 persistShelves(nodeId, connection, shelve);
196 } catch (SQLException e1) {
197 LOG.error("Something wrong when fetching ROADM shelves in DB", e1);
201 public void getCircuitPacks(String nodeId) throws InterruptedException, ExecutionException {
202 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
203 Optional<OrgOpenroadmDevice> deviceObject =
204 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
205 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
206 if (!deviceObject.isPresent()) {
207 LOG.warn("Device object {} was not found", nodeId);
210 LOG.info("Circuit pack size {}", deviceObject.get().getCircuitPacks().size());
212 try (Connection connection = requireNonNull(dataSource.getConnection())) {
213 for (int i = 0; i < deviceObject.get().getCircuitPacks().size(); i++) {
214 CircuitPacks cp = deviceObject.get().getCircuitPacks().get(i);
216 if (cp.getCpSlots() != null) {
217 persistCircuitPacksSlots(nodeId, cp, connection);
219 LOG.info("Everything {}", cp);
220 LOG.info("CP is {}", cp);
222 //persistPorts(cp, connection);
223 if (cp.getPorts() != null) {
224 persistCPPorts(nodeId, connection, cp);
226 persistCircuitPacks(nodeId, connection, cp);
228 } catch (SQLException e1) {
229 LOG.error("Something wrong when fetching Circuit Packs in DB", e1);
233 private void persistCircuitPacks(String nodeId, Connection connection, CircuitPacks cp) {
234 Object[] parameters = prepareCircuitPacksParameters(nodeId, cp);
235 String query = Queries.getQuery().deviceCircuitPackInsert().get();
236 LOG.info("Running {} query ", query);
237 try (PreparedStatement stmt = connection.prepareStatement(query)) {
238 for (int j = 0; j < parameters.length; j++) {
239 stmt.setObject(j + 1, parameters[j]);
242 stmt.clearParameters();
243 } catch (SQLException e) {
244 LOG.error("Something wrong when storing Circuit Packs in DB", e);
248 private void persistShelves(String nodeId, Connection connection, Shelves shelve) {
249 Object[] shelvesParameter = prepareShelvesParameters(nodeId, shelve);
250 String query = Queries.getQuery().deviceShelfInsert().get();
251 LOG.info("Running {} query ", query);
252 try (PreparedStatement preparedStmt = connection.prepareStatement(query)) {
253 for (int j = 0; j < shelvesParameter.length; j++) {
254 preparedStmt.setObject(j + 1, shelvesParameter[j]);
256 preparedStmt.execute();
257 preparedStmt.clearParameters();
258 } catch (SQLException e) {
259 LOG.error("Something wrong when storing shelves in DB", e);
263 private void persistShelveSlots(String nodeId, Shelves shelves, Connection connection) {
264 String startTimetampStr = getCurrentTimestamp();
265 for (int i = 0; i < shelves.getSlots().size(); i++) {
266 Slots slot = shelves.getSlots().get(i);
267 LOG.info("Getting Slot Details of {}", slot.getSlotName());
268 Object[] parameters = new Object[]{nodeId,
269 shelves.getShelfName(),
272 slot.getProvisionedCircuitPack(),
276 String query = Queries.getQuery().deviceShelfSlotInsert().get();
277 LOG.info("Running {} query ", query);
278 try (PreparedStatement stmt = connection.prepareStatement(query)) {
279 for (int j = 0; j < parameters.length; j++) {
280 stmt.setObject(j + 1, parameters[j]);
283 stmt.clearParameters();
284 } catch (SQLException e) {
285 LOG.error("Something wrong when storing shelves slots in DB", e);
291 private void persistCircuitPacksSlots(String nodeId, CircuitPacks circuitPacks, Connection connection) {
292 String startTimetampStr = getCurrentTimestamp();
293 for (int i = 0; i < circuitPacks.getCpSlots().size(); i++) {
294 CpSlots cpSlot = circuitPacks.getCpSlots().get(i);
296 Object[] parameters = new Object[]{nodeId,
297 circuitPacks.getCircuitPackName(),
298 cpSlot.getSlotName(),
300 cpSlot.getProvisionedCircuitPack(),
305 String query = Queries.getQuery().deviceCPSlotInsert().get();
306 LOG.info("Running {} query ", query);
307 try (PreparedStatement stmt = connection.prepareStatement(query)) {
308 for (int j = 0; j < parameters.length; j++) {
309 stmt.setObject(j + 1, parameters[j]);
312 stmt.clearParameters();
313 } catch (SQLException e) {
314 LOG.error("Something wrong when storing Cirtcuits Packs slots in DB", e);
320 * Prepares parameters for device insert query.
322 * @param deviceInfo device information
323 * @return Object an object
325 private static Object[] prepareDeviceInfoParameters(Info deviceInfo) {
326 String startTimetampStr = getCurrentTimestamp();
328 String nodeId = prepareDashString(deviceInfo.getNodeId());
329 Long nodeNumber = deviceInfo.getNodeNumber().toJava();
330 String nodeTypeEnu = deviceInfo.getNodeType().getName();
331 String clli = prepareDashString(deviceInfo.getClli());
332 String vendor = prepareDashString(deviceInfo.getVendor());
333 String model = prepareDashString(deviceInfo.getModel());
334 String serialId = prepareDashString(deviceInfo.getSerialId());
335 String ipAddress = prepareDashString(deviceInfo.getIpAddress().getIpv4Address().getValue());
336 String prefixLength = prepareDashString(deviceInfo.getPrefixLength());
337 String defaultGateway = prepareDashString(deviceInfo.getDefaultGateway().getIpv4Address().getValue());
338 String sourceEnum = deviceInfo.getSource().getName();
339 String currentIpAddress = prepareDashString(deviceInfo.getCurrentIpAddress().getIpv4Address().getValue());
340 String currentPrefixLength = prepareDashString(deviceInfo.getCurrentPrefixLength());
341 String currentDefaultGateway = prepareDashString(deviceInfo.getDefaultGateway().getIpv4Address().getValue());
342 String macAddress = prepareDashString(deviceInfo.getMacAddress().getValue());
343 String softwareVersion = prepareDashString(deviceInfo.getSoftwareVersion());
344 //String openroadmVersion = "1.2.1";
345 String template = prepareDashString(deviceInfo.getTemplate());
346 String currentDatetime = prepareDashString(deviceInfo.getCurrentDatetime().getValue());
347 String geoLatitude = (deviceInfo.getGeoLocation() != null
348 ? prepareDashString(deviceInfo.getGeoLocation().getLatitude()) : "");
349 String geoLongitude = (deviceInfo.getGeoLocation() != null
350 ? prepareDashString(deviceInfo.getGeoLocation().getLongitude()) : "");
351 String maxDegrees = (deviceInfo.getMaxDegrees() == null ? "-1" : prepareDashString(deviceInfo.getMaxDegrees()));
352 String maxSrgs = (deviceInfo.getMaxSrgs() == null ? "-1" : prepareDashString(deviceInfo.getMaxSrgs()));
353 String swVersion = prepareDashString(deviceInfo.getSoftwareVersion()); //sw_version
354 String swValidationTimer = prepareDashString(""); //sw_validation_timer
355 String activationDateTime = prepareDashString(""); //activation_date_time
356 //Integer maxNumBin15minHistoricalPm = null;
357 //Integer maxNumBin24hourHistoricalPm = null;
358 /*jsonDevInfo = JsonStringBuilder.getDevInfoJson().replace("$$NODE-ID$$",nodeId)
359 .replace("$$NODE-NUMBER$$", nodeNumber)
360 .replace("$$NODE-TYPE$$",nodeType)
361 .replace("$$CLLI$$",clli)
362 .replace("$$VENDOR$$",vendor)
363 .replace("$$MODEL$$",model)
364 .replace("$$SERIAL-ID$$",serialId)
365 .replace("$$IPADDRESS$$",ipAddress)
366 .replace("$$PREFIX-LENGTH$$",prefixLength)
367 .replace("$$DEFAULTGATEWAY$$",defaultGateway)
368 .replace("$$SOURCE$$",String.valueOf(source))
369 .replace("$$CURRENT-IPADDRESS$$",currentIpAddress)
370 .replace("$$CURRENT-PREFIX-LENGTH$$",currentPrefixLength)
371 .replace("$$CURRENT-DEFAULTGATEWAY$$",currentDefailtGateway)
372 .replace("$$MACADDRESS$$",macAddress)
373 .replace("$$SOFTWAREVERSION$$",softwareVersion)
374 .replace("$$OPENROADM-VERSION$$",openroadmVersion)
375 .replace("$$TEMPLATE$$",template)
376 .replace("$$CURRENT-DATETIME$$",currentDatetime)
377 .replace("$$LATITUDE$$",latitude)
378 .replace("$$LONGITUDE$$",longitude)
379 .replace("$$MAX-DEGREES$$",maxDegrees)
380 .replace("$$MAX-SRGS$$",maxSrgs)
381 .replace("$$MAX-NUM-BIN-15MIN-HISTORICAL-PM$$",prepareDashString(""))
382 .replace("$$MAX-NUM-BIN-24HOUR-HISTORICAL-PM$$",prepareDashString(""))
383 .replace("$$SW-VERSION$$",swVersion)
384 .replace("$$SW-VALIDATION-TIMER$$",swValidationTimer)
385 .replace("$$ACTIVATION-DATE-TIME$$",activationDateTime);*/
402 currentDefaultGateway,
413 //maxNumBin15minHistoricalPm,
414 //maxNumBin24hourHistoricalPm,
425 private static Object[] prepareShelvesParameters(String nodeId, Shelves shelve) {
426 String startTimestamp = getCurrentTimestamp();
428 return new Object[]{nodeId,
429 shelve.getShelfName(),
430 shelve.getShelfType(),
432 shelve.getShelfPosition(),
433 (shelve.getAdministrativeState() == null ? null : shelve.getAdministrativeState().getIntValue()),
436 shelve.getSerialId(),
438 shelve.getProductCode(),
439 (shelve.getManufactureDate() == null ? null : shelve.getManufactureDate().getValue()),
441 shelve.getHardwareVersion(),
442 (shelve.getOperationalState() == null ? null : shelve.getOperationalState().getIntValue()),
443 (shelve.getEquipmentState() == null ? null : shelve.getEquipmentState().getIntValue()),
444 (shelve.getDueDate() == null ? null : shelve.getDueDate().getValue()),
450 private static Object[] prepareCPPortsParameters(String nodeId, CircuitPacks circuitPacks, Ports cpPort) {
452 String circuitPackName = circuitPacks.getCircuitPackName();
453 String portName = cpPort.getPortName();
454 String portType = cpPort.getPortType();
455 String portQualEnu = String.valueOf((cpPort.getPortQual() == null ? "-1" : cpPort.getPortQual().getName()));
456 String portWavelengthTypeEnu = "-1"; //cpPort.getPortWavelengthType().getIntValue(); /* Check error*/
457 String portDirectionEnu = String.valueOf((cpPort.getPortDirection() == null ? "" :
458 cpPort.getPortDirection().getName()));
459 String label = cpPort.getLabel();
460 String circuitId = cpPort.getCircuitId();
461 String administrativeStateEnu = (cpPort.getAdministrativeState() == null ? "" :
462 cpPort.getAdministrativeState().getName());
463 String operationalStateEnu =
464 (cpPort.getOperationalState() == null ? "" : cpPort.getOperationalState().getName());
465 String logicalConnectionPoint = cpPort.getLogicalConnectionPoint();
466 String parentPortCircuitPackName = (cpPort.getPartnerPort() == null ? "" :
467 (cpPort.getPartnerPort().getCircuitPackName() == null ? "" : cpPort.getPartnerPort().getCircuitPackName()));
468 String partnerPortPortName = (cpPort.getPartnerPort() == null ? "" :
469 (cpPort.getPartnerPort().getPortName() == null ? "" : cpPort.getPartnerPort().getPortName().toString()));
470 String partnerPortCircuitPackName = (cpPort.getParentPort() == null ? "" :
471 (cpPort.getParentPort().getCircuitPackName() == null ? "" : cpPort.getParentPort().getCircuitPackName()));
472 String parentPortPortName = (cpPort.getParentPort() == null ? "" :
473 (cpPort.getParentPort().getPortName() == null ? "" : cpPort.getParentPort().toString()));
474 String roadmPortPortPowerCapabilityMinRx = (cpPort.getRoadmPort() == null ? "" :
475 (cpPort.getRoadmPort().getPortPowerCapabilityMinRx() == null ? "" :
476 cpPort.getRoadmPort().getPortPowerCapabilityMinRx().toString()));
477 String roadmPortPortPowerCapabilityMinTx = (cpPort.getRoadmPort() == null ? "" :
478 (cpPort.getRoadmPort().getPortPowerCapabilityMinTx() == null ? "" :
479 cpPort.getRoadmPort().getPortPowerCapabilityMinTx().toString()));
480 String roadmPortPortPowerCapabilityMaxRx = (cpPort.getRoadmPort() == null ? "" :
481 (cpPort.getRoadmPort().getPortPowerCapabilityMaxRx() == null ? "" :
482 cpPort.getRoadmPort().getPortPowerCapabilityMaxRx().toString()));
483 String roadmPortPortPowerCapabilityMaxTx = (cpPort.getRoadmPort() == null ? "" :
484 (cpPort.getRoadmPort().getPortPowerCapabilityMaxTx() == null ? "" :
485 cpPort.getRoadmPort().getPortPowerCapabilityMaxTx().toString()));
486 //String roadmPortCapableWavelengths = "";
487 //String roadmPortAvailableWavelengths = "";
488 //String roadmPortUsedWavelengths = "";
489 String transponderPortPortPowerCapabilityMinRx = (cpPort.getTransponderPort() == null ? "" :
490 (cpPort.getTransponderPort().getPortPowerCapabilityMinRx() == null ? "" :
491 cpPort.getTransponderPort().getPortPowerCapabilityMinRx().toString()));
492 String transponderPortPortPowerCapabilityMinTx = (cpPort.getTransponderPort() == null ? "" :
493 (cpPort.getTransponderPort().getPortPowerCapabilityMinTx() == null ? "" :
494 cpPort.getTransponderPort().getPortPowerCapabilityMinTx().toString()));
495 String transponderPortPortPowerCapabilityMaxRx = (cpPort.getTransponderPort() == null ? "" :
496 (cpPort.getTransponderPort().getPortPowerCapabilityMaxRx() == null ? "" :
497 cpPort.getTransponderPort().getPortPowerCapabilityMaxRx().toString()));
498 String transponderPortPortPowerCapabilityMaxTx = (cpPort.getTransponderPort() == null ? "" :
499 (cpPort.getTransponderPort().getPortPowerCapabilityMaxTx() == null ? "" :
500 cpPort.getTransponderPort().getPortPowerCapabilityMaxTx().toString()));
501 //String transponderPortCapableWavelengths = "";
502 String otdrPortLaunchCableLength = (cpPort.getOtdrPort() == null ? "" :
503 (cpPort.getOtdrPort().getLaunchCableLength() == null ? "" :
504 cpPort.getOtdrPort().getLaunchCableLength().toString()));
505 String otdrPortPortDirection = (cpPort.getOtdrPort() == null ? "-1" :
506 (cpPort.getOtdrPort().getPortDirection() == null ? "-1" :
507 Integer.toString(cpPort.getOtdrPort().getPortDirection().getIntValue())));
508 //String ilaPortPortPowerCapabilityMixRx = "";
509 //String ilaPortPortPowerCapabilityMixTx = "";
510 //String ilaPortPortPowerCapabilityMaxRx = "";
511 //String ilaPortPortPowerCapabilityMaxTx = "";
513 String startTimestamp = getCurrentTimestamp();
515 return new Object[]{nodeId,
520 portWavelengthTypeEnu,
524 administrativeStateEnu,
526 logicalConnectionPoint,
527 partnerPortCircuitPackName,
529 parentPortCircuitPackName,
531 roadmPortPortPowerCapabilityMinRx,
532 roadmPortPortPowerCapabilityMinTx,
533 roadmPortPortPowerCapabilityMaxRx,
534 roadmPortPortPowerCapabilityMaxTx,
535 //roadmPortCapableWavelengths,
536 //roadmPortAvailableWavelengths,
537 //roadmPortUsedWavelengths,
539 transponderPortPortPowerCapabilityMinRx,
540 transponderPortPortPowerCapabilityMinTx,
541 transponderPortPortPowerCapabilityMaxRx,
542 transponderPortPortPowerCapabilityMaxTx,
543 //transponderPortCapableWavelengths,
545 otdrPortLaunchCableLength,
546 otdrPortPortDirection,
547 //ilaPortPortPowerCapabilityMixRx,
548 //ilaPortPortPowerCapabilityMixTx,
549 //ilaPortPortPowerCapabilityMaxRx,
550 //ilaPortPortPowerCapabilityMaxTx,
558 private static Object[] prepareCircuitPacksParameters(String nodeId, CircuitPacks cpack) {
559 String startTimestamp = getCurrentTimestamp();
560 return new Object[]{nodeId,
561 cpack.getCircuitPackName(),
562 cpack.getCircuitPackType(),
563 cpack.getCircuitPackProductCode(),
564 (cpack.getAdministrativeState() == null ? "" : cpack.getAdministrativeState().getIntValue()),
569 cpack.getProductCode(),
570 (cpack.getManufactureDate() == null ? "" : cpack.getManufactureDate().getValue()),
572 cpack.getHardwareVersion(),
573 (cpack.getOperationalState() == null ? -1 : cpack.getOperationalState().getIntValue()),
574 cpack.getCircuitPackCategory().getType().getIntValue(),
575 cpack.getCircuitPackCategory().getExtension(),
576 (cpack.getEquipmentState() == null ? -1 : cpack.getEquipmentState().getIntValue()),
577 cpack.getCircuitPackMode(),
581 prepareEmptyString(cpack.getDueDate()),
582 prepareEmptyString((cpack.getParentCircuitPack() == null) ? "" :
583 ((cpack.getParentCircuitPack().getCircuitPackName() == null) ? "" :
584 cpack.getParentCircuitPack().getCircuitPackName())
586 prepareEmptyString((cpack.getParentCircuitPack() == null) ? "" :
587 ((cpack.getParentCircuitPack().getCpSlotName() == null) ? "" :
588 cpack.getParentCircuitPack().getCpSlotName())
595 private void persistCPPorts(String nodeId, Connection connection, CircuitPacks circuitPacks) {
597 for (int i = 0; i < circuitPacks.getPorts().size(); i++) {
598 Object[] cpPortsParameters = prepareCPPortsParameters(nodeId, circuitPacks, circuitPacks.getPorts().get(i));
599 String query = Queries.getQuery().deviceCPPortInsert().get();
600 LOG.info("Running {} query ", query);
601 try (PreparedStatement preparedStmt = connection.prepareStatement(query)) {
602 for (int j = 0; j < cpPortsParameters.length; j++) {
603 preparedStmt.setObject(j + 1, cpPortsParameters[j]);
605 preparedStmt.execute();
606 preparedStmt.clearParameters();
607 } catch (SQLException e) {
608 LOG.error("Something wrong when storing Cirtcuits Packs Ports in DB", e);
614 private Object[] prepareDevInterfaceParameters(String nodeId, Interface deviceInterface, Connection connection) {
616 String ethernetDuplexEnu = "";
617 String ethernetAutoNegotiationEnu = "";
618 String maintTestsignalTestpatternEnu = "";
619 String maintTestsignalTypeEnu = "";
620 String otuFecEnu = "";
621 String otuMaintTypeEnu = "";
622 //String otsFiberTypeEnu = "";
623 String ethernetSpeed = "-1";
624 String ethernetFec = "";
625 String ethernetMtu = "-1";
626 String ethernetCurrSpeed = "";
627 String ethernetCurrDuplex = "-1";
628 //String mciMcttpMinFreq = "";
629 //String mciMcttpMaxFreq = "";
630 //String mciMcttpCenterFreq = "";
631 //String mciMcttpSlotWidth = "";
632 //String mciNmcCtpFrequency = "";
633 //String mciNmcCtpWidth = "";
635 //String ochFrequency = "";
636 //String ochWidth = "";
637 String ochWavelengthNumber = "";
638 String ochModulationFormat = "";
639 String ochTransmitPower = "";
640 String otsSpanLossReceive = "";
641 String otsSpanLossTransmit = "";
642 //String otsIngressSpanLossAgingMargin = "";
643 //String otsEolMaxLoadPin = "";
645 //String oduFunction = "";
646 String oduMonitoringMode = "";
647 //String oduNoOamFunction = "";
648 String oduProactiveDelayMeasurementEnabled = "";
649 //String oduPoaTribPortNumber = "-1";
650 //String oduTxSapi = "";
651 //String oduTxDapi = "";
652 //String oduTxOperator = "";
653 //String oduAcceptedSapi = "";
654 //String oduAcceptedDapi = "";
655 //String oduAcceptedOperator = "";
656 //String oduExpectedSapi = "";
657 //String oduExpectedDapi = "";
658 //String oduTimActEnabled = "";
659 //String oduTimDetectMode = "";
660 //String oduDegmIntervals = "-1";
661 //String oduDegthrPercentage = "-1";
662 String opuPayloadType = "";
663 String opuRxPayloadType = "";
664 String opuExpPayloadType = "";
665 String opuPayloadInterface = "";
666 String maintTestsignalEnabled = "";
667 String maintTestsignalBiterrors = "-1";
668 String maintTestsignalBiterrorsterminal = "-1";
669 String maintTestsignalSyncseconds = "-1";
670 String maintTestsignalSyncsecondsterminal = "-1";
672 //String otuTxSapi = "";
673 //String otuTxDapi = "";
674 //String otuTxOperator = "";
675 //String otuAcceptedSapi = "";
676 //String otuAcceptedDapi = "";
677 //String otuAcceptedOperator = "";
678 //String otuExpectedSapi = "";
679 //String otuExpectedDapi = "";
680 //String otuTimActEnabled = "";
681 //String otuTimDetectMode = "";
682 //String otuDegmIntervals = "-1";
683 //String otuDegthrPercentage = "-1";
684 String otuMaintLoopbackEnabled = "";
685 //String mtOtuRate = "";
686 //String mtOtuFec = "";
687 //String mtOtuMaintLoopback = "";
688 //String mtOtuEnabled = "";
689 //String mtOtuType = "";
691 String name = deviceInterface.getName();
692 String description = deviceInterface.getDescription();
693 String type = deviceInterface.getType().getTypeName();
694 String administrativeStateEnu = deviceInterface.getAdministrativeState().getName();
695 int operationalState = deviceInterface.getOperationalState().getIntValue();
696 String circuitId = deviceInterface.getCircuitId();
697 String supportingInterface = deviceInterface.getSupportingInterface();
698 String supportingCircuitPackName = deviceInterface.getSupportingCircuitPackName();
699 String supportingPort = deviceInterface.getSupportingPort().toString();
701 switch (deviceInterface.getType().toString()) {
704 //EthernetBuilder ethIfBuilder = new EthernetBuilder();
705 EthernetBuilder ethIfBuilder = new EthernetBuilder(deviceInterface.augmentation(Interface1.class)
707 ethernetSpeed = (ethIfBuilder.getSpeed() == null ? "-1" :
708 Integer.toString(ethIfBuilder.getSpeed().intValue()));
709 ethernetFec = ethIfBuilder.getFec().getName();
710 ethernetDuplexEnu = (ethIfBuilder.getDuplex() == null ? "" : ethIfBuilder.getDuplex().getName());
711 ethernetMtu = ethIfBuilder.getMtu().toString();
712 ethernetAutoNegotiationEnu = ethIfBuilder.getAutoNegotiation().getName();
713 ethernetCurrSpeed = ethIfBuilder.getCurrSpeed();
714 ethernetCurrDuplex = ethIfBuilder.getCurrDuplex();
718 OchBuilder ochIfBuilder = new OchBuilder(deviceInterface.augmentation(
719 org.opendaylight.yang.gen.v1
720 .http.org.openroadm.optical.channel.interfaces.rev161014.Interface1.class)
722 ochRate = ochIfBuilder.getRate().getName();
723 ochWavelengthNumber = ochIfBuilder.getWavelengthNumber().toString();
724 ochModulationFormat = ochIfBuilder.getModulationFormat().getName();
725 ochTransmitPower = ochIfBuilder.getTransmitPower().toString();
729 OtsBuilder otsIfBuilder = new OtsBuilder(deviceInterface.augmentation(
730 org.opendaylight.yang.gen.v1
731 .http.org.openroadm.optical.transport.interfaces.rev161014.Interface1.class)
733 //otsFiberTypeEnu = String.valueOf(otsIfBuilder.getFiberType().getIntValue());
734 otsSpanLossReceive = otsIfBuilder.getSpanLossReceive().toString();
735 otsSpanLossTransmit = otsIfBuilder.getSpanLossTransmit().toString();
739 OduBuilder oduIfBuilder = new OduBuilder(deviceInterface.augmentation(
740 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.Interface1.class)
742 oduRate = String.valueOf(oduIfBuilder.getRate());
743 oduMonitoringMode = oduIfBuilder.getMonitoringMode().getName();
744 oduProactiveDelayMeasurementEnabled = oduIfBuilder.isProactiveDelayMeasurementEnabled().toString();
746 persistDevInterfaceTcm(nodeId, name, oduIfBuilder, connection);
747 persistDevInterfaceOtnOduTxMsi(nodeId, name, oduIfBuilder, connection);
748 persistDevInterfaceOtnOduRxMsi(nodeId, name, oduIfBuilder, connection);
749 persistDevInterfaceOtnOduExpMsi(nodeId, name, oduIfBuilder, connection);
751 opuPayloadType = oduIfBuilder.getOpu().getPayloadType();
752 opuRxPayloadType = oduIfBuilder.getOpu().getRxPayloadType();
753 opuExpPayloadType = oduIfBuilder.getOpu().getExpPayloadType();
754 opuPayloadInterface = oduIfBuilder.getOpu().getPayloadInterface();
755 /*persistDevInterfaceOtnOduTxMsi(nodeId,name,oduIfBuilder,connection);
756 persistDevInterfaceOtnOduRxMsi(nodeId,name,oduIfBuilder,connection);
757 persistDevInterfaceOtnOduExpMsi(nodeId,name,oduIfBuilder,connection); */
758 maintTestsignalEnabled = oduIfBuilder.getMaintTestsignal().isEnabled().toString();
759 maintTestsignalTestpatternEnu = oduIfBuilder.getMaintTestsignal().getTestPattern().getName();
760 maintTestsignalTypeEnu = oduIfBuilder.getMaintTestsignal().getType().getName();
761 maintTestsignalBiterrors = Integer.toString(
762 oduIfBuilder.getMaintTestsignal().getBitErrors().intValue());
763 maintTestsignalBiterrorsterminal = oduIfBuilder.getMaintTestsignal().getBitErrorsTerminal().toString();
764 maintTestsignalSyncseconds = oduIfBuilder.getMaintTestsignal().getSyncSeconds();
765 maintTestsignalSyncsecondsterminal = oduIfBuilder.getMaintTestsignal().getSyncSecondsTerminal();
769 OtuBuilder otuIfBuilder =
770 new OtuBuilder(deviceInterface.augmentation(
771 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class)
773 otuRate = otuIfBuilder.getRate().getName();
774 otuFecEnu = otuIfBuilder.getFec().getName();
775 otuMaintLoopbackEnabled = otuIfBuilder.getMaintLoopback().isEnabled().toString();
776 otuMaintTypeEnu = otuIfBuilder.getMaintLoopback().getType().getName();
780 LOG.error("could not get interface type");
784 String startTimestamp = getCurrentTimestamp();
786 return new Object[]{nodeId,
790 administrativeStateEnu,
791 Integer.toString(operationalState),
794 supportingCircuitPackName,
800 ethernetAutoNegotiationEnu,
805 //mciMcttpCenterFreq,
807 //mciNmcCtpFrequency,
809 "", "", "", "", "", "",
820 //otsIngressSpanLossAgingMargin,
829 oduProactiveDelayMeasurementEnabled,
830 //oduPoaTribPortNumber,
836 //oduAcceptedOperator,
842 //oduDegthrPercentage,
843 "-1", "", "", "", "", "","", "", "", "", "", "-1", "-1",
848 maintTestsignalEnabled,
849 maintTestsignalTestpatternEnu,
850 maintTestsignalTypeEnu,
851 maintTestsignalBiterrors,
852 maintTestsignalBiterrorsterminal,
853 maintTestsignalSyncseconds,
854 maintTestsignalSyncsecondsterminal,
862 //otuAcceptedOperator,
868 //otuDegthrPercentage,
869 "", "", "", "", "", "","", "", "", "", "-1", "-1",
870 otuMaintLoopbackEnabled,
874 //mtOtuMaintLoopback,
884 private static Object[] prepareDevInterfaceTcmParameters(String nodeId, String interfaceName, Tcm tcm) {
886 String layer = tcm.getLayer().toString();
887 String monitoringModeEnu = tcm.getMonitoringMode().getName();
888 String ltcActEnabled = tcm.isLtcActEnabled().toString();
889 String proactiveDelayMeasurementEnabled = tcm.isProactiveDelayMeasurementEnabled().toString();
890 //String tcmDirectionEnu = "";
891 //String timDetectModeEnu = "";
892 //String txSapi = "";
893 //String txDapi = "";
894 //String txOperator = "";
895 //String acceptedSapi = "";
896 //String acceptedDapi = "";
897 //String acceptedOperator = "";
898 //String expectedSapi = "";
899 //String expectedDapi = "";
900 //String timActEnabled = "";
901 //String degmIntervals = "";
902 //String degthrPercentage = "";
903 String startTimestamp = getCurrentTimestamp();
905 return new Object[]{nodeId,
910 proactiveDelayMeasurementEnabled,
924 "", "", "", "", "", "", "", "", "", "", "", "", "",
930 private static Object[] prepareDevInterfaceOtnOduTxMsiParameters(String nodeId, String interfaceName, TxMsi txMsi) {
932 String tribSlot = txMsi.getTribSlot().toString();
933 String odtuType = txMsi.getOdtuType().getTypeName();
934 String tribPort = txMsi.getTribPort().toString();
935 String tribPortPayload = txMsi.getTribPortPayload();
937 String startTimestamp = getCurrentTimestamp();
939 return new Object[]{nodeId,
951 private static Object[] prepareDevInterfaceOtnOduRxMsiParameters(String nodeId, String interfaceName, RxMsi rxMsi) {
953 String tribSlot = rxMsi.getTribSlot().toString();
954 String odtuType = rxMsi.getOdtuType().getTypeName();
955 String tribPort = rxMsi.getTribPort().toString();
956 String tribPortPayload = rxMsi.getTribPortPayload();
958 String startTimestamp = getCurrentTimestamp();
960 return new Object[]{nodeId,
973 private static Object[] prepareDevInterfaceOtnOduExpMsiParameters(String nodeId, String interfaceName,
976 String tribSlot = expMsi.getTribSlot().toString();
977 String odtuType = expMsi.getOdtuType().getTypeName();
978 String tribPort = expMsi.getTribPort().toString();
979 String tribPortPayload = expMsi.getTribPortPayload();
981 String startTimestamp = getCurrentTimestamp();
983 return new Object[]{nodeId,
995 private void persistDevInterfaces(String nodeId, Connection connection) {
997 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
998 Optional<OrgOpenroadmDevice> deviceObject =
999 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1000 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1002 /*InstanceIdentifier<Interface> interfaceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
1003 .child(Interface.class);
1004 Optional<Interface> interfaceOpt =
1005 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, interfaceIID,
1006 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT); */
1008 for (int i = 0; i < deviceObject.get().getInterface().size(); i++) {
1009 Interface deviceInterface;
1011 deviceInterface = deviceObject.get().getInterface().get(i);
1012 /*if (interfaceOpt.isPresent()) {
1013 deviceInterface = interfaceOpt.get();
1015 LOG.warn("Could not get interface info");
1018 Object[] parameters = prepareDevInterfaceParameters(nodeId, deviceInterface, connection);
1020 String query = Queries.getQuery().deviceInterfacesInsert().get();
1021 LOG.info("Running {} query ", query);
1022 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1023 for (int j = 0; j < parameters.length; j++) {
1024 stmt.setObject(j + 1, parameters[j]);
1027 stmt.clearParameters();
1028 } catch (SQLException e) {
1029 LOG.error("Something wrong when storing devices interfaces in DB", e);
1034 private void persistDevProtocols(String nodeId, Connection connection) {
1036 InstanceIdentifier<Protocols> protocolsIID =
1037 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1038 Optional<Protocols> protocolObject =
1039 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1040 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1041 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1042 LOG.error("LLDP subtree is missing");
1045 String adminstatusEnu = protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig()
1046 .getAdminStatus().getName();
1047 String msgTxtInterval = protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig()
1048 .getMsgTxInterval().toString();
1049 String mxgTxHoldMultiplier = protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig()
1050 .getMsgTxHoldMultiplier().toString();
1051 String startTimestamp = getCurrentTimestamp();
1052 persistDevProtocolLldpPortConfig(nodeId, connection);
1053 persistDevProtocolLldpNbrList(nodeId, connection);
1055 Object[] parameters = {nodeId,
1058 mxgTxHoldMultiplier,
1063 String query = Queries.getQuery().deviceProtocolInsert().get();
1064 LOG.info("Running {} query ", query);
1065 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1066 for (int j = 0; j < parameters.length; j++) {
1067 stmt.setObject(j + 1, parameters[j]);
1070 stmt.clearParameters();
1071 } catch (SQLException e) {
1072 LOG.error("Something wrong when storing devices protocols in DB", e);
1078 private void persistDevProtocolLldpPortConfig(String nodeId, Connection connection) {
1080 InstanceIdentifier<Protocols> protocolsIID =
1081 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1082 Optional<Protocols> protocolObject =
1083 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1084 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1085 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1086 LOG.error("LLDP subtree is missing");
1089 String startTimestamp = getCurrentTimestamp();
1090 for (int i = 0; i < protocolObject.get().augmentation(Protocols1.class).getLldp().getPortConfig().size(); i++) {
1091 PortConfig portConfig =
1092 protocolObject.get().augmentation(Protocols1.class).getLldp().getPortConfig().get(i);
1093 String ifName = portConfig.getIfName();
1094 String adminStatusEnu = portConfig.getAdminStatus().getName();
1096 Object[] parameters = {nodeId,
1103 String query = Queries.getQuery().deviceProtocolPortConfigInsert().get();
1104 LOG.info("Running {} query ", query);
1105 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1106 for (int j = 0; j < parameters.length; j++) {
1107 stmt.setObject(j + 1, parameters[j]);
1110 stmt.clearParameters();
1111 } catch (SQLException e) {
1112 LOG.error("Something wrong when storing devices protocols LLDP Port config in DB", e);
1119 private void persistDevProtocolLldpNbrList(String nodeId, Connection connection) {
1121 InstanceIdentifier<Protocols> protocolsIID =
1122 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1123 Optional<Protocols> protocolObject =
1124 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1125 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1126 if (protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList() == null) {
1128 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, protocolsIID,
1129 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1132 if (protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList() == null) {
1133 LOG.error("LLDP nbrlist subtree is missing for {}", nodeId);
1136 String startTimestamp = getCurrentTimestamp();
1137 for (int i = 0; i < protocolObject.get()
1138 .augmentation(Protocols1.class).getLldp().getNbrList().getIfName().size(); i++) {
1140 IfName ifNameObj = protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList()
1141 .getIfName().get(i);
1142 String ifName = ifNameObj.getIfName();
1143 String remotesysname = ifNameObj.getRemoteSysName();
1144 String remotemgmtaddresssubtype = ifNameObj.getRemoteMgmtAddressSubType().getName();
1145 String remotemgmtaddress = ifNameObj.getRemoteMgmtAddress().getIpv4Address().toString();
1146 String remoteportidsubtypeEnu = ifNameObj.getRemotePortIdSubType().getName();
1147 String remoteportid = ifNameObj.getRemotePortId();
1148 String remotechassisidsubtypeEnu = ifNameObj.getRemoteChassisIdSubType().getName();
1149 String remotechassisid = ifNameObj.getRemoteChassisId();
1151 Object[] parameters = {nodeId,
1154 remotemgmtaddresssubtype,
1156 remoteportidsubtypeEnu,
1158 remotechassisidsubtypeEnu,
1164 String query = Queries.getQuery().deviceProtocolLldpNbrlistInsert().get();
1165 LOG.info("Running {} query ", query);
1166 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1167 for (int j = 0; j < parameters.length; j++) {
1168 stmt.setObject(j + 1, parameters[j]);
1171 stmt.clearParameters();
1172 } catch (SQLException e) {
1173 LOG.error("Something wrong when storing devices protocols LLDP list number in DB", e);
1180 private void persistDevInternalLinks(String nodeId, Connection connection) {
1182 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1183 Optional<OrgOpenroadmDevice> deviceObject =
1184 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1185 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1186 if (deviceObject.get().getInternalLink() == null) {
1188 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, deviceIID,
1189 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1191 if (deviceObject.get().getInternalLink() == null) {
1192 LOG.info("External links not found for {}", nodeId);
1196 String startTimestamp = getCurrentTimestamp();
1197 for (int i = 0; i < deviceObject.get().getInternalLink().size(); i++) {
1198 InternalLink internalLink = deviceObject.get().getInternalLink().get(i);
1199 String internalLinkName = internalLink.getInternalLinkName();
1200 String sourceCircuitPackName = internalLink.getSource().getCircuitPackName();
1201 String sourcePortName = internalLink.getSource().getPortName().toString();
1202 String destinationCircuitPackName = internalLink.getDestination().getCircuitPackName();
1203 String destinationPortName = internalLink.getDestination().getPortName().toString();
1205 Object[] parameters = {nodeId,
1207 sourceCircuitPackName,
1209 destinationCircuitPackName,
1210 destinationPortName,
1215 String query = Queries.getQuery().deviceInternalLinkInsert().get();
1216 LOG.info("Running {} query ", query);
1217 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1218 for (int j = 0; j < parameters.length; j++) {
1219 stmt.setObject(j + 1, parameters[j]);
1222 stmt.clearParameters();
1223 } catch (SQLException e) {
1224 LOG.error("Something wrong when storing devices internal links", e);
1232 private void persistDevExternalLinks(String nodeId, Connection connection) {
1234 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1235 Optional<OrgOpenroadmDevice> deviceObject =
1236 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1237 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1239 if (deviceObject.get().getExternalLink() == null) {
1241 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, deviceIID,
1242 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1244 if (deviceObject.get().getExternalLink() == null) {
1245 LOG.info("External links not found for {}", nodeId);
1247 String startTimestamp = getCurrentTimestamp();
1248 for (int i = 0; i < deviceObject.get().getExternalLink().size(); i++) {
1249 ExternalLink externalLink = deviceObject.get().getExternalLink().get(i);
1250 String externalLinkName = externalLink.getExternalLinkName();
1251 String sourceNodeId = externalLink.getSource().getNodeId();
1252 String sourceCircuitPackName = externalLink.getSource().getCircuitPackName();
1253 String sourcePortName = externalLink.getSource().getPortName();
1254 String destinationNodeId = externalLink.getDestination().getNodeId();
1255 String destinationCircuitPackName = externalLink.getDestination().getCircuitPackName();
1256 String destinationPortName = externalLink.getDestination().getPortName();
1258 Object[] parameters = {nodeId,
1261 sourceCircuitPackName,
1264 destinationCircuitPackName,
1265 destinationPortName,
1270 String query = Queries.getQuery().deviceExternalLinkInsert().get();
1271 LOG.info("Running {} query ", query);
1272 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1273 for (int j = 0; j < parameters.length; j++) {
1274 stmt.setObject(j + 1, parameters[j]);
1277 stmt.clearParameters();
1278 } catch (SQLException e) {
1279 LOG.error("Something wrong when storing devices external links", e);
1286 private void persistDevPhysicalLinks(String nodeId, Connection connection) {
1288 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1289 Optional<OrgOpenroadmDevice> deviceObject =
1290 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1291 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1292 if (deviceObject.get().getPhysicalLink() == null) {
1294 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, deviceIID,
1295 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1297 if (deviceObject.get().getPhysicalLink() == null) {
1298 LOG.info("Physical links not found for {}", nodeId);
1301 String startTimestamp = getCurrentTimestamp();
1302 for (int i = 0; i < deviceObject.get().getPhysicalLink().size(); i++) {
1303 PhysicalLink physicalLink = deviceObject.get().getPhysicalLink().get(i);
1304 String physicalLinkName = physicalLink.getPhysicalLinkName();
1305 String sourceCircuitPackName = physicalLink.getSource().getCircuitPackName();
1306 String sourcePortName = physicalLink.getSource().getPortName().toString();
1307 String destinationCircuitPackName = physicalLink.getDestination().getCircuitPackName();
1308 String destinationPortName = physicalLink.getDestination().getPortName().toString();
1310 Object[] parameters = {nodeId,
1312 sourceCircuitPackName,
1314 destinationCircuitPackName,
1315 destinationPortName,
1320 String query = Queries.getQuery().devicePhysicalLinkInsert().get();
1321 LOG.info("Running {} query ", query);
1322 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1323 for (int j = 0; j < parameters.length; j++) {
1324 stmt.setObject(j + 1, parameters[j]);
1327 stmt.clearParameters();
1328 } catch (SQLException e) {
1329 LOG.error("Something wrong when storing devices physical links", e);
1336 private void persistDevDegree(String nodeId, Connection connection) {
1338 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1339 Optional<OrgOpenroadmDevice> deviceObject =
1340 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1341 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1344 /*if (deviceObject.get().getDegree()==null){
1346 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, deviceIID,
1347 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1349 if (deviceObject.get().getDegree() == null) {
1350 LOG.warn("Degree info not found for {}", nodeId);
1353 String startTimestamp = getCurrentTimestamp();
1354 for (int i = 0; i < deviceObject.get().getDegree().size(); i++) {
1355 Degree degree = deviceObject.get().getDegree().get(i);
1356 String degreeNumber = degree.getDegreeNumber().toString();
1357 String maxWavelengths = degree.getMaxWavelengths().toString();
1358 String otdrPortCircuitPackName =
1359 (degree.getOtdrPort() == null ? "" : degree.getOtdrPort().getCircuitPackName());
1360 String otdrPortPortName =
1361 (degree.getOtdrPort() == null ? "" : degree.getOtdrPort().getPortName().toString());
1362 //String mcCapabilitiesSlotWidthGranularity = "";
1363 //String mcCapabilitiesCenterFreqGranularity = "";
1364 //String mcCapabilitiesMinSlots = "-1";
1365 //String mcCapabilitiesMaxSlots = "-1";
1366 persistDevDegreeCircuitPack(nodeId, degree, degreeNumber, connection);
1367 persistDevDegreeConnectionPort(nodeId, degree, degreeNumber, connection);
1369 Object[] parameters = {nodeId,
1372 otdrPortCircuitPackName,
1374 //mcCapabilitiesSlotWidthGranularity,
1375 //mcCapabilitiesCenterFreqGranularity,
1376 //mcCapabilitiesMinSlots,
1377 //mcCapabilitiesMaxSlots,
1383 String query = Queries.getQuery().deviceDegreeInsert().get();
1384 LOG.info("Running {} query ", query);
1385 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1386 for (int j = 0; j < parameters.length; j++) {
1387 stmt.setObject(j + 1, parameters[j]);
1390 stmt.clearParameters();
1391 } catch (SQLException e) {
1392 LOG.error("Something wrong when storing devices degrees", e);
1400 private void persistDevDegreeCircuitPack(String nodeId, Degree degree, String degreeNumber, Connection connection) {
1402 String startTimestamp = getCurrentTimestamp();
1403 for (int i = 0; i < degree.getCircuitPacks().size(); i++) {
1405 String circuitPackIndex = degree.getCircuitPacks().get(i).getIndex().toString();
1406 String circuitPackName = degree.getCircuitPacks().get(i).getCircuitPackName();
1408 Object[] parameters = {nodeId,
1416 String query = Queries.getQuery().deviceDegreeCircuitPackInsert().get();
1417 LOG.info("Running {} query ", query);
1418 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1419 for (int j = 0; j < parameters.length; j++) {
1420 stmt.setObject(j + 1, parameters[j]);
1423 stmt.clearParameters();
1424 } catch (SQLException e) {
1425 LOG.error("Something wrong when storing devices degrees circuit packs", e);
1431 private void persistDevDegreeConnectionPort(String nodeId, Degree degree, String degreeNumber,
1432 Connection connection) {
1434 String startTimestamp = getCurrentTimestamp();
1435 for (int i = 0; i < degree.getConnectionPorts().size(); i++) {
1437 String connectionPortIndex = degree.getConnectionPorts().get(i).getIndex().toString();
1438 String circuitPackName = degree.getConnectionPorts().get(i).getCircuitPackName();
1439 String portName = degree.getConnectionPorts().get(i).getPortName().toString();
1441 Object[] parameters = {nodeId,
1443 connectionPortIndex,
1450 String query = Queries.getQuery().deviceDegreeConnectionPortInsert().get();
1451 LOG.info("Running {} query ", query);
1452 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1453 for (int j = 0; j < parameters.length; j++) {
1454 stmt.setObject(j + 1, parameters[j]);
1457 stmt.clearParameters();
1458 } catch (SQLException e) {
1459 LOG.error("Something wrong when storing devices degrees connection ports", e);
1466 private void persistDevSrg(String nodeId, Connection connection) {
1468 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1469 Optional<OrgOpenroadmDevice> deviceObject =
1470 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1471 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1473 if (deviceObject.get().getSharedRiskGroup() == null) {
1475 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, deviceIID,
1476 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1478 if (deviceObject.get().getSharedRiskGroup() == null) {
1479 LOG.info("no srg found for node {} ", nodeId);
1481 String startTimestamp = getCurrentTimestamp();
1482 for (int i = 0; i < deviceObject.get().getSharedRiskGroup().size(); i++) {
1483 SharedRiskGroup sharedRiskGroup = deviceObject.get().getSharedRiskGroup().get(i);
1484 //String currentProvisionedAddDropPorts = "-1";
1485 //String mcCapSlotWidthGranularity = "";
1486 //String mcCapCenterFreqGranularity = "";
1487 //String mcCapMinSlots = "-1";
1488 //String mcCapMaxSlots = "-1";
1489 String maxAddDropPorts = sharedRiskGroup.getMaxAddDropPorts().toString();
1490 String srgNumber = sharedRiskGroup.getSrgNumber().toString();
1491 String wavelengthDuplicationEnu = sharedRiskGroup.getWavelengthDuplication().getName();
1492 persistDevSrgCircuitPacks(nodeId, sharedRiskGroup, srgNumber, connection);
1494 Object[] parameters = {nodeId,
1496 //currentProvisionedAddDropPorts,
1499 wavelengthDuplicationEnu,
1500 //mcCapSlotWidthGranularity,
1501 //mcCapCenterFreqGranularity,
1509 String query = Queries.getQuery().deviceSharedRiskGroupInsert().get();
1510 LOG.info("Running {} query ", query);
1511 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1512 for (int j = 0; j < parameters.length; j++) {
1513 stmt.setObject(j + 1, parameters[j]);
1516 stmt.clearParameters();
1517 } catch (SQLException e) {
1518 LOG.error("Something wrong when storing devices SRG", e);
1526 private void persistDevSrgCircuitPacks(String nodeId, SharedRiskGroup sharedRiskGroup, String srgNumber,
1527 Connection connection) {
1529 String startTimestamp = getCurrentTimestamp();
1530 for (int i = 0; i < sharedRiskGroup.getCircuitPacks().size(); i++) {
1532 String circuitPackindex = sharedRiskGroup.getCircuitPacks().get(i).getIndex().toString();
1533 String circuitPackName = sharedRiskGroup.getCircuitPacks().get(i).getCircuitPackName();
1535 Object[] parameters = {nodeId,
1543 String query = Queries.getQuery().deviceSrgCircuitPackInsert().get();
1544 LOG.info("Running {} query ", query);
1545 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1546 for (int j = 0; j < parameters.length; j++) {
1547 stmt.setObject(j + 1, parameters[j]);
1550 stmt.clearParameters();
1551 } catch (SQLException e) {
1552 LOG.error("Something wrong when storing devices SRG circuit packs", e);
1558 private void persistDevRoadmConnections(String nodeId, Connection connection) {
1560 //int opticalcontrolmodeEnu=-1;
1562 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1563 Optional<OrgOpenroadmDevice> deviceObject =
1564 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1565 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1567 if (deviceObject.get().getRoadmConnections() == null) {
1569 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, deviceIID,
1570 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1573 if (deviceObject.get().getRoadmConnections() != null) {
1574 String startTimestamp = getCurrentTimestamp();
1575 for (int i = 0; i < deviceObject.get().getRoadmConnections().size(); i++) {
1576 RoadmConnections roadmConnections = deviceObject.get().getRoadmConnections().get(i);
1577 String connectionNumber = roadmConnections.getConnectionNumber();
1578 //String connectionName = "";
1579 String wavelengthNumber = roadmConnections.getWavelengthNumber().toString();
1580 String opticalcontrolmodeEnu = roadmConnections.getOpticalControlMode().getName();
1581 String targetOutputPower = roadmConnections.getTargetOutputPower().toString();
1582 String srcIf = roadmConnections.getSource().getSrcIf();
1583 String dstIf = roadmConnections.getDestination().getDstIf();
1585 Object[] parameters = {nodeId,
1590 opticalcontrolmodeEnu,
1598 String query = Queries.getQuery().deviceRoadmConnectionsInsert().get();
1599 LOG.info("Running {} query ", query);
1600 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1601 for (int j = 0; j < parameters.length; j++) {
1602 stmt.setObject(j + 1, parameters[j]);
1605 stmt.clearParameters();
1606 } catch (SQLException e) {
1607 LOG.error("Something wrong when storing devices ROADM connection ", e);
1612 LOG.info("ROADM Dev Connections not found!! for {}", nodeId);
1617 private void persistDevConnectionMap(String nodeId, Connection connection) {
1619 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1620 Optional<OrgOpenroadmDevice> deviceObject =
1621 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1622 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1624 String startTimestamp = getCurrentTimestamp();
1625 for (int i = 0; i < deviceObject.get().getConnectionMap().size(); i++) {
1626 ConnectionMap connectionMap = deviceObject.get().getConnectionMap().get(i);
1627 String connectionMapNumber = connectionMap.getConnectionMapNumber().toString();
1628 String sourceCircuitPackName = connectionMap.getSource().getCircuitPackName();
1629 String sourcePortName = connectionMap.getSource().getCircuitPackName();
1632 Object[] parameters = {nodeId,
1633 connectionMapNumber,
1634 sourceCircuitPackName,
1640 String query = Queries.getQuery().deviceConnectionMapInsert().get();
1641 LOG.info("Running {} query ", query);
1642 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1643 for (int j = 0; j < parameters.length; j++) {
1644 stmt.setObject(j + 1, parameters[j]);
1647 stmt.clearParameters();
1648 } catch (SQLException e) {
1649 LOG.error("Something wrong when storing devices connection map", e);
1655 private void persistDevWavelengthMap(String nodeId, Connection connection) {
1657 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1658 Optional<OrgOpenroadmDevice> deviceObject =
1659 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1660 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1662 String startTimestamp = getCurrentTimestamp();
1663 for (int i = 0; i < deviceObject.get().getWavelengthMap().getWavelengths().size(); i++) {
1664 Wavelengths wavelengths = deviceObject.get().getWavelengthMap().getWavelengths().get(i);
1665 String wavelengthNumber = wavelengths.getWavelengthNumber().toString();
1666 String centerFrequency = wavelengths.getCenterFrequency().toString();
1667 String wavelength = wavelengths.getWavelength().toString();
1670 Object[] parameters = {nodeId,
1678 String query = Queries.getQuery().deviceWavelengthInsert().get();
1679 LOG.info("Running {} query ", query);
1680 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1681 for (int j = 0; j < parameters.length; j++) {
1682 stmt.setObject(j + 1, parameters[j]);
1685 stmt.clearParameters();
1686 } catch (SQLException e) {
1687 LOG.error("Something wrong when storing devices wavelength map", e);
1694 private void persistDevInterfaceTcm(String nodeId, String interfaceName, OduBuilder oduBuilder,
1695 Connection connection) {
1697 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1700 tcm = oduBuilder.getTcm().get(i);
1702 Object[] parameters = prepareDevInterfaceTcmParameters(nodeId, interfaceName, tcm);
1704 String query = Queries.getQuery().deviceInterfacesInsert().get();
1705 LOG.info("Running {} query ", query);
1706 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1707 for (int j = 0; j < parameters.length; j++) {
1708 stmt.setObject(j + 1, parameters[j]);
1711 stmt.clearParameters();
1712 } catch (SQLException e) {
1713 LOG.error("Something wrong when storing devices interface tcm", e);
1718 private void persistDevInterfaceOtnOduTxMsi(String nodeId, String interfaceName, OduBuilder oduBuilder,
1719 Connection connection) {
1721 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1724 txMsi = oduBuilder.getOpu().getMsi().getTxMsi().get(i);
1726 Object[] parameters = prepareDevInterfaceOtnOduTxMsiParameters(nodeId, interfaceName, txMsi);
1728 String query = Queries.getQuery().deviceInterfaceOtnOduTxMsiInsert().get();
1729 LOG.info("Running {} query ", query);
1730 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1731 for (int j = 0; j < parameters.length; j++) {
1732 stmt.setObject(j + 1, parameters[j]);
1735 stmt.clearParameters();
1736 } catch (SQLException e) {
1737 LOG.error("Something wrong when storing devices interface OTN ODU Tx MSI", e);
1743 private void persistDevInterfaceOtnOduRxMsi(String nodeId, String interfaceName, OduBuilder oduBuilder,
1744 Connection connection) {
1746 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1749 rxMsi = oduBuilder.getOpu().getMsi().getRxMsi().get(i);
1751 Object[] parameters = prepareDevInterfaceOtnOduRxMsiParameters(nodeId, interfaceName, rxMsi);
1753 String query = Queries.getQuery().deviceInterfaceOtnOduRxMsiInsert().get();
1754 LOG.info("Running {} query ", query);
1755 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1756 for (int j = 0; j < parameters.length; j++) {
1757 stmt.setObject(j + 1, parameters[j]);
1760 stmt.clearParameters();
1761 } catch (SQLException e) {
1762 LOG.error("Something wrong when storing devices interface OTN ODU Rx MSI", e);
1768 private void persistDevInterfaceOtnOduExpMsi(String nodeId, String interfaceName, OduBuilder oduBuilder,
1769 Connection connection) {
1771 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1774 expMsi = oduBuilder.getOpu().getMsi().getExpMsi().get(i);
1776 Object[] parameters = prepareDevInterfaceOtnOduExpMsiParameters(nodeId, interfaceName, expMsi);
1778 String query = Queries.getQuery().deviceInterfaceOtnOduExpMsiInsert().get();
1779 LOG.info("Running {} query ", query);
1780 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1781 for (int j = 0; j < parameters.length; j++) {
1782 stmt.setObject(j + 1, parameters[j]);
1785 stmt.clearParameters();
1786 } catch (SQLException e) {
1787 LOG.error("Something wrong when storing devices interface OTN ODU Exp MSI", e);