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
8 package org.opendaylight.transportpce.inventory;
10 import static org.opendaylight.transportpce.inventory.utils.StringUtils.getCurrentTimestamp;
11 import static org.opendaylight.transportpce.inventory.utils.StringUtils.prepareDashString;
12 import static org.opendaylight.transportpce.inventory.utils.StringUtils.prepareEmptyString;
14 import com.google.common.base.Preconditions;
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;
24 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
25 import org.opendaylight.transportpce.common.Timeouts;
26 import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
27 import org.opendaylight.transportpce.inventory.query.Queries;
28 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.CpSlots;
29 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.Ports;
30 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.packs.CircuitPacks;
31 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.external.links.ExternalLink;
32 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.Interface;
33 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.internal.links.InternalLink;
34 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.OrgOpenroadmDevice;
35 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.ConnectionMap;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.Degree;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.Info;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.Protocols;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnections;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.SharedRiskGroup;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.physical.links.PhysicalLink;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.shelf.Slots;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.shelves.Shelves;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev161014.Interface1;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev161014.ethernet.container.EthernetBuilder;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.Protocols1;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.lldp.container.lldp.PortConfig;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.lldp.container.lldp.nbr.list.IfName;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.och.container.OchBuilder;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.ots.container.OtsBuilder;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.odu.attributes.Tcm;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.odu.container.OduBuilder;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.opu.opu.msi.ExpMsi;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.opu.opu.msi.RxMsi;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.opu.opu.msi.TxMsi;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.otu.container.OtuBuilder;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.rstp.bridge.port.attr.RstpBridgePortTable;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.rstp.container.rstp.RstpBridgeInstance;
59 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
60 import org.slf4j.Logger;
61 import org.slf4j.LoggerFactory;
64 public class INode221 {
65 private static final Logger LOG = LoggerFactory.getLogger(INode221.class);
67 private final DataSource dataSource;
68 private final DeviceTransactionManager deviceTransactionManager;
70 public INode221(DataSource dataSource, DeviceTransactionManager deviceTransactionManager) {
71 this.dataSource = dataSource;
72 this.deviceTransactionManager = deviceTransactionManager;
75 public boolean addNode(String deviceId) {
77 InstanceIdentifier<Info> infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class);
78 Optional<Info> infoOpt =
79 deviceTransactionManager.getDataFromDevice(deviceId, LogicalDatastoreType.OPERATIONAL, infoIID,
80 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
82 if (infoOpt.isPresent()) {
83 deviceInfo = infoOpt.get();
85 LOG.warn("Could not get device info from DataBroker");
88 boolean sqlResult = false;
89 String query = Queries.getQuery().deviceInfoInsert().get();
90 LOG.info("Running {} query ", query);
91 try (Connection connection = dataSource.getConnection();
92 PreparedStatement preparedStatement = connection.prepareStatement(query)) {
93 Object[] prepareParameters = prepareDeviceInfoParameters(deviceInfo);
94 for (int i = 0; i < prepareParameters.length; i++) {
95 LOG.debug("Parameter {} has value {}", i + 1, prepareParameters[i]);
96 preparedStatement.setObject(i + 1, prepareParameters[i]);
99 int executeUpdate = preparedStatement.executeUpdate();
100 LOG.info("{} entries were added", executeUpdate);
103 LOG.info("iNode AddNode call complete");
104 getRoadmShelves(deviceId);
105 LOG.info("iNode getRoadmShelves call complete");
106 getCircuitPacks(deviceId);
107 LOG.debug("iNode getCircuitPacks call complete");
109 LOG.debug("iNode persist interfaces call");
110 persistDevInterfaces(deviceId, connection);
111 LOG.debug("iNode persist interfaces call complete");
113 LOG.debug("iNode persist interfaces call");
114 persistDevInterfaces(deviceId, connection);
115 LOG.debug("iNode persist interfaces call complete");
117 LOG.debug("iNode persist protocols call");
118 persistDevProtocols(deviceId, connection);
119 LOG.debug("iNode persist protocols call complete");
121 // LOG.debug("iNode persist wavelength map call");
122 // persistDevWavelengthMap(deviceId, connection);
123 // LOG.debug("iNode persist wavelength map call complete");
125 LOG.debug("iNode persist internal links map call");
126 persistDevInternalLinks(deviceId, connection);
127 LOG.debug("iNode persist internal links map call complete");
129 LOG.debug("iNode persist Physical links map call");
130 persistDevPhysicalLinks(deviceId, connection);
131 LOG.debug("iNode persist Physical links map call complete");
133 LOG.debug("iNode persist External links map call");
134 persistDevExternalLinks(deviceId, connection);
135 LOG.debug("iNode persist External links map call complete");
137 LOG.debug("iNode persist degree map call");
138 persistDevDegree(deviceId, connection);
139 LOG.debug("iNode persist degree map call complete");
141 LOG.debug("iNode persist srg map call");
142 persistDevSrg(deviceId, connection);
143 LOG.debug("iNode persist srg map call complete");
145 LOG.debug("iNode persist Roadm Connections call");
146 persistDevRoadmConnections(deviceId, connection);
147 LOG.debug("iNode persist Roadm Connections call complete");
149 LOG.debug("iNode persist Connection Map call");
150 persistDevConnectionMap(deviceId, connection);
151 LOG.debug("iNode persist Connection Map call complete");
153 } catch (SQLException e) {
154 LOG.error(e.getMessage(), e);
155 } catch (InterruptedException e) {
156 LOG.error(e.getMessage(), e);
157 } catch (ExecutionException e) {
158 LOG.error(e.getMessage(), e);
163 public boolean nodeExists(String nodeId) {
164 String selectTableSQL = "select count(*) node_exists from inv_dev_info where node_id = ?";
166 LOG.info("Checking if {} exists in DB", nodeId);
167 try (Connection connection = dataSource.getConnection();
168 PreparedStatement preparedStmt = connection.prepareStatement(selectTableSQL)) {
169 preparedStmt.setString(1, nodeId);
170 try (ResultSet rs = preparedStmt.executeQuery()) {
172 nodeExists = rs.getInt("node_exists");
173 LOG.debug("Found {} devices matching {}", nodeExists, nodeId);
176 } catch (SQLException e) {
177 LOG.error(e.getMessage(), e);
179 return nodeExists == 0 ? false : true;
182 public void getRoadmShelves(String nodeId) throws InterruptedException, ExecutionException {
183 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
184 Optional<OrgOpenroadmDevice> deviceObject = deviceTransactionManager.getDataFromDevice(nodeId,
185 LogicalDatastoreType.OPERATIONAL, deviceIID, Timeouts.DEVICE_READ_TIMEOUT,
186 Timeouts.DEVICE_READ_TIMEOUT_UNIT);
188 LOG.info("Shelves size {}", deviceObject.get().getShelves().size());
189 try (Connection connection = dataSource.getConnection()) {
190 Preconditions.checkNotNull(connection);
191 for (int i = 0; i < deviceObject.get().getShelves().size(); i++) {
192 Shelves shelve = deviceObject.get().getShelves().get(i);
193 String shelfName = shelve.getShelfName();
195 LOG.info("Getting Shelve Details of {}", shelfName);
196 if (shelve.getSlots() != null) {
197 LOG.info("Slot Size {} ", shelve.getSlots().size());
198 persistShelveSlots(nodeId, shelve, connection);
200 LOG.info("No Slots for shelf {}", shelfName);
204 persistShelves(nodeId, connection, shelve);
206 } catch (SQLException e1) {
207 LOG.error(e1.getMessage(), e1);
211 public void getCircuitPacks(String nodeId) throws InterruptedException, ExecutionException {
212 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
213 Optional<OrgOpenroadmDevice> deviceObject =
214 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
215 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
216 if (!deviceObject.isPresent()) {
217 LOG.warn("Device object {} was not found", nodeId);
220 LOG.info("Circuit pack size {}", deviceObject.get().getCircuitPacks().size());
222 try (Connection connection = dataSource.getConnection()) {
223 Preconditions.checkNotNull(connection);
224 for (int i = 0; i < deviceObject.get().getCircuitPacks().size(); i++) {
225 CircuitPacks cp = deviceObject.get().getCircuitPacks().get(i);
227 if (cp.getCpSlots() != null) {
228 persistCircuitPacksSlots(nodeId, cp, connection);
230 LOG.info("Everything {}", cp);
231 LOG.info("CP is {}", cp);
233 persistPorts(cp, connection);
235 persistCircuitPacks(nodeId, connection, cp);
237 } catch (SQLException e1) {
238 LOG.error(e1.getMessage(), e1);
242 private void persistCircuitPacks(String nodeId, Connection connection, CircuitPacks cp) {
243 Object[] parameters = prepareCircuitPacksParameters(nodeId, cp);
244 String query = Queries.getQuery().deviceCircuitPackInsert().get();
245 LOG.info("Running {} query ", query);
246 try (PreparedStatement stmt = connection.prepareStatement(query)) {
247 for (int j = 0; j < parameters.length; j++) {
248 stmt.setObject(j + 1, parameters[j]);
251 stmt.clearParameters();
252 } catch (SQLException e) {
253 LOG.error(e.getMessage(), e);
257 private void persistShelves(String nodeId, Connection connection, Shelves shelve) {
258 Object[] shelvesParameter = prepareShelvesParameters(nodeId, shelve);
259 String query = Queries.getQuery().deviceShelfInsert().get();
260 LOG.info("Running {} query ", query);
261 try (PreparedStatement preparedStmt = connection.prepareStatement(query)) {
262 for (int j = 0; j < shelvesParameter.length; j++) {
263 preparedStmt.setObject(j + 1, shelvesParameter[j]);
265 preparedStmt.execute();
266 preparedStmt.clearParameters();
267 } catch (SQLException e) {
268 LOG.error(e.getMessage(), e);
272 private void persistShelveSlots(String nodeId, Shelves shelves, Connection connection) {
273 String startTimetampStr = getCurrentTimestamp();
274 for (int i = 0; i < shelves.getSlots().size(); i++) {
275 Slots slot = shelves.getSlots().get(i);
276 LOG.info("Getting Slot Details of {}", slot.getSlotName());
277 Object[] parameters = new Object[]{nodeId,
278 shelves.getShelfName(),
281 slot.getProvisionedCircuitPack(),
285 String query = Queries.getQuery().deviceShelfSlotInsert().get();
286 LOG.info("Running {} query ", query);
287 try (PreparedStatement stmt = connection.prepareStatement(query)) {
288 for (int j = 0; j < parameters.length; j++) {
289 stmt.setObject(j + 1, parameters[j]);
292 stmt.clearParameters();
293 } catch (SQLException e) {
294 LOG.error(e.getMessage(), e);
300 private void persistCircuitPacksSlots(String nodeId, CircuitPacks circuitPacks, Connection connection) {
301 String startTimetampStr = getCurrentTimestamp();
302 for (int i = 0; i < circuitPacks.getCpSlots().size(); i++) {
303 CpSlots cpSlot = circuitPacks.getCpSlots().get(i);
305 Object[] parameters = new Object[]{nodeId,
306 circuitPacks.getCircuitPackName(),
307 cpSlot.getSlotName(),
309 cpSlot.getProvisionedCircuitPack(),
313 String query = Queries.getQuery().deviceCPSlotInsert().get();
314 LOG.info("Running {} query ", query);
315 try (PreparedStatement stmt = connection.prepareStatement(query)) {
316 for (int j = 0; j < parameters.length; j++) {
317 stmt.setObject(j + 1, parameters[j]);
320 stmt.clearParameters();
321 } catch (SQLException e) {
322 LOG.error(e.getMessage(), e);
327 private void persistPorts(CircuitPacks circuitPacks, Connection connection) {
328 LOG.warn("Ports are not persisted yet");
333 * Prepares parameters for device insert query.
335 * @param deviceInfo device info
336 * @return Object Object
338 private static Object[] prepareDeviceInfoParameters(Info deviceInfo) {
339 String startTimetampStr = getCurrentTimestamp();
340 //Integer maxNumBin15minHistoricalPm = null;
341 //Integer maxNumBin24hourHistoricalPm = null;
342 //String serialId = "";
344 String nodeId = prepareDashString(deviceInfo.getNodeId());
345 Long nodeNumber = deviceInfo.getNodeNumber().toJava();
346 Integer nodeTypeEnu = deviceInfo.getNodeType().getIntValue();
347 String clli = prepareDashString(deviceInfo.getClli());
348 String vendor = prepareDashString(deviceInfo.getVendor());
349 String model = prepareDashString(deviceInfo.getModel());
350 String ipAddress = prepareDashString(deviceInfo.getIpAddress().getIpv4Address().getValue());
351 String prefixLength = prepareDashString(deviceInfo.getPrefixLength());
352 String defaultGateway = prepareDashString(deviceInfo.getDefaultGateway().getIpv4Address().getValue());
353 Integer sourceEnum = deviceInfo.getSource().getIntValue();
354 String currentIpAddress = prepareDashString(deviceInfo.getCurrentIpAddress().getIpv4Address().getValue());
355 String currentPrefixLength = prepareDashString(deviceInfo.getCurrentPrefixLength());
356 String currentDefaultGateway = prepareDashString(deviceInfo.getDefaultGateway().getIpv4Address().getValue());
357 String macAddress = prepareDashString(deviceInfo.getMacAddress().getValue());
358 String softwareVersion = prepareDashString(deviceInfo.getSoftwareVersion());
359 String openroadmVersion = "2.2.1";
360 String template = prepareDashString(deviceInfo.getTemplate());
361 String currentDatetime = prepareDashString(deviceInfo.getCurrentDatetime().getValue());
363 (deviceInfo.getGeoLocation() != null ? prepareDashString(deviceInfo.getGeoLocation().getLatitude()) : "");
364 String geoLongitude =
365 (deviceInfo.getGeoLocation() != null ? prepareDashString(deviceInfo.getGeoLocation().getLongitude()) : "");
366 String maxDegrees = prepareDashString(deviceInfo.getMaxDegrees()); // max_degrees
367 String maxSrgs = prepareDashString(deviceInfo.getMaxSrgs()); //max_srgs
368 String swVersion = prepareDashString(deviceInfo.getSoftwareVersion()); //sw_version
369 String swValidationTimer = prepareDashString(""); //sw_validation_timer
370 String activationDateTime = prepareDashString(""); //activation_date_time
371 /*jsonDevInfo = JsonStringBuilder.getDevInfoJson().replace("$$NODE-ID$$",nodeId)
372 .replace("$$NODE-NUMBER$$", nodeNumber)
373 .replace("$$NODE-TYPE$$",nodeType)
374 .replace("$$CLLI$$",clli)
375 .replace("$$VENDOR$$",vendor)
376 .replace("$$MODEL$$",model)
377 .replace("$$SERIAL-ID$$",serialId)
378 .replace("$$IPADDRESS$$",ipAddress)
379 .replace("$$PREFIX-LENGTH$$",prefixLength)
380 .replace("$$DEFAULTGATEWAY$$",defaultGateway)
381 .replace("$$SOURCE$$",String.valueOf(source))
382 .replace("$$CURRENT-IPADDRESS$$",currentIpAddress)
383 .replace("$$CURRENT-PREFIX-LENGTH$$",currentPrefixLength)
384 .replace("$$CURRENT-DEFAULTGATEWAY$$",currentDefailtGateway)
385 .replace("$$MACADDRESS$$",macAddress)
386 .replace("$$SOFTWAREVERSION$$",softwareVersion)
387 .replace("$$OPENROADM-VERSION$$",openroadmVersion)
388 .replace("$$TEMPLATE$$",template)
389 .replace("$$CURRENT-DATETIME$$",currentDatetime)
390 .replace("$$LATITUDE$$",latitude)
391 .replace("$$LONGITUDE$$",longitude)
392 .replace("$$MAX-DEGREES$$",maxDegrees)
393 .replace("$$MAX-SRGS$$",maxSrgs)
394 .replace("$$MAX-NUM-BIN-15MIN-HISTORICAL-PM$$",prepareDashString(""))
395 .replace("$$MAX-NUM-BIN-24HOUR-HISTORICAL-PM$$",prepareDashString(""))
396 .replace("$$SW-VERSION$$",swVersion)
397 .replace("$$SW-VALIDATION-TIMER$$",swValidationTimer)
398 .replace("$$ACTIVATION-DATE-TIME$$",activationDateTime);*/
416 currentDefaultGateway,
426 //maxNumBin15minHistoricalPm,
427 //maxNumBin24hourHistoricalPm,
438 private static Object[] prepareShelvesParameters(String nodeId, Shelves shelve) {
439 String startTimestamp = getCurrentTimestamp();
441 return new Object[]{nodeId,
442 shelve.getShelfName(),
443 shelve.getShelfType(),
445 shelve.getShelfPosition(),
446 (shelve.getAdministrativeState() == null ? null : shelve.getAdministrativeState().getIntValue()),
449 shelve.getSerialId(),
451 shelve.getProductCode(),
452 (shelve.getManufactureDate() == null ? null : shelve.getManufactureDate().getValue()),
454 shelve.getHardwareVersion(),
455 (shelve.getOperationalState() == null ? null : shelve.getOperationalState().getIntValue()),
456 (shelve.getEquipmentState() == null ? null : shelve.getEquipmentState().getIntValue()),
457 (shelve.getDueDate() == null ? null : shelve.getDueDate().getValue()),
463 private static Object[] prepareCPPortsParameters(String nodeId, CircuitPacks circuitPacks, Ports cpPort) {
465 String circuitPackName = circuitPacks.getCircuitPackName();
466 String portName = cpPort.getPortName();
467 String portType = cpPort.getPortType();
468 String portQualEnu = String.valueOf(cpPort.getPortQual().getIntValue());
469 String portWavelengthTypeEnu = String.valueOf(cpPort.getPortWavelengthType().getIntValue());
470 String portDirectionEnu = String.valueOf(cpPort.getPortDirection().getIntValue());
471 String label = cpPort.getLabel();
472 String circuitId = cpPort.getCircuitId();
473 String administrativeStateEnu =
474 (cpPort.getAdministrativeState() == null ? "" :
475 String.valueOf(cpPort.getAdministrativeState().getIntValue()));
476 String operationalStateEnu =
477 (cpPort.getOperationalState() == null ? "" : String.valueOf(cpPort.getOperationalState().getIntValue()));
478 String logicalConnectionPoint = cpPort.getLogicalConnectionPoint();
479 String partnerPortCircuitPackName = cpPort.getPartnerPort().getCircuitPackName();
480 String partnerPortPortName = cpPort.getPartnerPort().getPortName().toString();
481 String parentPortCircuitPackName = cpPort.getParentPort().getCircuitPackName();
482 String parentPortPortName = cpPort.getParentPort().getPortName().toString();
483 String roadmPortPortPowerCapabilityMinRx = cpPort.getRoadmPort().getPortPowerCapabilityMinRx().toString();
484 String roadmPortPortPowerCapabilityMinTx = cpPort.getRoadmPort().getPortPowerCapabilityMinTx().toString();
485 String roadmPortPortPowerCapabilityMaxRx = cpPort.getRoadmPort().getPortPowerCapabilityMaxRx().toString();
486 String roadmPortPortPowerCapabilityMaxTx = cpPort.getRoadmPort().getPortPowerCapabilityMaxTx().toString();
487 //String roadmPortCapableWavelengths = "";
488 //String roadmPortAvailableWavelengths = "";
489 //String roadmPortUsedWavelengths = "";
490 String transponderPortPortPowerCapabilityMinRx =
491 cpPort.getTransponderPort().getPortPowerCapabilityMinRx().toString();
492 String transponderPortPortPowerCapabilityMinTx =
493 cpPort.getTransponderPort().getPortPowerCapabilityMinTx().toString();
494 String transponderPortPortPowerCapabilityMaxRx =
495 cpPort.getTransponderPort().getPortPowerCapabilityMaxRx().toString();
496 String transponderPortPortPowerCapabilityMaxTx =
497 cpPort.getTransponderPort().getPortPowerCapabilityMaxTx().toString();
498 //String transponderPortCapableWavelengths = "";
499 String otdrPortLaunchCableLength = cpPort.getOtdrPort().getLaunchCableLength().toString();
500 String otdrPortPortDirection = String.valueOf(cpPort.getOtdrPort().getPortDirection().getIntValue());
501 //String ilaPortPortPowerCapabilityMixRx = "";
502 //String ilaPortPortPowerCapabilityMixTx = "";
503 //String ilaPortPortPowerCapabilityMaxRx = "";
504 //String ilaPortPortPowerCapabilityMaxTx = "";
506 String startTimestamp = getCurrentTimestamp();
508 return new Object[]{nodeId,
513 portWavelengthTypeEnu,
517 administrativeStateEnu,
519 logicalConnectionPoint,
520 partnerPortCircuitPackName,
522 parentPortCircuitPackName,
524 roadmPortPortPowerCapabilityMinRx,
525 roadmPortPortPowerCapabilityMinTx,
526 roadmPortPortPowerCapabilityMaxRx,
527 roadmPortPortPowerCapabilityMaxTx,
528 //roadmPortCapableWavelengths,
529 //roadmPortAvailableWavelengths,
530 //roadmPortUsedWavelengths,
532 transponderPortPortPowerCapabilityMinRx,
533 transponderPortPortPowerCapabilityMinTx,
534 transponderPortPortPowerCapabilityMaxRx,
535 transponderPortPortPowerCapabilityMaxTx,
536 //transponderPortCapableWavelengths,
538 otdrPortLaunchCableLength,
539 otdrPortPortDirection,
540 //ilaPortPortPowerCapabilityMixRx,
541 //ilaPortPortPowerCapabilityMixTx,
542 //ilaPortPortPowerCapabilityMaxRx,
543 //ilaPortPortPowerCapabilityMaxTx,
551 private static Object[] prepareCircuitPacksParameters(String nodeId, CircuitPacks cpack) {
552 String startTimestamp = getCurrentTimestamp();
553 return new Object[]{nodeId,
554 cpack.getCircuitPackName(),
555 cpack.getCircuitPackType(),
556 cpack.getCircuitPackProductCode(),
557 (cpack.getAdministrativeState() == null ? "" : cpack.getAdministrativeState().getIntValue()),
562 cpack.getProductCode(),
563 (cpack.getManufactureDate() == null ? "" : cpack.getManufactureDate().getValue()),
565 cpack.getHardwareVersion(),
566 prepareEmptyString(cpack.getOperationalState().getIntValue()),
567 cpack.getCircuitPackCategory().getType().getName(),
568 cpack.getCircuitPackCategory().getExtension(),
569 (cpack.getEquipmentState() == null ? "" : cpack.getEquipmentState().getIntValue()),
570 cpack.getCircuitPackMode(),
574 prepareEmptyString(cpack.getDueDate()),
575 prepareEmptyString((cpack.getParentCircuitPack() == null) ? "" :
576 ((cpack.getParentCircuitPack().getCircuitPackName() == null) ? "" :
577 cpack.getParentCircuitPack().getCircuitPackName())
579 prepareEmptyString((cpack.getParentCircuitPack() == null) ? "" :
580 ((cpack.getParentCircuitPack().getCpSlotName() == null) ? "" :
581 cpack.getParentCircuitPack().getCpSlotName())
588 private void persistCPPorts(String nodeId, Connection connection, CircuitPacks circuitPacks) {
589 for (int i = 0; i < circuitPacks.getPorts().size(); i++) {
590 Object[] cpPortsParameters = prepareCPPortsParameters(nodeId, circuitPacks, circuitPacks.getPorts().get(i));
591 String query = Queries.getQuery().deviceCPPortInsert().get();
592 LOG.info("Running {} query ", query);
593 try (PreparedStatement preparedStmt = connection.prepareStatement(query)) {
594 for (int j = 0; j < cpPortsParameters.length; j++) {
595 preparedStmt.setObject(j + 1, cpPortsParameters[j]);
597 preparedStmt.execute();
598 preparedStmt.clearParameters();
599 } catch (SQLException e) {
600 LOG.error(e.getMessage(), e);
606 private Object[] prepareDevInterfaceParameters(String nodeId, Interface deviceInterface, Connection connection) {
608 int administrativeStateEnu = deviceInterface.getAdministrativeState().getIntValue();
609 int operationalState = deviceInterface.getOperationalState().getIntValue();
610 int ethernetDuplexEnu = -1;
611 int ethernetAutoNegotiationEnu = -1;
612 int maintTestsignalTestpatternEnu = -1;
613 int maintTestsignalTypeEnu = -1;
615 int otuMaintTypeEnu = -1;
616 //int otsFiberTypeEnu = -1;
617 String name = deviceInterface.getName();
618 String description = deviceInterface.getDescription();
619 String type = deviceInterface.getType().getTypeName();
620 String circuitId = deviceInterface.getCircuitId();
621 String supportingInterface = deviceInterface.getSupportingInterface();
622 String supportingCircuitPackName = deviceInterface.getSupportingCircuitPackName();
623 String supportingPort = deviceInterface.getSupportingPort().toString();
624 String ethernetSpeed = "";
625 String ethernetFec = "";
626 String ethernetMtu = "";
627 String ethernetCurrSpeed = "";
628 String ethernetCurrDuplex = "";
629 //String mciMcttpMinFreq = "";
630 //String mciMcttpMaxFreq = "";
631 //String mciMcttpCenterFreq = "";
632 //String mciMcttpSlotWidth = "";
633 //String mciNmcCtpFrequency = "";
634 //String mciNmcCtpWidth = "";
636 //String ochFrequency = "";
637 //String ochWidth = "";
638 //String ochWavelengthNumber = "";
639 String ochModulationFormat = "";
640 String ochTransmitPower = "";
641 String otsSpanLossReceive = "";
642 String otsSpanLossTransmit = "";
643 //String otsIngressSpanLossAgingMargin = "";
644 //String otsEolMaxLoadPin = "";
645 String oduRate = ""; //BUG in following case switch statement ???
646 //String oduFunction = "";
647 String oduMonitoringMode = "";
648 //String oduNoOamFunction = "";
649 String oduProactiveDelayMeasurementEnabled = "";
650 //String oduPoaTribPortNumber = "";
651 //String oduTxSapi = "";
652 //String oduTxDapi = "";
653 //String oduTxOperator = "";
654 //String oduAcceptedSapi = "";
655 //String oduAcceptedDapi = "";
656 //String oduAcceptedOperator = "";
657 //String oduExpectedSapi = "";
658 //String oduExpectedDapi = "";
659 //String oduTimActEnabled = "";
660 //String oduTimDetectMode = "";
661 //String oduDegmIntervals = "";
662 //String oduDegthrPercentage = "";
663 String opuPayloadType = "";
664 String opuRxPayloadType = "";
665 String opuExpPayloadType = "";
666 String opuPayloadInterface = "";
667 String maintTestsignalEnabled = "";
668 String maintTestsignalBiterrors = "";
669 String maintTestsignalBiterrorsterminal = "";
670 String maintTestsignalSyncseconds = "";
671 String maintTestsignalSyncsecondsterminal = "";
673 //String otuTxSapi = "";
674 //String otuTxDapi = "";
675 //String otuTxOperator = "";
676 //String otuAcceptedSapi = "";
677 //String otuAcceptedDapi = "";
678 //String otuAcceptedOperator = "";
679 //String otuExpectedSapi = "";
680 //String otuExpectedDapi = "";
681 //String otuTimActEnabled = "";
682 //String otuTimDetectMode = "";
683 //String otuDegmIntervals = "";
684 //String otuDegthrPercentage = "";
685 String otuMaintLoopbackEnabled = "";
686 //String mtOtuRate = "";
687 //String mtOtuFec = "";
688 //String mtOtuMaintLoopback = "";
689 //String mtOtuEnabled = "";
690 //String mtOtuType = "";
692 switch (deviceInterface.getType().toString()) {
695 //EthernetBuilder ethIfBuilder = new EthernetBuilder();
696 EthernetBuilder ethIfBuilder =
697 new EthernetBuilder(deviceInterface.augmentation(Interface1.class).getEthernet());
698 ethernetSpeed = ethIfBuilder.getSpeed().toString();
699 ethernetFec = ethIfBuilder.getFec().getName();
700 ethernetDuplexEnu = ethIfBuilder.getDuplex().getIntValue();
701 ethernetMtu = ethIfBuilder.getMtu().toString();
702 ethernetAutoNegotiationEnu = ethIfBuilder.getAutoNegotiation().getIntValue();
703 ethernetCurrSpeed = ethIfBuilder.getCurrSpeed();
704 ethernetCurrDuplex = ethIfBuilder.getCurrDuplex();
708 OchBuilder ochIfBuilder = new OchBuilder(deviceInterface.augmentation(
709 org.opendaylight.yang.gen.v1
710 .http.org.openroadm.optical.channel.interfaces.rev161014.Interface1.class)
712 ochRate = ochIfBuilder.getRate().getName();
713 //ochWavelengthNumber = ochIfBuilder.getWavelengthNumber().toString();
714 ochModulationFormat = ochIfBuilder.getModulationFormat().getName();
715 ochTransmitPower = ochIfBuilder.getTransmitPower().toString();
719 OtsBuilder otsIfBuilder = new OtsBuilder(deviceInterface.augmentation(
720 org.opendaylight.yang.gen.v1
721 .http.org.openroadm.optical.transport.interfaces.rev161014.Interface1.class)
723 int otsFiberTypeEnu = otsIfBuilder.getFiberType().getIntValue();
724 otsSpanLossReceive = otsIfBuilder.getSpanLossReceive().toString();
725 otsSpanLossTransmit = otsIfBuilder.getSpanLossTransmit().toString();
729 OduBuilder oduIfBuilder = new OduBuilder(deviceInterface.augmentation(
730 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.Interface1.class)
732 oduRate = String.valueOf(oduIfBuilder.getRate());
733 oduMonitoringMode = oduIfBuilder.getMonitoringMode().getName();
734 oduProactiveDelayMeasurementEnabled = oduIfBuilder.isProactiveDelayMeasurementEnabled().toString();
736 persistDevInterfaceTcm(nodeId, name, oduIfBuilder, connection);
737 persistDevInterfaceOtnOduTxMsi(nodeId, name, oduIfBuilder, connection);
738 persistDevInterfaceOtnOduRxMsi(nodeId, name, oduIfBuilder, connection);
739 persistDevInterfaceOtnOduExpMsi(nodeId, name, oduIfBuilder, connection);
741 opuPayloadType = oduIfBuilder.getOpu().getPayloadType().toString();
742 opuRxPayloadType = oduIfBuilder.getOpu().getRxPayloadType().toString();
743 opuExpPayloadType = oduIfBuilder.getOpu().getExpPayloadType().toString();
744 opuPayloadInterface = oduIfBuilder.getOpu().getPayloadInterface();
745 /*persistDevInterfaceOtnOduTxMsi(nodeId,name,oduIfBuilder,connection);
746 persistDevInterfaceOtnOduRxMsi(nodeId,name,oduIfBuilder,connection);
747 persistDevInterfaceOtnOduExpMsi(nodeId,name,oduIfBuilder,connection); */
748 maintTestsignalEnabled = oduIfBuilder.getMaintTestsignal().isEnabled().toString();
749 maintTestsignalTestpatternEnu = oduIfBuilder.getMaintTestsignal().getTestPattern().getIntValue();
750 maintTestsignalTypeEnu = oduIfBuilder.getMaintTestsignal().getType().getIntValue();
751 maintTestsignalBiterrors = oduIfBuilder.getMaintTestsignal().getBitErrors().toString();
752 maintTestsignalBiterrorsterminal = oduIfBuilder.getMaintTestsignal().getBitErrorsTerminal().toString();
753 maintTestsignalSyncseconds = oduIfBuilder.getMaintTestsignal().getSyncSeconds();
754 maintTestsignalSyncsecondsterminal = oduIfBuilder.getMaintTestsignal().getSyncSecondsTerminal();
758 OtuBuilder otuIfBuilder = new OtuBuilder(deviceInterface.augmentation(
759 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class)
761 otuRate = otuIfBuilder.getRate().getName();
762 otuFecEnu = otuIfBuilder.getFec().getIntValue();
763 otuMaintLoopbackEnabled = otuIfBuilder.getMaintLoopback().isEnabled().toString();
764 otuMaintTypeEnu = otuIfBuilder.getMaintLoopback().getType().getIntValue();
768 LOG.error("Could not get interface type");
771 String startTimestamp = getCurrentTimestamp();
773 return new Object[]{nodeId,
777 Integer.toString(administrativeStateEnu),
778 Integer.toString(operationalState),
781 supportingCircuitPackName,
785 Integer.toString(ethernetDuplexEnu),
787 Integer.toString(ethernetAutoNegotiationEnu),
792 //mciMcttpCenterFreq,
794 //mciNmcCtpFrequency,
796 "", "", "", "", "", "",
800 //ochWavelengthNumber,
804 //Integer.toString(otsFiberTypeEnu),
808 //otsIngressSpanLossAgingMargin,
817 oduProactiveDelayMeasurementEnabled,
818 //oduPoaTribPortNumber,
824 //oduAcceptedOperator,
830 //oduDegthrPercentage,
831 "", "", "", "", "", "", "", "", "", "", "", "", "",
836 maintTestsignalEnabled,
837 Integer.toString(maintTestsignalTestpatternEnu),
838 Integer.toString(maintTestsignalTypeEnu),
839 maintTestsignalBiterrors,
840 maintTestsignalBiterrorsterminal,
841 maintTestsignalSyncseconds,
842 maintTestsignalSyncsecondsterminal,
844 Integer.toString(otuFecEnu),
850 //otuAcceptedOperator,
856 //otuDegthrPercentage,
857 "", "", "", "", "", "", "", "", "", "", "", "",
858 otuMaintLoopbackEnabled,
859 Integer.toString(otuMaintTypeEnu),
862 //mtOtuMaintLoopback,
872 private static Object[] prepareDevInterfaceTcmParameters(String nodeId, String interfaceName, Tcm tcm) {
875 String layer = tcm.getLayer().toString();
876 int monitoringModeEnu = tcm.getMonitoringMode().getIntValue();
877 String ltcActEnabled = tcm.isLtcActEnabled().toString();
878 String proactiveDelayMeasurementEnabled = tcm.isProactiveDelayMeasurementEnabled().toString();
879 //int tcmDirectionEnu = -1;
880 //int timDetectModeEnu = -1;
881 //String txSapi = "";
882 //String txDapi = "";
883 //String txOperator = "";
884 //String acceptedSapi = "";
885 //String acceptedDapi = "";
886 //String acceptedOperator = "";
887 //String expectedSapi = "";
888 //String expectedDapi = "";
889 //String timActEnabled = "";
890 //String degmIntervals = "";
891 //String degthrPercentage = "";
893 String startTimestamp = getCurrentTimestamp();
895 return new Object[]{nodeId,
898 Integer.toString(monitoringModeEnu),
900 proactiveDelayMeasurementEnabled,
901 //Integer.toString(tcmDirectionEnu),
912 "", "", "", "", "", "", "", "", "",
913 //Integer.toString(timDetectModeEnu),
923 private static Object[] prepareDevInterfaceOtnOduTxMsiParameters(String nodeId, String interfaceName, TxMsi txMsi) {
925 String tribSlot = txMsi.getTribSlot().toString();
926 String odtuType = txMsi.getOdtuType().getTypeName();
927 String tribPort = txMsi.getTribPort().toString();
928 String tribPortPayload = txMsi.getTribPortPayload();
930 String startTimestamp = getCurrentTimestamp();
932 return new Object[]{nodeId,
944 private static Object[] prepareDevInterfaceOtnOduRxMsiParameters(String nodeId, String interfaceName, RxMsi rxMsi) {
946 String tribSlot = rxMsi.getTribSlot().toString();
947 String odtuType = rxMsi.getOdtuType().getTypeName();
948 String tribPort = rxMsi.getTribPort().toString();
949 String tribPortPayload = rxMsi.getTribPortPayload();
951 String startTimestamp = getCurrentTimestamp();
953 return new Object[]{nodeId,
966 private static Object[] prepareDevInterfaceOtnOduExpMsiParameters(String nodeId, String interfaceName,
969 String tribSlot = expMsi.getTribSlot().toString();
970 String odtuType = expMsi.getOdtuType().getTypeName();
971 String tribPort = expMsi.getTribPort().toString();
972 String tribPortPayload = expMsi.getTribPortPayload();
974 String startTimestamp = getCurrentTimestamp();
976 return new Object[]{nodeId,
988 private void persistDevInterfaces(String nodeId, Connection connection) {
990 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
991 Optional<OrgOpenroadmDevice> deviceObject =
992 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
993 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
995 /*InstanceIdentifier<Interface> interfaceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
996 .child(Interface.class);
997 Optional<Interface> interfaceOpt =
998 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, interfaceIID,
999 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT); */
1001 for (int i = 0; i < deviceObject.get().getInterface().size(); i++) {
1002 Interface deviceInterface;
1004 deviceInterface = deviceObject.get().getInterface().get(i);
1005 /*if (interfaceOpt.isPresent()) {
1006 deviceInterface = interfaceOpt.get();
1008 LOG.warn("Could not get interface info");
1011 Object[] parameters = prepareDevInterfaceParameters(nodeId, deviceInterface, connection);
1013 String query = Queries.getQuery().deviceInterfacesInsert().get();
1014 LOG.info("Running {} query ", query);
1015 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1016 for (int j = 0; j < parameters.length; j++) {
1017 stmt.setObject(j + 1, parameters[j]);
1020 stmt.clearParameters();
1021 } catch (SQLException e) {
1022 LOG.error(e.getMessage(), e);
1027 private void persistDevProtocols(String nodeId, Connection connection) {
1029 InstanceIdentifier<Protocols> protocolsIID =
1030 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1031 Optional<Protocols> protocolObject =
1032 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1033 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1034 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1035 LOG.error("LLDP subtree is missing");
1038 int adminstatusEnu =
1039 protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig().getAdminStatus()
1041 String msgTxtInterval =
1042 protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig().getMsgTxInterval()
1044 String mxgTxHoldMultiplier =
1045 protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig().getMsgTxHoldMultiplier()
1047 String startTimestamp = getCurrentTimestamp();
1048 persistDevProtocolLldpPortConfig(nodeId, connection);
1049 persistDevProtocolLldpNbrList(nodeId, connection);
1051 Object[] parameters = {nodeId,
1052 Integer.toString(adminstatusEnu),
1054 mxgTxHoldMultiplier,
1059 String query = Queries.getQuery().deviceProtocolInsert().get();
1060 LOG.info("Running {} query ", query);
1061 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1062 for (int j = 0; j < parameters.length; j++) {
1063 stmt.setObject(j + 1, parameters[j]);
1066 stmt.clearParameters();
1067 } catch (SQLException e) {
1068 LOG.error(e.getMessage(), e);
1074 private void persistDevProtocolLldpPortConfig(String nodeId, Connection connection) {
1076 InstanceIdentifier<Protocols> protocolsIID =
1077 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1078 Optional<Protocols> protocolObject =
1079 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1080 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1081 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1082 LOG.error("LLDP subtree is missing");
1085 String startTimestamp = getCurrentTimestamp();
1086 for (int i = 0; i < protocolObject.get().augmentation(Protocols1.class).getLldp().getPortConfig().size(); i++) {
1088 PortConfig portConfig =
1089 protocolObject.get().augmentation(Protocols1.class).getLldp().getPortConfig().get(i);
1090 String ifName = portConfig.getIfName();
1091 int adminStatusEnu = portConfig.getAdminStatus().getIntValue();
1093 Object[] parameters = {nodeId,
1095 Integer.toString(adminStatusEnu),
1100 String query = Queries.getQuery().deviceProtocolPortConfigInsert().get();
1101 LOG.info("Running {} query ", query);
1102 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1103 for (int j = 0; j < parameters.length; j++) {
1104 stmt.setObject(j + 1, parameters[j]);
1107 stmt.clearParameters();
1108 } catch (SQLException e) {
1109 LOG.error(e.getMessage(), e);
1116 private void persistDevProtocolLldpNbrList(String nodeId, Connection connection) {
1118 InstanceIdentifier<Protocols> protocolsIID =
1119 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1120 Optional<Protocols> protocolObject =
1121 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1122 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1123 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1124 LOG.error("LLDP subtree is missing");
1127 String startTimestamp = getCurrentTimestamp();
1128 for (int i = 0; i < protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList().getIfName()
1132 protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList().getIfName().get(i);
1133 String ifName = ifNameObj.getIfName();
1134 String remotesysname = ifNameObj.getRemoteSysName();
1135 String remotemgmtaddresssubtype = ifNameObj.getRemoteMgmtAddressSubType().getName();
1136 String remotemgmtaddress = ifNameObj.getRemoteMgmtAddress().getIpv4Address().toString();
1137 int remoteportidsubtypeEnu = ifNameObj.getRemotePortIdSubType().getIntValue();
1138 String remoteportid = ifNameObj.getRemotePortId();
1139 int remotechassisidsubtypeEnu = ifNameObj.getRemoteChassisIdSubType().getIntValue();
1140 String remotechassisid = ifNameObj.getRemoteChassisId();
1142 Object[] parameters = {nodeId,
1145 remotemgmtaddresssubtype,
1147 Integer.toString(remoteportidsubtypeEnu),
1149 Integer.toString(remotechassisidsubtypeEnu),
1155 String query = Queries.getQuery().deviceProtocolLldpNbrlistInsert().get();
1156 LOG.info("Running {} query ", query);
1157 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1158 for (int j = 0; j < parameters.length; j++) {
1159 stmt.setObject(j + 1, parameters[j]);
1162 stmt.clearParameters();
1163 } catch (SQLException e) {
1164 LOG.error(e.getMessage(), e);
1170 private void persistDevProtocolRstp(String nodeId, Connection connection) {
1172 InstanceIdentifier<Protocols> protocolsIID =
1173 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1174 Optional<Protocols> protocolObject =
1175 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1176 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1177 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1178 LOG.error("LLDP subtree is missing");
1181 String startTimestamp = getCurrentTimestamp();
1182 for (int i = 0; i < protocolObject.get()
1183 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.Protocols1.class)
1184 .getRstp().getRstpBridgeInstance().size(); i++) {
1186 RstpBridgeInstance rstpBridgeInstance = protocolObject.get()
1187 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.Protocols1.class)
1188 .getRstp().getRstpBridgeInstance().get(i);
1189 String bridgeName = rstpBridgeInstance.getBridgeName();
1190 String bridgePriority = rstpBridgeInstance.getRstpConfig().getBridgePriority().toString();
1191 String shutdown = rstpBridgeInstance.getRstpConfig().getShutdown().toString();
1192 String holdTime = rstpBridgeInstance.getRstpConfig().getHoldTime().toString();
1193 String helloTime = rstpBridgeInstance.getRstpConfig().getHelloTime().toString();
1194 String maxAge = rstpBridgeInstance.getRstpConfig().getMaxAge().toString();
1195 String forwardDelay = rstpBridgeInstance.getRstpConfig().getForwardDelay().toString();
1196 String transmitHoldCount = rstpBridgeInstance.getRstpConfig().getTransmitHoldCount().toString();
1197 String rootBridgePort =
1198 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootBridgePort().toString();
1199 String rootPathCost = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootPathCost().toString();
1200 String rootBridgePriority =
1201 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootBridgePriority().toString();
1202 String rootBridgeId = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootBridgeId().toString();
1203 String rootHoldTime = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootHoldTime().toString();
1204 String rootHelloTime = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootHelloTime().toString();
1205 String rootMaxAge = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootMaxAge().toString();
1206 String rootForwardDelay =
1207 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootForwardDelay().toString();
1208 String bridgeId = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getBridgeId().toString();
1209 String topoChangeCount =
1210 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getTopoChangeCount().toString();
1211 String timeSinceTopoChange =
1212 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getTimeSinceTopoChange().toString();
1214 persistDevProtocolRstpBridgePort(nodeId, bridgeName, rstpBridgeInstance, connection);
1215 persistDevProtocolRstpBridgePortAttr(nodeId, bridgeName, rstpBridgeInstance, connection);
1217 Object[] parameters = {nodeId,
1236 timeSinceTopoChange,
1241 String query = Queries.getQuery().deviceProtocolRstpInsert().get();
1242 LOG.info("Running {} query ", query);
1243 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1244 for (int j = 0; j < parameters.length; j++) {
1245 stmt.setObject(j + 1, parameters[j]);
1248 stmt.clearParameters();
1249 } catch (SQLException e) {
1250 LOG.error(e.getMessage(), e);
1256 private void persistDevProtocolRstpBridgePort(String nodeId, String bridgeName,
1257 RstpBridgeInstance rstpBridgeInstance, Connection connection) {
1259 String startTimestamp = getCurrentTimestamp();
1260 for (int i = 0; i < rstpBridgeInstance.getRstpConfig().getRstpBridgePortTable().size(); i++) {
1261 RstpBridgePortTable rstpBridgePortTable =
1262 rstpBridgeInstance.getRstpConfig().getRstpBridgePortTable().get(i);
1264 String ifName = rstpBridgePortTable.getIfname();
1265 String cost = rstpBridgePortTable.getCost().toString();
1266 String priority = rstpBridgePortTable.getPriority().toString();
1268 Object[] parameters = {nodeId,
1277 String query = Queries.getQuery().deviceProtocolRstpBridgePortInsert().get();
1278 LOG.info("Running {} query ", query);
1279 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1280 for (int j = 0; j < parameters.length; j++) {
1281 stmt.setObject(j + 1, parameters[j]);
1284 stmt.clearParameters();
1285 } catch (SQLException e) {
1286 LOG.error(e.getMessage(), e);
1292 private void persistDevProtocolRstpBridgePortAttr(String nodeId, String bridgeName,
1293 RstpBridgeInstance rstpBridgeInstance, Connection connection) {
1295 String startTimestamp = getCurrentTimestamp();
1296 for (int i = 0; i < rstpBridgeInstance.getRstpState().getRstpBridgePortAttr().getRstpBridgePortTable().size();
1299 org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.rstp.bridge.port.state.attr
1300 .RstpBridgePortTable rstpBridgePortTableAttr =
1301 rstpBridgeInstance.getRstpState().getRstpBridgePortAttr().getRstpBridgePortTable().get(i);
1303 String ifName = rstpBridgePortTableAttr.getIfname();
1304 String bridgePortState = rstpBridgePortTableAttr.getBridgePortState().getName();
1305 String bridgePortRole = rstpBridgePortTableAttr.getBridgePortRole().getName();
1306 String bridgePortId = rstpBridgePortTableAttr.getBridgePortId().toString();
1307 String openEdgeBridgePort = rstpBridgePortTableAttr.getOperEdgeBridgePort().toString();
1308 String designatedBridgePort = rstpBridgePortTableAttr.getDesignatedBridgePort().toString();
1309 String designatedBridgeId = rstpBridgePortTableAttr.getDesignatedBridgeid().toString();
1311 Object[] parameters = {nodeId,
1318 designatedBridgePort,
1324 String query = Queries.getQuery().deviceProtocolRstpBridgePortAttrInsert().get();
1325 LOG.info("Running {} query ", query);
1326 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1327 for (int j = 0; j < parameters.length; j++) {
1328 stmt.setObject(j + 1, parameters[j]);
1331 stmt.clearParameters();
1332 } catch (SQLException e) {
1333 LOG.error(e.getMessage(), e);
1340 private void persistDevInternalLinks(String nodeId, Connection connection) {
1342 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1343 Optional<OrgOpenroadmDevice> deviceObject =
1344 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1345 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1347 String startTimestamp = getCurrentTimestamp();
1348 for (int i = 0; i < deviceObject.get().getInternalLink().size(); i++) {
1349 InternalLink internalLink = deviceObject.get().getInternalLink().get(i);
1350 String internalLinkName = internalLink.getInternalLinkName();
1351 String sourceCircuitPackName = internalLink.getSource().getCircuitPackName();
1352 String sourcePortName = internalLink.getSource().getPortName().toString();
1353 String destinationCircuitPackName = internalLink.getDestination().getCircuitPackName();
1354 String destinationPortName = internalLink.getDestination().getPortName().toString();
1356 Object[] parameters = {nodeId,
1358 sourceCircuitPackName,
1360 destinationCircuitPackName,
1361 destinationPortName,
1366 String query = Queries.getQuery().deviceInternalLinkInsert().get();
1367 LOG.info("Running {} query ", query);
1368 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1369 for (int j = 0; j < parameters.length; j++) {
1370 stmt.setObject(j + 1, parameters[j]);
1373 stmt.clearParameters();
1374 } catch (SQLException e) {
1375 LOG.error(e.getMessage(), e);
1382 private void persistDevExternalLinks(String nodeId, Connection connection) {
1384 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1385 Optional<OrgOpenroadmDevice> deviceObject =
1386 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1387 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1389 String startTimestamp = getCurrentTimestamp();
1390 for (int i = 0; i < deviceObject.get().getExternalLink().size(); i++) {
1391 ExternalLink externalLink = deviceObject.get().getExternalLink().get(i);
1392 String externalLinkName = externalLink.getExternalLinkName();
1393 String sourceNodeId = externalLink.getSource().getNodeId().toString();
1394 String sourceCircuitPackName = externalLink.getSource().getCircuitPackName();
1395 String sourcePortName = externalLink.getSource().getPortName().toString();
1396 String destinationNodeId = externalLink.getDestination().getNodeId().toString();
1397 String destinationCircuitPackName = externalLink.getDestination().getCircuitPackName();
1398 String destinationPortName = externalLink.getDestination().getPortName().toString();
1400 Object[] parameters = {nodeId,
1403 sourceCircuitPackName,
1406 destinationCircuitPackName,
1407 destinationPortName,
1412 String query = Queries.getQuery().deviceExternalLinkInsert().get();
1413 LOG.info("Running {} query ", query);
1414 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1415 for (int j = 0; j < parameters.length; j++) {
1416 stmt.setObject(j + 1, parameters[j]);
1419 stmt.clearParameters();
1420 } catch (SQLException e) {
1421 LOG.error(e.getMessage(), e);
1427 private void persistDevPhysicalLinks(String nodeId, Connection connection) {
1429 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1430 Optional<OrgOpenroadmDevice> deviceObject =
1431 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1432 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1434 String startTimestamp = getCurrentTimestamp();
1435 for (int i = 0; i < deviceObject.get().getPhysicalLink().size(); i++) {
1436 PhysicalLink physicalLink = deviceObject.get().getPhysicalLink().get(i);
1437 String physicalLinkName = physicalLink.getPhysicalLinkName();
1438 String sourceCircuitPackName = physicalLink.getSource().getCircuitPackName();
1439 String sourcePortName = physicalLink.getSource().getPortName().toString();
1440 String destinationCircuitPackName = physicalLink.getDestination().getCircuitPackName();
1441 String destinationPortName = physicalLink.getDestination().getPortName().toString();
1443 Object[] parameters = {nodeId,
1445 sourceCircuitPackName,
1447 destinationCircuitPackName,
1448 destinationPortName,
1453 String query = Queries.getQuery().devicePhysicalLinkInsert().get();
1454 LOG.info("Running {} query ", query);
1455 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1456 for (int j = 0; j < parameters.length; j++) {
1457 stmt.setObject(j + 1, parameters[j]);
1460 stmt.clearParameters();
1461 } catch (SQLException e) {
1462 LOG.error(e.getMessage(), e);
1468 private void persistDevDegree(String nodeId, Connection connection) {
1470 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1471 Optional<OrgOpenroadmDevice> deviceObject =
1472 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1473 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1475 String startTimestamp = getCurrentTimestamp();
1476 for (int i = 0; i < deviceObject.get().getDegree().size(); i++) {
1477 Degree degree = deviceObject.get().getDegree().get(i);
1478 String degreeNumber = degree.getDegreeNumber().toString();
1479 String maxWavelengths = degree.getMaxWavelengths().toString();
1480 String otdrPortCircuitPackName = degree.getOtdrPort().getCircuitPackName();
1481 String otdrPortPortName = degree.getOtdrPort().getPortName().toString();
1482 persistDevDegreeCircuitPack(nodeId, degree, degreeNumber, connection);
1483 persistDevDegreeConnectionPort(nodeId, degree, degreeNumber, connection);
1484 //String mcCapabilitiesSlotWidthGranularity = "";
1485 //String mcCapabilitiesCenterFreqGranularity = "";
1486 //String mcCapabilitiesMinSlots = "";
1487 //String mcCapabilitiesMaxSlots = "";
1489 Object[] parameters = {nodeId,
1492 otdrPortCircuitPackName,
1494 //mcCapabilitiesSlotWidthGranularity,
1495 //mcCapabilitiesCenterFreqGranularity,
1496 //mcCapabilitiesMinSlots,
1497 //mcCapabilitiesMaxSlots,
1503 String query = Queries.getQuery().deviceDegreeInsert().get();
1504 LOG.info("Running {} query ", query);
1505 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1506 for (int j = 0; j < parameters.length; j++) {
1507 stmt.setObject(j + 1, parameters[j]);
1510 stmt.clearParameters();
1511 } catch (SQLException e) {
1512 LOG.error(e.getMessage(), e);
1519 private void persistDevDegreeCircuitPack(String nodeId, Degree degree, String degreeNumber, Connection connection) {
1521 String startTimestamp = getCurrentTimestamp();
1522 for (int i = 0; i < degree.getCircuitPacks().size(); i++) {
1524 String circuitPackIndex = degree.getCircuitPacks().get(i).getIndex().toString();
1525 String circuitPackName = degree.getCircuitPacks().get(i).getCircuitPackName();
1527 Object[] parameters = {nodeId,
1535 String query = Queries.getQuery().deviceDegreeCircuitPackInsert().get();
1536 LOG.info("Running {} query ", query);
1537 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1538 for (int j = 0; j < parameters.length; j++) {
1539 stmt.setObject(j + 1, parameters[j]);
1542 stmt.clearParameters();
1543 } catch (SQLException e) {
1544 LOG.error(e.getMessage(), e);
1550 private void persistDevDegreeConnectionPort(String nodeId, Degree degree, String degreeNumber,
1551 Connection connection) {
1553 String startTimestamp = getCurrentTimestamp();
1554 for (int i = 0; i < degree.getConnectionPorts().size(); i++) {
1556 String connectionPortIndex = degree.getConnectionPorts().get(i).getIndex().toString();
1557 String circuitPackName = degree.getConnectionPorts().get(i).getCircuitPackName();
1558 String portName = degree.getConnectionPorts().get(i).getPortName().toString();
1560 Object[] parameters = {nodeId,
1562 connectionPortIndex,
1569 String query = Queries.getQuery().deviceDegreeConnectionPortInsert().get();
1570 LOG.info("Running {} query ", query);
1571 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1572 for (int j = 0; j < parameters.length; j++) {
1573 stmt.setObject(j + 1, parameters[j]);
1576 stmt.clearParameters();
1577 } catch (SQLException e) {
1578 LOG.error(e.getMessage(), e);
1585 private void persistDevSrg(String nodeId, Connection connection) {
1587 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1588 Optional<OrgOpenroadmDevice> deviceObject =
1589 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1590 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1592 String startTimestamp = getCurrentTimestamp();
1593 for (int i = 0; i < deviceObject.get().getSharedRiskGroup().size(); i++) {
1594 SharedRiskGroup sharedRiskGroup = deviceObject.get().getSharedRiskGroup().get(i);
1595 String maxAddDropPorts = sharedRiskGroup.getMaxAddDropPorts().toString();
1596 String srgNumber = sharedRiskGroup.getSrgNumber().toString();
1597 int wavelengthDuplicationEnu = sharedRiskGroup.getWavelengthDuplication().getIntValue();
1598 persistDevSrgCircuitPacks(nodeId, sharedRiskGroup, srgNumber, connection);
1599 //String currentProvisionedAddDropPorts = "";
1600 //String mcCapSlotWidthGranularity = "";
1601 //String mcCapCenterFreqGranularity = "";
1602 //String mcCapMinSlots = "";
1603 //String mcCapMaxSlots = "";
1605 Object[] parameters = {nodeId,
1607 //currentProvisionedAddDropPorts,
1610 //mcCapSlotWidthGranularity,
1611 //mcCapCenterFreqGranularity,
1619 String query = Queries.getQuery().deviceSharedRiskGroupInsert().get();
1620 LOG.info("Running {} query ", query);
1621 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1622 for (int j = 0; j < parameters.length; j++) {
1623 stmt.setObject(j + 1, parameters[j]);
1626 stmt.clearParameters();
1627 } catch (SQLException e) {
1628 LOG.error(e.getMessage(), e);
1634 private void persistDevSrgCircuitPacks(String nodeId, SharedRiskGroup sharedRiskGroup, String srgNumber,
1635 Connection connection) {
1637 String startTimestamp = getCurrentTimestamp();
1638 for (int i = 0; i < sharedRiskGroup.getCircuitPacks().size(); i++) {
1640 String circuitPackindex = sharedRiskGroup.getCircuitPacks().get(i).getIndex().toString();
1641 String circuitPackName = sharedRiskGroup.getCircuitPacks().get(i).getCircuitPackName();
1643 Object[] parameters = {nodeId,
1651 String query = Queries.getQuery().deviceSrgCircuitPackInsert().get();
1652 LOG.info("Running {} query ", query);
1653 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1654 for (int j = 0; j < parameters.length; j++) {
1655 stmt.setObject(j + 1, parameters[j]);
1658 stmt.clearParameters();
1659 } catch (SQLException e) {
1660 LOG.error(e.getMessage(), e);
1666 private void persistDevRoadmConnections(String nodeId, Connection connection) {
1668 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1669 Optional<OrgOpenroadmDevice> deviceObject =
1670 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1671 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1673 String startTimestamp = getCurrentTimestamp();
1674 for (int i = 0; i < deviceObject.get().getRoadmConnections().size(); i++) {
1675 RoadmConnections roadmConnections = deviceObject.get().getRoadmConnections().get(i);
1676 int opticalcontrolmodeEnu = roadmConnections.getOpticalControlMode().getIntValue();
1677 //String connectionName = "";
1678 //String connectionNumber = "";
1679 //String wavelengthNumber = "";
1680 String targetOutputPower = roadmConnections.getTargetOutputPower().toString();
1681 String srcIf = roadmConnections.getSource().getSrcIf();
1682 String dstIf = roadmConnections.getDestination().getDstIf();
1684 Object[] parameters = {nodeId,
1689 Integer.toString(opticalcontrolmodeEnu),
1697 String query = Queries.getQuery().deviceRoadmConnectionsInsert().get();
1698 LOG.info("Running {} query ", query);
1699 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1700 for (int j = 0; j < parameters.length; j++) {
1701 stmt.setObject(j + 1, parameters[j]);
1704 stmt.clearParameters();
1705 } catch (SQLException e) {
1706 LOG.error(e.getMessage(), e);
1713 private void persistDevConnectionMap(String nodeId, Connection connection) {
1715 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1716 Optional<OrgOpenroadmDevice> deviceObject =
1717 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1718 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1720 String startTimestamp = getCurrentTimestamp();
1721 for (int i = 0; i < deviceObject.get().getConnectionMap().size(); i++) {
1722 ConnectionMap connectionMap = deviceObject.get().getConnectionMap().get(i);
1723 String connectionMapNumber = connectionMap.getConnectionMapNumber().toString();
1724 String sourceCircuitPackName = connectionMap.getSource().getCircuitPackName();
1725 String sourcePortName = connectionMap.getSource().getCircuitPackName();
1728 Object[] parameters = {nodeId,
1729 connectionMapNumber,
1730 sourceCircuitPackName,
1736 String query = Queries.getQuery().deviceConnectionMapInsert().get();
1737 LOG.info("Running {} query ", query);
1738 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1739 for (int j = 0; j < parameters.length; j++) {
1740 stmt.setObject(j + 1, parameters[j]);
1743 stmt.clearParameters();
1744 } catch (SQLException e) {
1745 LOG.error(e.getMessage(), e);
1751 private void persistDevWavelengthMap(String nodeId, Connection connection) {
1754 String wavelengthNumber="", centerFrequency="", wavelength="";;
1756 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1757 Optional<OrgOpenroadmDevice> deviceObject =
1758 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1759 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1762 String startTimestamp = getCurrentTimestamp();
1763 for (int i = 0; i<deviceObject.get().getWavelengthMap().getWavelengths().size(); i++) {
1764 Wavelengths wavelengths = deviceObject.get().getWavelengthMap().getWavelengths().get(i);
1765 wavelengthNumber=wavelengths.getWavelengthNumber().toString();
1766 centerFrequency=wavelengths.getCenterFrequency().toString();
1767 wavelength=wavelengths.getWavelength().toString();
1770 Object[] parameters = {nodeId,
1778 String query = Queries.getQuery().deviceWavelengthInsert().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(e.getMessage(), e);
1795 private void persistDevInterfaceTcm(String nodeId, String interfaceName, OduBuilder oduBuilder,
1796 Connection connection) {
1798 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1801 tcm = oduBuilder.getTcm().get(i);
1803 Object[] parameters = prepareDevInterfaceTcmParameters(nodeId, interfaceName, tcm);
1805 String query = Queries.getQuery().deviceInterfacesInsert().get();
1806 LOG.info("Running {} query ", query);
1807 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1808 for (int j = 0; j < parameters.length; j++) {
1809 stmt.setObject(j + 1, parameters[j]);
1812 stmt.clearParameters();
1813 } catch (SQLException e) {
1814 LOG.error(e.getMessage(), e);
1819 private void persistDevInterfaceOtnOduTxMsi(String nodeId, String interfaceName, OduBuilder oduBuilder,
1820 Connection connection) {
1822 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1825 txMsi = oduBuilder.getOpu().getMsi().getTxMsi().get(i);
1827 Object[] parameters = prepareDevInterfaceOtnOduTxMsiParameters(nodeId, interfaceName, txMsi);
1829 String query = Queries.getQuery().deviceInterfaceOtnOduTxMsiInsert().get();
1830 LOG.info("Running {} query ", query);
1831 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1832 for (int j = 0; j < parameters.length; j++) {
1833 stmt.setObject(j + 1, parameters[j]);
1836 stmt.clearParameters();
1837 } catch (SQLException e) {
1838 LOG.error(e.getMessage(), e);
1844 private void persistDevInterfaceOtnOduRxMsi(String nodeId, String interfaceName, OduBuilder oduBuilder,
1845 Connection connection) {
1847 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1850 rxMsi = oduBuilder.getOpu().getMsi().getRxMsi().get(i);
1852 Object[] parameters = prepareDevInterfaceOtnOduRxMsiParameters(nodeId, interfaceName, rxMsi);
1854 String query = Queries.getQuery().deviceInterfaceOtnOduRxMsiInsert().get();
1855 LOG.info("Running {} query ", query);
1856 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1857 for (int j = 0; j < parameters.length; j++) {
1858 stmt.setObject(j + 1, parameters[j]);
1861 stmt.clearParameters();
1862 } catch (SQLException e) {
1863 LOG.error(e.getMessage(), e);
1869 private void persistDevInterfaceOtnOduExpMsi(String nodeId, String interfaceName, OduBuilder oduBuilder,
1870 Connection connection) {
1872 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1875 expMsi = oduBuilder.getOpu().getMsi().getExpMsi().get(i);
1877 Object[] parameters = prepareDevInterfaceOtnOduExpMsiParameters(nodeId, interfaceName, expMsi);
1879 String query = Queries.getQuery().deviceInterfaceOtnOduExpMsiInsert().get();
1880 LOG.info("Running {} query ", query);
1881 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1882 for (int j = 0; j < parameters.length; j++) {
1883 stmt.setObject(j + 1, parameters[j]);
1886 stmt.clearParameters();
1887 } catch (SQLException e) {
1888 LOG.error(e.getMessage(), e);