Esempio n. 1
0
  /**
   * Create a return message object for each path segment returned by PCE.
   *
   * @param path
   * @return
   */
  public List<ResolvedPathType> resolvePath(Path path) {
    List<ResolvedPathType> resolvedPath = new ArrayList<>();

    // For each pair of STP we need to build a resolved path.
    for (PathSegment segment : path.getPathSegments()) {
      // Convert the constraints.
      AttrConstraints pathConstraints = segment.getConstraints();
      StringAttrConstraint serviceType =
          pathConstraints.removeStringAttrConstraint(PCEConstraints.SERVICETYPE);
      ObjectAttrConstraint p2pObject =
          pathConstraints.removeObjectAttrConstraint(Point2PointTypes.P2PS);
      List<TypeValueType> attrConstraints = pathConstraints.removeStringAttrConstraints();

      // Results go here...
      ResolvedPathType pathObj = new ResolvedPathType();

      // Build our path finding results into an P2PS service.
      if (p2pObject != null) {
        P2PServiceBaseType p2psResult = p2pObject.getValue(P2PServiceBaseType.class);
        p2psResult.getParameter().addAll(attrConstraints);
        pathObj.getAny().add(factory.createP2Ps(p2psResult));
      }

      // Set the corresponding serviceType and add out EVTS results.
      if (serviceType != null) {
        pathObj.setServiceType(serviceType.getValue());
      }

      pathObj.setNsa(segment.getNsaId());
      pathObj.setCsProviderURL(segment.getCsProviderURL());

      resolvedPath.add(pathObj);
    }
    return resolvedPath;
  }
Esempio n. 2
0
 public Constraint addConstraint(P2PServiceBaseType service) {
   ObjectAttrConstraint constraint = new ObjectAttrConstraint();
   constraint.setAttrName(Point2PointTypes.P2PS);
   constraint.setValue(service);
   return constraint;
 }