Issue-ID: POLICY-4427
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: I22706cdbd45c49946435aff15bc5ec5f7408296b
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2022 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
throw new CoderException(new FileNotFoundException(policyPath));
}
throw new CoderException(new FileNotFoundException(policyPath));
}
+ if (policyPath.startsWith("policies/")) {
+ // using policy/models examples where policies are wrapped with the ToscaServiceTemplate
+ // for API component provisioning
+ logger.info("retrieving policy from policy models examples");
+ ToscaServiceTemplate template = coder.decode(policyJson, ToscaServiceTemplate.class);
+ if (template.getToscaTopologyTemplate().getPolicies().size() == 1) {
+ return template.getToscaTopologyTemplate().getPolicies().get(0).values().iterator().next();
+ }
+ }
+
return coder.decode(policyJson, ToscaPolicy.class);
}
return coder.decode(policyJson, ToscaPolicy.class);
}