Ejemplo n.º 1
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);
    }
  }
Ejemplo n.º 2
0
  private ServiceFunctionForwarder buildServiceFunctionForwarder(
      SffName name,
      List<SffDataPlaneLocator> sffDataplaneLocatorList,
      List<ServiceFunctionDictionary> dictionaryList,
      String classifier) {
    ServiceFunctionForwarderBuilder sffBuilder = new ServiceFunctionForwarderBuilder();
    sffBuilder
        .setName(name)
        .setKey(new ServiceFunctionForwarderKey(name))
        .setServiceNode(new SnName(name.getValue()))
        .setSffDataPlaneLocator(sffDataplaneLocatorList)
        .setServiceFunctionDictionary(dictionaryList);

    return sffBuilder.build();
  }