diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2021-05-18 09:47:00 +0530 |
---|---|---|
committer | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2021-05-18 09:52:24 +0530 |
commit | caaf7cf0edd7c605c9d57c0470806d2a13ebe773 (patch) | |
tree | c9c5ac7474aa5b19243b9f57d54172f06d5cb0aa /sdnr | |
parent | c8b3f59b0bc308e9b715ce88ac83d67959dc112d (diff) |
Fix nullPointerException
IPv4/IPv6 addresses can be used as mountpoint addresses for reporting state changes
Issue-ID: CCSDK-3308
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: I8fda8297a15998a293dbd13da084e4ef2c369705
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr')
4 files changed, 19 insertions, 11 deletions
diff --git a/sdnr/wt/mountpoint-state-provider/installer/pom.xml b/sdnr/wt/mountpoint-state-provider/installer/pom.xml index 0ad724e73..2da73f060 100755 --- a/sdnr/wt/mountpoint-state-provider/installer/pom.xml +++ b/sdnr/wt/mountpoint-state-provider/installer/pom.xml @@ -47,7 +47,7 @@ <dependencies> <dependency> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <groupId>${project.groupId}</groupId> <artifactId>${application.name}-feature</artifactId> <version>${project.version}</version> <type>xml</type> @@ -60,7 +60,7 @@ </exclusions> </dependency> <dependency> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <groupId>${project.groupId}</groupId> <artifactId>${application.name}-provider</artifactId> <version>${project.version}</version> </dependency> diff --git a/sdnr/wt/mountpoint-state-provider/provider/pom.xml b/sdnr/wt/mountpoint-state-provider/provider/pom.xml index fc6d7e07e..6323b85c1 100644 --- a/sdnr/wt/mountpoint-state-provider/provider/pom.xml +++ b/sdnr/wt/mountpoint-state-provider/provider/pom.xml @@ -61,19 +61,19 @@ </dependency> <!-- end for testing --> <dependency> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <groupId>${project.groupId}</groupId> <artifactId>sdnr-wt-common</artifactId> <version>${project.version}</version> <scope>provided</scope> </dependency> <dependency> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> - <artifactId>sdnr-wt-devicemanager-model</artifactId> + <groupId>${project.groupId}</groupId> + <artifactId>sdnr-wt-devicemanager-core-model</artifactId> <version>${project.version}</version> <scope>provided</scope> </dependency> <dependency> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <groupId>${project.groupId}</groupId> <artifactId>sdnr-wt-netconfnode-state-service-model</artifactId> <version>${project.version}</version> </dependency> 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()); |