From 05855d531b912698ee63b1fd9de4303baff83670 Mon Sep 17 00:00:00 2001 From: Bruno Sakoto Date: Tue, 20 Apr 2021 08:22:56 -0400 Subject: Implement db schema with liquibase Issue-ID: CPS-193 Signed-off-by: Bruno Sakoto Change-Id: Ieabee4b86bbe7a42c05bb225499487cfcc9deb1d --- .../resources/db/changelog/changelog-master.xml | 29 ++ .../resources/db/changelog/data/02-init-data.dat | 537 +++++++++++++++++++++ .../resources/db/changelog/data/02-init-data.xml | 51 ++ .../db/changelog/schema/01-init-schema.xml | 92 ++++ 4 files changed, 709 insertions(+) create mode 100644 src/main/resources/db/changelog/changelog-master.xml create mode 100644 src/main/resources/db/changelog/data/02-init-data.dat create mode 100644 src/main/resources/db/changelog/data/02-init-data.xml create mode 100644 src/main/resources/db/changelog/schema/01-init-schema.xml (limited to 'src/main/resources/db/changelog') diff --git a/src/main/resources/db/changelog/changelog-master.xml b/src/main/resources/db/changelog/changelog-master.xml new file mode 100644 index 0000000..630d399 --- /dev/null +++ b/src/main/resources/db/changelog/changelog-master.xml @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/src/main/resources/db/changelog/data/02-init-data.dat b/src/main/resources/db/changelog/data/02-init-data.dat new file mode 100644 index 0000000..338444b --- /dev/null +++ b/src/main/resources/db/changelog/data/02-init-data.dat @@ -0,0 +1,537 @@ +timestamp|dataspace|schema_set|anchor|version|payload +(select now())|NFP-Operational|cps-ran-schema-model|ran-network-simulation|(select now())|' +{ + "NearRTRIC": [ + { + "idNearRTRIC": "22", + "GNBCUUPFunction": [ + { + "idGNBCUUPFunction": "2222", + "attributes": { + "gNBId": 98763.0 + } + } + ], + "GNBDUFunction": [ + { + "idGNBDUFunction": "5", + "NRCellDU": [ + { + "idNRCellDU": "13910", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 13910.0 + } + }, + { + "idNRCellDU": "10897", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 10897.0 + } + }, + { + "idNRCellDU": "14656", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 14656.0 + } + }, + { + "idNRCellDU": "13905", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 13905.0 + } + }, + { + "idNRCellDU": "14655", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 14655.0 + } + } + ], + "attributes": { + "gNBDUId": 5.0, + "gNBDUName": "gnduserver5", + "gNBIdLength": 32.0 + } + }, + { + "idGNBDUFunction": "4", + "NRCellDU": [ + { + "idNRCellDU": "11569", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 11569.0 + } + }, + { + "idNRCellDU": "11568", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 11568.0 + } + }, + { + "idNRCellDU": "11561", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 11561.0 + } + }, + { + "idNRCellDU": "10896", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 10896.0 + } + }, + { + "idNRCellDU": "11562", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 11562.0 + } + } + ], + "attributes": { + "gNBDUId": 4.0, + "gNBDUName": "gnduserver4", + "gNBIdLength": 32.0 + } + }, + { + "idGNBDUFunction": "6", + "NRCellDU": [ + { + "idNRCellDU": "14427", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 14427.0 + } + }, + { + "idNRCellDU": "15361", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15361.0 + } + }, + { + "idNRCellDU": "15548", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15548.0 + } + }, + { + "idNRCellDU": "15360", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15360.0 + } + }, + { + "idNRCellDU": "15549", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15549.0 + } + } + ], + "attributes": { + "gNBDUId": 6.0, + "gNBDUName": "gnduserver6", + "gNBIdLength": 32.0 + } + } + ], + "GNBCUCPFunction": [ + { + "idGNBCUCPFunction": "cucpserver2", + "NRCellCU": [ + { + "idNRCellCU": "13910", + "attributes": { + "cellLocalId": 13910.0 + } + }, + { + "idNRCellCU": "14656", + "attributes": { + "cellLocalId": 14656.0 + } + }, + { + "idNRCellCU": "10897", + "attributes": { + "cellLocalId": 10897.0 + } + }, + { + "idNRCellCU": "14655", + "attributes": { + "cellLocalId": 14655.0 + } + }, + { + "idNRCellCU": "11561", + "attributes": { + "cellLocalId": 11561.0 + } + }, + { + "idNRCellCU": "11569", + "attributes": { + "cellLocalId": 11569.0 + } + }, + { + "idNRCellCU": "13905", + "attributes": { + "cellLocalId": 13905.0 + } + }, + { + "idNRCellCU": "15549", + "attributes": { + "cellLocalId": 15549.0 + } + }, + { + "idNRCellCU": "15361", + "attributes": { + "cellLocalId": 15361.0 + } + }, + { + "idNRCellCU": "15548", + "attributes": { + "cellLocalId": 15548.0 + } + }, + { + "idNRCellCU": "15360", + "attributes": { + "cellLocalId": 15360.0 + } + }, + { + "idNRCellCU": "14427", + "attributes": { + "cellLocalId": 14427.0 + } + }, + { + "idNRCellCU": "11562", + "attributes": { + "cellLocalId": 11562.0 + } + }, + { + "idNRCellCU": "11568", + "attributes": { + "cellLocalId": 11568.0 + } + }, + { + "idNRCellCU": "10896", + "attributes": { + "cellLocalId": 10896.0 + } + } + ], + "attributes": { + "gNBId": 98763.0, + "gNBCUName": "cucpserver2", + "gNBIdLength": 32.0 + } + } + ] + }, + { + "idNearRTRIC": "11", + "GNBCUUPFunction": [ + { + "idGNBCUUPFunction": "1111", + "attributes": { + "gNBId": 98763.0 + } + } + ], + "GNBDUFunction": [ + { + "idGNBDUFunction": "1", + "NRCellDU": [ + { + "idNRCellDU": "15289", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15289.0 + } + }, + { + "idNRCellDU": "15290", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15290.0 + } + }, + { + "idNRCellDU": "15689", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15689.0 + } + }, + { + "idNRCellDU": "15687", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15687.0 + } + }, + { + "idNRCellDU": "15296", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15296.0 + } + } + ], + "attributes": { + "gNBDUId": 1.0, + "gNBDUName": "gnduserver1", + "gNBIdLength": 32.0 + } + }, + { + "idGNBDUFunction": "2", + "NRCellDU": [ + { + "idNRCellDU": "15175", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15175.0 + } + }, + { + "idNRCellDU": "15176", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15176.0 + } + }, + { + "idNRCellDU": "15155", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15155.0 + } + }, + { + "idNRCellDU": "15825", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15825.0 + } + }, + { + "idNRCellDU": "15174", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15174.0 + } + } + ], + "attributes": { + "gNBDUId": 2.0, + "gNBDUName": "gnduserver2", + "gNBIdLength": 32.0 + } + }, + { + "idGNBDUFunction": "3", + "NRCellDU": [ + { + "idNRCellDU": "15826", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15826.0 + } + }, + { + "idNRCellDU": "15425", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15425.0 + } + }, + { + "idNRCellDU": "14000", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 14000.0 + } + }, + { + "idNRCellDU": "13999", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 13999.0 + } + }, + { + "idNRCellDU": "15426", + "attributes": { + "nRPCI": 12.0, + "nRTAC": 310.0, + "cellLocalId": 15426.0 + } + } + ], + "attributes": { + "gNBDUId": 3.0, + "gNBDUName": "gnduserver3", + "gNBIdLength": 32.0 + } + } + ], + "GNBCUCPFunction": [ + { + "idGNBCUCPFunction": "cucpserver1", + "NRCellCU": [ + { + "idNRCellCU": "15176", + "attributes": { + "cellLocalId": 15176.0 + } + }, + { + "idNRCellCU": "15296", + "attributes": { + "cellLocalId": 15296.0 + } + }, + { + "idNRCellCU": "15174", + "attributes": { + "cellLocalId": 15174.0 + } + }, + { + "idNRCellCU": "15290", + "attributes": { + "cellLocalId": 15290.0 + } + }, + { + "idNRCellCU": "15825", + "attributes": { + "cellLocalId": 15825.0 + } + }, + { + "idNRCellCU": "15689", + "attributes": { + "cellLocalId": 15689.0 + } + }, + { + "idNRCellCU": "15175", + "attributes": { + "cellLocalId": 15175.0 + } + }, + { + "idNRCellCU": "15426", + "attributes": { + "cellLocalId": 15426.0 + } + }, + { + "idNRCellCU": "15687", + "attributes": { + "cellLocalId": 15687.0 + } + }, + { + "idNRCellCU": "15826", + "attributes": { + "cellLocalId": 15826.0 + } + }, + { + "idNRCellCU": "14000", + "attributes": { + "cellLocalId": 14000.0 + } + }, + { + "idNRCellCU": "15425", + "attributes": { + "cellLocalId": 15425.0 + } + }, + { + "idNRCellCU": "15289", + "attributes": { + "cellLocalId": 15289.0 + } + }, + { + "idNRCellCU": "13999", + "attributes": { + "cellLocalId": 13999.0 + } + }, + { + "idNRCellCU": "15155", + "attributes": { + "cellLocalId": 15155.0 + } + } + ], + "attributes": { + "gNBId": 98763.0, + "gNBCUName": "cucpserver1", + "gNBIdLength": 32.0 + } + } + ] + } + ] +} +' diff --git a/src/main/resources/db/changelog/data/02-init-data.xml b/src/main/resources/db/changelog/data/02-init-data.xml new file mode 100644 index 0000000..24898ba --- /dev/null +++ b/src/main/resources/db/changelog/data/02-init-data.xml @@ -0,0 +1,51 @@ + + + + + + + Create initialization data + + + + + + + + + + + + dataspace = 'NFP-Operational' + and schema_set = 'cps-ran-schema-model' + and anchor ='ran-network-simulation' + + + + + + diff --git a/src/main/resources/db/changelog/schema/01-init-schema.xml b/src/main/resources/db/changelog/schema/01-init-schema.xml new file mode 100644 index 0000000..b10cd00 --- /dev/null +++ b/src/main/resources/db/changelog/schema/01-init-schema.xml @@ -0,0 +1,92 @@ + + + + + + + Create network data timescale table + + + + + + + + + + + + + + + + + + + + + + SELECT create_hypertable('network_data', 'timestamp', chunk_time_interval => interval '1 minute'); + + + + DROP table network_data; + + + + + + Create indexes on network data + + + + + + + + + + + + + + Create GIN index on network data payload + + CREATE INDEX network_data_payload_idx ON network_data USING GIN (payload); + + + + DROP INDEX network_data_payload_idx; + + + + + -- cgit 1.2.3-korg