public ServiceFunctionChainBuilder serviceFunctionChainBuilder(
      ServiceFunctionChainBuilder serviceFunctionChainBuilder,
      String name,
      Boolean symmetric,
      List<SfcServiceFunction> sfcServiceFunctionList) {

    return serviceFunctionChainBuilder
        .setName(SfcName.getDefaultInstance(name))
        .setSymmetric(symmetric)
        .setSfcServiceFunction(sfcServiceFunctionList);
  }
Example #2
0
  public ServiceFunctionChain createServiceFunctionChain(
      List<Class<? extends ServiceFunctionTypeIdentity>> sfTypes) {

    short order = 0;
    List<SfcServiceFunction> sfcSfs = new ArrayList<SfcServiceFunction>();
    for (Class<? extends ServiceFunctionTypeIdentity> sfType : sfTypes) {
      String name = sfType.getName() + "Abstract";
      SfcServiceFunctionBuilder sfcSfBuilder = new SfcServiceFunctionBuilder();
      sfcSfBuilder.setKey(new SfcServiceFunctionKey(name));
      sfcSfBuilder.setName(name);
      sfcSfBuilder.setOrder(order++);
      sfcSfBuilder.setType(sfType);
      sfcSfs.add(sfcSfBuilder.build());
    }

    SfcName sfcName = new SfcName(SFC_NAME_PREFIX + String.valueOf(SFC_NAME_INDEX++));
    ServiceFunctionChainBuilder sfcBuilder = new ServiceFunctionChainBuilder();
    sfcBuilder.setName(sfcName);
    sfcBuilder.setKey(new ServiceFunctionChainKey(sfcName));
    sfcBuilder.setSymmetric(true);
    sfcBuilder.setSfcServiceFunction(sfcSfs);

    return sfcBuilder.build();
  }