Beispiel #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);
    }
  }
Beispiel #2
0
 private String getSffOpenFlowNodeName(final SffName sffName) {
   ServiceFunctionForwarder sff =
       SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(sffName);
   return sfcL2ProviderUtils.getSffOpenFlowNodeName(sff);
 }