コード例 #1
0
 private VCPENetworkModel createEmptyModel(Resource resource) {
   VCPENetworkModel model = new VCPENetworkModel();
   model.setVcpeNetworkId(resource.getResourceIdentifier().getId());
   model.setVcpeNetworkName(resource.getResourceDescriptor().getInformation().getName());
   model.setCreated(false);
   return model;
 }
コード例 #2
0
 private VCPENetworkModel hierarchicalLRnames(VCPENetworkModel model) {
   for (LogicalRouter lr :
       Iterables.filter(
           VCPENetworkModelHelper.getRouters(model.getElements()), LogicalRouter.class)) {
     lr.setName(model.getName() + "-" + lr.getName());
   }
   return model;
 }
コード例 #3
0
  private VCPENetworkModel configureRouting(VCPENetworkModel model) {
    // reset routing configuration for LRs
    for (LogicalRouter lr :
        Iterables.filter(
            VCPENetworkModelHelper.getRouters(model.getElements()), LogicalRouter.class)) {
      lr.setRoutingConfiguration(new RoutingConfiguration());
    }

    configureStaticRoutes(model);
    return model;
  }
コード例 #4
0
  /**
   * Copies data in elements from given source to elements in given destination with same
   * templateName. No element is created within this method. Does not copy references to other
   * elements (interfaces, physicalRouter, etc.)
   *
   * @param source
   * @param destination
   * @return destination updated with values in source.
   */
  private VCPENetworkModel partialCopy(VCPENetworkModel source, VCPENetworkModel destination) {
    destination.setName(source.getName());
    destination.setId(source.getId());

    VCPENetworkElement dstElement;
    for (VCPENetworkElement srcElement : source.getElements()) {
      dstElement =
          VCPENetworkModelHelper.getElementByTemplateName(
              destination.getElements(), srcElement.getTemplateName());
      if (dstElement != null) {
        dstElement.setName(srcElement.getName());
        if (srcElement instanceof Interface && dstElement instanceof Interface) {
          VCPENetworkModelHelper.copyInterface((Interface) dstElement, (Interface) srcElement);
        } else if (srcElement instanceof IPNetworkDomain && dstElement instanceof IPNetworkDomain) {
          ((IPNetworkDomain) dstElement).setOwner(((IPNetworkDomain) srcElement).getOwner());
          ((IPNetworkDomain) dstElement).setASNumber(((IPNetworkDomain) srcElement).getASNumber());
          ((IPNetworkDomain) dstElement)
              .setIPAddressRanges(((IPNetworkDomain) srcElement).getIPAddressRanges());
        }
      }
    }
    return destination;
  }