This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Replace IPv4 with IPv6 addresses for monitored nodes

I think that the time has come and we shall be considering transitioning from IPv4 to IPv6. Below SQL query will help you do that within no time, assuming you have working IPv6 infrastructure with IPv6 addresses assigned to devices. The script will simply replace existing IPv4 addresses for selected nodes (check variable: @NLimit) with their IPv6 addresses matching pattern (check variable: @IPv6).

In the example below I have used IPv6 range of addresses in our lab (2002:aa0:205:/48) as well as run it against nodes which have custom property NODE_FUNCTION set to INFRASTRUCTURE.

Based on the experiment conducted (Orion Platform 2018.2 HF3) addresses can be updated on the live system without shutting down and affecting services.

Warning:

     Always make sure to have database backed up before attempting any changes.

--
-- Author:     
-- Create date: 11/09/2018
-- Description: Update/replace nodes' polling address with first IPv6 address
--              matching the pattern and available on the node
--

DECLARE @IPv6 VARCHAR(50) -- IPv6 address pattern
--
-- EXAMPLES:
--
-- 1. full /64 range
--    2001:dead:beef:cafe:
--
-- 2. partial range
--    2002:beef:
--

DECLARE @NLimit TABLE(NodeID int) -- nodes limitation
--
-- EXMPLES:
--
-- INSERT INTO @NLimit(NodeID) ...
---
-- 1. custom property NODE_FUNCTION and value INFRASTRUCTURE
--    SELECT NodeID FROM NodesCustomProperties WHERE NODE_FUNCTION='INFRASTRUCTURE'
--
-- 2. node caption starting with SUP-COR
--    SELECT NodeID FROM NodesData WHERE Captrion LIKE 'SUP-COR%'
--
-- 3. ALL NODES
--    SELECT NodeID FROM NodesData
--

-- SET BELOW AS REQUIRED
SET @IPv6 = '2002:aa0:205:'
INSERT INTO @NLimit(NodeID) SELECT NodeID FROM NodesCustomProperties WHERE NODE_FUNCTION='INFRASTRUCTURE'


-- DO NOT MAKE ANY CHANGES BELOW
UPDATE NodesData
SET IP_Address =
(
SELECT TOP 1 NNN.IPAddress FROM
(SELECT NodeID, IPAddress FROM NodeIPAddresses WHERE IPAddress like @IPv6+'%' AND NodeID IN (SELECT * FROM @NLimit)) AS NNN
WHERE NNN.NodeID=NodesData.NodeID
)
, IP_Address_Type='IPv6'
WHERE NodeID IN
(
SELECT NodeID FROM NodeIPAddresses WHERE IPAddress like @IPv6+'%' AND NodeID IN (SELECT * FROM @NLimit)
)

Disclaimer: