...
mvn clean install to build the projjectproject
Use docker images to see image stored in the local cache.
Use docker rmi <image id> to remove api images
cd to packages/policy-api-docker/ and run mvn clean install again to build the docker image
...
Code Block |
---|
language | xml |
---|
title | persistence.xml |
---|
|
<properties>
<property name="javax.persistence.schema-generation.database.action" value="create" />
<!--property name="eclipselink.ddl-generation" value="create-or-extend-tables" /-->
<property name="eclipselink.ddl-generation" value="none" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.logging.level" value="INFO" />
</properties> |
run mvn clean install
Use docker images to see image stored in the local cache.
Use docker rmi <image id> to remove pap images
cd packages/policy-pap-docker and run mvn clean install again to build the docker image
...
Code Block |
---|
language | yml |
---|
title | docker-compose-all.yml |
---|
|
pap:
#image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION}
image: onap/policy-pap:${POLICY_PAP_VERSION} |
Re-run CSIT test for pap
Expand |
---|
|
Waiting for mariadb port 3306... mariadb (172.23.0.3:3306) open .......Waiting for policy-db-migrator port 6824... policy-db-migrator (172.23.0.4:6824) open ...........Waiting for message-router port 3905... message-router (172.23.0.2:3905) open Waiting for api port 6969... api (172.23.0.5:6969) open .........Policy pap config file: /opt/app/policy/pap/etc/defaultConfig.json [EL Info]: 2021-08-11 09:30:21.762--ServerSession(1758893871)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Warning]: 2021-08-11 09:30:22.738--ServerSession(1758893871)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLSyntaxErrorException: (conn=335) Unknown column 't1.LASTUPDATE' in 'field list' Error Code: 1054 Call: SELECT t1.HEALTHY, t1.LASTUPDATE, t1.MESSAGE, t1.PDPSTATE, t1.parentLocalName, t1.localName, t1.parentKeyVersion, t1.parentKeyName FROM PdpSubGroup_Pdp t0, Pdp t1 WHERE ((t0.pdpLocalName = ?) AND ((t0.pdpParentLocalName = ?) AND ((t0.pdpParentKeyVersion = ?) AND ((t0.pdpParentKeyName = ?) AND ((t1.parentKeyName = t0.parentKeyName) AND ((t1.parentKeyVersion = t0.parentKeyVersion) AND ((t1.localName = t0.localName) AND (t1.parentLocalName = t0.parentLocalName)))))))) bind => [4 parameters bound] Query: ReadAllQuery(name="pdpInstances" referenceClass=JpaPdp sql="SELECT t1.HEALTHY, t1.LASTUPDATE, t1.MESSAGE, t1.PDPSTATE, t1.parentLocalName, t1.localName, t1.parentKeyVersion, t1.parentKeyName FROM PdpSubGroup_Pdp t0, Pdp t1 WHERE ((t0.pdpLocalName = ?) AND ((t0.pdpParentLocalName = ?) AND ((t0.pdpParentKeyVersion = ?) AND ((t0.pdpParentKeyName = ?) AND ((t1.parentKeyName = t0.parentKeyName) AND ((t1.parentKeyVersion = t0.parentKeyVersion) AND ((t1.localName = t0.localName) AND (t1.parentLocalName = t0.parentLocalName))))))))") Exception in thread "main" org.onap.policy.pap.main.PolicyPapRuntimeException: Start of policy-pap service failed. at org.onap.policy.pap.main.startstop.Main.<init>(Main.java:93) at org.onap.policy.pap.main.startstop.Main.main(Main.java:159) Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLSyntaxErrorException: (conn=335) Unknown column 't1.LASTUPDATE' in 'field list' Error Code: 1054 Call: SELECT t1.HEALTHY, t1.LASTUPDATE, t1.MESSAGE, t1.PDPSTATE, t1.parentLocalName, t1.localName, t1.parentKeyVersion, t1.parentKeyName FROM PdpSubGroup_Pdp t0, Pdp t1 WHERE ((t0.pdpLocalName = ?) AND ((t0.pdpParentLocalName = ?) AND ((t0.pdpParentKeyVersion = ?) AND ((t0.pdpParentKeyName = ?) AND ((t1.parentKeyName = t0.parentKeyName) AND ((t1.parentKeyVersion = t0.parentKeyVersion) AND ((t1.localName = t0.localName) AND (t1.parentLocalName = t0.parentLocalName)))))))) bind => [4 parameters bound] Query: ReadAllQuery(name="pdpInstances" referenceClass=JpaPdp sql="SELECT t1.HEALTHY, t1.LASTUPDATE, t1.MESSAGE, t1.PDPSTATE, t1.parentLocalName, t1.localName, t1.parentKeyVersion, t1.parentKeyName FROM PdpSubGroup_Pdp t0, Pdp t1 WHERE ((t0.pdpLocalName = ?) AND ((t0.pdpParentLocalName = ?) AND ((t0.pdpParentKeyVersion = ?) AND ((t0.pdpParentKeyName = ?) AND ((t1.parentKeyName = t0.parentKeyName) AND ((t1.parentKeyVersion = t0.parentKeyVersion) AND ((t1.localName = t0.localName) AND (t1.parentLocalName = t0.parentLocalName))))))))") at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:342) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:691) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:567) at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2099) at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:603) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:277) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:263) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:334) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:746) at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2768) at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2721) at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:584) at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1232) at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:911) at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1191) at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:485) at org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:3356) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1898) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1880) at org.eclipse.persistence.internal.indirection.NoIndirectionPolicy.valueFromQuery(NoIndirectionPolicy.java:328) at org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRowInternal(ForeignReferenceMapping.java:2344) at org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRow(ForeignReferenceMapping.java:2185) at org.eclipse.persistence.mappings.ForeignReferenceMapping.readFromRowIntoObject(ForeignReferenceMapping.java:1511) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:472) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.refreshObjectIfRequired(ObjectBuilder.java:4321) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:1050) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:747) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:1351) at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:605) at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1232) at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:911) at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1191) at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:485) at org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:3356) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1898) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1880) at org.eclipse.persistence.internal.indirection.NoIndirectionPolicy.valueFromQuery(NoIndirectionPolicy.java:328) at org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRowInternal(ForeignReferenceMapping.java:2344) at org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRow(ForeignReferenceMapping.java:2185) at org.eclipse.persistence.mappings.ForeignReferenceMapping.readFromRowIntoObject(ForeignReferenceMapping.java:1511) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:472) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.refreshObjectIfRequired(ObjectBuilder.java:4321) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:1050) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:909) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:862) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:745) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:699) at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:861) at org.eclipse.persistence.queries.ReadObjectQuery.registerResultInUnitOfWork(ReadObjectQuery.java:901) at org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery(ReadObjectQuery.java:568) at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1232) at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:911) at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1191) at org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:447) at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1279) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2983) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1898) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1880) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1830) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.executeQuery(EntityManagerImpl.java:1012) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.refresh(EntityManagerImpl.java:1156) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.refresh(EntityManagerImpl.java:1042) at org.onap.policy.models.dao.impl.DefaultPfDao.genericGet(DefaultPfDao.java:443) at org.onap.policy.models.dao.impl.DefaultPfDao.get(DefaultPfDao.java:412) at org.onap.policy.models.pdp.persistence.provider.PdpProvider.createPdpGroups(PdpProvider.java:114) at org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl.createPdpGroups(DatabasePolicyModelsProviderImpl.java:225) at org.onap.policy.pap.main.startstop.PapDatabaseInitializer.initializePapDatabase(PapDatabaseInitializer.java:79) at org.onap.policy.pap.main.startstop.Main.<init>(Main.java:72) ... 1 more Caused by: java.sql.SQLSyntaxErrorException: (conn=335) Unknown column 't1.LASTUPDATE' in 'field list' at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62) at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:153) at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:274) at org.mariadb.jdbc.ClientSidePreparedStatement.executeInternal(ClientSidePreparedStatement.java:229) at org.mariadb.jdbc.ClientSidePreparedStatement.execute(ClientSidePreparedStatement.java:149) at org.mariadb.jdbc.ClientSidePreparedStatement.executeQuery(ClientSidePreparedStatement.java:163) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:1015) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:651) ... 67 more Caused by: org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException: Unknown column 't1.LASTUPDATE' in 'field list' at org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException.of(MariaDbSqlException.java:34) at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.exceptionWithQuery(AbstractQueryProtocol.java:194) at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.exceptionWithQuery(AbstractQueryProtocol.java:177) at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:321) at org.mariadb.jdbc.ClientSidePreparedStatement.executeInternal(ClientSidePreparedStatement.java:220) ... 71 more Caused by: java.sql.SQLException: Unknown column 't1.LASTUPDATE' in 'field list' at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1683) at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readPacket(AbstractQueryProtocol.java:1545) at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1508) at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:318) ... 72 more |
The PDP table is missing a column
cd to the docker directory
cd to policy-db-migrator/src/main/docker
Update config/policyadmin/sql/0800/upgrade/0470-pdp.sql
Code Block |
---|
language | bash |
---|
title | 0470-pdp.sql |
---|
|
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
CREATE TABLE IF NOT EXISTS pdp (HEALTHY INT DEFAULT NULL NULL, LASTUPDATE DATETIME DEFAULT NULL NULL, MESSAGE VARCHAR(255) NULL, PDPSTATE INT DEFAULT NULL NULL, parentLocalName VARCHAR(120) NOT NULL, localName VARCHAR(120) NOT NULL, parentKeyVersion VARCHAR(15) NOT NULL, parentKeyName VARCHAR(120) NOT NULL, CONSTRAINT PK_PDP PRIMARY KEY (parentLocalName, localName, parentKeyVersion, parentKeyName)); |
Use docker images to see image stored in the local cache.
Use docker rmi <image id> to remove db-migrator images
cd /git/docker/policy-db-migrator, run mvn clean install again to build the docker image
Update docker-compose-all.yaml to use the local copy
Code Block |
---|
language | yml |
---|
title | docker-compose-all.yaml |
---|
|
policy-db-migrator:
#image: nexus3.onap.org:10001/onap/policy-db-migrator:${POLICY_DOCKER_VERSION}
image: onap/policy-db-migrator:${POLICY_DOCKER_VERSION}
|
Re-run papa CSIT test
Expand |
---|
|
Waiting for mariadb port 3306... mariadb (172.28.0.3:3306) open .......Waiting for policy-db-migrator port 6824... policy-db-migrator (172.28.0.4:6824) open ...........Waiting for message-router port 3905... message-router (172.28.0.2:3905) open Waiting for api port 6969... api (172.28.0.5:6969) open .........Policy pap config file: /opt/app/policy/pap/etc/defaultConfig.json [EL Info]: 2021-08-11 11:14:26.965--ServerSession(124494140)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:38.6--ServerSession(465183707)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:40.254--ServerSession(1922626110)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:40.652--ServerSession(2027186692)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:41.202--ServerSession(1371975109)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Warning]: 2021-08-11 11:14:41.94--UnitOfWork(1142495097)--Exception [EclipseLink-4011] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException Exception Description: Error preallocating sequence numbers. The sequence table information is not complete. [EL Info]: 2021-08-11 11:14:42.121--ServerSession(1307703223)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:42.41--ServerSession(1515135276)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:42.649--ServerSession(1239331505)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Warning]: 2021-08-11 11:14:43.169--UnitOfWork(761891474)--Exception [EclipseLink-4011] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException Exception Description: Error preallocating sequence numbers. The sequence table information is not complete. [EL Info]: 2021-08-11 11:14:43.34--ServerSession(858762233)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:43.604--ServerSession(1429879266)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:43.87--ServerSession(713555031)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:44.137--ServerSession(1486795260)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:44.395--ServerSession(298203416)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:49.248--ServerSession(627717566)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 |
Still some errors around the sequence table, we may need to prepopulate this table.
------------------------------------------------------------------------------
pap | FAIL |
15 tests, 13 passed, 2 failed
==============================================================================
2 test failures
QueryPolicyAuditAfterDeploy :: Verify policy audit record after de... /tmp/v/robot/lib/python3.8/site-packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn((
QueryPolicyAuditAfterDeploy :: Verify policy audit record after de... | FAIL |
Resolving variable '${resp.json()[0]['pdpGroup']}' failed: IndexError: list index out of range
------------------------------------------------------------------------------
UndeployPolicy :: Undeploy a policy named 'onap.restart.tca' from ... /tmp/v/robot/lib/python3.8/site-packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn((
UndeployPolicy :: Undeploy a policy named 'onap.restart.tca' from ... | PASS |
------------------------------------------------------------------------------
QueryPdpGroupsAfterUndeploy :: Verify PdpGroups after undeploy /tmp/v/robot/lib/python3.8/site-packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn((
QueryPdpGroupsAfterUndeploy :: Verify PdpGroups after undeploy | PASS |
------------------------------------------------------------------------------
QueryPolicyAuditAfterUnDeploy :: Verify policy audit record after ... /tmp/v/robot/lib/python3.8/site-packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn((
QueryPolicyAuditAfterUnDeploy :: Verify policy audit record after ... | FAIL |
Resolving variable '${resp.json()[0]['pdpGroup']}' failed: IndexError: list index out of range