• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Ip类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.openbaton.catalogue.mano.common.Ip的典型用法代码示例。如果您正苦于以下问题:Java Ip类的具体用法?Java Ip怎么用?Java Ip使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

Ip类属于org.openbaton.catalogue.mano.common包,在下文中一共展示了Ip类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: fillVnfrVnfc

点赞 2

import org.openbaton.catalogue.mano.common.Ip; //导入依赖的package包/类
/**
 * Fill the Map vnfrVnfc.
 *
 * @param nsr
 */
private void fillVnfrVnfc(NetworkServiceRecord nsr) {
  for (VirtualNetworkFunctionRecord vnfr : nsr.getVnfr()) {
    List<VNFCRepresentation> representationList = new LinkedList<>();
    Configuration conf = vnfr.getConfigurations();
    Map<String, String> confMap = new HashMap<>();
    for (ConfigurationParameter confPar : conf.getConfigurationParameters()) {
      confMap.put(confPar.getConfKey(), confPar.getValue());
    }
    for (VirtualDeploymentUnit vdu : vnfr.getVdu()) {
      for (VNFCInstance vnfcInstance : vdu.getVnfc_instance()) {
        VNFCRepresentation vnfcRepresentation = new VNFCRepresentation();
        vnfcRepresentation.setVnfrName(vnfr.getName());
        vnfcRepresentation.setHostname(vnfcInstance.getHostname());
        vnfcRepresentation.setConfiguration(confMap);
        for (Ip ip : vnfcInstance.getIps()) {
          vnfcRepresentation.addNetIp(ip.getNetName(), ip.getIp());
        }
        for (Ip fIp : vnfcInstance.getFloatingIps()) {
          vnfcRepresentation.addNetFip(fIp.getNetName(), fIp.getIp());
        }
        representationList.add(vnfcRepresentation);
      }
    }
    if (!vnfrVnfc.containsKey(vnfr.getType())) {
      vnfrVnfc.put(vnfr.getType(), representationList);
    } else {
      List<VNFCRepresentation> l = vnfrVnfc.get(vnfr.getType());
      l.addAll(representationList);
    }
  }
}
 

开发者ID:openbaton,
项目名称:integration-tests,
代码行数:37,
代码来源:GenericServiceTester.java

示例2: status

点赞 2

import org.openbaton.catalogue.mano.common.Ip; //导入依赖的package包/类
/**
 * Checks the lifecycle status of the NSR referenced by the occi-Id.
 * If the creation is completed all public and private ip's of the
 * vnfds are returned as well.
 *
 * @param response HttpServletResponse object containing to be returned header
 * @param headers HttpHeaders object containing the request headers
 * @return simple OK
 * @throws SDKException
 */
