diff options
Diffstat (limited to 'sdnr/wt/devicemanager-onap/openroadm71/provider')
12 files changed, 89 insertions, 116 deletions
diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/pom.xml b/sdnr/wt/devicemanager-onap/openroadm71/provider/pom.xml index 1d4ec88c4..56698cbbc 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/pom.xml +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/pom.xml @@ -20,13 +20,14 @@ ~ ============LICENSE_END======================================================= ~ --> + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> @@ -50,13 +51,6 @@ </properties> <dependencies> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>ietf-alarms</artifactId> - <version>${project.version}</version> - <scope>provided</scope> - </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>sdnr-wt-devicemanager-onap-openroadm71-model</artifactId> @@ -113,6 +107,12 @@ <groupId>net.bytebuddy</groupId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-yang-utils</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> <!-- end for testing --> </dependencies> diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/InitialDeviceAlarmReader.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/InitialDeviceAlarmReader.java index 5a9beaf9a..7a038bd60 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/InitialDeviceAlarmReader.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/InitialDeviceAlarmReader.java @@ -105,7 +105,7 @@ public class InitialDeviceAlarmReader { // Mapping Severity of AlarmNotification to SeverityType of FaultLog protected static SeverityType checkSeverityValue(Severity severity) { SeverityType severityType = null; - log.info("Device Severity: {}", severity.getName()); + log.debug("Device Severity: {}", severity.getName()); switch (severity.getName()) { case ("warning"): @@ -141,13 +141,13 @@ public class InitialDeviceAlarmReader { // Read Alarm Data private Optional<ActiveAlarmList> getActiveAlarmList(NetconfBindingAccessor accessor) { final Class<ActiveAlarmList> classAlarm = ActiveAlarmList.class; - log.info("Get Alarm data for element {}", accessor.getNodeId().getValue()); + log.debug("Get Alarm data for element {}", accessor.getNodeId().getValue()); InstanceIdentifier<ActiveAlarmList> alarmDataIid = InstanceIdentifier.builder(classAlarm).build(); ActiveAlarmList alarmData = accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, alarmDataIid); - log.info("AlarmData {}", alarmData); + log.debug("AlarmData {}", alarmData); return Optional.ofNullable(alarmData); } diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmChangeNotificationListener.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmChangeNotificationListener.java index 747de40de..3a243842f 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmChangeNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmChangeNotificationListener.java @@ -96,7 +96,7 @@ public class OpenroadmChangeNotificationListener implements IetfNetconfNotificat @Override public void onNetconfConfigChange(NetconfConfigChange notification) { - LOG.info("onNetconfConfigChange (1) {}", notification); + LOG.debug("onNetconfConfigChange (1) {}", notification); StringBuffer sb = new StringBuffer(); List<Edit> editList = notification.nonnullEdit(); for (Edit edit : editList) { diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmDeviceChangeNotificationListener.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmDeviceChangeNotificationListener.java index 3263e1de2..b914b31d5 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmDeviceChangeNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmDeviceChangeNotificationListener.java @@ -75,7 +75,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe @Override public void onChangeNotification(ChangeNotification notification) { - log.info("onDeviceConfigChange(1){}", notification); + log.debug("onDeviceConfigChange(1){}", notification); StringBuffer sb = new StringBuffer(); @NonNull @@ -89,9 +89,9 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe InstanceIdentifier<?> target = edit.getTarget(); if (target != null) { eventlogBuilder.setObjectId(target.getPathArguments().toString()); - log.info("TARGET: {} {}", target.getClass(), target.getTargetType()); + log.debug("TARGET: {} {}", target.getClass(), target.getTargetType()); for (PathArgument pa : target.getPathArguments()) { - log.info("PathArgument {}", pa); + log.debug("PathArgument {}", pa); } eventlogBuilder.setAttributeName(target.getTargetType().getName()); } @@ -101,7 +101,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe eventlogBuilder.setCounter(counter); eventlogBuilder.setSourceType(SourceType.Netconf); databaseProvider.writeEventLog(eventlogBuilder.build()); - log.info("onDeviceConfigChange (2) {}", sb); + log.debug("onDeviceConfigChange (2) {}", sb); counter++; } this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(), @@ -112,7 +112,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe public void onCreateTechInfoNotification(CreateTechInfoNotification notification) { DateAndTime now = NetconfTimeStampImpl.getConverter().getTimeStamp(); - log.info("onCreateTechInfoNotification(1){}", notification); + log.debug("onCreateTechInfoNotification(1){}", notification); EventlogBuilder eventlogBuilder = new EventlogBuilder(); eventlogBuilder.setId(notification.getShelfId()).setAttributeName(notification.getShelfId()) .setObjectId(notification.getShelfId()).setNodeId(this.netconfAccessor.getNodeId().getValue()) @@ -121,7 +121,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe databaseProvider.writeEventLog(eventlogBuilder.build()); this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(), CreateTechInfoNotification.QNAME, now); - log.info("Create-techInfo Notification written "); + log.debug("Create-techInfo Notification written "); counter++; } // end of public methods diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmFaultNotificationListener.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmFaultNotificationListener.java index 7a1116515..785778b5d 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmFaultNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmFaultNotificationListener.java @@ -80,7 +80,7 @@ public class OpenroadmFaultNotificationListener implements OrgOpenroadmAlarmList @Override public void onAlarmNotification(AlarmNotification notification) { - log.info("AlarmNotification is {} \t {}", notification.getId(), notification.getAdditionalDetail()); + log.debug("AlarmNotification is {} \t {}", notification.getId(), notification.getAdditionalDetail()); String affectedResourceName = getAffectedResourceName(notification.getResource().getResource().getResource()); String probableCauseName = getProbableCauseName(notification.getProbableCause()); @@ -98,7 +98,7 @@ public class OpenroadmFaultNotificationListener implements OrgOpenroadmAlarmList this.notificationService.sendNotification(notification,new NodeId(netconfAccessor.getNodeId().getValue()), AlarmNotification.QNAME, notification.getRaiseTime()); count++; - log.info("Notification is written into the database {}", faultAlarm.getObjectId()); + log.debug("Notification is written into the database {}", faultAlarm.getObjectId()); } diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmInventoryInput.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmInventoryInput.java index 2f48d79f7..b383c9d70 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmInventoryInput.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmInventoryInput.java @@ -58,7 +58,7 @@ public class OpenroadmInventoryInput { // public methods public Inventory getInventoryData(Uint32 treeLevel) { InventoryBuilder inventoryBuilder = new InventoryBuilder(); - log.info("Info for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue()); + log.debug("Info for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue()); Info info = this.openRoadmDevice.getInfo(); inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()) .setUuid(info.getNodeId() == null ? NOT_AVAILABLE : info.getNodeId().getValue()) @@ -68,13 +68,14 @@ public class OpenroadmInventoryInput { .setVersion(info.getOpenroadmVersion() != null ? info.getOpenroadmVersion().getName() : null) .setDescription("org-openroadm-device").setParentUuid("None").setTypeName(info.getNodeType().getName()) .setPartTypeId("device"); - log.info("Inventory data written for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue()); + log.debug("Inventory data written for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue()); return inventoryBuilder.build(); } public Inventory getShelvesInventory(Shelves shelf, Uint32 treeLevel) { InventoryBuilder inventoryBuilder = new InventoryBuilder(); - inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setId(shelf.getShelfName()) + inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()) + .setId(this.accessor.getNodeId().getValue() + "/" + shelf.getShelfName()) .setDescription((shelf.getUserDescription() == null) ? ("Position: " + shelf.getShelfPosition() + "\nState: " + shelf.getOperationalState()) : (shelf.getUserDescription()) + "\nPosition: " + shelf.getShelfPosition() + "\nState: " @@ -85,28 +86,29 @@ public class OpenroadmInventoryInput { .setManufacturerIdentifier(shelf.getVendor()).setModelIdentifier(shelf.getModel()) .setVersion(shelf.getHardwareVersion()) .setDate(shelf.getManufactureDate() != null ? shelf.getManufactureDate().getValue() : NOT_AVAILABLE); - log.info("Inventory data written for Shelf {}", shelf.getShelfName()); + log.debug("Inventory data written for Shelf {}", shelf.getShelfName()); return inventoryBuilder.build(); } public Inventory getInterfacesInventory(Interface deviceInterface, Uint32 treeLevel) { InventoryBuilder inventoryBuilder = new InventoryBuilder(); - inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setId(deviceInterface.getName()) + inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()) + .setId(this.accessor.getNodeId().getValue() + "/" + deviceInterface.getName()) .setDescription( (deviceInterface.getDescription() == null) ? NOT_AVAILABLE : deviceInterface.getDescription()) .setUuid(deviceInterface.getName()).setSerial(deviceInterface.getName()) .setParentUuid((deviceInterface.getSupportingCircuitPackName() != null) ? deviceInterface.getSupportingCircuitPackName() - // : ((deviceInterface.getSupportingInterface() != null) ? deviceInterface.getSupportingInterface() + // : ((deviceInterface.getSupportingInterface() != null) ? + // deviceInterface.getSupportingInterface() : this.openRoadmDevice.getInfo().getNodeId().getValue()) .setTreeLevel(treeLevel) .setTypeName((deviceInterface.getType() == null) ? "Interface" - : deviceInterface.getType().getName().substring(69, - deviceInterface.getType().getName().length())) + : deviceInterface.getType().getClass().getSimpleName()) .setPartTypeId("Interface").setManufacturerIdentifier(this.openRoadmDevice.getInfo().getVendor()) .setModelIdentifier(this.openRoadmDevice.getInfo().getModel()).setVersion("N/A") .setDate(this.openRoadmDevice.getInfo().getCurrentDatetime().getValue()); - log.info("Inventory data written for Interface {}", deviceInterface.getName()); + log.debug("Inventory data written for Interface {}", deviceInterface.getName()); return inventoryBuilder.build(); } @@ -116,8 +118,9 @@ public class OpenroadmInventoryInput { inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setUuid(circuitPack.getCircuitPackName()) .setDate((circuitPack.getManufactureDate() == null) ? NOT_AVAILABLE : circuitPack.getManufactureDate().getValue().substring(0, 19)) - .setId(circuitPack.getCircuitPackName()).setManufacturerIdentifier(circuitPack.getVendor()) - .setModelIdentifier(circuitPack.getModel()).setSerial(circuitPack.getSerialId()).setTreeLevel(treeLevel) + .setId(this.accessor.getNodeId().getValue() + "/" + circuitPack.getCircuitPackName()) + .setManufacturerIdentifier(circuitPack.getVendor()).setModelIdentifier(circuitPack.getModel()) + .setSerial(circuitPack.getSerialId()).setTreeLevel(treeLevel) .setVersion(circuitPack.getHardwareVersion()) .setDescription("ProductCode: " + circuitPack.getProductCode() + " " + "Mode: " + circuitPack.getCircuitPackMode()) @@ -127,14 +130,15 @@ public class OpenroadmInventoryInput { ? circuitPack.getParentCircuitPack().getCircuitPackName() : ((circuitPack.getShelf() != null) ? circuitPack.getShelf() : this.openRoadmDevice.getInfo().getNodeId().getValue())); - log.info("Inventory data written for CircuitPack {}", circuitPack.getCircuitPackName()); + log.debug("Inventory data written for CircuitPack {}", circuitPack.getCircuitPackName()); return inventoryBuilder.build(); } public Inventory getXponderInventory(Xponder xpdr, Uint32 treeLevel) { InventoryBuilder inventoryBuilder = new InventoryBuilder(); - inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setId(xpdr.getXpdrNumber().toString()) + inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()) + .setId(this.accessor.getNodeId().getValue() + "/" + xpdr.getXpdrNumber().toString()) .setDescription("Xponder\nLifecycleState: " + xpdr.getLifecycleState().getName()) .setUuid(xpdr.getXpdrNumber().toString()).setSerial(xpdr.getXpdrNumber().toString()) .setParentUuid(this.openRoadmDevice.getInfo().getNodeId().getValue()).setTreeLevel(treeLevel) @@ -143,7 +147,7 @@ public class OpenroadmInventoryInput { .setModelIdentifier(this.openRoadmDevice.getInfo().getModel()) .setVersion(this.openRoadmDevice.getInfo().getOpenroadmVersion().getName()) .setDate(this.openRoadmDevice.getInfo().getCurrentDatetime().getValue()); - log.info("Inventory data written for Xponder{}", xpdr.getXpdrNumber()); + log.debug("Inventory data written for Xponder{}", xpdr.getXpdrNumber()); return inventoryBuilder.build(); } diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElement.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElement.java index 2a22e1e9d..e4201bc44 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElement.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElement.java @@ -85,7 +85,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { super(netconfAccess, serviceProvider); - LOG.info("Create {}", OpenroadmNetworkElement.class.getSimpleName()); + LOG.debug("Create {}", OpenroadmNetworkElement.class.getSimpleName()); this.openRdmListenerRegistrationResult = null; this.openRdmListener = new OpenroadmChangeNotificationListener(netconfAccessor, databaseService, serviceProvider.getWebsocketService()); @@ -98,7 +98,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { this.shelfProvisionedcircuitPacks = new Hashtable<>(); this.openRoadmPmData = new PmDataBuilderOpenRoadm(this.netconfAccessor); this.initialAlarmReader = new InitialDeviceAlarmReader(this.netconfAccessor, serviceProvider); - LOG.info("NodeId {}", this.netconfAccessor.getNodeId().getValue()); + LOG.debug("NodeId {}", this.netconfAccessor.getNodeId().getValue()); } @@ -109,7 +109,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { OrgOpenroadmDevice device = readDevice(this.netconfAccessor); this.opnRdmInventoryInput = new OpenroadmInventoryInput(this.netconfAccessor, device); - LOG.info("openroadmMapper details{}", this.opnRdmInventoryInput.getClass().getName()); + LOG.debug("openroadmMapper details{}", this.opnRdmInventoryInput.getClass().getName()); List<Inventory> inventoryList = new ArrayList<>(); inventoryList.add(this.opnRdmInventoryInput.getInventoryData(Uint32.valueOf(EQUIPMENTLEVEL_BASE))); readShelvesData(inventoryList, device); @@ -124,12 +124,12 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { pmDataEntity = this.openRoadmPmData.buildPmDataEntity(this.openRoadmPmData.getPmData(this.netconfAccessor)); if (!pmDataEntity.isEmpty()) { this.databaseService.doWritePerformanceData(pmDataEntity); - LOG.info("PmDatEntity is written with size {}", pmDataEntity.size()); + LOG.debug("PmDatEntity is written with size {}", pmDataEntity.size()); for (PmdataEntity ent : pmDataEntity) { - LOG.info("GetNode: {}, granPeriod: {}", ent.getNodeName(), ent.getGranularityPeriod().getName()); + LOG.debug("GetNode: {}, granPeriod: {}", ent.getNodeName(), ent.getGranularityPeriod().getName()); } } else { - LOG.info("PmDatEntity is empty"); + LOG.debug("PmDatEntity is empty"); } } @@ -148,7 +148,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { netconfAccessor.registerNotificationsStream(NetconfAccessor.DefaultNotificationsStream); } else { - LOG.info("device {} does not support netconf notification", netconfAccessor.getNodeId().getValue()); + LOG.debug("device {} does not support netconf notification", netconfAccessor.getNodeId().getValue()); } } @@ -172,7 +172,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { Collection<Shelves> shelves = YangHelper.getCollection(device.getShelves()); if (shelves != null) { for (Shelves shelf : shelves) { - LOG.info( + LOG.debug( "Shelf Name: {}, \n Serial Id:{}, \n Product Code;{}, \n Position:{}, \n EquipmetState: {}, \n Hardware version: {}" + "\n ShelfType:{}, \n Vendor: {}, \n LifecycleState: {} ", shelf.getShelfName(), shelf.getSerialId(), shelf.getProductCode(), shelf.getShelfPosition(), @@ -187,13 +187,13 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { this.shelfProvisionedcircuitPacks.put(slot.getProvisionedCircuitPack(), EQUIPMENTLEVEL_BASE + 2); } - LOG.info("Slots for the shelf: {}", shelf.getShelfName()); - LOG.info("\n Slot Name: {}, \n Status: {}, \n Slot label: {} ", slot.getSlotName(), + LOG.debug("Slots for the shelf: {}", shelf.getShelfName()); + LOG.debug("\n Slot Name: {}, \n Status: {}, \n Slot label: {} ", slot.getSlotName(), slot.getSlotStatus(), slot.getLabel()); } } } - LOG.info("size of shelfProvisionedcircuitPacks: {} ", shelfProvisionedcircuitPacks.size()); + LOG.debug("size of shelfProvisionedcircuitPacks: {} ", shelfProvisionedcircuitPacks.size()); } } @@ -206,7 +206,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { inventoryList.add(this.opnRdmInventoryInput.getXponderInventory(xponder, Uint32.valueOf(EQUIPMENTLEVEL_BASE + 1))); - LOG.info("Xponders: No.: {} , \n Port: {} ,\n Type: {}", xponder.getXpdrNumber(), xponder.getXpdrPort(), + LOG.debug("Xponders: No.: {} , \n Port: {} ,\n Type: {}", xponder.getXpdrNumber(), xponder.getXpdrPort(), xponder.getXpdrType()); Collection<XpdrPort> xpdrportlist = YangHelper.getCollection(xponder.getXpdrPort()); if (xpdrportlist != null) { @@ -214,7 +214,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { if (xpdrport.getCircuitPackName() != null) { this.shelfProvisionedcircuitPacks.put(xpdrport.getCircuitPackName(), EQUIPMENTLEVEL_BASE + 2); - LOG.info("Size of dict{}", this.shelfProvisionedcircuitPacks.size()); + LOG.debug("Size of dict{}", this.shelfProvisionedcircuitPacks.size()); } } @@ -233,11 +233,11 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { } for (CircuitPacks cp : circuitpackCollection) { - LOG.info("CP Name:{}", cp.getCircuitPackName()); + LOG.debug("CP Name:{}", cp.getCircuitPackName()); if (cp.getParentCircuitPack() == null && !this.shelfProvisionedcircuitPacks.containsKey(cp.getCircuitPackName())) { - LOG.info("cp has no parent and no shelf"); + LOG.debug("cp has no parent and no shelf"); this.circuitPacksRecord.put(cp.getCircuitPackName(), (EQUIPMENTLEVEL_BASE + 1)); inventoryList.add(this.opnRdmInventoryInput.getCircuitPackInventory(cp, Uint32.valueOf(EQUIPMENTLEVEL_BASE + 1))); @@ -246,7 +246,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { if (cp.getParentCircuitPack().getCpSlotName() != null && cp.getParentCircuitPack().getCircuitPackName() == null) { - LOG.info("Cp {} has slotname of the parent circuit pack but no parent circuit pack name", + LOG.debug("Cp {} has slotname of the parent circuit pack but no parent circuit pack name", cp.getCircuitPackName()); this.circuitPacksRecord.put(cp.getCircuitPackName(), (EQUIPMENTLEVEL_BASE + 3)); inventoryList.add(this.opnRdmInventoryInput.getCircuitPackInventory(cp, @@ -258,7 +258,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { } else if (cp.getParentCircuitPack().getCircuitPackName() != null && this.shelfProvisionedcircuitPacks .containsKey(cp.getParentCircuitPack().getCircuitPackName())) { - LOG.info("Cp {} has parent circuit pack and shelf", cp.getCircuitPackName()); + LOG.debug("Cp {} has parent circuit pack and shelf", cp.getCircuitPackName()); this.circuitPacksRecord.put(cp.getCircuitPackName(), (EQUIPMENTLEVEL_BASE + 3)); inventoryList.add(this.opnRdmInventoryInput.getCircuitPackInventory(cp, Uint32.valueOf(EQUIPMENTLEVEL_BASE + 3))); @@ -271,7 +271,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { .setId(cp.getParentCircuitPack().getCpSlotName()).build()); } - LOG.info("Cp has parent circuit pack but no shelf or a shelf but no parent circuit pack"); + LOG.debug("Cp has parent circuit pack but no shelf or a shelf but no parent circuit pack"); this.circuitPacksRecord.put(cp.getCircuitPackName(), (EQUIPMENTLEVEL_BASE + 2)); inventoryList.add(this.opnRdmInventoryInput.getCircuitPackInventory(cp, Uint32.valueOf(EQUIPMENTLEVEL_BASE + 2))); @@ -287,12 +287,12 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { Collection<Interface> interfaceList = YangHelper.getCollection(device.getInterface()); if (interfaceList != null) { for (Interface deviceInterface : interfaceList) { - LOG.info("\n InterfaceName: {}", deviceInterface.getName()); - LOG.info("Supporting CP {}", this.circuitPacksRecord.size()); + LOG.debug("\n InterfaceName: {}", deviceInterface.getName()); + LOG.debug("Supporting CP {}", this.circuitPacksRecord.size()); for (String s : this.circuitPacksRecord.keySet()) { - LOG.info("{} value {}", s, this.circuitPacksRecord.get(s)); + LOG.debug("{} value {}", s, this.circuitPacksRecord.get(s)); } - LOG.info("Interface {} and their supporting CP {}", deviceInterface.getName(), + LOG.debug("Interface {} and their supporting CP {}", deviceInterface.getName(), deviceInterface.getSupportingCircuitPackName()); if (deviceInterface.getSupportingCircuitPackName() != null) { if (this.circuitPacksRecord.containsKey(deviceInterface.getSupportingCircuitPackName())) { diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElementFactory.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElementFactory.java index 04b6b2ae1..60ece0780 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElementFactory.java @@ -51,7 +51,7 @@ public class OpenroadmNetworkElementFactory implements NetworkElementFactory { if (accessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)) { log.info("Create OpenRoadm device {} ", OpenroadmNetworkElement.class.getName()); - log.info("Node Id read by Acessor {}:", accessor.getNodeId().getValue()); + log.debug("Node Id read by Acessor {}:", accessor.getNodeId().getValue()); Optional<NetconfBindingAccessor> bindingAccessor = accessor.getNetconfBindingAccessor(); if (bindingAccessor.isPresent()) { return Optional.of(new OpenroadmNetworkElement(bindingAccessor.get(), serviceProvider)); diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/PmDataBuilderOpenRoadm.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/PmDataBuilderOpenRoadm.java index 658c507cd..b58eb1dd4 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/PmDataBuilderOpenRoadm.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/PmDataBuilderOpenRoadm.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Map; import org.onap.ccsdk.features.sdnr.wt.common.YangHelper; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev200529.HistoricalPmList; import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev200529.historical.pm.group.HistoricalPm; @@ -84,7 +85,7 @@ public class PmDataBuilderOpenRoadm { // Read PM data public HistoricalPmList getPmData(NetconfBindingAccessor accessor) { final Class<HistoricalPmList> pmDataClass = HistoricalPmList.class; - log.info("Get PM data for element {}", accessor.getNodeId().getValue()); + log.debug("Get PM data for element {}", accessor.getNodeId().getValue()); InstanceIdentifier<HistoricalPmList> pmDataIid = InstanceIdentifier.builder(pmDataClass).build(); return accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, pmDataIid); @@ -103,19 +104,19 @@ public class PmDataBuilderOpenRoadm { pmDataBuilder.setUuidInterface(pmDataEntry.getPmResourceType().getName()); Collection<HistoricalPm> historicalPmList = YangHelper.getCollection(pmDataEntry.getHistoricalPm()); for (HistoricalPm historicalPm : historicalPmList) { - log.info("PmName:{}", historicalPm.getType()); + log.debug("PmName:{}", historicalPm.getType()); // pmDataBuilder.setPerformanceData(value) try { writeperformanceData(historicalPm); } catch (ClassNotFoundException e) { - log.info("No relevant data found"); + log.debug("No relevant data found"); } pmEntitiyList.add(this.pmDataBuilder.build()); - log.info("PmListSize before db writing: {}", pmEntitiyList.size()); + log.debug("PmListSize before db writing: {}", pmEntitiyList.size()); } - log.info("PmListSize before db writing: {}", pmEntitiyList.size()); + log.debug("PmListSize before db writing: {}", pmEntitiyList.size()); } return pmEntitiyList; } @@ -181,10 +182,10 @@ public class PmDataBuilderOpenRoadm { List<Class<? extends PerformanceMeasurementTypeId>> measTypeObjList = new ArrayList<>(); URL root = Thread.currentThread().getContextClassLoader().getResource(packageName1); - log.info("path for type package: {}", root); + log.debug("path for type package: {}", root); Enumeration<URL> results = getFileURL(b, packageName); - log.info("FOund Packages {}", results); + log.debug("FOund Packages {}", results); if (results != null) { while (results.hasMoreElements()) { URL path = results.nextElement(); @@ -197,7 +198,7 @@ public class PmDataBuilderOpenRoadm { } if (cls1 != null) { - log.info("Class Added {}", cls1.getSimpleName()); + log.debug("Class Added {}", cls1.getSimpleName()); } } @@ -208,31 +209,24 @@ public class PmDataBuilderOpenRoadm { return measTypeObjList; } - private Class<? extends PerformanceMeasurementUnitId> setMeasurementUnit(String unitName) { - Class<? extends PerformanceMeasurementUnitId> measurementUnitClass = null; + private PerformanceMeasurementUnitId setMeasurementUnit(String unitName) { switch (unitName) { case ("celsius"): - measurementUnitClass = Celsius.class; - break; + return Celsius.VALUE; case ("dB"): - measurementUnitClass = DB.class; - break; + return DB.VALUE; case ("dBm"): - measurementUnitClass = DBm.class; - break; + return DBm.VALUE; case ("fahrenheit"): - measurementUnitClass = Fahrenheit.class; - break; + return Fahrenheit.VALUE; case ("kHz"): - measurementUnitClass = KHz.class; - break; + return KHz.VALUE; case ("mW"): - measurementUnitClass = MW.class; - break; + return MW.VALUE; default: break; } - return measurementUnitClass; + return null; } private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.Measurement measurementBuilder( @@ -240,13 +234,13 @@ public class PmDataBuilderOpenRoadm { MeasurementBuilder measBuilder = new MeasurementBuilder(); if (pmType.getName().equals("erroredSeconds")) { - measBuilder.setPmKey(ErroredSecond.class); + measBuilder.setPmKey(ErroredSecond.VALUE); } else if (pmType.getName().equals("severelyErroredSeconds")) { - measBuilder.setPmKey(SeverelyErroredSecond.class); + measBuilder.setPmKey(SeverelyErroredSecond.VALUE); } else { for (Class<? extends PerformanceMeasurementTypeId> obj : setMeasurementTypeId()) { if (obj.toString().contains(pmType.name())) { - measBuilder.setPmKey(obj); + measBuilder.setPmKey(YangToolsMapperHelper.getIdentityValueFromClass(obj)); } } } @@ -262,7 +256,7 @@ public class PmDataBuilderOpenRoadm { try { return bundle.loadClass(className); } catch (Exception e) { - log.info(String.format("Class [%s] could not be loaded. Message: [%s].", className, e.getMessage())); + log.debug(String.format("Class [%s] could not be loaded. Message: [%s].", className, e.getMessage())); } return null; } @@ -271,15 +265,15 @@ public class PmDataBuilderOpenRoadm { BundleContext context = b == null ? null : b.getBundleContext(); if (context == null) { - log.info("no bundle context available"); + log.debug("no bundle context available"); return null; } Bundle[] bundles = context.getBundles(); if (bundles == null || bundles.length <= 0) { - log.info("no bundles found"); + log.debug("no bundles found"); return null; } - log.info("found {} bundles", bundles.length); + log.debug("found {} bundles", bundles.length); Enumeration<URL> resultUrl = null; for (Bundle bundle : bundles) { diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev200327/PmDataTypeBuilder.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev200327/PmDataTypeBuilder.java deleted file mode 100644 index f470fb6ba..000000000 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev200327/PmDataTypeBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev200327; -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. - * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). - * - * The reason behind putting it under src/main/java is: - * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent - * loss of user code. - * - */ -public class PmDataTypeBuilder { - private PmDataTypeBuilder() { - //Exists only to defeat instantiation. - } - - public static PmDataType getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmNetworkElement.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmNetworkElement.java index a018df739..7ebb3af2e 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmNetworkElement.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmNetworkElement.java @@ -85,10 +85,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.common.Uint16; -import org.opendaylight.yangtools.yang.common.Uint32; -import org.opendaylight.yangtools.yang.common.Uint64; -import org.opendaylight.yangtools.yang.common.Uint8; +import org.opendaylight.yangtools.yang.common.*; public class TestOpenRoadmNetworkElement { @@ -268,7 +265,7 @@ public class TestOpenRoadmNetworkElement { Measurement measurement = mock(Measurement.class); PmDataType pmDataType = mock(PmDataType.class); - when(pmDataType.getUint64()).thenReturn(Uint64.valueOf(2425425)); + when(pmDataType.getDecimal64()).thenReturn(Decimal64.valueOf(1,2425425)); when(measurement.getBinNumber()).thenReturn(Uint16.valueOf(1452)); when(measurement.getCompletionTime()).thenReturn(new DateAndTime("2018-10-22T15:23:43Z")); when(measurement.getGranularity()).thenReturn(PmGranularity._24Hour); diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmPMDataBuilder.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmPMDataBuilder.java index 49585acb2..cfeca1342 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmPMDataBuilder.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmPMDataBuilder.java @@ -64,6 +64,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument; +import org.opendaylight.yangtools.yang.common.Decimal64; import org.opendaylight.yangtools.yang.common.Uint16; import org.opendaylight.yangtools.yang.common.Uint64; @@ -79,7 +80,7 @@ public class TestOpenRoadmPMDataBuilder { private NodeId nodeId = new NodeId("RoadmA"); private HistoricalPmList historicalPmDatalist = mock(HistoricalPmList.class); private HistoricalPm historicalPm = mock(HistoricalPm.class); - private PmDataType pmDataType = new PmDataType(Uint64.valueOf(67508)); + private PmDataType pmDataType = new PmDataType(Decimal64.valueOf(1,67508)); private MeasurementBuilder measurementBuilder = new MeasurementBuilder(); private HistoricalPmBuilder historicalPmBuilder = new HistoricalPmBuilder(); private HistoricalPmEntryBuilder historicalPmEntryBuiler = new HistoricalPmEntryBuilder(); |