* the License.
* ============LICENSE_END==========================================================================
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding;
-import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElementService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESPNFRegistrationFieldsPOJO;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.StreamKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.Hardware;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.Component;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfCapabilityChange;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfigChange;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfirmedCommit;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionEnd;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionStart;
import org.opendaylight.yang.gen.v1.urn.onap.system.rev201026.System1;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Guicutthrough;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory;
.augmentation(System1.class).build();
private final NetconfBindingAccessor netconfAccessor;
+ private final Optional<NetconfBindingAccessor> netconfAccessorOpt;
+
+ private final Optional<NetconfDomAccessor> netconfDomAccessor;
private final DataProvider databaseService;
private final ORanRegistrationToVESpnfRegistrationMapper mapper;
private final VESCollectorService vesCollectorService;
private ListenerRegistration<NotificationListener> oRanListenerRegistrationResult;
- private @NonNull final ORanChangeNotificationListener oRanListener;
+ //private @NonNull final ORanChangeNotificationListener oRanListener;
private ListenerRegistration<NotificationListener> oRanFaultListenerRegistrationResult;
private @NonNull final ORanFaultNotificationListener oRanFaultListener;
- ORanNetworkElement(NetconfBindingAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) {
+ //ORanNetworkElement(NetconfBindingAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) {
+ ORanNetworkElement(NetconfAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) {
LOG.info("Create {}", ORanNetworkElement.class.getSimpleName());
// Read parameters
- this.netconfAccessor = netconfAccess;
-
+ this.netconfAccessorOpt = netconfAccess.getNetconfBindingAccessor();
+ this.netconfAccessor = netconfAccessorOpt.get();
+ this.netconfDomAccessor = netconfAccess.getNetconfDomAccessor();
// Get services
this.databaseService = serviceProvider.getDataProvider();
this.vesCollectorService = serviceProvider.getVESCollectorService();
// Register callbacks
this.oRanListenerRegistrationResult = null;
- this.oRanListener = new ORanChangeNotificationListener(netconfAccessor, serviceProvider);
+ //this.oRanListener = new ORanChangeNotificationListener(netconfAccessor, serviceProvider);
this.oRanFaultListenerRegistrationResult = null;
this.oRanFaultListener = new ORanFaultNotificationListener(netconfAccessor, vesCollectorService,
serviceProvider.getFaultService(), serviceProvider.getWebsocketService(), databaseService);
+
}
private Collection<Component> initialReadFromNetworkElement() {
// Publish the mountpoint to VES if enabled
publishMountpointToVES(componentList);
// Register call back class for receiving notifications
- this.oRanListenerRegistrationResult = netconfAccessor.doRegisterNotificationListener(oRanListener);
+ //this.oRanListenerRegistrationResult = netconfAccessor.doRegisterNotificationListener(oRanListener);
this.oRanFaultListenerRegistrationResult = netconfAccessor.doRegisterNotificationListener(oRanFaultListener);
// Register notifications stream
- if (netconfAccessor.isNotificationsRFC5277Supported()) {
+ /*if (netconfAccessor.isNotificationsRFC5277Supported()) {
netconfAccessor.registerNotificationsStream();
- }
+ }*/
+
+ QName[] notifications = { NetconfConfigChange.QNAME, NetconfConfirmedCommit.QNAME,
+ NetconfSessionStart.QNAME, NetconfSessionEnd.QNAME, NetconfCapabilityChange.QNAME };
+ //netconfDomAccessor.get().doRegisterNotificationListener(new ORanDOMChangeNotificationListener(netconfDomAccessor.get(), databaseService), notifications);
+ // Output notification streams to LOG
+ Map<StreamKey, Stream> streams = netconfDomAccessor.get().getNotificationStreamsAsMap();
+ LOG.info("Available notifications streams: {}", streams);
+ // Register to default stream
+ netconfDomAccessor.get().invokeCreateSubscription();
}
@Override
// If the device supports subtended configuration then it is assumed that the
// Chassis containing the management interface will be the root component and
// there will be only one root.
- VESCommonEventHeaderPOJO header = mapper.mapCommonEventHeader(component);
+ /*VESCommonEventHeaderPOJO header = mapper.mapCommonEventHeader(component);
VESPNFRegistrationFieldsPOJO body = mapper.mapPNFRegistrationFields(component);
try {
vesCollectorService.publishVESMessage(vesCollectorService.generateVESEvent(header, body));
} catch (JsonProcessingException e) {
LOG.warn("Error while serializing VES Event to String ", e);
- e.printStackTrace();
- }
+ }*/
}
}
}