Пример #1
0
  @Override
  public Future<RpcResult<DeleteRenderedPathOutput>> deleteRenderedPath(
      DeleteRenderedPathInput input) {

    boolean ret;
    RpcResultBuilder<DeleteRenderedPathOutput> rpcResultBuilder;
    // If a RSP is deleted we delete both SF and SFF operational states.
    SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderStateExecutor(input.getName());
    SfcProviderServiceFunctionAPI.deleteServicePathFromServiceFunctionStateExecutor(
        input.getName());

    ret = SfcProviderRenderedPathAPI.deleteRenderedServicePathExecutor(input.getName());
    DeleteRenderedPathOutputBuilder deleteRenderedPathOutputBuilder =
        new DeleteRenderedPathOutputBuilder();
    deleteRenderedPathOutputBuilder.setResult(ret);
    if (ret) {
      rpcResultBuilder = RpcResultBuilder.success(deleteRenderedPathOutputBuilder.build());
    } else {
      String message = "Error Deleting Rendered Service Path: " + input.getName();
      rpcResultBuilder =
          RpcResultBuilder.<DeleteRenderedPathOutput>failed()
              .withError(ErrorType.APPLICATION, message);
    }

    return Futures.immediateFuture(rpcResultBuilder.build());
  }
Пример #2
0
  private void buildGroup(ServiceFunctionGroup sfg, boolean isAdd) {
    try {
      List<SfcServiceFunction> sfs = sfg.getSfcServiceFunction();
      SfName sfName = new SfName(sfs.get(0).getName());
      ServiceFunction sf = SfcProviderServiceFunctionAPI.readServiceFunction(sfName);
      // assuming all SF's have the same SFF
      // should use the ovs id
      SffName sffName = sf.getSfDataPlaneLocator().get(0).getServiceFunctionForwarder();
      String sffNodeId = null;
      sffNodeId = getSffOpenFlowNodeName(sffName);

      if (sffNodeId == null) {
        LOG.warn("failed to find switch configuration: sffName: {}- \naborting", sffName);
        return;
      }

      ServiceFunctionGroupAlgorithm algorithm =
          SfcProviderServiceFunctionGroupAlgAPI.readServiceFunctionGroupAlg(sfg.getAlgorithm());

      List<GroupBucketInfo> bucketsInfo = new ArrayList<GroupBucketInfo>();

      ServiceFunctionForwarder sff =
          SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(sffName);

      int index = 0;
      for (SfcServiceFunction sfcServiceFunction : sfg.getSfcServiceFunction()) {
        sfName = new SfName(sfcServiceFunction.getName());
        sf = SfcProviderServiceFunctionAPI.readServiceFunction(sfName);
        ServiceFunctionDictionary sffSfDict = sfcL2ProviderUtils.getSffSfDictionary(sff, sfName);
        String outPort = sfcL2ProviderUtils.getDictPortInfoPort(sff, sffSfDict);
        bucketsInfo.add(buildBucket(sf, outPort, index));
        index++;
      }
      this.sfcL2FlowProgrammer.configureGroup(
          sffName.getValue(),
          sffNodeId,
          sfg.getName(),
          sfg.getGroupId(),
          algorithm.getAlgorithmType().getIntValue(),
          bucketsInfo,
          isAdd);

    } catch (Exception e) {
      LOG.warn("Failed generating group " + sfg, e);
    }
  }
Пример #3
0
 private String getSffOpenFlowNodeName(final SffName sffName) {
   ServiceFunctionForwarder sff =
       SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(sffName);
   return sfcL2ProviderUtils.getSffOpenFlowNodeName(sff);
 }