Release M - How to Run TEIV with Your Models
Running
To run TEIV with your models pgsql-schema-generator is provided to generate PostgresSQL schemes from the YANG models which can be used in TEIV.
First of all you need the pgsql-schema-generator which can be achieved by one of the following:
the build steps at Release M - Build
pulling the image directly from the Nexus Repository https://nexus3.o-ran-sc.org/#browse/browse:docker.snapshot:v2%2Fo-ran-sc%2Fsmo-teiv-pgsql-schema-generator%2Ftags%2Flatest (if available)
Building is a far more time consuming process and may lead to errors.
TEIV with pgsql-schema-generator using Docker
Things you should know:
If using you own YANG models place them in a new directory
generate-defaultsindocker-compose/AND delete the default sql schemas indocker-compose/sql_scriptsif you are generating your own sql schemes with different YANG models, compared to the default YANG, the example events will not work, therefore
kafka-producermust be commented out in thedocker-compose.ymlOR you can replace the example events with your own datathe
pgsql-schema-generatorfunction may fail due to a permission error if thedocker-compose/sql_scriptsto fix this you can runsudo chmod -R 777 sql_scripts/
In the /teiv/docker-compose directory run the following code to bring TEIV up:
docker-compose upRunning 'docker ps -a’ should show the following docker containers:
kafka-producer confluentinc/cp-kafka:7.6.1 (optional - automatically populates TEIV)
pgsql-schema-generator o-ran-sc/smo-teiv-pgsql-schema-generator:latest (optional - if you want to generate your own sql schemas)
kafka confluentinc/cp-kafka:7.6.1
kafka2 confluentinc/cp-kafka:7.6.1
kafka3 confluentinc/cp-kafka:7.6.1
topology-ingestion-inventory o-ran-sc/smo-teiv-ingestion:latest
topology-exposure-inventory o-ran-sc/smo-teiv-exposure:latest
zookeeper confluentinc/cp-zookeeper:6.2.1
dbpostgresql postgis/postgis:13-3.4-alpine
Once running there are some sample queries to try at Sample TEIV Queries
The /teiv/docker-compose directory has everything needed to get TEIV up and running consisting of the following files and directories:
docker-compose.yml- contains all the services needed to run TEIVsql_scripts- contains the sql scripts produced by thepgsql-schema-generatorand a script used in thedbpostgresqlcontainer to check if the sql schemas are presentcloudEventProducer- contains acloudEventProducerscript that will produce kafka events to populate TEIV by running locally,cloudEventProducerForDockerComposeused for thekafka-producerservice indocker-compomse.ymland the actual events are in the events directorygenerate-defaults- is an optional directory where you put your own YANG files to generate your own custom sql schemas frompgsql-schema-generatorcopySqlSchemaFromPgsqlGenerator.sh- copies the sql schema generated frompgsql-schema-generatorto thesql_scriptsdirectory, renaming and replacing placeholders.
In docker-compose.yml there is an optional services:
kafka-producerwhich will automatically run thecloudEventProducerForDockerComposescript to populate TEIV. Can comment out if this is not desired.pgsql-schema-generatorwhich will generate sql schemas from your YANG files atdocker-compose/generate-defaultstodocker-compose/sql_scriptsand use them automatically
Build/run pgsql-schema-generator directly with Maven
If successful built the files highlighted in green/yellow should be present.
The default sql scripts in /docker-compose/sql_scripts were built from TEIVs default yang models provided in /teiv/teiv/src/main/resources/models using the pgsql-schema-generator.
To run pgsql-schema-generator yourself, using the default YANG models or your own YANG models, copy YANG models into the /teiv/pgsql-schema-generator/src/main/resources/generate-defaults directory and from /teiv/pgsql-schema-generator/ run:
mvn exec:java -Dexec.mainClass="org.oran.smo.teiv.pgsqlgenerator.DatabaseSchemaGeneratorApplication"Once run successfully the sql schemas should be present in /teiv/pgsql-schema-generator/target (highlighted in red below) and graphs representing the entities and relationships of the YANG models in /teiv/pgsql-schema-generator/target/graphs (highlighted in blue below):