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;
15 import java.sql.Connection;
16 import java.sql.PreparedStatement;
17 import java.sql.ResultSet;
18 import java.sql.SQLException;
19 import java.util.Optional;
20 import java.util.concurrent.ExecutionException;
21 import javax.sql.DataSource;
22 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
23 import org.opendaylight.transportpce.common.Timeouts;
24 import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
25 import org.opendaylight.transportpce.inventory.query.Queries;
26 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.CpSlots;
27 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.Ports;
28 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.packs.CircuitPacks;
29 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.external.links.ExternalLink;
30 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.Interface;
31 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.internal.links.InternalLink;
32 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.OrgOpenroadmDevice;
33 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.ConnectionMap;
34 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.Degree;
35 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.Info;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.Protocols;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnections;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.SharedRiskGroup;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.physical.links.PhysicalLink;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.shelf.Slots;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.shelves.Shelves;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev161014.Interface1;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev161014.ethernet.container.EthernetBuilder;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.Protocols1;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.lldp.container.lldp.PortConfig;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.lldp.container.lldp.nbr.list.IfName;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.och.container.OchBuilder;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.ots.container.OtsBuilder;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.odu.attributes.Tcm;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.odu.container.OduBuilder;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.opu.opu.msi.ExpMsi;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.opu.opu.msi.RxMsi;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.opu.opu.msi.TxMsi;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.otu.container.OtuBuilder;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.rstp.bridge.port.attr.RstpBridgePortTable;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.rstp.container.rstp.RstpBridgeInstance;
57 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
58 import org.slf4j.Logger;
59 import org.slf4j.LoggerFactory;
62 public class INode221 {
63 private static final Logger LOG = LoggerFactory.getLogger(INode221.class);
65 private final DataSource dataSource;
66 private final DeviceTransactionManager deviceTransactionManager;
68 public INode221(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.info("iNode AddNode call complete");
102 getRoadmShelves(deviceId);
103 LOG.info("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");
111 LOG.debug("iNode persist interfaces call");
112 persistDevInterfaces(deviceId, connection);
113 LOG.debug("iNode persist interfaces call complete");
115 LOG.debug("iNode persist protocols call");
116 persistDevProtocols(deviceId, connection);
117 LOG.debug("iNode persist protocols call complete");
119 // LOG.debug("iNode persist wavelength map call");
120 // persistDevWavelengthMap(deviceId, connection);
121 // LOG.debug("iNode persist wavelength map call complete");
123 LOG.debug("iNode persist internal links map call");
124 persistDevInternalLinks(deviceId, connection);
125 LOG.debug("iNode persist internal links map call complete");
127 LOG.debug("iNode persist Physical links map call");
128 persistDevPhysicalLinks(deviceId, connection);
129 LOG.debug("iNode persist Physical links map call complete");
131 LOG.debug("iNode persist External links map call");
132 persistDevExternalLinks(deviceId, connection);
133 LOG.debug("iNode persist External links map call complete");
135 LOG.debug("iNode persist degree map call");
136 persistDevDegree(deviceId, connection);
137 LOG.debug("iNode persist degree map call complete");
139 LOG.debug("iNode persist srg map call");
140 persistDevSrg(deviceId, connection);
141 LOG.debug("iNode persist srg map call complete");
143 LOG.debug("iNode persist Roadm Connections call");
144 persistDevRoadmConnections(deviceId, connection);
145 LOG.debug("iNode persist Roadm Connections call complete");
147 LOG.debug("iNode persist Connection Map call");
148 persistDevConnectionMap(deviceId, connection);
149 LOG.debug("iNode persist Connection Map call complete");
151 } catch (SQLException e) {
152 LOG.error(e.getMessage(), e);
153 } catch (InterruptedException e) {
154 LOG.error(e.getMessage(), e);
155 } catch (ExecutionException e) {
156 LOG.error(e.getMessage(), e);
161 public boolean nodeExists(String nodeId) {
162 String selectTableSQL = "select count(*) node_exists from inv_dev_info where node_id = ?";
164 LOG.info("Checking if {} exists in DB", nodeId);
165 try (Connection connection = dataSource.getConnection();
166 PreparedStatement preparedStmt = connection.prepareStatement(selectTableSQL)) {
167 preparedStmt.setString(1, nodeId);
168 try (ResultSet rs = preparedStmt.executeQuery()) {
170 nodeExists = rs.getInt("node_exists");
171 LOG.debug("Found {} devices matching {}", nodeExists, nodeId);
174 } catch (SQLException e) {
175 LOG.error(e.getMessage(), e);
177 return nodeExists == 0 ? false : true;
180 public void getRoadmShelves(String nodeId) throws InterruptedException, ExecutionException {
181 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
182 Optional<OrgOpenroadmDevice> deviceObject = deviceTransactionManager.getDataFromDevice(nodeId,
183 LogicalDatastoreType.OPERATIONAL, deviceIID, Timeouts.DEVICE_READ_TIMEOUT,
184 Timeouts.DEVICE_READ_TIMEOUT_UNIT);
186 LOG.info("Shelves size {}", deviceObject.get().getShelves().size());
187 try (Connection connection = dataSource.getConnection()) {
188 Preconditions.checkNotNull(connection);
189 for (int i = 0; i < deviceObject.get().getShelves().size(); i++) {
190 Shelves shelve = deviceObject.get().getShelves().get(i);
191 String shelfName = shelve.getShelfName();
193 LOG.info("Getting Shelve Details of {}", shelfName);
194 if (shelve.getSlots() != null) {
195 LOG.info("Slot Size {} ", shelve.getSlots().size());
196 persistShelveSlots(nodeId, shelve, connection);
198 LOG.info("No Slots for shelf {}", shelfName);
202 persistShelves(nodeId, connection, shelve);
204 } catch (SQLException e1) {
205 LOG.error(e1.getMessage(), e1);
209 public void getCircuitPacks(String nodeId) throws InterruptedException, ExecutionException {
210 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
211 Optional<OrgOpenroadmDevice> deviceObject =
212 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
213 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
214 if (!deviceObject.isPresent()) {
215 LOG.warn("Device object {} was not found", nodeId);
218 LOG.info("Circuit pack size {}", deviceObject.get().getCircuitPacks().size());
220 try (Connection connection = dataSource.getConnection()) {
221 Preconditions.checkNotNull(connection);
222 for (int i = 0; i < deviceObject.get().getCircuitPacks().size(); i++) {
223 CircuitPacks cp = deviceObject.get().getCircuitPacks().get(i);
225 if (cp.getCpSlots() != null) {
226 persistCircuitPacksSlots(nodeId, cp, connection);
228 LOG.info("Everything {}", cp);
229 LOG.info("CP is {}", cp);
231 persistPorts(cp, connection);
233 persistCircuitPacks(nodeId, connection, cp);
235 } catch (SQLException e1) {
236 LOG.error(e1.getMessage(), e1);
240 private void persistCircuitPacks(String nodeId, Connection connection, CircuitPacks cp) {
241 Object[] parameters = prepareCircuitPacksParameters(nodeId, cp);
242 String query = Queries.getQuery().deviceCircuitPackInsert().get();
243 LOG.info("Running {} query ", query);
244 try (PreparedStatement stmt = connection.prepareStatement(query)) {
245 for (int j = 0; j < parameters.length; j++) {
246 stmt.setObject(j + 1, parameters[j]);
249 stmt.clearParameters();
250 } catch (SQLException e) {
251 LOG.error(e.getMessage(), e);
255 private void persistShelves(String nodeId, Connection connection, Shelves shelve) {
256 Object[] shelvesParameter = prepareShelvesParameters(nodeId, shelve);
257 String query = Queries.getQuery().deviceShelfInsert().get();
258 LOG.info("Running {} query ", query);
259 try (PreparedStatement preparedStmt = connection.prepareStatement(query)) {
260 for (int j = 0; j < shelvesParameter.length; j++) {
261 preparedStmt.setObject(j + 1, shelvesParameter[j]);
263 preparedStmt.execute();
264 preparedStmt.clearParameters();
265 } catch (SQLException e) {
266 LOG.error(e.getMessage(), e);
270 private void persistShelveSlots(String nodeId, Shelves shelves, Connection connection) {
271 String startTimetampStr = getCurrentTimestamp();
272 for (int i = 0; i < shelves.getSlots().size(); i++) {
273 Slots slot = shelves.getSlots().get(i);
274 LOG.info("Getting Slot Details of {}", slot.getSlotName());
275 Object[] parameters = new Object[]{nodeId,
276 shelves.getShelfName(),
279 slot.getProvisionedCircuitPack(),
283 String query = Queries.getQuery().deviceShelfSlotInsert().get();
284 LOG.info("Running {} query ", query);
285 try (PreparedStatement stmt = connection.prepareStatement(query)) {
286 for (int j = 0; j < parameters.length; j++) {
287 stmt.setObject(j + 1, parameters[j]);
290 stmt.clearParameters();
291 } catch (SQLException e) {
292 LOG.error(e.getMessage(), e);
298 private void persistCircuitPacksSlots(String nodeId, CircuitPacks circuitPacks, Connection connection) {
299 String startTimetampStr = getCurrentTimestamp();
300 for (int i = 0; i < circuitPacks.getCpSlots().size(); i++) {
301 CpSlots cpSlot = circuitPacks.getCpSlots().get(i);
303 Object[] parameters = new Object[]{nodeId,
304 circuitPacks.getCircuitPackName(),
305 cpSlot.getSlotName(),
307 cpSlot.getProvisionedCircuitPack(),
311 String query = Queries.getQuery().deviceCPSlotInsert().get();
312 LOG.info("Running {} query ", query);
313 try (PreparedStatement stmt = connection.prepareStatement(query)) {
314 for (int j = 0; j < parameters.length; j++) {
315 stmt.setObject(j + 1, parameters[j]);
318 stmt.clearParameters();
319 } catch (SQLException e) {
320 LOG.error(e.getMessage(), e);
325 private void persistPorts(CircuitPacks circuitPacks, Connection connection) {
326 LOG.warn("Ports are not persisted yet");
331 * Prepares parameters for device insert query.
333 * @param deviceInfo device info
334 * @return Object Object
336 private static Object[] prepareDeviceInfoParameters(Info deviceInfo) {
337 String startTimetampStr = getCurrentTimestamp();
338 //Integer maxNumBin15minHistoricalPm = null;
339 //Integer maxNumBin24hourHistoricalPm = null;
340 //String serialId = "";
342 String nodeId = prepareDashString(deviceInfo.getNodeId());
343 Long nodeNumber = deviceInfo.getNodeNumber().toJava();
344 Integer nodeTypeEnu = deviceInfo.getNodeType().getIntValue();
345 String clli = prepareDashString(deviceInfo.getClli());
346 String vendor = prepareDashString(deviceInfo.getVendor());
347 String model = prepareDashString(deviceInfo.getModel());
348 String ipAddress = prepareDashString(deviceInfo.getIpAddress().getIpv4Address().getValue());
349 String prefixLength = prepareDashString(deviceInfo.getPrefixLength());
350 String defaultGateway = prepareDashString(deviceInfo.getDefaultGateway().getIpv4Address().getValue());
351 Integer sourceEnum = deviceInfo.getSource().getIntValue();
352 String currentIpAddress = prepareDashString(deviceInfo.getCurrentIpAddress().getIpv4Address().getValue());
353 String currentPrefixLength = prepareDashString(deviceInfo.getCurrentPrefixLength());
354 String currentDefaultGateway = prepareDashString(deviceInfo.getDefaultGateway().getIpv4Address().getValue());
355 String macAddress = prepareDashString(deviceInfo.getMacAddress().getValue());
356 String softwareVersion = prepareDashString(deviceInfo.getSoftwareVersion());
357 String openroadmVersion = "2.2.1";
358 String template = prepareDashString(deviceInfo.getTemplate());
359 String currentDatetime = prepareDashString(deviceInfo.getCurrentDatetime().getValue());
361 (deviceInfo.getGeoLocation() != null ? prepareDashString(deviceInfo.getGeoLocation().getLatitude()) : "");
362 String geoLongitude =
363 (deviceInfo.getGeoLocation() != null ? prepareDashString(deviceInfo.getGeoLocation().getLongitude()) : "");
364 String maxDegrees = prepareDashString(deviceInfo.getMaxDegrees()); // max_degrees
365 String maxSrgs = prepareDashString(deviceInfo.getMaxSrgs()); //max_srgs
366 String swVersion = prepareDashString(deviceInfo.getSoftwareVersion()); //sw_version
367 String swValidationTimer = prepareDashString(""); //sw_validation_timer
368 String activationDateTime = prepareDashString(""); //activation_date_time
369 /*jsonDevInfo = JsonStringBuilder.getDevInfoJson().replace("$$NODE-ID$$",nodeId)
370 .replace("$$NODE-NUMBER$$", nodeNumber)
371 .replace("$$NODE-TYPE$$",nodeType)
372 .replace("$$CLLI$$",clli)
373 .replace("$$VENDOR$$",vendor)
374 .replace("$$MODEL$$",model)
375 .replace("$$SERIAL-ID$$",serialId)
376 .replace("$$IPADDRESS$$",ipAddress)
377 .replace("$$PREFIX-LENGTH$$",prefixLength)
378 .replace("$$DEFAULTGATEWAY$$",defaultGateway)
379 .replace("$$SOURCE$$",String.valueOf(source))
380 .replace("$$CURRENT-IPADDRESS$$",currentIpAddress)
381 .replace("$$CURRENT-PREFIX-LENGTH$$",currentPrefixLength)
382 .replace("$$CURRENT-DEFAULTGATEWAY$$",currentDefailtGateway)
383 .replace("$$MACADDRESS$$",macAddress)
384 .replace("$$SOFTWAREVERSION$$",softwareVersion)
385 .replace("$$OPENROADM-VERSION$$",openroadmVersion)
386 .replace("$$TEMPLATE$$",template)
387 .replace("$$CURRENT-DATETIME$$",currentDatetime)
388 .replace("$$LATITUDE$$",latitude)
389 .replace("$$LONGITUDE$$",longitude)
390 .replace("$$MAX-DEGREES$$",maxDegrees)
391 .replace("$$MAX-SRGS$$",maxSrgs)
392 .replace("$$MAX-NUM-BIN-15MIN-HISTORICAL-PM$$",prepareDashString(""))
393 .replace("$$MAX-NUM-BIN-24HOUR-HISTORICAL-PM$$",prepareDashString(""))
394 .replace("$$SW-VERSION$$",swVersion)
395 .replace("$$SW-VALIDATION-TIMER$$",swValidationTimer)
396 .replace("$$ACTIVATION-DATE-TIME$$",activationDateTime);*/
414 currentDefaultGateway,
424 //maxNumBin15minHistoricalPm,
425 //maxNumBin24hourHistoricalPm,
436 private static Object[] prepareShelvesParameters(String nodeId, Shelves shelve) {
437 String startTimestamp = getCurrentTimestamp();
439 return new Object[]{nodeId,
440 shelve.getShelfName(),
441 shelve.getShelfType(),
443 shelve.getShelfPosition(),
444 (shelve.getAdministrativeState() == null ? null : shelve.getAdministrativeState().getIntValue()),
447 shelve.getSerialId(),
449 shelve.getProductCode(),
450 (shelve.getManufactureDate() == null ? null : shelve.getManufactureDate().getValue()),
452 shelve.getHardwareVersion(),
453 (shelve.getOperationalState() == null ? null : shelve.getOperationalState().getIntValue()),
454 (shelve.getEquipmentState() == null ? null : shelve.getEquipmentState().getIntValue()),
455 (shelve.getDueDate() == null ? null : shelve.getDueDate().getValue()),
461 private static Object[] prepareCPPortsParameters(String nodeId, CircuitPacks circuitPacks, Ports cpPort) {
463 String circuitPackName = circuitPacks.getCircuitPackName();
464 String portName = cpPort.getPortName();
465 String portType = cpPort.getPortType();
466 String portQualEnu = String.valueOf(cpPort.getPortQual().getIntValue());
467 String portWavelengthTypeEnu = String.valueOf(cpPort.getPortWavelengthType().getIntValue());
468 String portDirectionEnu = String.valueOf(cpPort.getPortDirection().getIntValue());
469 String label = cpPort.getLabel();
470 String circuitId = cpPort.getCircuitId();
471 String administrativeStateEnu =
472 (cpPort.getAdministrativeState() == null ? "" :
473 String.valueOf(cpPort.getAdministrativeState().getIntValue()));
474 String operationalStateEnu =
475 (cpPort.getOperationalState() == null ? "" : String.valueOf(cpPort.getOperationalState().getIntValue()));
476 String logicalConnectionPoint = cpPort.getLogicalConnectionPoint();
477 String partnerPortCircuitPackName = cpPort.getPartnerPort().getCircuitPackName();
478 String partnerPortPortName = cpPort.getPartnerPort().getPortName().toString();
479 String parentPortCircuitPackName = cpPort.getParentPort().getCircuitPackName();
480 String parentPortPortName = cpPort.getParentPort().getPortName().toString();
481 String roadmPortPortPowerCapabilityMinRx = cpPort.getRoadmPort().getPortPowerCapabilityMinRx().toString();
482 String roadmPortPortPowerCapabilityMinTx = cpPort.getRoadmPort().getPortPowerCapabilityMinTx().toString();
483 String roadmPortPortPowerCapabilityMaxRx = cpPort.getRoadmPort().getPortPowerCapabilityMaxRx().toString();
484 String roadmPortPortPowerCapabilityMaxTx = cpPort.getRoadmPort().getPortPowerCapabilityMaxTx().toString();
485 //String roadmPortCapableWavelengths = "";
486 //String roadmPortAvailableWavelengths = "";
487 //String roadmPortUsedWavelengths = "";
488 String transponderPortPortPowerCapabilityMinRx =
489 cpPort.getTransponderPort().getPortPowerCapabilityMinRx().toString();
490 String transponderPortPortPowerCapabilityMinTx =
491 cpPort.getTransponderPort().getPortPowerCapabilityMinTx().toString();
492 String transponderPortPortPowerCapabilityMaxRx =
493 cpPort.getTransponderPort().getPortPowerCapabilityMaxRx().toString();
494 String transponderPortPortPowerCapabilityMaxTx =
495 cpPort.getTransponderPort().getPortPowerCapabilityMaxTx().toString();
496 //String transponderPortCapableWavelengths = "";
497 String otdrPortLaunchCableLength = cpPort.getOtdrPort().getLaunchCableLength().toString();
498 String otdrPortPortDirection = String.valueOf(cpPort.getOtdrPort().getPortDirection().getIntValue());
499 //String ilaPortPortPowerCapabilityMixRx = "";
500 //String ilaPortPortPowerCapabilityMixTx = "";
501 //String ilaPortPortPowerCapabilityMaxRx = "";
502 //String ilaPortPortPowerCapabilityMaxTx = "";
504 String startTimestamp = getCurrentTimestamp();
506 return new Object[]{nodeId,
511 portWavelengthTypeEnu,
515 administrativeStateEnu,
517 logicalConnectionPoint,
518 partnerPortCircuitPackName,
520 parentPortCircuitPackName,
522 roadmPortPortPowerCapabilityMinRx,
523 roadmPortPortPowerCapabilityMinTx,
524 roadmPortPortPowerCapabilityMaxRx,
525 roadmPortPortPowerCapabilityMaxTx,
526 //roadmPortCapableWavelengths,
527 //roadmPortAvailableWavelengths,
528 //roadmPortUsedWavelengths,
530 transponderPortPortPowerCapabilityMinRx,
531 transponderPortPortPowerCapabilityMinTx,
532 transponderPortPortPowerCapabilityMaxRx,
533 transponderPortPortPowerCapabilityMaxTx,
534 //transponderPortCapableWavelengths,
536 otdrPortLaunchCableLength,
537 otdrPortPortDirection,
538 //ilaPortPortPowerCapabilityMixRx,
539 //ilaPortPortPowerCapabilityMixTx,
540 //ilaPortPortPowerCapabilityMaxRx,
541 //ilaPortPortPowerCapabilityMaxTx,
549 private static Object[] prepareCircuitPacksParameters(String nodeId, CircuitPacks cpack) {
550 String startTimestamp = getCurrentTimestamp();
551 return new Object[]{nodeId,
552 cpack.getCircuitPackName(),
553 cpack.getCircuitPackType(),
554 cpack.getCircuitPackProductCode(),
555 (cpack.getAdministrativeState() == null ? "" : cpack.getAdministrativeState().getIntValue()),
560 cpack.getProductCode(),
561 (cpack.getManufactureDate() == null ? "" : cpack.getManufactureDate().getValue()),
563 cpack.getHardwareVersion(),
564 prepareEmptyString(cpack.getOperationalState().getIntValue()),
565 cpack.getCircuitPackCategory().getType().getName(),
566 cpack.getCircuitPackCategory().getExtension(),
567 (cpack.getEquipmentState() == null ? "" : cpack.getEquipmentState().getIntValue()),
568 cpack.getCircuitPackMode(),
572 prepareEmptyString(cpack.getDueDate()),
573 prepareEmptyString((cpack.getParentCircuitPack() == null) ? "" :
574 ((cpack.getParentCircuitPack().getCircuitPackName() == null) ? "" :
575 cpack.getParentCircuitPack().getCircuitPackName())
577 prepareEmptyString((cpack.getParentCircuitPack() == null) ? "" :
578 ((cpack.getParentCircuitPack().getCpSlotName() == null) ? "" :
579 cpack.getParentCircuitPack().getCpSlotName())
586 private void persistCPPorts(String nodeId, Connection connection, CircuitPacks circuitPacks) {
587 for (int i = 0; i < circuitPacks.getPorts().size(); i++) {
588 Object[] cpPortsParameters = prepareCPPortsParameters(nodeId, circuitPacks, circuitPacks.getPorts().get(i));
589 String query = Queries.getQuery().deviceCPPortInsert().get();
590 LOG.info("Running {} query ", query);
591 try (PreparedStatement preparedStmt = connection.prepareStatement(query)) {
592 for (int j = 0; j < cpPortsParameters.length; j++) {
593 preparedStmt.setObject(j + 1, cpPortsParameters[j]);
595 preparedStmt.execute();
596 preparedStmt.clearParameters();
597 } catch (SQLException e) {
598 LOG.error(e.getMessage(), e);
604 private Object[] prepareDevInterfaceParameters(String nodeId, Interface deviceInterface, Connection connection) {
606 int administrativeStateEnu = deviceInterface.getAdministrativeState().getIntValue();
607 int operationalState = deviceInterface.getOperationalState().getIntValue();
608 int ethernetDuplexEnu = -1;
609 int ethernetAutoNegotiationEnu = -1;
610 int maintTestsignalTestpatternEnu = -1;
611 int maintTestsignalTypeEnu = -1;
613 int otuMaintTypeEnu = -1;
614 //int otsFiberTypeEnu = -1;
615 String name = deviceInterface.getName();
616 String description = deviceInterface.getDescription();
617 String type = deviceInterface.getType().getTypeName();
618 String circuitId = deviceInterface.getCircuitId();
619 String supportingInterface = deviceInterface.getSupportingInterface();
620 String supportingCircuitPackName = deviceInterface.getSupportingCircuitPackName();
621 String supportingPort = deviceInterface.getSupportingPort().toString();
622 String ethernetSpeed = "";
623 String ethernetFec = "";
624 String ethernetMtu = "";
625 String ethernetCurrSpeed = "";
626 String ethernetCurrDuplex = "";
627 //String mciMcttpMinFreq = "";
628 //String mciMcttpMaxFreq = "";
629 //String mciMcttpCenterFreq = "";
630 //String mciMcttpSlotWidth = "";
631 //String mciNmcCtpFrequency = "";
632 //String mciNmcCtpWidth = "";
634 //String ochFrequency = "";
635 //String ochWidth = "";
636 //String ochWavelengthNumber = "";
637 String ochModulationFormat = "";
638 String ochTransmitPower = "";
639 String otsSpanLossReceive = "";
640 String otsSpanLossTransmit = "";
641 //String otsIngressSpanLossAgingMargin = "";
642 //String otsEolMaxLoadPin = "";
643 String oduRate = ""; //BUG in following case switch statement ???
644 //String oduFunction = "";
645 String oduMonitoringMode = "";
646 //String oduNoOamFunction = "";
647 String oduProactiveDelayMeasurementEnabled = "";
648 //String oduPoaTribPortNumber = "";
649 //String oduTxSapi = "";
650 //String oduTxDapi = "";
651 //String oduTxOperator = "";
652 //String oduAcceptedSapi = "";
653 //String oduAcceptedDapi = "";
654 //String oduAcceptedOperator = "";
655 //String oduExpectedSapi = "";
656 //String oduExpectedDapi = "";
657 //String oduTimActEnabled = "";
658 //String oduTimDetectMode = "";
659 //String oduDegmIntervals = "";
660 //String oduDegthrPercentage = "";
661 String opuPayloadType = "";
662 String opuRxPayloadType = "";
663 String opuExpPayloadType = "";
664 String opuPayloadInterface = "";
665 String maintTestsignalEnabled = "";
666 String maintTestsignalBiterrors = "";
667 String maintTestsignalBiterrorsterminal = "";
668 String maintTestsignalSyncseconds = "";
669 String maintTestsignalSyncsecondsterminal = "";
671 //String otuTxSapi = "";
672 //String otuTxDapi = "";
673 //String otuTxOperator = "";
674 //String otuAcceptedSapi = "";
675 //String otuAcceptedDapi = "";
676 //String otuAcceptedOperator = "";
677 //String otuExpectedSapi = "";
678 //String otuExpectedDapi = "";
679 //String otuTimActEnabled = "";
680 //String otuTimDetectMode = "";
681 //String otuDegmIntervals = "";
682 //String otuDegthrPercentage = "";
683 String otuMaintLoopbackEnabled = "";
684 //String mtOtuRate = "";
685 //String mtOtuFec = "";
686 //String mtOtuMaintLoopback = "";
687 //String mtOtuEnabled = "";
688 //String mtOtuType = "";
690 switch (deviceInterface.getType().toString()) {
693 //EthernetBuilder ethIfBuilder = new EthernetBuilder();
694 EthernetBuilder ethIfBuilder =
695 new EthernetBuilder(deviceInterface.augmentation(Interface1.class).getEthernet());
696 ethernetSpeed = ethIfBuilder.getSpeed().toString();
697 ethernetFec = ethIfBuilder.getFec().getName();
698 ethernetDuplexEnu = ethIfBuilder.getDuplex().getIntValue();
699 ethernetMtu = ethIfBuilder.getMtu().toString();
700 ethernetAutoNegotiationEnu = ethIfBuilder.getAutoNegotiation().getIntValue();
701 ethernetCurrSpeed = ethIfBuilder.getCurrSpeed();
702 ethernetCurrDuplex = ethIfBuilder.getCurrDuplex();
706 OchBuilder ochIfBuilder = new OchBuilder(deviceInterface.augmentation(
707 org.opendaylight.yang.gen.v1
708 .http.org.openroadm.optical.channel.interfaces.rev161014.Interface1.class)
710 ochRate = ochIfBuilder.getRate().getName();
711 //ochWavelengthNumber = ochIfBuilder.getWavelengthNumber().toString();
712 ochModulationFormat = ochIfBuilder.getModulationFormat().getName();
713 ochTransmitPower = ochIfBuilder.getTransmitPower().toString();
717 OtsBuilder otsIfBuilder = new OtsBuilder(deviceInterface.augmentation(
718 org.opendaylight.yang.gen.v1
719 .http.org.openroadm.optical.transport.interfaces.rev161014.Interface1.class)
721 int otsFiberTypeEnu = otsIfBuilder.getFiberType().getIntValue();
722 otsSpanLossReceive = otsIfBuilder.getSpanLossReceive().toString();
723 otsSpanLossTransmit = otsIfBuilder.getSpanLossTransmit().toString();
727 OduBuilder oduIfBuilder = new OduBuilder(deviceInterface.augmentation(
728 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.Interface1.class)
730 oduRate = String.valueOf(oduIfBuilder.getRate());
731 oduMonitoringMode = oduIfBuilder.getMonitoringMode().getName();
732 oduProactiveDelayMeasurementEnabled = oduIfBuilder.isProactiveDelayMeasurementEnabled().toString();
734 persistDevInterfaceTcm(nodeId, name, oduIfBuilder, connection);
735 persistDevInterfaceOtnOduTxMsi(nodeId, name, oduIfBuilder, connection);
736 persistDevInterfaceOtnOduRxMsi(nodeId, name, oduIfBuilder, connection);
737 persistDevInterfaceOtnOduExpMsi(nodeId, name, oduIfBuilder, connection);
739 opuPayloadType = oduIfBuilder.getOpu().getPayloadType().toString();
740 opuRxPayloadType = oduIfBuilder.getOpu().getRxPayloadType().toString();
741 opuExpPayloadType = oduIfBuilder.getOpu().getExpPayloadType().toString();
742 opuPayloadInterface = oduIfBuilder.getOpu().getPayloadInterface();
743 /*persistDevInterfaceOtnOduTxMsi(nodeId,name,oduIfBuilder,connection);
744 persistDevInterfaceOtnOduRxMsi(nodeId,name,oduIfBuilder,connection);
745 persistDevInterfaceOtnOduExpMsi(nodeId,name,oduIfBuilder,connection); */
746 maintTestsignalEnabled = oduIfBuilder.getMaintTestsignal().isEnabled().toString();
747 maintTestsignalTestpatternEnu = oduIfBuilder.getMaintTestsignal().getTestPattern().getIntValue();
748 maintTestsignalTypeEnu = oduIfBuilder.getMaintTestsignal().getType().getIntValue();
749 maintTestsignalBiterrors = oduIfBuilder.getMaintTestsignal().getBitErrors().toString();
750 maintTestsignalBiterrorsterminal = oduIfBuilder.getMaintTestsignal().getBitErrorsTerminal().toString();
751 maintTestsignalSyncseconds = oduIfBuilder.getMaintTestsignal().getSyncSeconds();
752 maintTestsignalSyncsecondsterminal = oduIfBuilder.getMaintTestsignal().getSyncSecondsTerminal();
756 OtuBuilder otuIfBuilder = new OtuBuilder(deviceInterface.augmentation(
757 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class)
759 otuRate = otuIfBuilder.getRate().getName();
760 otuFecEnu = otuIfBuilder.getFec().getIntValue();
761 otuMaintLoopbackEnabled = otuIfBuilder.getMaintLoopback().isEnabled().toString();
762 otuMaintTypeEnu = otuIfBuilder.getMaintLoopback().getType().getIntValue();
766 LOG.error("Could not get interface type");
769 String startTimestamp = getCurrentTimestamp();
771 return new Object[]{nodeId,
775 Integer.toString(administrativeStateEnu),
776 Integer.toString(operationalState),
779 supportingCircuitPackName,
783 Integer.toString(ethernetDuplexEnu),
785 Integer.toString(ethernetAutoNegotiationEnu),
790 //mciMcttpCenterFreq,
792 //mciNmcCtpFrequency,
794 "", "", "", "", "", "",
798 //ochWavelengthNumber,
802 //Integer.toString(otsFiberTypeEnu),
806 //otsIngressSpanLossAgingMargin,
815 oduProactiveDelayMeasurementEnabled,
816 //oduPoaTribPortNumber,
822 //oduAcceptedOperator,
828 //oduDegthrPercentage,
829 "", "", "", "", "", "", "", "", "", "", "", "", "",
834 maintTestsignalEnabled,
835 Integer.toString(maintTestsignalTestpatternEnu),
836 Integer.toString(maintTestsignalTypeEnu),
837 maintTestsignalBiterrors,
838 maintTestsignalBiterrorsterminal,
839 maintTestsignalSyncseconds,
840 maintTestsignalSyncsecondsterminal,
842 Integer.toString(otuFecEnu),
848 //otuAcceptedOperator,
854 //otuDegthrPercentage,
855 "", "", "", "", "", "", "", "", "", "", "", "",
856 otuMaintLoopbackEnabled,
857 Integer.toString(otuMaintTypeEnu),
860 //mtOtuMaintLoopback,
870 private static Object[] prepareDevInterfaceTcmParameters(String nodeId, String interfaceName, Tcm tcm) {
873 String layer = tcm.getLayer().toString();
874 int monitoringModeEnu = tcm.getMonitoringMode().getIntValue();
875 String ltcActEnabled = tcm.isLtcActEnabled().toString();
876 String proactiveDelayMeasurementEnabled = tcm.isProactiveDelayMeasurementEnabled().toString();
877 //int tcmDirectionEnu = -1;
878 //int timDetectModeEnu = -1;
879 //String txSapi = "";
880 //String txDapi = "";
881 //String txOperator = "";
882 //String acceptedSapi = "";
883 //String acceptedDapi = "";
884 //String acceptedOperator = "";
885 //String expectedSapi = "";
886 //String expectedDapi = "";
887 //String timActEnabled = "";
888 //String degmIntervals = "";
889 //String degthrPercentage = "";
891 String startTimestamp = getCurrentTimestamp();
893 return new Object[]{nodeId,
896 Integer.toString(monitoringModeEnu),
898 proactiveDelayMeasurementEnabled,
899 //Integer.toString(tcmDirectionEnu),
910 "", "", "", "", "", "", "", "", "",
911 //Integer.toString(timDetectModeEnu),
921 private static Object[] prepareDevInterfaceOtnOduTxMsiParameters(String nodeId, String interfaceName, TxMsi txMsi) {
923 String tribSlot = txMsi.getTribSlot().toString();
924 String odtuType = txMsi.getOdtuType().getTypeName();
925 String tribPort = txMsi.getTribPort().toString();
926 String tribPortPayload = txMsi.getTribPortPayload();
928 String startTimestamp = getCurrentTimestamp();
930 return new Object[]{nodeId,
942 private static Object[] prepareDevInterfaceOtnOduRxMsiParameters(String nodeId, String interfaceName, RxMsi rxMsi) {
944 String tribSlot = rxMsi.getTribSlot().toString();
945 String odtuType = rxMsi.getOdtuType().getTypeName();
946 String tribPort = rxMsi.getTribPort().toString();
947 String tribPortPayload = rxMsi.getTribPortPayload();
949 String startTimestamp = getCurrentTimestamp();
951 return new Object[]{nodeId,
964 private static Object[] prepareDevInterfaceOtnOduExpMsiParameters(String nodeId, String interfaceName,
967 String tribSlot = expMsi.getTribSlot().toString();
968 String odtuType = expMsi.getOdtuType().getTypeName();
969 String tribPort = expMsi.getTribPort().toString();
970 String tribPortPayload = expMsi.getTribPortPayload();
972 String startTimestamp = getCurrentTimestamp();
974 return new Object[]{nodeId,
986 private void persistDevInterfaces(String nodeId, Connection connection) {
988 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
989 Optional<OrgOpenroadmDevice> deviceObject =
990 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
991 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
993 /*InstanceIdentifier<Interface> interfaceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
994 .child(Interface.class);
995 Optional<Interface> interfaceOpt =
996 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, interfaceIID,
997 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT); */
999 for (int i = 0; i < deviceObject.get().getInterface().size(); i++) {
1000 Interface deviceInterface;
1002 deviceInterface = deviceObject.get().getInterface().get(i);
1003 /*if (interfaceOpt.isPresent()) {
1004 deviceInterface = interfaceOpt.get();
1006 LOG.warn("Could not get interface info");
1009 Object[] parameters = prepareDevInterfaceParameters(nodeId, deviceInterface, connection);
1011 String query = Queries.getQuery().deviceInterfacesInsert().get();
1012 LOG.info("Running {} query ", query);
1013 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1014 for (int j = 0; j < parameters.length; j++) {
1015 stmt.setObject(j + 1, parameters[j]);
1018 stmt.clearParameters();
1019 } catch (SQLException e) {
1020 LOG.error(e.getMessage(), e);
1025 private void persistDevProtocols(String nodeId, Connection connection) {
1027 InstanceIdentifier<Protocols> protocolsIID =
1028 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1029 Optional<Protocols> protocolObject =
1030 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1031 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1032 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1033 LOG.error("LLDP subtree is missing");
1036 int adminstatusEnu =
1037 protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig().getAdminStatus()
1039 String msgTxtInterval =
1040 protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig().getMsgTxInterval()
1042 String mxgTxHoldMultiplier =
1043 protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig().getMsgTxHoldMultiplier()
1045 String startTimestamp = getCurrentTimestamp();
1046 persistDevProtocolLldpPortConfig(nodeId, connection);
1047 persistDevProtocolLldpNbrList(nodeId, connection);
1049 Object[] parameters = {nodeId,
1050 Integer.toString(adminstatusEnu),
1052 mxgTxHoldMultiplier,
1057 String query = Queries.getQuery().deviceProtocolInsert().get();
1058 LOG.info("Running {} query ", query);
1059 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1060 for (int j = 0; j < parameters.length; j++) {
1061 stmt.setObject(j + 1, parameters[j]);
1064 stmt.clearParameters();
1065 } catch (SQLException e) {
1066 LOG.error(e.getMessage(), e);
1072 private void persistDevProtocolLldpPortConfig(String nodeId, Connection connection) {
1074 InstanceIdentifier<Protocols> protocolsIID =
1075 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1076 Optional<Protocols> protocolObject =
1077 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1078 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1079 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1080 LOG.error("LLDP subtree is missing");
1083 String startTimestamp = getCurrentTimestamp();
1084 for (int i = 0; i < protocolObject.get().augmentation(Protocols1.class).getLldp().getPortConfig().size(); i++) {
1086 PortConfig portConfig =
1087 protocolObject.get().augmentation(Protocols1.class).getLldp().getPortConfig().get(i);
1088 String ifName = portConfig.getIfName();
1089 int adminStatusEnu = portConfig.getAdminStatus().getIntValue();
1091 Object[] parameters = {nodeId,
1093 Integer.toString(adminStatusEnu),
1098 String query = Queries.getQuery().deviceProtocolPortConfigInsert().get();
1099 LOG.info("Running {} query ", query);
1100 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1101 for (int j = 0; j < parameters.length; j++) {
1102 stmt.setObject(j + 1, parameters[j]);
1105 stmt.clearParameters();
1106 } catch (SQLException e) {
1107 LOG.error(e.getMessage(), e);
1114 private void persistDevProtocolLldpNbrList(String nodeId, Connection connection) {
1116 InstanceIdentifier<Protocols> protocolsIID =
1117 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1118 Optional<Protocols> protocolObject =
1119 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1120 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1121 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1122 LOG.error("LLDP subtree is missing");
1125 String startTimestamp = getCurrentTimestamp();
1126 for (int i = 0; i < protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList().getIfName()
1130 protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList().getIfName().get(i);
1131 String ifName = ifNameObj.getIfName();
1132 String remotesysname = ifNameObj.getRemoteSysName();
1133 String remotemgmtaddresssubtype = ifNameObj.getRemoteMgmtAddressSubType().getName();
1134 String remotemgmtaddress = ifNameObj.getRemoteMgmtAddress().getIpv4Address().toString();
1135 int remoteportidsubtypeEnu = ifNameObj.getRemotePortIdSubType().getIntValue();
1136 String remoteportid = ifNameObj.getRemotePortId();
1137 int remotechassisidsubtypeEnu = ifNameObj.getRemoteChassisIdSubType().getIntValue();
1138 String remotechassisid = ifNameObj.getRemoteChassisId();
1140 Object[] parameters = {nodeId,
1143 remotemgmtaddresssubtype,
1145 Integer.toString(remoteportidsubtypeEnu),
1147 Integer.toString(remotechassisidsubtypeEnu),
1153 String query = Queries.getQuery().deviceProtocolLldpNbrlistInsert().get();
1154 LOG.info("Running {} query ", query);
1155 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1156 for (int j = 0; j < parameters.length; j++) {
1157 stmt.setObject(j + 1, parameters[j]);
1160 stmt.clearParameters();
1161 } catch (SQLException e) {
1162 LOG.error(e.getMessage(), e);
1168 private void persistDevProtocolRstp(String nodeId, Connection connection) {
1170 InstanceIdentifier<Protocols> protocolsIID =
1171 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1172 Optional<Protocols> protocolObject =
1173 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1174 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1175 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1176 LOG.error("LLDP subtree is missing");
1179 String startTimestamp = getCurrentTimestamp();
1180 for (int i = 0; i < protocolObject.get()
1181 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.Protocols1.class)
1182 .getRstp().getRstpBridgeInstance().size(); i++) {
1184 RstpBridgeInstance rstpBridgeInstance = protocolObject.get()
1185 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.Protocols1.class)
1186 .getRstp().getRstpBridgeInstance().get(i);
1187 String bridgeName = rstpBridgeInstance.getBridgeName();
1188 String bridgePriority = rstpBridgeInstance.getRstpConfig().getBridgePriority().toString();
1189 String shutdown = rstpBridgeInstance.getRstpConfig().getShutdown().toString();
1190 String holdTime = rstpBridgeInstance.getRstpConfig().getHoldTime().toString();
1191 String helloTime = rstpBridgeInstance.getRstpConfig().getHelloTime().toString();
1192 String maxAge = rstpBridgeInstance.getRstpConfig().getMaxAge().toString();
1193 String forwardDelay = rstpBridgeInstance.getRstpConfig().getForwardDelay().toString();
1194 String transmitHoldCount = rstpBridgeInstance.getRstpConfig().getTransmitHoldCount().toString();
1195 String rootBridgePort =
1196 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootBridgePort().toString();
1197 String rootPathCost = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootPathCost().toString();
1198 String rootBridgePriority =
1199 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootBridgePriority().toString();
1200 String rootBridgeId = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootBridgeId().toString();
1201 String rootHoldTime = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootHoldTime().toString();
1202 String rootHelloTime = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootHelloTime().toString();
1203 String rootMaxAge = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootMaxAge().toString();
1204 String rootForwardDelay =
1205 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootForwardDelay().toString();
1206 String bridgeId = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getBridgeId().toString();
1207 String topoChangeCount =
1208 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getTopoChangeCount().toString();
1209 String timeSinceTopoChange =
1210 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getTimeSinceTopoChange().toString();
1212 persistDevProtocolRstpBridgePort(nodeId, bridgeName, rstpBridgeInstance, connection);
1213 persistDevProtocolRstpBridgePortAttr(nodeId, bridgeName, rstpBridgeInstance, connection);
1215 Object[] parameters = {nodeId,
1234 timeSinceTopoChange,
1239 String query = Queries.getQuery().deviceProtocolRstpInsert().get();
1240 LOG.info("Running {} query ", query);
1241 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1242 for (int j = 0; j < parameters.length; j++) {
1243 stmt.setObject(j + 1, parameters[j]);
1246 stmt.clearParameters();
1247 } catch (SQLException e) {
1248 LOG.error(e.getMessage(), e);
1254 private void persistDevProtocolRstpBridgePort(String nodeId, String bridgeName,
1255 RstpBridgeInstance rstpBridgeInstance, Connection connection) {
1257 String startTimestamp = getCurrentTimestamp();
1258 for (int i = 0; i < rstpBridgeInstance.getRstpConfig().getRstpBridgePortTable().size(); i++) {
1259 RstpBridgePortTable rstpBridgePortTable =
1260 rstpBridgeInstance.getRstpConfig().getRstpBridgePortTable().get(i);
1262 String ifName = rstpBridgePortTable.getIfname();
1263 String cost = rstpBridgePortTable.getCost().toString();
1264 String priority = rstpBridgePortTable.getPriority().toString();
1266 Object[] parameters = {nodeId,
1275 String query = Queries.getQuery().deviceProtocolRstpBridgePortInsert().get();
1276 LOG.info("Running {} query ", query);
1277 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1278 for (int j = 0; j < parameters.length; j++) {
1279 stmt.setObject(j + 1, parameters[j]);
1282 stmt.clearParameters();
1283 } catch (SQLException e) {
1284 LOG.error(e.getMessage(), e);
1290 private void persistDevProtocolRstpBridgePortAttr(String nodeId, String bridgeName,
1291 RstpBridgeInstance rstpBridgeInstance, Connection connection) {
1293 String startTimestamp = getCurrentTimestamp();
1294 for (int i = 0; i < rstpBridgeInstance.getRstpState().getRstpBridgePortAttr().getRstpBridgePortTable().size();
1297 org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.rstp.bridge.port.state.attr
1298 .RstpBridgePortTable rstpBridgePortTableAttr =
1299 rstpBridgeInstance.getRstpState().getRstpBridgePortAttr().getRstpBridgePortTable().get(i);
1301 String ifName = rstpBridgePortTableAttr.getIfname();
1302 String bridgePortState = rstpBridgePortTableAttr.getBridgePortState().getName();
1303 String bridgePortRole = rstpBridgePortTableAttr.getBridgePortRole().getName();
1304 String bridgePortId = rstpBridgePortTableAttr.getBridgePortId().toString();
1305 String openEdgeBridgePort = rstpBridgePortTableAttr.getOperEdgeBridgePort().toString();
1306 String designatedBridgePort = rstpBridgePortTableAttr.getDesignatedBridgePort().toString();
1307 String designatedBridgeId = rstpBridgePortTableAttr.getDesignatedBridgeid().toString();
1309 Object[] parameters = {nodeId,
1316 designatedBridgePort,
1322 String query = Queries.getQuery().deviceProtocolRstpBridgePortAttrInsert().get();
1323 LOG.info("Running {} query ", query);
1324 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1325 for (int j = 0; j < parameters.length; j++) {
1326 stmt.setObject(j + 1, parameters[j]);
1329 stmt.clearParameters();
1330 } catch (SQLException e) {
1331 LOG.error(e.getMessage(), e);
1338 private void persistDevInternalLinks(String nodeId, Connection connection) {
1340 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1341 Optional<OrgOpenroadmDevice> deviceObject =
1342 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1343 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1345 String startTimestamp = getCurrentTimestamp();
1346 for (int i = 0; i < deviceObject.get().getInternalLink().size(); i++) {
1347 InternalLink internalLink = deviceObject.get().getInternalLink().get(i);
1348 String internalLinkName = internalLink.getInternalLinkName();
1349 String sourceCircuitPackName = internalLink.getSource().getCircuitPackName();
1350 String sourcePortName = internalLink.getSource().getPortName().toString();
1351 String destinationCircuitPackName = internalLink.getDestination().getCircuitPackName();
1352 String destinationPortName = internalLink.getDestination().getPortName().toString();
1354 Object[] parameters = {nodeId,
1356 sourceCircuitPackName,
1358 destinationCircuitPackName,
1359 destinationPortName,
1364 String query = Queries.getQuery().deviceInternalLinkInsert().get();
1365 LOG.info("Running {} query ", query);
1366 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1367 for (int j = 0; j < parameters.length; j++) {
1368 stmt.setObject(j + 1, parameters[j]);
1371 stmt.clearParameters();
1372 } catch (SQLException e) {
1373 LOG.error(e.getMessage(), e);
1380 private void persistDevExternalLinks(String nodeId, Connection connection) {
1382 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1383 Optional<OrgOpenroadmDevice> deviceObject =
1384 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1385 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1387 String startTimestamp = getCurrentTimestamp();
1388 for (int i = 0; i < deviceObject.get().getExternalLink().size(); i++) {
1389 ExternalLink externalLink = deviceObject.get().getExternalLink().get(i);
1390 String externalLinkName = externalLink.getExternalLinkName();
1391 String sourceNodeId = externalLink.getSource().getNodeId().toString();
1392 String sourceCircuitPackName = externalLink.getSource().getCircuitPackName();
1393 String sourcePortName = externalLink.getSource().getPortName().toString();
1394 String destinationNodeId = externalLink.getDestination().getNodeId().toString();
1395 String destinationCircuitPackName = externalLink.getDestination().getCircuitPackName();
1396 String destinationPortName = externalLink.getDestination().getPortName().toString();
1398 Object[] parameters = {nodeId,
1401 sourceCircuitPackName,
1404 destinationCircuitPackName,
1405 destinationPortName,
1410 String query = Queries.getQuery().deviceExternalLinkInsert().get();
1411 LOG.info("Running {} query ", query);
1412 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1413 for (int j = 0; j < parameters.length; j++) {
1414 stmt.setObject(j + 1, parameters[j]);
1417 stmt.clearParameters();
1418 } catch (SQLException e) {
1419 LOG.error(e.getMessage(), e);
1425 private void persistDevPhysicalLinks(String nodeId, Connection connection) {
1427 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1428 Optional<OrgOpenroadmDevice> deviceObject =
1429 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1430 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1432 String startTimestamp = getCurrentTimestamp();
1433 for (int i = 0; i < deviceObject.get().getPhysicalLink().size(); i++) {
1434 PhysicalLink physicalLink = deviceObject.get().getPhysicalLink().get(i);
1435 String physicalLinkName = physicalLink.getPhysicalLinkName();
1436 String sourceCircuitPackName = physicalLink.getSource().getCircuitPackName();
1437 String sourcePortName = physicalLink.getSource().getPortName().toString();
1438 String destinationCircuitPackName = physicalLink.getDestination().getCircuitPackName();
1439 String destinationPortName = physicalLink.getDestination().getPortName().toString();
1441 Object[] parameters = {nodeId,
1443 sourceCircuitPackName,
1445 destinationCircuitPackName,
1446 destinationPortName,
1451 String query = Queries.getQuery().devicePhysicalLinkInsert().get();
1452 LOG.info("Running {} query ", query);
1453 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1454 for (int j = 0; j < parameters.length; j++) {
1455 stmt.setObject(j + 1, parameters[j]);
1458 stmt.clearParameters();
1459 } catch (SQLException e) {
1460 LOG.error(e.getMessage(), e);
1466 private void persistDevDegree(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 String startTimestamp = getCurrentTimestamp();
1474 for (int i = 0; i < deviceObject.get().getDegree().size(); i++) {
1475 Degree degree = deviceObject.get().getDegree().get(i);
1476 String degreeNumber = degree.getDegreeNumber().toString();
1477 String maxWavelengths = degree.getMaxWavelengths().toString();
1478 String otdrPortCircuitPackName = degree.getOtdrPort().getCircuitPackName();
1479 String otdrPortPortName = degree.getOtdrPort().getPortName().toString();
1480 persistDevDegreeCircuitPack(nodeId, degree, degreeNumber, connection);
1481 persistDevDegreeConnectionPort(nodeId, degree, degreeNumber, connection);
1482 //String mcCapabilitiesSlotWidthGranularity = "";
1483 //String mcCapabilitiesCenterFreqGranularity = "";
1484 //String mcCapabilitiesMinSlots = "";
1485 //String mcCapabilitiesMaxSlots = "";
1487 Object[] parameters = {nodeId,
1490 otdrPortCircuitPackName,
1492 //mcCapabilitiesSlotWidthGranularity,
1493 //mcCapabilitiesCenterFreqGranularity,
1494 //mcCapabilitiesMinSlots,
1495 //mcCapabilitiesMaxSlots,
1501 String query = Queries.getQuery().deviceDegreeInsert().get();
1502 LOG.info("Running {} query ", query);
1503 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1504 for (int j = 0; j < parameters.length; j++) {
1505 stmt.setObject(j + 1, parameters[j]);
1508 stmt.clearParameters();
1509 } catch (SQLException e) {
1510 LOG.error(e.getMessage(), e);
1517 private void persistDevDegreeCircuitPack(String nodeId, Degree degree, String degreeNumber, Connection connection) {
1519 String startTimestamp = getCurrentTimestamp();
1520 for (int i = 0; i < degree.getCircuitPacks().size(); i++) {
1522 String circuitPackIndex = degree.getCircuitPacks().get(i).getIndex().toString();
1523 String circuitPackName = degree.getCircuitPacks().get(i).getCircuitPackName();
1525 Object[] parameters = {nodeId,
1533 String query = Queries.getQuery().deviceDegreeCircuitPackInsert().get();
1534 LOG.info("Running {} query ", query);
1535 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1536 for (int j = 0; j < parameters.length; j++) {
1537 stmt.setObject(j + 1, parameters[j]);
1540 stmt.clearParameters();
1541 } catch (SQLException e) {
1542 LOG.error(e.getMessage(), e);
1548 private void persistDevDegreeConnectionPort(String nodeId, Degree degree, String degreeNumber,
1549 Connection connection) {
1551 String startTimestamp = getCurrentTimestamp();
1552 for (int i = 0; i < degree.getConnectionPorts().size(); i++) {
1554 String connectionPortIndex = degree.getConnectionPorts().get(i).getIndex().toString();
1555 String circuitPackName = degree.getConnectionPorts().get(i).getCircuitPackName();
1556 String portName = degree.getConnectionPorts().get(i).getPortName().toString();
1558 Object[] parameters = {nodeId,
1560 connectionPortIndex,
1567 String query = Queries.getQuery().deviceDegreeConnectionPortInsert().get();
1568 LOG.info("Running {} query ", query);
1569 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1570 for (int j = 0; j < parameters.length; j++) {
1571 stmt.setObject(j + 1, parameters[j]);
1574 stmt.clearParameters();
1575 } catch (SQLException e) {
1576 LOG.error(e.getMessage(), e);
1583 private void persistDevSrg(String nodeId, Connection connection) {
1585 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1586 Optional<OrgOpenroadmDevice> deviceObject =
1587 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1588 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1590 String startTimestamp = getCurrentTimestamp();
1591 for (int i = 0; i < deviceObject.get().getSharedRiskGroup().size(); i++) {
1592 SharedRiskGroup sharedRiskGroup = deviceObject.get().getSharedRiskGroup().get(i);
1593 String maxAddDropPorts = sharedRiskGroup.getMaxAddDropPorts().toString();
1594 String srgNumber = sharedRiskGroup.getSrgNumber().toString();
1595 int wavelengthDuplicationEnu = sharedRiskGroup.getWavelengthDuplication().getIntValue();
1596 persistDevSrgCircuitPacks(nodeId, sharedRiskGroup, srgNumber, connection);
1597 //String currentProvisionedAddDropPorts = "";
1598 //String mcCapSlotWidthGranularity = "";
1599 //String mcCapCenterFreqGranularity = "";
1600 //String mcCapMinSlots = "";
1601 //String mcCapMaxSlots = "";
1603 Object[] parameters = {nodeId,
1605 //currentProvisionedAddDropPorts,
1608 //mcCapSlotWidthGranularity,
1609 //mcCapCenterFreqGranularity,
1617 String query = Queries.getQuery().deviceSharedRiskGroupInsert().get();
1618 LOG.info("Running {} query ", query);
1619 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1620 for (int j = 0; j < parameters.length; j++) {
1621 stmt.setObject(j + 1, parameters[j]);
1624 stmt.clearParameters();
1625 } catch (SQLException e) {
1626 LOG.error(e.getMessage(), e);
1632 private void persistDevSrgCircuitPacks(String nodeId, SharedRiskGroup sharedRiskGroup, String srgNumber,
1633 Connection connection) {
1635 String startTimestamp = getCurrentTimestamp();
1636 for (int i = 0; i < sharedRiskGroup.getCircuitPacks().size(); i++) {
1638 String circuitPackindex = sharedRiskGroup.getCircuitPacks().get(i).getIndex().toString();
1639 String circuitPackName = sharedRiskGroup.getCircuitPacks().get(i).getCircuitPackName();
1641 Object[] parameters = {nodeId,
1649 String query = Queries.getQuery().deviceSrgCircuitPackInsert().get();
1650 LOG.info("Running {} query ", query);
1651 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1652 for (int j = 0; j < parameters.length; j++) {
1653 stmt.setObject(j + 1, parameters[j]);
1656 stmt.clearParameters();
1657 } catch (SQLException e) {
1658 LOG.error(e.getMessage(), e);
1664 private void persistDevRoadmConnections(String nodeId, Connection connection) {
1666 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1667 Optional<OrgOpenroadmDevice> deviceObject =
1668 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1669 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1671 String startTimestamp = getCurrentTimestamp();
1672 for (int i = 0; i < deviceObject.get().getRoadmConnections().size(); i++) {
1673 RoadmConnections roadmConnections = deviceObject.get().getRoadmConnections().get(i);
1674 int opticalcontrolmodeEnu = roadmConnections.getOpticalControlMode().getIntValue();
1675 //String connectionName = "";
1676 //String connectionNumber = "";
1677 //String wavelengthNumber = "";
1678 String targetOutputPower = roadmConnections.getTargetOutputPower().toString();
1679 String srcIf = roadmConnections.getSource().getSrcIf();
1680 String dstIf = roadmConnections.getDestination().getDstIf();
1682 Object[] parameters = {nodeId,
1687 Integer.toString(opticalcontrolmodeEnu),
1695 String query = Queries.getQuery().deviceRoadmConnectionsInsert().get();
1696 LOG.info("Running {} query ", query);
1697 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1698 for (int j = 0; j < parameters.length; j++) {
1699 stmt.setObject(j + 1, parameters[j]);
1702 stmt.clearParameters();
1703 } catch (SQLException e) {
1704 LOG.error(e.getMessage(), e);
1711 private void persistDevConnectionMap(String nodeId, Connection connection) {
1713 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1714 Optional<OrgOpenroadmDevice> deviceObject =
1715 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1716 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1718 String startTimestamp = getCurrentTimestamp();
1719 for (int i = 0; i < deviceObject.get().getConnectionMap().size(); i++) {
1720 ConnectionMap connectionMap = deviceObject.get().getConnectionMap().get(i);
1721 String connectionMapNumber = connectionMap.getConnectionMapNumber().toString();
1722 String sourceCircuitPackName = connectionMap.getSource().getCircuitPackName();
1723 String sourcePortName = connectionMap.getSource().getCircuitPackName();
1726 Object[] parameters = {nodeId,
1727 connectionMapNumber,
1728 sourceCircuitPackName,
1734 String query = Queries.getQuery().deviceConnectionMapInsert().get();
1735 LOG.info("Running {} query ", query);
1736 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1737 for (int j = 0; j < parameters.length; j++) {
1738 stmt.setObject(j + 1, parameters[j]);
1741 stmt.clearParameters();
1742 } catch (SQLException e) {
1743 LOG.error(e.getMessage(), e);
1749 private void persistDevWavelengthMap(String nodeId, Connection connection) {
1752 String wavelengthNumber="", centerFrequency="", wavelength="";;
1754 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1755 Optional<OrgOpenroadmDevice> deviceObject =
1756 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1757 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1760 String startTimestamp = getCurrentTimestamp();
1761 for (int i = 0; i<deviceObject.get().getWavelengthMap().getWavelengths().size(); i++) {
1762 Wavelengths wavelengths = deviceObject.get().getWavelengthMap().getWavelengths().get(i);
1763 wavelengthNumber=wavelengths.getWavelengthNumber().toString();
1764 centerFrequency=wavelengths.getCenterFrequency().toString();
1765 wavelength=wavelengths.getWavelength().toString();
1768 Object[] parameters = {nodeId,
1776 String query = Queries.getQuery().deviceWavelengthInsert().get();
1777 LOG.info("Running {} query ", query);
1778 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1779 for (int j = 0; j < parameters.length; j++) {
1780 stmt.setObject(j + 1, parameters[j]);
1783 stmt.clearParameters();
1784 } catch (SQLException e) {
1785 LOG.error(e.getMessage(), e);
1793 private void persistDevInterfaceTcm(String nodeId, String interfaceName, OduBuilder oduBuilder,
1794 Connection connection) {
1796 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1799 tcm = oduBuilder.getTcm().get(i);
1801 Object[] parameters = prepareDevInterfaceTcmParameters(nodeId, interfaceName, tcm);
1803 String query = Queries.getQuery().deviceInterfacesInsert().get();
1804 LOG.info("Running {} query ", query);
1805 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1806 for (int j = 0; j < parameters.length; j++) {
1807 stmt.setObject(j + 1, parameters[j]);
1810 stmt.clearParameters();
1811 } catch (SQLException e) {
1812 LOG.error(e.getMessage(), e);
1817 private void persistDevInterfaceOtnOduTxMsi(String nodeId, String interfaceName, OduBuilder oduBuilder,
1818 Connection connection) {
1820 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1823 txMsi = oduBuilder.getOpu().getMsi().getTxMsi().get(i);
1825 Object[] parameters = prepareDevInterfaceOtnOduTxMsiParameters(nodeId, interfaceName, txMsi);
1827 String query = Queries.getQuery().deviceInterfaceOtnOduTxMsiInsert().get();
1828 LOG.info("Running {} query ", query);
1829 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1830 for (int j = 0; j < parameters.length; j++) {
1831 stmt.setObject(j + 1, parameters[j]);
1834 stmt.clearParameters();
1835 } catch (SQLException e) {
1836 LOG.error(e.getMessage(), e);
1842 private void persistDevInterfaceOtnOduRxMsi(String nodeId, String interfaceName, OduBuilder oduBuilder,
1843 Connection connection) {
1845 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1848 rxMsi = oduBuilder.getOpu().getMsi().getRxMsi().get(i);
1850 Object[] parameters = prepareDevInterfaceOtnOduRxMsiParameters(nodeId, interfaceName, rxMsi);
1852 String query = Queries.getQuery().deviceInterfaceOtnOduRxMsiInsert().get();
1853 LOG.info("Running {} query ", query);
1854 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1855 for (int j = 0; j < parameters.length; j++) {
1856 stmt.setObject(j + 1, parameters[j]);
1859 stmt.clearParameters();
1860 } catch (SQLException e) {
1861 LOG.error(e.getMessage(), e);
1867 private void persistDevInterfaceOtnOduExpMsi(String nodeId, String interfaceName, OduBuilder oduBuilder,
1868 Connection connection) {
1870 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1873 expMsi = oduBuilder.getOpu().getMsi().getExpMsi().get(i);
1875 Object[] parameters = prepareDevInterfaceOtnOduExpMsiParameters(nodeId, interfaceName, expMsi);
1877 String query = Queries.getQuery().deviceInterfaceOtnOduExpMsiInsert().get();
1878 LOG.info("Running {} query ", query);
1879 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1880 for (int j = 0; j < parameters.length; j++) {
1881 stmt.setObject(j + 1, parameters[j]);
1884 stmt.clearParameters();
1885 } catch (SQLException e) {
1886 LOG.error(e.getMessage(), e);