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 java.util.Objects.requireNonNull;
11 import static org.opendaylight.transportpce.inventory.utils.StringUtils.getCurrentTimestamp;
12 import static org.opendaylight.transportpce.inventory.utils.StringUtils.prepareDashString;
13 import static org.opendaylight.transportpce.inventory.utils.StringUtils.prepareEmptyString;
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 = requireNonNull(dataSource.getConnection())) {
188 for (int i = 0; i < deviceObject.get().getShelves().size(); i++) {
189 Shelves shelve = deviceObject.get().getShelves().get(i);
190 String shelfName = shelve.getShelfName();
192 LOG.info("Getting Shelve Details of {}", shelfName);
193 if (shelve.getSlots() != null) {
194 LOG.info("Slot Size {} ", shelve.getSlots().size());
195 persistShelveSlots(nodeId, shelve, connection);
197 LOG.info("No Slots for shelf {}", shelfName);
201 persistShelves(nodeId, connection, shelve);
203 } catch (SQLException e1) {
204 LOG.error(e1.getMessage(), e1);
208 public void getCircuitPacks(String nodeId) throws InterruptedException, ExecutionException {
209 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
210 Optional<OrgOpenroadmDevice> deviceObject =
211 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
212 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
213 if (!deviceObject.isPresent()) {
214 LOG.warn("Device object {} was not found", nodeId);
217 LOG.info("Circuit pack size {}", deviceObject.get().getCircuitPacks().size());
219 try (Connection connection = requireNonNull(dataSource.getConnection())) {
220 for (int i = 0; i < deviceObject.get().getCircuitPacks().size(); i++) {
221 CircuitPacks cp = deviceObject.get().getCircuitPacks().get(i);
223 if (cp.getCpSlots() != null) {
224 persistCircuitPacksSlots(nodeId, cp, connection);
226 LOG.info("Everything {}", cp);
227 LOG.info("CP is {}", cp);
229 persistPorts(cp, connection);
231 persistCircuitPacks(nodeId, connection, cp);
233 } catch (SQLException e1) {
234 LOG.error(e1.getMessage(), e1);
238 private void persistCircuitPacks(String nodeId, Connection connection, CircuitPacks cp) {
239 Object[] parameters = prepareCircuitPacksParameters(nodeId, cp);
240 String query = Queries.getQuery().deviceCircuitPackInsert().get();
241 LOG.info("Running {} query ", query);
242 try (PreparedStatement stmt = connection.prepareStatement(query)) {
243 for (int j = 0; j < parameters.length; j++) {
244 stmt.setObject(j + 1, parameters[j]);
247 stmt.clearParameters();
248 } catch (SQLException e) {
249 LOG.error(e.getMessage(), e);
253 private void persistShelves(String nodeId, Connection connection, Shelves shelve) {
254 Object[] shelvesParameter = prepareShelvesParameters(nodeId, shelve);
255 String query = Queries.getQuery().deviceShelfInsert().get();
256 LOG.info("Running {} query ", query);
257 try (PreparedStatement preparedStmt = connection.prepareStatement(query)) {
258 for (int j = 0; j < shelvesParameter.length; j++) {
259 preparedStmt.setObject(j + 1, shelvesParameter[j]);
261 preparedStmt.execute();
262 preparedStmt.clearParameters();
263 } catch (SQLException e) {
264 LOG.error(e.getMessage(), e);
268 private void persistShelveSlots(String nodeId, Shelves shelves, Connection connection) {
269 String startTimetampStr = getCurrentTimestamp();
270 for (int i = 0; i < shelves.getSlots().size(); i++) {
271 Slots slot = shelves.getSlots().get(i);
272 LOG.info("Getting Slot Details of {}", slot.getSlotName());
273 Object[] parameters = new Object[]{nodeId,
274 shelves.getShelfName(),
277 slot.getProvisionedCircuitPack(),
281 String query = Queries.getQuery().deviceShelfSlotInsert().get();
282 LOG.info("Running {} query ", query);
283 try (PreparedStatement stmt = connection.prepareStatement(query)) {
284 for (int j = 0; j < parameters.length; j++) {
285 stmt.setObject(j + 1, parameters[j]);
288 stmt.clearParameters();
289 } catch (SQLException e) {
290 LOG.error(e.getMessage(), e);
296 private void persistCircuitPacksSlots(String nodeId, CircuitPacks circuitPacks, Connection connection) {
297 String startTimetampStr = getCurrentTimestamp();
298 for (int i = 0; i < circuitPacks.getCpSlots().size(); i++) {
299 CpSlots cpSlot = circuitPacks.getCpSlots().get(i);
301 Object[] parameters = new Object[]{nodeId,
302 circuitPacks.getCircuitPackName(),
303 cpSlot.getSlotName(),
305 cpSlot.getProvisionedCircuitPack(),
309 String query = Queries.getQuery().deviceCPSlotInsert().get();
310 LOG.info("Running {} query ", query);
311 try (PreparedStatement stmt = connection.prepareStatement(query)) {
312 for (int j = 0; j < parameters.length; j++) {
313 stmt.setObject(j + 1, parameters[j]);
316 stmt.clearParameters();
317 } catch (SQLException e) {
318 LOG.error(e.getMessage(), e);
323 private void persistPorts(CircuitPacks circuitPacks, Connection connection) {
324 LOG.warn("Ports are not persisted yet");
329 * Prepares parameters for device insert query.
331 * @param deviceInfo device info
332 * @return Object Object
334 private static Object[] prepareDeviceInfoParameters(Info deviceInfo) {
335 String startTimetampStr = getCurrentTimestamp();
336 //Integer maxNumBin15minHistoricalPm = null;
337 //Integer maxNumBin24hourHistoricalPm = null;
338 //String serialId = "";
340 String nodeId = prepareDashString(deviceInfo.getNodeId());
341 Long nodeNumber = deviceInfo.getNodeNumber().toJava();
342 Integer nodeTypeEnu = deviceInfo.getNodeType().getIntValue();
343 String clli = prepareDashString(deviceInfo.getClli());
344 String vendor = prepareDashString(deviceInfo.getVendor());
345 String model = prepareDashString(deviceInfo.getModel());
346 String ipAddress = prepareDashString(deviceInfo.getIpAddress().getIpv4Address().getValue());
347 String prefixLength = prepareDashString(deviceInfo.getPrefixLength());
348 String defaultGateway = prepareDashString(deviceInfo.getDefaultGateway().getIpv4Address().getValue());
349 Integer sourceEnum = deviceInfo.getSource().getIntValue();
350 String currentIpAddress = prepareDashString(deviceInfo.getCurrentIpAddress().getIpv4Address().getValue());
351 String currentPrefixLength = prepareDashString(deviceInfo.getCurrentPrefixLength());
352 String currentDefaultGateway = prepareDashString(deviceInfo.getDefaultGateway().getIpv4Address().getValue());
353 String macAddress = prepareDashString(deviceInfo.getMacAddress().getValue());
354 String softwareVersion = prepareDashString(deviceInfo.getSoftwareVersion());
355 String openroadmVersion = "2.2.1";
356 String template = prepareDashString(deviceInfo.getTemplate());
357 String currentDatetime = prepareDashString(deviceInfo.getCurrentDatetime().getValue());
359 (deviceInfo.getGeoLocation() != null ? prepareDashString(deviceInfo.getGeoLocation().getLatitude()) : "");
360 String geoLongitude =
361 (deviceInfo.getGeoLocation() != null ? prepareDashString(deviceInfo.getGeoLocation().getLongitude()) : "");
362 String maxDegrees = prepareDashString(deviceInfo.getMaxDegrees()); // max_degrees
363 String maxSrgs = prepareDashString(deviceInfo.getMaxSrgs()); //max_srgs
364 String swVersion = prepareDashString(deviceInfo.getSoftwareVersion()); //sw_version
365 String swValidationTimer = prepareDashString(""); //sw_validation_timer
366 String activationDateTime = prepareDashString(""); //activation_date_time
367 /*jsonDevInfo = JsonStringBuilder.getDevInfoJson().replace("$$NODE-ID$$",nodeId)
368 .replace("$$NODE-NUMBER$$", nodeNumber)
369 .replace("$$NODE-TYPE$$",nodeType)
370 .replace("$$CLLI$$",clli)
371 .replace("$$VENDOR$$",vendor)
372 .replace("$$MODEL$$",model)
373 .replace("$$SERIAL-ID$$",serialId)
374 .replace("$$IPADDRESS$$",ipAddress)
375 .replace("$$PREFIX-LENGTH$$",prefixLength)
376 .replace("$$DEFAULTGATEWAY$$",defaultGateway)
377 .replace("$$SOURCE$$",String.valueOf(source))
378 .replace("$$CURRENT-IPADDRESS$$",currentIpAddress)
379 .replace("$$CURRENT-PREFIX-LENGTH$$",currentPrefixLength)
380 .replace("$$CURRENT-DEFAULTGATEWAY$$",currentDefailtGateway)
381 .replace("$$MACADDRESS$$",macAddress)
382 .replace("$$SOFTWAREVERSION$$",softwareVersion)
383 .replace("$$OPENROADM-VERSION$$",openroadmVersion)
384 .replace("$$TEMPLATE$$",template)
385 .replace("$$CURRENT-DATETIME$$",currentDatetime)
386 .replace("$$LATITUDE$$",latitude)
387 .replace("$$LONGITUDE$$",longitude)
388 .replace("$$MAX-DEGREES$$",maxDegrees)
389 .replace("$$MAX-SRGS$$",maxSrgs)
390 .replace("$$MAX-NUM-BIN-15MIN-HISTORICAL-PM$$",prepareDashString(""))
391 .replace("$$MAX-NUM-BIN-24HOUR-HISTORICAL-PM$$",prepareDashString(""))
392 .replace("$$SW-VERSION$$",swVersion)
393 .replace("$$SW-VALIDATION-TIMER$$",swValidationTimer)
394 .replace("$$ACTIVATION-DATE-TIME$$",activationDateTime);*/
412 currentDefaultGateway,
422 //maxNumBin15minHistoricalPm,
423 //maxNumBin24hourHistoricalPm,
434 private static Object[] prepareShelvesParameters(String nodeId, Shelves shelve) {
435 String startTimestamp = getCurrentTimestamp();
437 return new Object[]{nodeId,
438 shelve.getShelfName(),
439 shelve.getShelfType(),
441 shelve.getShelfPosition(),
442 (shelve.getAdministrativeState() == null ? null : shelve.getAdministrativeState().getIntValue()),
445 shelve.getSerialId(),
447 shelve.getProductCode(),
448 (shelve.getManufactureDate() == null ? null : shelve.getManufactureDate().getValue()),
450 shelve.getHardwareVersion(),
451 (shelve.getOperationalState() == null ? null : shelve.getOperationalState().getIntValue()),
452 (shelve.getEquipmentState() == null ? null : shelve.getEquipmentState().getIntValue()),
453 (shelve.getDueDate() == null ? null : shelve.getDueDate().getValue()),
459 private static Object[] prepareCPPortsParameters(String nodeId, CircuitPacks circuitPacks, Ports cpPort) {
461 String circuitPackName = circuitPacks.getCircuitPackName();
462 String portName = cpPort.getPortName();
463 String portType = cpPort.getPortType();
464 String portQualEnu = String.valueOf(cpPort.getPortQual().getIntValue());
465 String portWavelengthTypeEnu = String.valueOf(cpPort.getPortWavelengthType().getIntValue());
466 String portDirectionEnu = String.valueOf(cpPort.getPortDirection().getIntValue());
467 String label = cpPort.getLabel();
468 String circuitId = cpPort.getCircuitId();
469 String administrativeStateEnu =
470 (cpPort.getAdministrativeState() == null ? "" :
471 String.valueOf(cpPort.getAdministrativeState().getIntValue()));
472 String operationalStateEnu =
473 (cpPort.getOperationalState() == null ? "" : String.valueOf(cpPort.getOperationalState().getIntValue()));
474 String logicalConnectionPoint = cpPort.getLogicalConnectionPoint();
475 String partnerPortCircuitPackName = cpPort.getPartnerPort().getCircuitPackName();
476 String partnerPortPortName = cpPort.getPartnerPort().getPortName().toString();
477 String parentPortCircuitPackName = cpPort.getParentPort().getCircuitPackName();
478 String parentPortPortName = cpPort.getParentPort().getPortName().toString();
479 String roadmPortPortPowerCapabilityMinRx = cpPort.getRoadmPort().getPortPowerCapabilityMinRx().toString();
480 String roadmPortPortPowerCapabilityMinTx = cpPort.getRoadmPort().getPortPowerCapabilityMinTx().toString();
481 String roadmPortPortPowerCapabilityMaxRx = cpPort.getRoadmPort().getPortPowerCapabilityMaxRx().toString();
482 String roadmPortPortPowerCapabilityMaxTx = cpPort.getRoadmPort().getPortPowerCapabilityMaxTx().toString();
483 //String roadmPortCapableWavelengths = "";
484 //String roadmPortAvailableWavelengths = "";
485 //String roadmPortUsedWavelengths = "";
486 String transponderPortPortPowerCapabilityMinRx =
487 cpPort.getTransponderPort().getPortPowerCapabilityMinRx().toString();
488 String transponderPortPortPowerCapabilityMinTx =
489 cpPort.getTransponderPort().getPortPowerCapabilityMinTx().toString();
490 String transponderPortPortPowerCapabilityMaxRx =
491 cpPort.getTransponderPort().getPortPowerCapabilityMaxRx().toString();
492 String transponderPortPortPowerCapabilityMaxTx =
493 cpPort.getTransponderPort().getPortPowerCapabilityMaxTx().toString();
494 //String transponderPortCapableWavelengths = "";
495 String otdrPortLaunchCableLength = cpPort.getOtdrPort().getLaunchCableLength().toString();
496 String otdrPortPortDirection = String.valueOf(cpPort.getOtdrPort().getPortDirection().getIntValue());
497 //String ilaPortPortPowerCapabilityMixRx = "";
498 //String ilaPortPortPowerCapabilityMixTx = "";
499 //String ilaPortPortPowerCapabilityMaxRx = "";
500 //String ilaPortPortPowerCapabilityMaxTx = "";
502 String startTimestamp = getCurrentTimestamp();
504 return new Object[]{nodeId,
509 portWavelengthTypeEnu,
513 administrativeStateEnu,
515 logicalConnectionPoint,
516 partnerPortCircuitPackName,
518 parentPortCircuitPackName,
520 roadmPortPortPowerCapabilityMinRx,
521 roadmPortPortPowerCapabilityMinTx,
522 roadmPortPortPowerCapabilityMaxRx,
523 roadmPortPortPowerCapabilityMaxTx,
524 //roadmPortCapableWavelengths,
525 //roadmPortAvailableWavelengths,
526 //roadmPortUsedWavelengths,
528 transponderPortPortPowerCapabilityMinRx,
529 transponderPortPortPowerCapabilityMinTx,
530 transponderPortPortPowerCapabilityMaxRx,
531 transponderPortPortPowerCapabilityMaxTx,
532 //transponderPortCapableWavelengths,
534 otdrPortLaunchCableLength,
535 otdrPortPortDirection,
536 //ilaPortPortPowerCapabilityMixRx,
537 //ilaPortPortPowerCapabilityMixTx,
538 //ilaPortPortPowerCapabilityMaxRx,
539 //ilaPortPortPowerCapabilityMaxTx,
547 private static Object[] prepareCircuitPacksParameters(String nodeId, CircuitPacks cpack) {
548 String startTimestamp = getCurrentTimestamp();
549 return new Object[]{nodeId,
550 cpack.getCircuitPackName(),
551 cpack.getCircuitPackType(),
552 cpack.getCircuitPackProductCode(),
553 (cpack.getAdministrativeState() == null ? "" : cpack.getAdministrativeState().getIntValue()),
558 cpack.getProductCode(),
559 (cpack.getManufactureDate() == null ? "" : cpack.getManufactureDate().getValue()),
561 cpack.getHardwareVersion(),
562 prepareEmptyString(cpack.getOperationalState().getIntValue()),
563 cpack.getCircuitPackCategory().getType().getName(),
564 cpack.getCircuitPackCategory().getExtension(),
565 (cpack.getEquipmentState() == null ? "" : cpack.getEquipmentState().getIntValue()),
566 cpack.getCircuitPackMode(),
570 prepareEmptyString(cpack.getDueDate()),
571 prepareEmptyString((cpack.getParentCircuitPack() == null) ? "" :
572 ((cpack.getParentCircuitPack().getCircuitPackName() == null) ? "" :
573 cpack.getParentCircuitPack().getCircuitPackName())
575 prepareEmptyString((cpack.getParentCircuitPack() == null) ? "" :
576 ((cpack.getParentCircuitPack().getCpSlotName() == null) ? "" :
577 cpack.getParentCircuitPack().getCpSlotName())
584 private void persistCPPorts(String nodeId, Connection connection, CircuitPacks circuitPacks) {
585 for (int i = 0; i < circuitPacks.getPorts().size(); i++) {
586 Object[] cpPortsParameters = prepareCPPortsParameters(nodeId, circuitPacks, circuitPacks.getPorts().get(i));
587 String query = Queries.getQuery().deviceCPPortInsert().get();
588 LOG.info("Running {} query ", query);
589 try (PreparedStatement preparedStmt = connection.prepareStatement(query)) {
590 for (int j = 0; j < cpPortsParameters.length; j++) {
591 preparedStmt.setObject(j + 1, cpPortsParameters[j]);
593 preparedStmt.execute();
594 preparedStmt.clearParameters();
595 } catch (SQLException e) {
596 LOG.error(e.getMessage(), e);
602 private Object[] prepareDevInterfaceParameters(String nodeId, Interface deviceInterface, Connection connection) {
604 int administrativeStateEnu = deviceInterface.getAdministrativeState().getIntValue();
605 int operationalState = deviceInterface.getOperationalState().getIntValue();
606 int ethernetDuplexEnu = -1;
607 int ethernetAutoNegotiationEnu = -1;
608 int maintTestsignalTestpatternEnu = -1;
609 int maintTestsignalTypeEnu = -1;
611 int otuMaintTypeEnu = -1;
612 //int otsFiberTypeEnu = -1;
613 String name = deviceInterface.getName();
614 String description = deviceInterface.getDescription();
615 String type = deviceInterface.getType().getTypeName();
616 String circuitId = deviceInterface.getCircuitId();
617 String supportingInterface = deviceInterface.getSupportingInterface();
618 String supportingCircuitPackName = deviceInterface.getSupportingCircuitPackName();
619 String supportingPort = deviceInterface.getSupportingPort().toString();
620 String ethernetSpeed = "";
621 String ethernetFec = "";
622 String ethernetMtu = "";
623 String ethernetCurrSpeed = "";
624 String ethernetCurrDuplex = "";
625 //String mciMcttpMinFreq = "";
626 //String mciMcttpMaxFreq = "";
627 //String mciMcttpCenterFreq = "";
628 //String mciMcttpSlotWidth = "";
629 //String mciNmcCtpFrequency = "";
630 //String mciNmcCtpWidth = "";
632 //String ochFrequency = "";
633 //String ochWidth = "";
634 //String ochWavelengthNumber = "";
635 String ochModulationFormat = "";
636 String ochTransmitPower = "";
637 String otsSpanLossReceive = "";
638 String otsSpanLossTransmit = "";
639 //String otsIngressSpanLossAgingMargin = "";
640 //String otsEolMaxLoadPin = "";
641 String oduRate = ""; //BUG in following case switch statement ???
642 //String oduFunction = "";
643 String oduMonitoringMode = "";
644 //String oduNoOamFunction = "";
645 String oduProactiveDelayMeasurementEnabled = "";
646 //String oduPoaTribPortNumber = "";
647 //String oduTxSapi = "";
648 //String oduTxDapi = "";
649 //String oduTxOperator = "";
650 //String oduAcceptedSapi = "";
651 //String oduAcceptedDapi = "";
652 //String oduAcceptedOperator = "";
653 //String oduExpectedSapi = "";
654 //String oduExpectedDapi = "";
655 //String oduTimActEnabled = "";
656 //String oduTimDetectMode = "";
657 //String oduDegmIntervals = "";
658 //String oduDegthrPercentage = "";
659 String opuPayloadType = "";
660 String opuRxPayloadType = "";
661 String opuExpPayloadType = "";
662 String opuPayloadInterface = "";
663 String maintTestsignalEnabled = "";
664 String maintTestsignalBiterrors = "";
665 String maintTestsignalBiterrorsterminal = "";
666 String maintTestsignalSyncseconds = "";
667 String maintTestsignalSyncsecondsterminal = "";
669 //String otuTxSapi = "";
670 //String otuTxDapi = "";
671 //String otuTxOperator = "";
672 //String otuAcceptedSapi = "";
673 //String otuAcceptedDapi = "";
674 //String otuAcceptedOperator = "";
675 //String otuExpectedSapi = "";
676 //String otuExpectedDapi = "";
677 //String otuTimActEnabled = "";
678 //String otuTimDetectMode = "";
679 //String otuDegmIntervals = "";
680 //String otuDegthrPercentage = "";
681 String otuMaintLoopbackEnabled = "";
682 //String mtOtuRate = "";
683 //String mtOtuFec = "";
684 //String mtOtuMaintLoopback = "";
685 //String mtOtuEnabled = "";
686 //String mtOtuType = "";
688 switch (deviceInterface.getType().toString()) {
691 //EthernetBuilder ethIfBuilder = new EthernetBuilder();
692 EthernetBuilder ethIfBuilder =
693 new EthernetBuilder(deviceInterface.augmentation(Interface1.class).getEthernet());
694 ethernetSpeed = ethIfBuilder.getSpeed().toString();
695 ethernetFec = ethIfBuilder.getFec().getName();
696 ethernetDuplexEnu = ethIfBuilder.getDuplex().getIntValue();
697 ethernetMtu = ethIfBuilder.getMtu().toString();
698 ethernetAutoNegotiationEnu = ethIfBuilder.getAutoNegotiation().getIntValue();
699 ethernetCurrSpeed = ethIfBuilder.getCurrSpeed();
700 ethernetCurrDuplex = ethIfBuilder.getCurrDuplex();
704 OchBuilder ochIfBuilder = new OchBuilder(deviceInterface.augmentation(
705 org.opendaylight.yang.gen.v1
706 .http.org.openroadm.optical.channel.interfaces.rev161014.Interface1.class)
708 ochRate = ochIfBuilder.getRate().getName();
709 //ochWavelengthNumber = ochIfBuilder.getWavelengthNumber().toString();
710 ochModulationFormat = ochIfBuilder.getModulationFormat().getName();
711 ochTransmitPower = ochIfBuilder.getTransmitPower().toString();
715 OtsBuilder otsIfBuilder = new OtsBuilder(deviceInterface.augmentation(
716 org.opendaylight.yang.gen.v1
717 .http.org.openroadm.optical.transport.interfaces.rev161014.Interface1.class)
719 int otsFiberTypeEnu = otsIfBuilder.getFiberType().getIntValue();
720 otsSpanLossReceive = otsIfBuilder.getSpanLossReceive().toString();
721 otsSpanLossTransmit = otsIfBuilder.getSpanLossTransmit().toString();
725 OduBuilder oduIfBuilder = new OduBuilder(deviceInterface.augmentation(
726 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.Interface1.class)
728 oduRate = String.valueOf(oduIfBuilder.getRate());
729 oduMonitoringMode = oduIfBuilder.getMonitoringMode().getName();
730 oduProactiveDelayMeasurementEnabled = oduIfBuilder.isProactiveDelayMeasurementEnabled().toString();
732 persistDevInterfaceTcm(nodeId, name, oduIfBuilder, connection);
733 persistDevInterfaceOtnOduTxMsi(nodeId, name, oduIfBuilder, connection);
734 persistDevInterfaceOtnOduRxMsi(nodeId, name, oduIfBuilder, connection);
735 persistDevInterfaceOtnOduExpMsi(nodeId, name, oduIfBuilder, connection);
737 opuPayloadType = oduIfBuilder.getOpu().getPayloadType().toString();
738 opuRxPayloadType = oduIfBuilder.getOpu().getRxPayloadType().toString();
739 opuExpPayloadType = oduIfBuilder.getOpu().getExpPayloadType().toString();
740 opuPayloadInterface = oduIfBuilder.getOpu().getPayloadInterface();
741 /*persistDevInterfaceOtnOduTxMsi(nodeId,name,oduIfBuilder,connection);
742 persistDevInterfaceOtnOduRxMsi(nodeId,name,oduIfBuilder,connection);
743 persistDevInterfaceOtnOduExpMsi(nodeId,name,oduIfBuilder,connection); */
744 maintTestsignalEnabled = oduIfBuilder.getMaintTestsignal().isEnabled().toString();
745 maintTestsignalTestpatternEnu = oduIfBuilder.getMaintTestsignal().getTestPattern().getIntValue();
746 maintTestsignalTypeEnu = oduIfBuilder.getMaintTestsignal().getType().getIntValue();
747 maintTestsignalBiterrors = oduIfBuilder.getMaintTestsignal().getBitErrors().toString();
748 maintTestsignalBiterrorsterminal = oduIfBuilder.getMaintTestsignal().getBitErrorsTerminal().toString();
749 maintTestsignalSyncseconds = oduIfBuilder.getMaintTestsignal().getSyncSeconds();
750 maintTestsignalSyncsecondsterminal = oduIfBuilder.getMaintTestsignal().getSyncSecondsTerminal();
754 OtuBuilder otuIfBuilder = new OtuBuilder(deviceInterface.augmentation(
755 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class)
757 otuRate = otuIfBuilder.getRate().getName();
758 otuFecEnu = otuIfBuilder.getFec().getIntValue();
759 otuMaintLoopbackEnabled = otuIfBuilder.getMaintLoopback().isEnabled().toString();
760 otuMaintTypeEnu = otuIfBuilder.getMaintLoopback().getType().getIntValue();
764 LOG.error("Could not get interface type");
767 String startTimestamp = getCurrentTimestamp();
769 return new Object[]{nodeId,
773 Integer.toString(administrativeStateEnu),
774 Integer.toString(operationalState),
777 supportingCircuitPackName,
781 Integer.toString(ethernetDuplexEnu),
783 Integer.toString(ethernetAutoNegotiationEnu),
788 //mciMcttpCenterFreq,
790 //mciNmcCtpFrequency,
792 "", "", "", "", "", "",
796 //ochWavelengthNumber,
800 //Integer.toString(otsFiberTypeEnu),
804 //otsIngressSpanLossAgingMargin,
813 oduProactiveDelayMeasurementEnabled,
814 //oduPoaTribPortNumber,
820 //oduAcceptedOperator,
826 //oduDegthrPercentage,
827 "", "", "", "", "", "", "", "", "", "", "", "", "",
832 maintTestsignalEnabled,
833 Integer.toString(maintTestsignalTestpatternEnu),
834 Integer.toString(maintTestsignalTypeEnu),
835 maintTestsignalBiterrors,
836 maintTestsignalBiterrorsterminal,
837 maintTestsignalSyncseconds,
838 maintTestsignalSyncsecondsterminal,
840 Integer.toString(otuFecEnu),
846 //otuAcceptedOperator,
852 //otuDegthrPercentage,
853 "", "", "", "", "", "", "", "", "", "", "", "",
854 otuMaintLoopbackEnabled,
855 Integer.toString(otuMaintTypeEnu),
858 //mtOtuMaintLoopback,
868 private static Object[] prepareDevInterfaceTcmParameters(String nodeId, String interfaceName, Tcm tcm) {
871 String layer = tcm.getLayer().toString();
872 int monitoringModeEnu = tcm.getMonitoringMode().getIntValue();
873 String ltcActEnabled = tcm.isLtcActEnabled().toString();
874 String proactiveDelayMeasurementEnabled = tcm.isProactiveDelayMeasurementEnabled().toString();
875 //int tcmDirectionEnu = -1;
876 //int timDetectModeEnu = -1;
877 //String txSapi = "";
878 //String txDapi = "";
879 //String txOperator = "";
880 //String acceptedSapi = "";
881 //String acceptedDapi = "";
882 //String acceptedOperator = "";
883 //String expectedSapi = "";
884 //String expectedDapi = "";
885 //String timActEnabled = "";
886 //String degmIntervals = "";
887 //String degthrPercentage = "";
889 String startTimestamp = getCurrentTimestamp();
891 return new Object[]{nodeId,
894 Integer.toString(monitoringModeEnu),
896 proactiveDelayMeasurementEnabled,
897 //Integer.toString(tcmDirectionEnu),
908 "", "", "", "", "", "", "", "", "",
909 //Integer.toString(timDetectModeEnu),
919 private static Object[] prepareDevInterfaceOtnOduTxMsiParameters(String nodeId, String interfaceName, TxMsi txMsi) {
921 String tribSlot = txMsi.getTribSlot().toString();
922 String odtuType = txMsi.getOdtuType().getTypeName();
923 String tribPort = txMsi.getTribPort().toString();
924 String tribPortPayload = txMsi.getTribPortPayload();
926 String startTimestamp = getCurrentTimestamp();
928 return new Object[]{nodeId,
940 private static Object[] prepareDevInterfaceOtnOduRxMsiParameters(String nodeId, String interfaceName, RxMsi rxMsi) {
942 String tribSlot = rxMsi.getTribSlot().toString();
943 String odtuType = rxMsi.getOdtuType().getTypeName();
944 String tribPort = rxMsi.getTribPort().toString();
945 String tribPortPayload = rxMsi.getTribPortPayload();
947 String startTimestamp = getCurrentTimestamp();
949 return new Object[]{nodeId,
962 private static Object[] prepareDevInterfaceOtnOduExpMsiParameters(String nodeId, String interfaceName,
965 String tribSlot = expMsi.getTribSlot().toString();
966 String odtuType = expMsi.getOdtuType().getTypeName();
967 String tribPort = expMsi.getTribPort().toString();
968 String tribPortPayload = expMsi.getTribPortPayload();
970 String startTimestamp = getCurrentTimestamp();
972 return new Object[]{nodeId,
984 private void persistDevInterfaces(String nodeId, Connection connection) {
986 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
987 Optional<OrgOpenroadmDevice> deviceObject =
988 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
989 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
991 /*InstanceIdentifier<Interface> interfaceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
992 .child(Interface.class);
993 Optional<Interface> interfaceOpt =
994 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, interfaceIID,
995 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT); */
997 for (int i = 0; i < deviceObject.get().getInterface().size(); i++) {
998 Interface deviceInterface;
1000 deviceInterface = deviceObject.get().getInterface().get(i);
1001 /*if (interfaceOpt.isPresent()) {
1002 deviceInterface = interfaceOpt.get();
1004 LOG.warn("Could not get interface info");
1007 Object[] parameters = prepareDevInterfaceParameters(nodeId, deviceInterface, connection);
1009 String query = Queries.getQuery().deviceInterfacesInsert().get();
1010 LOG.info("Running {} query ", query);
1011 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1012 for (int j = 0; j < parameters.length; j++) {
1013 stmt.setObject(j + 1, parameters[j]);
1016 stmt.clearParameters();
1017 } catch (SQLException e) {
1018 LOG.error(e.getMessage(), e);
1023 private void persistDevProtocols(String nodeId, Connection connection) {
1025 InstanceIdentifier<Protocols> protocolsIID =
1026 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1027 Optional<Protocols> protocolObject =
1028 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1029 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1030 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1031 LOG.error("LLDP subtree is missing");
1034 int adminstatusEnu =
1035 protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig().getAdminStatus()
1037 String msgTxtInterval =
1038 protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig().getMsgTxInterval()
1040 String mxgTxHoldMultiplier =
1041 protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig().getMsgTxHoldMultiplier()
1043 String startTimestamp = getCurrentTimestamp();
1044 persistDevProtocolLldpPortConfig(nodeId, connection);
1045 persistDevProtocolLldpNbrList(nodeId, connection);
1047 Object[] parameters = {nodeId,
1048 Integer.toString(adminstatusEnu),
1050 mxgTxHoldMultiplier,
1055 String query = Queries.getQuery().deviceProtocolInsert().get();
1056 LOG.info("Running {} query ", query);
1057 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1058 for (int j = 0; j < parameters.length; j++) {
1059 stmt.setObject(j + 1, parameters[j]);
1062 stmt.clearParameters();
1063 } catch (SQLException e) {
1064 LOG.error(e.getMessage(), e);
1070 private void persistDevProtocolLldpPortConfig(String nodeId, Connection connection) {
1072 InstanceIdentifier<Protocols> protocolsIID =
1073 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1074 Optional<Protocols> protocolObject =
1075 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1076 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1077 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1078 LOG.error("LLDP subtree is missing");
1081 String startTimestamp = getCurrentTimestamp();
1082 for (int i = 0; i < protocolObject.get().augmentation(Protocols1.class).getLldp().getPortConfig().size(); i++) {
1084 PortConfig portConfig =
1085 protocolObject.get().augmentation(Protocols1.class).getLldp().getPortConfig().get(i);
1086 String ifName = portConfig.getIfName();
1087 int adminStatusEnu = portConfig.getAdminStatus().getIntValue();
1089 Object[] parameters = {nodeId,
1091 Integer.toString(adminStatusEnu),
1096 String query = Queries.getQuery().deviceProtocolPortConfigInsert().get();
1097 LOG.info("Running {} query ", query);
1098 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1099 for (int j = 0; j < parameters.length; j++) {
1100 stmt.setObject(j + 1, parameters[j]);
1103 stmt.clearParameters();
1104 } catch (SQLException e) {
1105 LOG.error(e.getMessage(), e);
1112 private void persistDevProtocolLldpNbrList(String nodeId, Connection connection) {
1114 InstanceIdentifier<Protocols> protocolsIID =
1115 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1116 Optional<Protocols> protocolObject =
1117 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1118 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1119 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1120 LOG.error("LLDP subtree is missing");
1123 String startTimestamp = getCurrentTimestamp();
1124 for (int i = 0; i < protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList().getIfName()
1128 protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList().getIfName().get(i);
1129 String ifName = ifNameObj.getIfName();
1130 String remotesysname = ifNameObj.getRemoteSysName();
1131 String remotemgmtaddresssubtype = ifNameObj.getRemoteMgmtAddressSubType().getName();
1132 String remotemgmtaddress = ifNameObj.getRemoteMgmtAddress().getIpv4Address().toString();
1133 int remoteportidsubtypeEnu = ifNameObj.getRemotePortIdSubType().getIntValue();
1134 String remoteportid = ifNameObj.getRemotePortId();
1135 int remotechassisidsubtypeEnu = ifNameObj.getRemoteChassisIdSubType().getIntValue();
1136 String remotechassisid = ifNameObj.getRemoteChassisId();
1138 Object[] parameters = {nodeId,
1141 remotemgmtaddresssubtype,
1143 Integer.toString(remoteportidsubtypeEnu),
1145 Integer.toString(remotechassisidsubtypeEnu),
1151 String query = Queries.getQuery().deviceProtocolLldpNbrlistInsert().get();
1152 LOG.info("Running {} query ", query);
1153 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1154 for (int j = 0; j < parameters.length; j++) {
1155 stmt.setObject(j + 1, parameters[j]);
1158 stmt.clearParameters();
1159 } catch (SQLException e) {
1160 LOG.error(e.getMessage(), e);
1166 private void persistDevProtocolRstp(String nodeId, Connection connection) {
1168 InstanceIdentifier<Protocols> protocolsIID =
1169 InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
1170 Optional<Protocols> protocolObject =
1171 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
1172 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1173 if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
1174 LOG.error("LLDP subtree is missing");
1177 String startTimestamp = getCurrentTimestamp();
1178 for (int i = 0; i < protocolObject.get()
1179 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.Protocols1.class)
1180 .getRstp().getRstpBridgeInstance().size(); i++) {
1182 RstpBridgeInstance rstpBridgeInstance = protocolObject.get()
1183 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.Protocols1.class)
1184 .getRstp().getRstpBridgeInstance().get(i);
1185 String bridgeName = rstpBridgeInstance.getBridgeName();
1186 String bridgePriority = rstpBridgeInstance.getRstpConfig().getBridgePriority().toString();
1187 String shutdown = rstpBridgeInstance.getRstpConfig().getShutdown().toString();
1188 String holdTime = rstpBridgeInstance.getRstpConfig().getHoldTime().toString();
1189 String helloTime = rstpBridgeInstance.getRstpConfig().getHelloTime().toString();
1190 String maxAge = rstpBridgeInstance.getRstpConfig().getMaxAge().toString();
1191 String forwardDelay = rstpBridgeInstance.getRstpConfig().getForwardDelay().toString();
1192 String transmitHoldCount = rstpBridgeInstance.getRstpConfig().getTransmitHoldCount().toString();
1193 String rootBridgePort =
1194 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootBridgePort().toString();
1195 String rootPathCost = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootPathCost().toString();
1196 String rootBridgePriority =
1197 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootBridgePriority().toString();
1198 String rootBridgeId = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootBridgeId().toString();
1199 String rootHoldTime = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootHoldTime().toString();
1200 String rootHelloTime = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootHelloTime().toString();
1201 String rootMaxAge = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootMaxAge().toString();
1202 String rootForwardDelay =
1203 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getRootForwardDelay().toString();
1204 String bridgeId = rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getBridgeId().toString();
1205 String topoChangeCount =
1206 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getTopoChangeCount().toString();
1207 String timeSinceTopoChange =
1208 rstpBridgeInstance.getRstpState().getRstpBridgeAttr().getTimeSinceTopoChange().toString();
1210 persistDevProtocolRstpBridgePort(nodeId, bridgeName, rstpBridgeInstance, connection);
1211 persistDevProtocolRstpBridgePortAttr(nodeId, bridgeName, rstpBridgeInstance, connection);
1213 Object[] parameters = {nodeId,
1232 timeSinceTopoChange,
1237 String query = Queries.getQuery().deviceProtocolRstpInsert().get();
1238 LOG.info("Running {} query ", query);
1239 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1240 for (int j = 0; j < parameters.length; j++) {
1241 stmt.setObject(j + 1, parameters[j]);
1244 stmt.clearParameters();
1245 } catch (SQLException e) {
1246 LOG.error(e.getMessage(), e);
1252 private void persistDevProtocolRstpBridgePort(String nodeId, String bridgeName,
1253 RstpBridgeInstance rstpBridgeInstance, Connection connection) {
1255 String startTimestamp = getCurrentTimestamp();
1256 for (int i = 0; i < rstpBridgeInstance.getRstpConfig().getRstpBridgePortTable().size(); i++) {
1257 RstpBridgePortTable rstpBridgePortTable =
1258 rstpBridgeInstance.getRstpConfig().getRstpBridgePortTable().get(i);
1260 String ifName = rstpBridgePortTable.getIfname();
1261 String cost = rstpBridgePortTable.getCost().toString();
1262 String priority = rstpBridgePortTable.getPriority().toString();
1264 Object[] parameters = {nodeId,
1273 String query = Queries.getQuery().deviceProtocolRstpBridgePortInsert().get();
1274 LOG.info("Running {} query ", query);
1275 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1276 for (int j = 0; j < parameters.length; j++) {
1277 stmt.setObject(j + 1, parameters[j]);
1280 stmt.clearParameters();
1281 } catch (SQLException e) {
1282 LOG.error(e.getMessage(), e);
1288 private void persistDevProtocolRstpBridgePortAttr(String nodeId, String bridgeName,
1289 RstpBridgeInstance rstpBridgeInstance, Connection connection) {
1291 String startTimestamp = getCurrentTimestamp();
1292 for (int i = 0; i < rstpBridgeInstance.getRstpState().getRstpBridgePortAttr().getRstpBridgePortTable().size();
1295 org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.rstp.bridge.port.state.attr
1296 .RstpBridgePortTable rstpBridgePortTableAttr =
1297 rstpBridgeInstance.getRstpState().getRstpBridgePortAttr().getRstpBridgePortTable().get(i);
1299 String ifName = rstpBridgePortTableAttr.getIfname();
1300 String bridgePortState = rstpBridgePortTableAttr.getBridgePortState().getName();
1301 String bridgePortRole = rstpBridgePortTableAttr.getBridgePortRole().getName();
1302 String bridgePortId = rstpBridgePortTableAttr.getBridgePortId().toString();
1303 String openEdgeBridgePort = rstpBridgePortTableAttr.getOperEdgeBridgePort().toString();
1304 String designatedBridgePort = rstpBridgePortTableAttr.getDesignatedBridgePort().toString();
1305 String designatedBridgeId = rstpBridgePortTableAttr.getDesignatedBridgeid().toString();
1307 Object[] parameters = {nodeId,
1314 designatedBridgePort,
1320 String query = Queries.getQuery().deviceProtocolRstpBridgePortAttrInsert().get();
1321 LOG.info("Running {} query ", query);
1322 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1323 for (int j = 0; j < parameters.length; j++) {
1324 stmt.setObject(j + 1, parameters[j]);
1327 stmt.clearParameters();
1328 } catch (SQLException e) {
1329 LOG.error(e.getMessage(), e);
1336 private void persistDevInternalLinks(String nodeId, Connection connection) {
1338 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1339 Optional<OrgOpenroadmDevice> deviceObject =
1340 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1341 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1343 String startTimestamp = getCurrentTimestamp();
1344 for (int i = 0; i < deviceObject.get().getInternalLink().size(); i++) {
1345 InternalLink internalLink = deviceObject.get().getInternalLink().get(i);
1346 String internalLinkName = internalLink.getInternalLinkName();
1347 String sourceCircuitPackName = internalLink.getSource().getCircuitPackName();
1348 String sourcePortName = internalLink.getSource().getPortName().toString();
1349 String destinationCircuitPackName = internalLink.getDestination().getCircuitPackName();
1350 String destinationPortName = internalLink.getDestination().getPortName().toString();
1352 Object[] parameters = {nodeId,
1354 sourceCircuitPackName,
1356 destinationCircuitPackName,
1357 destinationPortName,
1362 String query = Queries.getQuery().deviceInternalLinkInsert().get();
1363 LOG.info("Running {} query ", query);
1364 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1365 for (int j = 0; j < parameters.length; j++) {
1366 stmt.setObject(j + 1, parameters[j]);
1369 stmt.clearParameters();
1370 } catch (SQLException e) {
1371 LOG.error(e.getMessage(), e);
1378 private void persistDevExternalLinks(String nodeId, Connection connection) {
1380 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1381 Optional<OrgOpenroadmDevice> deviceObject =
1382 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1383 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1385 String startTimestamp = getCurrentTimestamp();
1386 for (int i = 0; i < deviceObject.get().getExternalLink().size(); i++) {
1387 ExternalLink externalLink = deviceObject.get().getExternalLink().get(i);
1388 String externalLinkName = externalLink.getExternalLinkName();
1389 String sourceNodeId = externalLink.getSource().getNodeId().toString();
1390 String sourceCircuitPackName = externalLink.getSource().getCircuitPackName();
1391 String sourcePortName = externalLink.getSource().getPortName().toString();
1392 String destinationNodeId = externalLink.getDestination().getNodeId().toString();
1393 String destinationCircuitPackName = externalLink.getDestination().getCircuitPackName();
1394 String destinationPortName = externalLink.getDestination().getPortName().toString();
1396 Object[] parameters = {nodeId,
1399 sourceCircuitPackName,
1402 destinationCircuitPackName,
1403 destinationPortName,
1408 String query = Queries.getQuery().deviceExternalLinkInsert().get();
1409 LOG.info("Running {} query ", query);
1410 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1411 for (int j = 0; j < parameters.length; j++) {
1412 stmt.setObject(j + 1, parameters[j]);
1415 stmt.clearParameters();
1416 } catch (SQLException e) {
1417 LOG.error(e.getMessage(), e);
1423 private void persistDevPhysicalLinks(String nodeId, Connection connection) {
1425 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1426 Optional<OrgOpenroadmDevice> deviceObject =
1427 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1428 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1430 String startTimestamp = getCurrentTimestamp();
1431 for (int i = 0; i < deviceObject.get().getPhysicalLink().size(); i++) {
1432 PhysicalLink physicalLink = deviceObject.get().getPhysicalLink().get(i);
1433 String physicalLinkName = physicalLink.getPhysicalLinkName();
1434 String sourceCircuitPackName = physicalLink.getSource().getCircuitPackName();
1435 String sourcePortName = physicalLink.getSource().getPortName().toString();
1436 String destinationCircuitPackName = physicalLink.getDestination().getCircuitPackName();
1437 String destinationPortName = physicalLink.getDestination().getPortName().toString();
1439 Object[] parameters = {nodeId,
1441 sourceCircuitPackName,
1443 destinationCircuitPackName,
1444 destinationPortName,
1449 String query = Queries.getQuery().devicePhysicalLinkInsert().get();
1450 LOG.info("Running {} query ", query);
1451 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1452 for (int j = 0; j < parameters.length; j++) {
1453 stmt.setObject(j + 1, parameters[j]);
1456 stmt.clearParameters();
1457 } catch (SQLException e) {
1458 LOG.error(e.getMessage(), e);
1464 private void persistDevDegree(String nodeId, Connection connection) {
1466 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1467 Optional<OrgOpenroadmDevice> deviceObject =
1468 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1469 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1471 String startTimestamp = getCurrentTimestamp();
1472 for (int i = 0; i < deviceObject.get().getDegree().size(); i++) {
1473 Degree degree = deviceObject.get().getDegree().get(i);
1474 String degreeNumber = degree.getDegreeNumber().toString();
1475 String maxWavelengths = degree.getMaxWavelengths().toString();
1476 String otdrPortCircuitPackName = degree.getOtdrPort().getCircuitPackName();
1477 String otdrPortPortName = degree.getOtdrPort().getPortName().toString();
1478 persistDevDegreeCircuitPack(nodeId, degree, degreeNumber, connection);
1479 persistDevDegreeConnectionPort(nodeId, degree, degreeNumber, connection);
1480 //String mcCapabilitiesSlotWidthGranularity = "";
1481 //String mcCapabilitiesCenterFreqGranularity = "";
1482 //String mcCapabilitiesMinSlots = "";
1483 //String mcCapabilitiesMaxSlots = "";
1485 Object[] parameters = {nodeId,
1488 otdrPortCircuitPackName,
1490 //mcCapabilitiesSlotWidthGranularity,
1491 //mcCapabilitiesCenterFreqGranularity,
1492 //mcCapabilitiesMinSlots,
1493 //mcCapabilitiesMaxSlots,
1499 String query = Queries.getQuery().deviceDegreeInsert().get();
1500 LOG.info("Running {} query ", query);
1501 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1502 for (int j = 0; j < parameters.length; j++) {
1503 stmt.setObject(j + 1, parameters[j]);
1506 stmt.clearParameters();
1507 } catch (SQLException e) {
1508 LOG.error(e.getMessage(), e);
1515 private void persistDevDegreeCircuitPack(String nodeId, Degree degree, String degreeNumber, Connection connection) {
1517 String startTimestamp = getCurrentTimestamp();
1518 for (int i = 0; i < degree.getCircuitPacks().size(); i++) {
1520 String circuitPackIndex = degree.getCircuitPacks().get(i).getIndex().toString();
1521 String circuitPackName = degree.getCircuitPacks().get(i).getCircuitPackName();
1523 Object[] parameters = {nodeId,
1531 String query = Queries.getQuery().deviceDegreeCircuitPackInsert().get();
1532 LOG.info("Running {} query ", query);
1533 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1534 for (int j = 0; j < parameters.length; j++) {
1535 stmt.setObject(j + 1, parameters[j]);
1538 stmt.clearParameters();
1539 } catch (SQLException e) {
1540 LOG.error(e.getMessage(), e);
1546 private void persistDevDegreeConnectionPort(String nodeId, Degree degree, String degreeNumber,
1547 Connection connection) {
1549 String startTimestamp = getCurrentTimestamp();
1550 for (int i = 0; i < degree.getConnectionPorts().size(); i++) {
1552 String connectionPortIndex = degree.getConnectionPorts().get(i).getIndex().toString();
1553 String circuitPackName = degree.getConnectionPorts().get(i).getCircuitPackName();
1554 String portName = degree.getConnectionPorts().get(i).getPortName().toString();
1556 Object[] parameters = {nodeId,
1558 connectionPortIndex,
1565 String query = Queries.getQuery().deviceDegreeConnectionPortInsert().get();
1566 LOG.info("Running {} query ", query);
1567 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1568 for (int j = 0; j < parameters.length; j++) {
1569 stmt.setObject(j + 1, parameters[j]);
1572 stmt.clearParameters();
1573 } catch (SQLException e) {
1574 LOG.error(e.getMessage(), e);
1581 private void persistDevSrg(String nodeId, Connection connection) {
1583 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1584 Optional<OrgOpenroadmDevice> deviceObject =
1585 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1586 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1588 String startTimestamp = getCurrentTimestamp();
1589 for (int i = 0; i < deviceObject.get().getSharedRiskGroup().size(); i++) {
1590 SharedRiskGroup sharedRiskGroup = deviceObject.get().getSharedRiskGroup().get(i);
1591 String maxAddDropPorts = sharedRiskGroup.getMaxAddDropPorts().toString();
1592 String srgNumber = sharedRiskGroup.getSrgNumber().toString();
1593 int wavelengthDuplicationEnu = sharedRiskGroup.getWavelengthDuplication().getIntValue();
1594 persistDevSrgCircuitPacks(nodeId, sharedRiskGroup, srgNumber, connection);
1595 //String currentProvisionedAddDropPorts = "";
1596 //String mcCapSlotWidthGranularity = "";
1597 //String mcCapCenterFreqGranularity = "";
1598 //String mcCapMinSlots = "";
1599 //String mcCapMaxSlots = "";
1601 Object[] parameters = {nodeId,
1603 //currentProvisionedAddDropPorts,
1606 //mcCapSlotWidthGranularity,
1607 //mcCapCenterFreqGranularity,
1615 String query = Queries.getQuery().deviceSharedRiskGroupInsert().get();
1616 LOG.info("Running {} query ", query);
1617 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1618 for (int j = 0; j < parameters.length; j++) {
1619 stmt.setObject(j + 1, parameters[j]);
1622 stmt.clearParameters();
1623 } catch (SQLException e) {
1624 LOG.error(e.getMessage(), e);
1630 private void persistDevSrgCircuitPacks(String nodeId, SharedRiskGroup sharedRiskGroup, String srgNumber,
1631 Connection connection) {
1633 String startTimestamp = getCurrentTimestamp();
1634 for (int i = 0; i < sharedRiskGroup.getCircuitPacks().size(); i++) {
1636 String circuitPackindex = sharedRiskGroup.getCircuitPacks().get(i).getIndex().toString();
1637 String circuitPackName = sharedRiskGroup.getCircuitPacks().get(i).getCircuitPackName();
1639 Object[] parameters = {nodeId,
1647 String query = Queries.getQuery().deviceSrgCircuitPackInsert().get();
1648 LOG.info("Running {} query ", query);
1649 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1650 for (int j = 0; j < parameters.length; j++) {
1651 stmt.setObject(j + 1, parameters[j]);
1654 stmt.clearParameters();
1655 } catch (SQLException e) {
1656 LOG.error(e.getMessage(), e);
1662 private void persistDevRoadmConnections(String nodeId, Connection connection) {
1664 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1665 Optional<OrgOpenroadmDevice> deviceObject =
1666 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1667 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1669 String startTimestamp = getCurrentTimestamp();
1670 for (int i = 0; i < deviceObject.get().getRoadmConnections().size(); i++) {
1671 RoadmConnections roadmConnections = deviceObject.get().getRoadmConnections().get(i);
1672 int opticalcontrolmodeEnu = roadmConnections.getOpticalControlMode().getIntValue();
1673 //String connectionName = "";
1674 //String connectionNumber = "";
1675 //String wavelengthNumber = "";
1676 String targetOutputPower = roadmConnections.getTargetOutputPower().toString();
1677 String srcIf = roadmConnections.getSource().getSrcIf();
1678 String dstIf = roadmConnections.getDestination().getDstIf();
1680 Object[] parameters = {nodeId,
1685 Integer.toString(opticalcontrolmodeEnu),
1693 String query = Queries.getQuery().deviceRoadmConnectionsInsert().get();
1694 LOG.info("Running {} query ", query);
1695 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1696 for (int j = 0; j < parameters.length; j++) {
1697 stmt.setObject(j + 1, parameters[j]);
1700 stmt.clearParameters();
1701 } catch (SQLException e) {
1702 LOG.error(e.getMessage(), e);
1709 private void persistDevConnectionMap(String nodeId, Connection connection) {
1711 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1712 Optional<OrgOpenroadmDevice> deviceObject =
1713 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1714 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1716 String startTimestamp = getCurrentTimestamp();
1717 for (int i = 0; i < deviceObject.get().getConnectionMap().size(); i++) {
1718 ConnectionMap connectionMap = deviceObject.get().getConnectionMap().get(i);
1719 String connectionMapNumber = connectionMap.getConnectionMapNumber().toString();
1720 String sourceCircuitPackName = connectionMap.getSource().getCircuitPackName();
1721 String sourcePortName = connectionMap.getSource().getCircuitPackName();
1724 Object[] parameters = {nodeId,
1725 connectionMapNumber,
1726 sourceCircuitPackName,
1732 String query = Queries.getQuery().deviceConnectionMapInsert().get();
1733 LOG.info("Running {} query ", query);
1734 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1735 for (int j = 0; j < parameters.length; j++) {
1736 stmt.setObject(j + 1, parameters[j]);
1739 stmt.clearParameters();
1740 } catch (SQLException e) {
1741 LOG.error(e.getMessage(), e);
1747 private void persistDevWavelengthMap(String nodeId, Connection connection) {
1750 String wavelengthNumber="", centerFrequency="", wavelength="";;
1752 InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
1753 Optional<OrgOpenroadmDevice> deviceObject =
1754 deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
1755 Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
1758 String startTimestamp = getCurrentTimestamp();
1759 for (int i = 0; i<deviceObject.get().getWavelengthMap().getWavelengths().size(); i++) {
1760 Wavelengths wavelengths = deviceObject.get().getWavelengthMap().getWavelengths().get(i);
1761 wavelengthNumber=wavelengths.getWavelengthNumber().toString();
1762 centerFrequency=wavelengths.getCenterFrequency().toString();
1763 wavelength=wavelengths.getWavelength().toString();
1766 Object[] parameters = {nodeId,
1774 String query = Queries.getQuery().deviceWavelengthInsert().get();
1775 LOG.info("Running {} query ", query);
1776 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1777 for (int j = 0; j < parameters.length; j++) {
1778 stmt.setObject(j + 1, parameters[j]);
1781 stmt.clearParameters();
1782 } catch (SQLException e) {
1783 LOG.error(e.getMessage(), e);
1791 private void persistDevInterfaceTcm(String nodeId, String interfaceName, OduBuilder oduBuilder,
1792 Connection connection) {
1794 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1797 tcm = oduBuilder.getTcm().get(i);
1799 Object[] parameters = prepareDevInterfaceTcmParameters(nodeId, interfaceName, tcm);
1801 String query = Queries.getQuery().deviceInterfacesInsert().get();
1802 LOG.info("Running {} query ", query);
1803 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1804 for (int j = 0; j < parameters.length; j++) {
1805 stmt.setObject(j + 1, parameters[j]);
1808 stmt.clearParameters();
1809 } catch (SQLException e) {
1810 LOG.error(e.getMessage(), e);
1815 private void persistDevInterfaceOtnOduTxMsi(String nodeId, String interfaceName, OduBuilder oduBuilder,
1816 Connection connection) {
1818 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1821 txMsi = oduBuilder.getOpu().getMsi().getTxMsi().get(i);
1823 Object[] parameters = prepareDevInterfaceOtnOduTxMsiParameters(nodeId, interfaceName, txMsi);
1825 String query = Queries.getQuery().deviceInterfaceOtnOduTxMsiInsert().get();
1826 LOG.info("Running {} query ", query);
1827 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1828 for (int j = 0; j < parameters.length; j++) {
1829 stmt.setObject(j + 1, parameters[j]);
1832 stmt.clearParameters();
1833 } catch (SQLException e) {
1834 LOG.error(e.getMessage(), e);
1840 private void persistDevInterfaceOtnOduRxMsi(String nodeId, String interfaceName, OduBuilder oduBuilder,
1841 Connection connection) {
1843 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1846 rxMsi = oduBuilder.getOpu().getMsi().getRxMsi().get(i);
1848 Object[] parameters = prepareDevInterfaceOtnOduRxMsiParameters(nodeId, interfaceName, rxMsi);
1850 String query = Queries.getQuery().deviceInterfaceOtnOduRxMsiInsert().get();
1851 LOG.info("Running {} query ", query);
1852 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1853 for (int j = 0; j < parameters.length; j++) {
1854 stmt.setObject(j + 1, parameters[j]);
1857 stmt.clearParameters();
1858 } catch (SQLException e) {
1859 LOG.error(e.getMessage(), e);
1865 private void persistDevInterfaceOtnOduExpMsi(String nodeId, String interfaceName, OduBuilder oduBuilder,
1866 Connection connection) {
1868 for (int i = 0; i < oduBuilder.getTcm().size(); i++) {
1871 expMsi = oduBuilder.getOpu().getMsi().getExpMsi().get(i);
1873 Object[] parameters = prepareDevInterfaceOtnOduExpMsiParameters(nodeId, interfaceName, expMsi);
1875 String query = Queries.getQuery().deviceInterfaceOtnOduExpMsiInsert().get();
1876 LOG.info("Running {} query ", query);
1877 try (PreparedStatement stmt = connection.prepareStatement(query)) {
1878 for (int j = 0; j < parameters.length; j++) {
1879 stmt.setObject(j + 1, parameters[j]);
1882 stmt.clearParameters();
1883 } catch (SQLException e) {
1884 LOG.error(e.getMessage(), e);