import org.slf4j.LoggerFactory;
/**
- * Responsible class for documenting changes in the ODL itself. The occurence of such an event is
- * documented in the database and to clients. Specific example here is the registration or
- * deregistration of a netconf device. This service has an own eventcounter to apply to the ONF
- * Coremodel netconf behaviour.
+ * Responsible class for documenting changes in the ODL itself. The occurence of such an event is documented in the
+ * database and to clients. Specific example here is the registration or deregistration of a netconf device. This
+ * service has an own eventcounter to apply to the ONF Coremodel netconf behaviour.
*
* Important: Websocket notification must be the last action.
*
/**
* A registration of a mountpoint occured, that is in connect state
+ *
* @param registrationName of device (mountpoint name)
* @param nNode with mountpoint data
*/
@Override
public void registration(String registrationName, NetconfNode nNode) {
- ObjectCreationNotificationXml cNotificationXml =
- new ObjectCreationNotificationXml(ownKeyName, popEvntNumber(),
- InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName);
- NetworkElementConnectionEntity e = NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode);
+ ObjectCreationNotificationXml cNotificationXml = new ObjectCreationNotificationXml(ownKeyName, popEvntNumber(),
+ InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName);
+ NetworkElementConnectionEntity e =
+ NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode);
LOG.debug("registration networkelement-connection for {} with status {}", registrationName, e.getStatus());
// Write first to prevent missing entries
/**
* mountpoint created, connection state not connected
- * @param mountpointNodeName uuid that is nodeId or mountpointId
- * @param netconfNode
- */
- public void mountpointCreatedIndication(String mountpointNodeName, NetconfNode netconfNode) {
- LOG.debug("mountpoint create indication for {}", mountpointNodeName);
- this.registration(mountpointNodeName, netconfNode);
- }
+ *
+ * @param mountpointNodeName uuid that is nodeId or mountpointId
+ * @param netconfNode
+ */
+ public void mountpointCreatedIndication(String mountpointNodeName, NetconfNode netconfNode) {
+ LOG.debug("mountpoint create indication for {}", mountpointNodeName);
+ this.registration(mountpointNodeName, netconfNode);
+ }
+
/**
* After registration
+ *
* @param mountpointNodeName uuid that is nodeId or mountpointId
* @param deviceType according to assessement
*/
public void connectIndication(String mountpointNodeName, NetworkElementDeviceType deviceType) {
// Write first to prevent missing entries
- LOG.debug("updating networkelement-connection devicetype for {} with {}",mountpointNodeName, deviceType);
- NetworkElementConnectionEntity e = NetworkElementConnectionEntitiyUtil.getNetworkConnectionDeviceTpe(deviceType);
+ LOG.debug("updating networkelement-connection devicetype for {} with {}", mountpointNodeName, deviceType);
+ NetworkElementConnectionEntity e =
+ NetworkElementConnectionEntitiyUtil.getNetworkConnectionDeviceTpe(deviceType);
databaseService.updateNetworkConnectionDeviceType(e, mountpointNodeName);
AttributeValueChangedNotificationXml notificationXml = new AttributeValueChangedNotificationXml(ownKeyName,
- popEvntNumber(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()),
- mountpointNodeName, "deviceType", deviceType.name());
+ popEvntNumber(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), mountpointNodeName,
+ "deviceType", deviceType.name());
webSocketService.sendViaWebsockets(mountpointNodeName, notificationXml);
}
/**
* mountpoint state changed
- * @param mountpointNodeName
- * @param netconfNode
- */
- public void onStateChangeIndication(String mountpointNodeName, NetconfNode netconfNode) {
- LOG.debug("mountpoint state changed indication for {}", mountpointNodeName);
- ConnectionStatus csts = netconfNode.getConnectionStatus();
- this.updateRegistration(mountpointNodeName, ConnectionStatus.class.getSimpleName(),
+ *
+ * @param mountpointNodeName
+ * @param netconfNode
+ */
+ public void onStateChangeIndication(String mountpointNodeName, NetconfNode netconfNode) {
+ LOG.debug("mountpoint state changed indication for {}", mountpointNodeName);
+ ConnectionStatus csts = netconfNode.getConnectionStatus();
+ this.updateRegistration(mountpointNodeName, ConnectionStatus.class.getSimpleName(),
csts != null ? csts.getName() : "null", netconfNode);
-
- }
+
+ }
+
/**
* A deregistration of a mountpoint occured.
+ *
* @param registrationName Name of the event that is used as key in the database.
*/
@Override
public void deRegistration(String registrationName) {
- ObjectDeletionNotificationXml dNotificationXml =
- new ObjectDeletionNotificationXml(ownKeyName, popEvntNumber(),
- InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName);
+ ObjectDeletionNotificationXml dNotificationXml = new ObjectDeletionNotificationXml(ownKeyName, popEvntNumber(),
+ InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName);
// Write first to prevent missing entries
databaseService.removeNetworkConnection(registrationName);
/**
* Mountpoint state changed .. from connected -> connecting or unable-to-connect or vis-e-versa.
+ *
* @param registrationName Name of the event that is used as key in the database.
*/
@Override
- public void updateRegistration(String registrationName, String attribute, String attributeNewValue, NetconfNode nNode) {
+ public void updateRegistration(String registrationName, String attribute, String attributeNewValue,
+ NetconfNode nNode) {
AttributeValueChangedNotificationXml notificationXml = new AttributeValueChangedNotificationXml(ownKeyName,
- popEvntNumber(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()),
- registrationName, attribute, attributeNewValue);
- NetworkElementConnectionEntity e = NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode);
+ popEvntNumber(), InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp()), registrationName,
+ attribute, attributeNewValue);
+ NetworkElementConnectionEntity e =
+ NetworkElementConnectionEntitiyUtil.getNetworkConnection(registrationName, nNode);
LOG.debug("updating networkelement-connection for {} with status {}", registrationName, e.getStatus());
databaseService.updateNetworkConnection22(e, registrationName);
LOG.debug("Got startComplete");
EventlogBuilder eventlogBuilder = new EventlogBuilder();
eventlogBuilder.setNodeId(ownKeyName).setTimestamp(new DateAndTime(NETCONFTIME_CONVERTER.getTimeStamp()))
- .setObjectId(objectId).setAttributeName(msg).setNewValue(value).setCounter(popEvntNumber())
- .setSourceType(SourceType.Controller);
+ .setObjectId(objectId).setAttributeName(msg).setNewValue(value).setCounter(popEvntNumber())
+ .setSourceType(SourceType.Controller);
databaseService.writeEventLog(eventlogBuilder.build());
}
return eventNumber++;
}
-
-
}