diff options
Diffstat (limited to 'sdnr/wt/mountpoint-state-provider/provider/src/main')
2 files changed, 13 insertions, 5 deletions
diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeConnectListenerImpl.java b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeConnectListenerImpl.java index 466d4f4ef..20487a300 100644 --- a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeConnectListenerImpl.java +++ b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeConnectListenerImpl.java @@ -25,6 +25,8 @@ import org.json.JSONObject; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeConnectListener; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateService; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.opendaylight.yangtools.concepts.ListenerRegistration; @@ -51,8 +53,10 @@ public class MountpointNodeConnectListenerImpl implements NetconfNodeConnectList NodeId nNodeId = accessor.getNodeId(); NetconfNode netconfNode = accessor.getNetconfNode(); + Ipv4Address ipv4Address = netconfNode.getHost().getIpAddress().getIpv4Address(); + Ipv6Address ipv6Address = netconfNode.getHost().getIpAddress().getIpv6Address(); LOG.debug("In onEnterConnected of MountpointNodeConnectListenerImpl - nNodeId = {}, IP Address = {}",nNodeId.getValue() - ,netconfNode.getHost().getIpAddress().getIpv4Address().getValue()); + ,ipv4Address != null?ipv4Address.getValue():ipv6Address.getValue()); JSONObject obj = new JSONObject(); obj.put(Constants.NODEID, nNodeId.getValue()); diff --git a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeStateListenerImpl.java b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeStateListenerImpl.java index 46b17eb15..ea5232d59 100644 --- a/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeStateListenerImpl.java +++ b/sdnr/wt/mountpoint-state-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointstateprovider/impl/MountpointNodeStateListenerImpl.java @@ -21,6 +21,8 @@ package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl; import org.json.JSONObject; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateListener; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateService; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.opendaylight.yangtools.concepts.ListenerRegistration; @@ -45,9 +47,10 @@ public class MountpointNodeStateListenerImpl implements NetconfNodeStateListener @Override public void onCreated(NodeId nNodeId, NetconfNode netconfNode) { - + Ipv4Address ipv4Address = netconfNode.getHost().getIpAddress().getIpv4Address(); + Ipv6Address ipv6Address = netconfNode.getHost().getIpAddress().getIpv6Address(); LOG.info("In onCreated of MountpointNodeStateListenerImpl - nNodeId = {}, IP Address = {}",nNodeId.getValue(), - netconfNode.getHost().getIpAddress().getIpv4Address().toString()); + ipv4Address != null?ipv4Address.getValue():ipv6Address.getValue()); JSONObject obj = new JSONObject(); obj.put(Constants.NODEID, nNodeId.getValue()); obj.put(Constants.NETCONFNODESTATE, netconfNode.getConnectionStatus().toString()); @@ -58,9 +61,10 @@ public class MountpointNodeStateListenerImpl implements NetconfNodeStateListener @Override public void onStateChange(NodeId nNodeId, NetconfNode netconfNode) { - + Ipv4Address ipv4Address = netconfNode.getHost().getIpAddress().getIpv4Address(); + Ipv6Address ipv6Address = netconfNode.getHost().getIpAddress().getIpv6Address(); LOG.info("In onStateChange of MountpointNodeStateListenerImpl - nNodeId = {}, IP Address = {}",nNodeId.getValue(), - netconfNode.getHost().getIpAddress().getIpv4Address().getValue()); + ipv4Address != null?ipv4Address.getValue():ipv6Address.getValue()); JSONObject obj = new JSONObject(); obj.put(Constants.NODEID, nNodeId.getValue()); obj.put(Constants.NETCONFNODESTATE, netconfNode.getConnectionStatus().toString()); |