aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/vfc
AgeCommit message (Expand)AuthorFilesLines
2020-04-15Update VFC nslcm & vnflcm & gvnfm component version to 1.3.9yangyan3-3/+3
2020-04-02Bump chart versionSylvain Desbureaux18-19/+19
2020-03-27update releae version of vfc-nslcm & vfc-vnflcmyangyan2-2/+2
2020-03-25[VFC] Use faster version of common secret templateKrzysztof Opasiak9-9/+9
2020-03-20Remove catalog component from VFCyangyan11-533/+0
2020-03-11Add VFC env about reg_to_msb_when_start to determine whether register to micr...update vfc juju versionyangyanyj1-1/+1
2019-05-05fix vfc chart issueyangyanyj11-23/+7
2019-05-05update vfc image versionyangyan23-370/+16
2019-04-24Merge "Update vfc chart using OOM shared mariadb galera"Borislav Glozman8-3/+49
2019-04-23Update VFC image versionYang Xu17-17/+17
2019-04-19Update vfc chart using OOM shared mariadb galerayangyan14-9/+55
2019-02-25Merge "Add vfc catalog volumn"Borislav Glozman5-0/+115
2019-02-10Update Chart version for Dublin ReleaseMike Elliott20-20/+20
2019-02-03Add vfc catalog volumnyangyanyj5-0/+115
2018-11-15Sync docker tags with release manifestGary Wu13-13/+13
2018-10-24Sync docker tags with release manifestGary Wu1-1/+1
2018-10-22fix vfc deployment erroryangyan1-1/+1
2018-10-19Fix driver startup in OOMDenes Nemeth1-0/+2
2018-10-18Sync docker tags with release manifestGary Wu17-17/+17
2018-10-02Add Resource Limits for vfcGregSulek18-325/+351
2018-09-25Updating charts to use common resource templateMandeep Khinda18-18/+18
2018-09-24Update Chart versions to 3.0Mike Elliott20-20/+20
2018-09-19Sync values from docker-manifest-staging fileAlexis de Talhouƫt1-1/+1
2018-08-20Merge "Add VFC DB helm charts"Borislav Glozman11-75/+326
2018-08-17Modify vfc values.yamlyangyan17-17/+17
2018-08-16Add VFC DB helm chartsBharath Thiruveedula11-75/+326
2018-07-31Enable istio sidecar injectio for vfcHuabing Zhao34-0/+85
2018-06-05Sync OOM docker versions with docker-manifest.csvGary Wu17-17/+17
2018-05-10Improve docker registry secret managementBorislavG17-17/+0
2018-05-08Sync docker image images with docker-manifest.csvGary Wu16-16/+16
2018-05-03Remove nsPrefix references from vfc chartPriyanka Jain1-2/+1
2018-04-24Make all services independent of helm Release.NameBorislavG34-70/+87
2018-04-24Merge "Update vfc charts configutation"Mandeep Khinda3-1/+10
2018-04-18Update vfc charts configutationyangyan3-1/+10
n class="o">, OperationProperties.EVENT_ADDITIONAL_PARAMS, OperationProperties.OPT_CDS_GRPC_AAI_PROPERTIES); // @formatter:on /** * Constructs the object. * * @param params operation parameters * @param config configuration for this operation */ public GrpcOperation(ControlLoopOperationParams params, GrpcConfig config) { super(params, config, Collections.emptyList()); this.config = config; if (TargetType.PNF.equals(params.getTargetType())) { aaiRequestor = this::getPnf; aaiConverter = this::convertPnfToAaiProperties; } else { aaiRequestor = this::getCq; aaiConverter = this::convertCqToAaiProperties; } } @Override public List<String> getPropertyNames() { return (TargetType.PNF.equals(params.getTargetType()) ? PNF_PROPERTY_NAMES : VNF_PROPERTY_NAMES); } /** * If no timeout is specified, then it returns the operator's configured timeout. */ @Override protected long getTimeoutMs(Integer timeoutSec) { return (timeoutSec == null || timeoutSec == 0 ? config.getTimeoutMs() : super.getTimeoutMs(timeoutSec)); } /** * Ensures that A&AI query has been performed, and runs the guard. */ @Override @SuppressWarnings("unchecked") protected CompletableFuture<OperationOutcome> startPreprocessorAsync() { if (params.isPreprocessed()) { return null; } // run A&AI Query and Guard, in parallel return allOf(aaiRequestor, this::startGuardAsync); } /** * Requests the A&AI PNF data. * * @return a future to get the PNF data */ private CompletableFuture<OperationOutcome> getPnf() { ControlLoopOperationParams pnfParams = params.toBuilder().actor(AaiConstants.ACTOR_NAME) .operation(AaiGetPnfOperation.NAME).payload(null).retry(null).timeoutSec(null).build(); return params.getContext().obtain(AaiGetPnfOperation.getKey(params.getTargetEntity()), pnfParams); } /** * Requests the A&AI Custom Query data. * * @return a future to get the custom query data */ private CompletableFuture<OperationOutcome> getCq() { ControlLoopOperationParams cqParams = params.toBuilder().actor(AaiConstants.ACTOR_NAME) .operation(AaiCustomQueryOperation.NAME).payload(null).retry(null).timeoutSec(null).build(); return params.getContext().obtain(AaiCqResponse.CONTEXT_KEY, cqParams); } /** * Converts the A&AI PNF data to a map suitable for passing via the "aaiProperties" * field in the CDS request. * * @return a map of the PNF data */ private Map<String, String> convertPnfToAaiProperties() { Map<String, String> result = this.getProperty(OperationProperties.OPT_CDS_GRPC_AAI_PROPERTIES); if (result != null) { return result; } // convert PNF data to a Map Map<String, Object> source = Util.translateToMap(getFullName(), getPnfData()); result = new LinkedHashMap<>(); for (Entry<String, Object> ent : source.entrySet()) { result.put(AAI_PNF_PREFIX + ent.getKey(), ent.getValue().toString()); } return result; } /** * Gets the PNF from the operation properties, if it exists, or from the context * properties otherwise. * * @return the PNF item */ protected Object getPnfData() { Object pnf = getProperty(OperationProperties.AAI_PNF); if (pnf != null) { return pnf; } pnf = params.getContext().getProperty(AaiGetPnfOperation.getKey(params.getTargetEntity())); if (pnf == null) { throw new IllegalArgumentException("missing PNF data"); } return pnf; } /** * Converts the A&AI Custom Query data to a map suitable for passing via the * "aaiProperties" field in the CDS request. * * @return a map of the custom query data */ private Map<String, String> convertCqToAaiProperties() { Map<String, String> result = this.getProperty(OperationProperties.OPT_CDS_GRPC_AAI_PROPERTIES); if (result != null) { return result; } result = new LinkedHashMap<>(); result.put(AAI_SERVICE_INSTANCE_ID_KEY, getServiceInstanceId()); result.put(AAI_VNF_ID_KEY, getVnfId()); return result; } protected String getServiceInstanceId() { ServiceInstance serviceInstance = getProperty(OperationProperties.AAI_SERVICE); if (serviceInstance != null) { return serviceInstance.getServiceInstanceId(); } AaiCqResponse aaicq = params.getContext().getProperty(AaiCqResponse.CONTEXT_KEY); serviceInstance = aaicq.getServiceInstance(); if (serviceInstance == null) { throw new IllegalArgumentException("Target service instance could not be found"); } return serviceInstance.getServiceInstanceId(); } protected String getVnfId() { GenericVnf genericVnf = getProperty(OperationProperties.AAI_RESOURCE_VNF); if (genericVnf != null) { return genericVnf.getVnfId(); } AaiCqResponse aaicq = params.getContext().getProperty(AaiCqResponse.CONTEXT_KEY); genericVnf = aaicq.getGenericVnfByModelInvariantId(params.getTargetEntityIds() .get(ControlLoopOperationParams.PARAMS_ENTITY_RESOURCEID)); if (genericVnf == null) { throw new IllegalArgumentException("Target generic vnf could not be found"); } return genericVnf.getVnfId(); } @Override public void generateSubRequestId(int attempt) { setSubRequestId("0"); } /** * {@inheritDoc}. */ @Override protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) { /* * construct the request first so that we don't have to clean up the "client" if * an exception is thrown */ ExecutionServiceInput request = constructRequest(); CompletableFuture<OperationOutcome> future = new CompletableFuture<>(); client = new CdsProcessorGrpcClient(new CdsActorServiceManager(outcome, future), config.getCdsServerProperties()); client.sendRequest(request); // arrange to shutdown the client when the request completes PipelineControllerFuture<OperationOutcome> controller = new PipelineControllerFuture<>(); controller.wrap(future).whenCompleteAsync(controller.delayedComplete(), params.getExecutor()) .whenCompleteAsync((arg1, arg2) -> client.close(), getBlockingExecutor()); return controller; } /** * Build the CDS ExecutionServiceInput request from the policy object and the AAI * enriched parameters. TO-DO: Avoid leaking Exceptions to the Kie Session thread. TBD * item for Frankfurt release. * * @return an ExecutionServiceInput instance. */ public ExecutionServiceInput constructRequest() { // For the current operational TOSCA policy model (yaml) CBA name and version are // embedded in the payload // section, with the new policy type model being proposed in Frankfurt we will be // able to move it out. if (!validateCdsMandatoryParams(params)) { throw new IllegalArgumentException("missing cds mandatory params - " + params); } Map<String, String> payload = convertPayloadMap(params.getPayload()); String cbaName = payload.get(CdsActorConstants.KEY_CBA_NAME); String cbaVersion = payload.get(CdsActorConstants.KEY_CBA_VERSION); // Retain only the payload by removing CBA name and version once they are // extracted // to be put in CDS request header. payload.remove(CdsActorConstants.KEY_CBA_NAME); payload.remove(CdsActorConstants.KEY_CBA_VERSION); // Embed payload from policy to ConfigDeployRequest object, serialize and inject // into grpc request. String cbaActionName = params.getOperation(); CdsActionRequest request = new CdsActionRequest(); request.setPolicyPayload(payload); request.setActionName(cbaActionName); request.setResolutionKey(UUID.randomUUID().toString()); // Inject AAI properties into payload map. Offer flexibility to the usecase // implementation to inject whatever AAI parameters are of interest to them. // E.g. For vFW usecase El-Alto inject service-instance-id, generic-vnf-id as // needed by CDS. // // Note: that is a future enhancement. For now, the actor is hard-coded to // use the A&AI query result specific to the target type request.setAaiProperties(aaiConverter.get()); // Inject any additional event parameters that may be present in the onset event Map<String, String> additionalParams = getAdditionalEventParams(); if (additionalParams != null) { request.setAdditionalEventParams(additionalParams); } Builder struct = Struct.newBuilder(); try { String requestStr = request.generateCdsPayload(); Preconditions.checkState(!Strings.isNullOrEmpty(requestStr), "Unable to build " + "config-deploy-request from payload parameters: {}", payload); JsonFormat.parser().merge(requestStr, struct); } catch (InvalidProtocolBufferException | CoderException e) { throw new IllegalArgumentException("Failed to embed CDS payload string into the input request. blueprint({" + cbaName + "}:{" + cbaVersion + "}) for action({" + cbaActionName + "})", e); } // Build CDS gRPC request common-header CommonHeader commonHeader = CommonHeader.newBuilder().setOriginatorId(CdsActorConstants.ORIGINATOR_ID) .setRequestId(params.getRequestId().toString()).setSubRequestId(getSubRequestId()).build(); // Build CDS gRPC request action-identifier ActionIdentifiers actionIdentifiers = ActionIdentifiers.newBuilder().setBlueprintName(cbaName).setBlueprintVersion(cbaVersion) .setActionName(cbaActionName).setMode(CdsActorConstants.CDS_MODE).build(); // Finally build & return the ExecutionServiceInput gRPC request object. return ExecutionServiceInput.newBuilder().setCommonHeader(commonHeader).setActionIdentifiers(actionIdentifiers) .setPayload(struct.build()).build(); } protected Map<String, String> getAdditionalEventParams() { if (containsProperty(OperationProperties.EVENT_ADDITIONAL_PARAMS)) { return getProperty(OperationProperties.EVENT_ADDITIONAL_PARAMS); } return params.getContext().getEvent().getAdditionalEventParams(); } private Map<String, String> convertPayloadMap(Map<String, Object> payload) { Map<String, String> convertedPayload = new HashMap<>(); for (Entry<String, Object> entry : payload.entrySet()) { convertedPayload.put(entry.getKey(), entry.getValue().toString()); } return convertedPayload; } private boolean validateCdsMandatoryParams(ControlLoopOperationParams params) { if (params == null || params.getPayload() == null) { return false; } Map<String, Object> payload = params.getPayload(); if (payload.get(CdsActorConstants.KEY_CBA_NAME) == null || payload.get(CdsActorConstants.KEY_CBA_VERSION) == null) { return false; } return !Strings.isNullOrEmpty(payload.get(CdsActorConstants.KEY_CBA_NAME).toString()) && !Strings.isNullOrEmpty(payload.get(CdsActorConstants.KEY_CBA_VERSION).toString()) && !Strings.isNullOrEmpty(params.getOperation()); } }