@RequestMapping(value = "/default", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public String status(HttpServletResponse response, @RequestHeader HttpHeaders headers) throws SDKException {
    String occiId = getOcciId(headers);
    log.debug("Received status request for instance " + occiId);

    if (occiId != null) {
        Stack stack = stacks.get(occiId);

        if (Objects.equals(stack.getStatus(), "CREATE_COMPLETE")) {
            for (VirtualNetworkFunctionRecord record : stack.getVirtualNFRs()) {
                // TODO: proper formatting, this may also go in the return header!
                String attributePrefix = occiProperties.getPrefix() + ".";
                String endpoint = "";

                for (VirtualDeploymentUnit vdu : record.getVdu()) {
                    for (VNFCInstance vnfc : vdu.getVnfc_instance()) {
                        // Get all private Ip's
                        for (Ip privateIp : vnfc.getIps()) {
                            response.addHeader("X-OCCI-Attribute", attributePrefix + record.getName() + "." +
                                    privateIp.getNetName() + ".private=\"" + privateIp.getIp() + "\"");
                            endpoint = "\"" + privateIp.getIp() + "\"";
                        }
                        // Get all public Ip's
                        for (Ip publicIp : vnfc.getFloatingIps()) {
                            response.addHeader("X-OCCI-Attribute", attributePrefix + record.getName() + "." +
                                    publicIp.getNetName() + ".public=\"" + publicIp.getIp() + "\"");
                            endpoint = "\"" + publicIp.getIp() + "\"";
                        }
                    }
                }
                // Set "endpoint" Ip, private if no public Ip's were found, public otherwise.
                response.addHeader("X-OCCI-Attribute", attributePrefix + record.getName() + "=" + endpoint);
            }
        }
        response.addHeader("X-OCCI-Attribute", "occi.stack.state=\"" + stack.getStatus() + "\"");
        response.addHeader("X-OCCI-Attribute", "occi.stack.id=\"" + stack.getCount() + "\"");
        response.addHeader("X-OCCI-Attribute", "occi.core.id=\"" + apiPath + "default\"");
    }
    return "OK";
}
 

开发者ID:MobileCloudNetworking,
项目名称:OpenBaton-OCCI,
代码行数:52,
代码来源:OcciControler.java

示例3: executeScriptsForEvent

点赞 2

import org.openbaton.catalogue.mano.common.Ip; //导入依赖的package包/类
public Iterable<String> executeScriptsForEvent(
    VirtualNetworkFunctionRecord virtualNetworkFunctionRecord, Event event)
    throws Exception { //TODO make it parallel
  Map<String, String> env = getMap(virtualNetworkFunctionRecord);
  Collection<String> res = new ArrayList<>();
  LifecycleEvent le =
      VnfmUtils.getLifecycleEvent(virtualNetworkFunctionRecord.getLifecycle_event(), event);

  if (le != null) {
    log.trace(
        "The number of scripts for "
            + virtualNetworkFunctionRecord.getName()
            + " are: "
            + le.getLifecycle_events());
    for (String script : le.getLifecycle_events()) {
      log.info(
          "Sending script: "
              + script
              + " to VirtualNetworkFunctionRecord: "
              + virtualNetworkFunctionRecord.getName());
      for (VirtualDeploymentUnit vdu : virtualNetworkFunctionRecord.getVdu()) {
        for (VNFCInstance vnfcInstance : vdu.getVnfc_instance()) {

          Map<String, String> tempEnv = new HashMap<>();
          for (Ip ip : vnfcInstance.getIps()) {
            log.debug("Adding net: " + ip.getNetName() + " with value: " + ip.getIp());
            tempEnv.put(ip.getNetName(), ip.getIp());
          }
          log.debug("adding floatingIp: " + vnfcInstance.getFloatingIps());
          for (Ip fip : vnfcInstance.getFloatingIps()) {
            tempEnv.put(fip.getNetName() + "_floatingIp", fip.getIp());
          }

          tempEnv.put("hostname", vnfcInstance.getHostname());
          tempEnv = modifyUnsafeEnvVarNames(tempEnv);
          env.putAll(tempEnv);
          log.info("Environment Variables are: " + env);

          String command = JsonUtils.getJsonObject("EXECUTE", script, env).toString();
          String output =
              ems.executeActionOnEMS(
                  vnfcInstance.getHostname(),
                  command,
                  virtualNetworkFunctionRecord,
                  vnfcInstance);
          res.add(output);
          log.debug("Saving log to file...");
          logUtils.saveLogToFile(virtualNetworkFunctionRecord, script, vnfcInstance, output);
          for (String key : tempEnv.keySet()) {
            env.remove(key);
          }
        }
      }
    }
  }
  return res;
}
 

开发者ID:openbaton,
项目名称:generic-vnfm,
代码行数:58,
代码来源:LifeCycleManagement.java

示例4: getFloatingIps

点赞 2

import org.openbaton.catalogue.mano.common.Ip; //导入依赖的package包/类
public Set<Ip> getFloatingIps() {
  return floatingIps;
}
 

开发者ID:openbaton,
项目名称:NFVO,
代码行数:4,
代码来源:VNFCInstance.java

示例5: setFloatingIps

点赞 2

import org.openbaton.catalogue.mano.common.Ip; //导入依赖的package包/类
public void setFloatingIps(Set<Ip> floatingIps) {
  this.floatingIps = floatingIps;
}
 

开发者ID:openbaton,
项目名称:NFVO,
代码行数:4,
代码来源:VNFCInstance.java

示例6: getIps

点赞 2

import org.openbaton.catalogue.mano.common.Ip; //导入依赖的package包/类
public Set<Ip> getIps() {
  return ips;
}
 

开发者ID:openbaton,
项目名称:NFVO,
代码行数:4,
代码来源:VNFCInstance.java

示例7: setIps

点赞 2

import org.openbaton.catalogue.mano.common.Ip; //导入依赖的package包/类
public void setIps(Set<Ip> ips) {
  this.ips = ips;
}
 

开发者ID:openbaton,
项目名称:NFVO,
代码行数:4,
代码来源:VNFCInstance.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)