当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurationParameter类代码示例

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


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

示例1: configurationCreate

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
@Test
public void configurationCreate() {
  Configuration configuration = new Configuration();
  configuration.setId("123");
  ConfigurationParameter parameters = new ConfigurationParameter();
  parameters.setConfKey("test_key");
  parameters.setValue("test_value");
  configuration.setConfigurationParameters(new HashSet<ConfigurationParameter>());
  configuration.getConfigurationParameters().add(parameters);
  configuration.setName("configuration_test");
  when(mock.add(configuration)).thenReturn(configuration);

  log.info("" + restConfiguration.create(configuration, "project-id"));
  Configuration configuration2 = restConfiguration.create(configuration, "project-id");
  assertEquals(configuration, configuration2);
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:17,代码来源:ApiRestConfigurationTest.java

示例2: configurationUpdate

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
@Test
public void configurationUpdate() throws NotFoundException {
  Configuration configuration = new Configuration();
  configuration.setId("123");
  ConfigurationParameter parameters = new ConfigurationParameter();
  parameters.setConfKey("test_key");
  parameters.setValue("test_value");
  configuration.setConfigurationParameters(new HashSet<ConfigurationParameter>());
  configuration.getConfigurationParameters().add(parameters);
  configuration.setName("configuration_test");
  when(mock.update(any(configuration.getClass()), anyString(), anyString()))
      .thenReturn(configuration);
  assertEquals(
      configuration,
      restConfiguration.update(configuration, configuration.getId(), "project-id"));
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:17,代码来源:ApiRestConfigurationTest.java

示例3: fillAccessibilityConfigurationParameters

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
private Map<String, String> fillAccessibilityConfigurationParameters(
    Map<String, String> extension, VirtualNetworkFunctionDescriptor vnfd, DeployNSRBody body) {
  if (body.getConfigurations().get(vnfd.getName()) == null) return extension;
  for (ConfigurationParameter passedConfigurationParameter :
      body.getConfigurations().get(vnfd.getName()).getConfigurationParameters()) {
    if (passedConfigurationParameter.getConfKey().equalsIgnoreCase("ssh_username")
        && passedConfigurationParameter.getValue() != null
        && !passedConfigurationParameter.getValue().isEmpty()) {
      extension.put(
          passedConfigurationParameter.getConfKey(), passedConfigurationParameter.getValue());
    }
    if (passedConfigurationParameter.getConfKey().equals("ssh_password")
        && passedConfigurationParameter.getValue() != null
        && !passedConfigurationParameter.getValue().isEmpty()) {
      extension.put(
          passedConfigurationParameter.getConfKey(), passedConfigurationParameter.getValue());
    }
  }
  return extension;
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:21,代码来源:MessageGenerator.java

示例4: nfvImageManagementUpdateTest

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
@Test
public void nfvImageManagementUpdateTest() throws NotFoundException {
  Configuration configutation = createConfigutation();
  Configuration configuration2 = createConfigutation();
  configuration2.setName("UpdatedName");
  ConfigurationParameter configurationParameter = new ConfigurationParameter();
  configurationParameter.setConfKey("new_key");
  configurationParameter.setValue("new_value");
  configuration2.getConfigurationParameters().add(configurationParameter);
  when(configurationRepository.save(any(Configuration.class))).thenReturn(configuration2);
  when(configurationRepository.findFirstByIdAndProjectId(anyString(), eq(projectId)))
      .thenReturn(configuration2);
  configutation =
      configurationManagement.update(configuration2, configutation.getId(), projectId);
  assertEqualsConfiguration(configutation, configuration2);
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:17,代码来源:ConfigurationManagementClassSuiteTest.java

示例5: assertEqualsConfiguration

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
private void assertEqualsConfiguration(
    Configuration configuration_exp, Configuration configuration_new) {
  Assert.assertEquals(configuration_exp.getName(), configuration_new.getName());
  int i = 0;
  for (ConfigurationParameter configurationParameter :
      configuration_exp.getConfigurationParameters()) {
    ConfigurationParameter[] parameters = new ConfigurationParameter[10];
    Assert.assertEquals(
        configurationParameter.getConfKey(),
        configuration_new.getConfigurationParameters().toArray(parameters)[i].getConfKey());
    Assert.assertEquals(
        configurationParameter.getValue(),
        configuration_new.getConfigurationParameters().toArray(parameters)[i].getValue());
    i++;
  }
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:17,代码来源:ConfigurationManagementClassSuiteTest.java

示例6: nsrManagementDeleteTest

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
@Test
public void nsrManagementDeleteTest()
    throws VimException, InterruptedException, ExecutionException, NamingException,
        NotFoundException, WrongStatusException, PluginException, BadFormatException {
  NetworkServiceRecord nsd_exp = createNetworkServiceRecord();
  when(resourceManagement.release(any(VirtualDeploymentUnit.class), any(VNFCInstance.class)))
      .thenReturn(new AsyncResult<Void>(null));
  when(nsrRepository.findFirstByIdAndProjectId(nsd_exp.getId(), projectId)).thenReturn(nsd_exp);
  Configuration system = new Configuration();
  system.setConfigurationParameters(new HashSet<>());
  ConfigurationParameter configurationParameter = new ConfigurationParameter();
  configurationParameter.setConfKey("delete-on-all-status");
  configurationParameter.setValue("true");
  when(configurationManagement.queryByName("system")).thenReturn(system);
  nsrManagement.delete(nsd_exp.getId(), projectId);
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:17,代码来源:NetworkServiceRecordManagementClassSuiteTest.java

示例7: instantiate

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
/**
 * This operation allows creating a VNF instance.
 *
 * @param virtualNetworkFunctionRecord
 * @param scripts
 */
@Override
public VirtualNetworkFunctionRecord instantiate(
    VirtualNetworkFunctionRecord virtualNetworkFunctionRecord,
    Object scripts,
    Map<String, Collection<BaseVimInstance>> vimInstances)
    throws Exception {
  log.info(
      "Instantiation of VirtualNetworkFunctionRecord " + virtualNetworkFunctionRecord.getName());

  // vnfmHelper.saveScriptOnEms(virtualNetworkFunctionRecord, scripts);

  log.debug("added parameter to config");
  log.debug("CONFIGURATION: " + virtualNetworkFunctionRecord.getConfigurations());
  ConfigurationParameter cp = new ConfigurationParameter();
  cp.setConfKey("new_key");
  cp.setValue("new_value");
  virtualNetworkFunctionRecord.getConfigurations().getConfigurationParameters().add(cp);

  Thread.sleep((int) (Math.random() * 5000) + 4000);

  return virtualNetworkFunctionRecord;
}
 
开发者ID:openbaton,项目名称:dummy-vnfm-amqp,代码行数:29,代码来源:DummyAMQPVNFManager.java

示例8: fillSpecificProvides

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
@Override
protected void fillSpecificProvides(VirtualNetworkFunctionRecord virtualNetworkFunctionRecord) {
  for (ConfigurationParameter configurationParameter :
      virtualNetworkFunctionRecord.getProvides().getConfigurationParameters()) {
    if (!configurationParameter.getConfKey().startsWith("#nfvo:")) {
      configurationParameter.setValue(String.valueOf((int) (Math.random() * 100)));
      log.debug(
          "Setting: "
              + configurationParameter.getConfKey()
              + " with value: "
              + configurationParameter.getValue());
    }
  }
}
 
开发者ID:openbaton,项目名称:generic-vnfm,代码行数:15,代码来源:GenericVNFM.java

示例9: configurationFindBy

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
@Test
public void configurationFindBy() {
  Configuration configuration = new Configuration();
  configuration.setId("123");
  ConfigurationParameter parameters = new ConfigurationParameter();
  parameters.setConfKey("test_key");
  parameters.setValue("test_value");
  configuration.setConfigurationParameters(new HashSet<ConfigurationParameter>());
  configuration.getConfigurationParameters().add(parameters);
  configuration.setName("configuration_test");
  when(mock.query(anyString(), anyString())).thenReturn(configuration);
  assertEquals(configuration, restConfiguration.findById(configuration.getId(), "project-id"));
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:14,代码来源:ApiRestConfigurationTest.java

示例10: updateConfigurationParameters

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
private Set<ConfigurationParameter> updateConfigurationParameters(
    Set<ConfigurationParameter> configurationParameters_nfvo,
    Set<ConfigurationParameter> configurationParameters_manager) {
  Set<ConfigurationParameter> configurationParameters = new HashSet<>();
  boolean found = false;
  //Updating existing Components, adding new ones and ignoring old ones
  for (ConfigurationParameter configurationParameter_manager : configurationParameters_manager) {
    //VNFCInstance ID is null -> NEW
    if (configurationParameter_manager.getId() == null) {
      configurationParameters.add(configurationParameter_manager);
      log.debug("Update: Added new ConfigurationParameter " + configurationParameter_manager);
      continue;
    }
    for (ConfigurationParameter configurationParameter_nfvo : configurationParameters_nfvo) {
      //Found Instance -> Updating
      if (configurationParameter_nfvo.getId().equals(configurationParameter_manager.getId())) {
        log.debug(
            "Update: Updating existing ConfigurationParameter "
                + configurationParameter_nfvo.getId());
        found = true;
        configurationParameter_nfvo.setConfKey(configurationParameter_manager.getConfKey());
        configurationParameter_nfvo.setValue(configurationParameter_manager.getValue());
        //Add updated ConfigurationParameter
        configurationParameters.add(configurationParameter_nfvo);
        //Proceed with the next ConfigurationParameter
        break;
      }
    }
    //ConfigurationParameter was not found -> NEW
    if (!found) {
      configurationParameters.add(configurationParameter_manager);
      log.debug(
          "Update: Added new ConfigurationParameter " + configurationParameter_manager.getId());
    }
  }
  log.debug("Update: Updated ConfigurationParameters " + configurationParameters);
  return configurationParameters;
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:39,代码来源:UpdatevnfrTask.java

示例11: checkSshInfo

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
private void checkSshInfo(NetworkServiceDescriptor nsd, DeployNSRBody body)
    throws NotFoundException {
  for (VirtualNetworkFunctionDescriptor vnfd : nsd.getVnfd()) {
    if (body.getConfigurations().get(vnfd.getName()) == null) {
      continue;
    }
    boolean isSshUsernameProvided = false;
    boolean isSshPasswordProvided = false;
    for (ConfigurationParameter passedConfigurationParameter :
        body.getConfigurations().get(vnfd.getName()).getConfigurationParameters()) {
      if (passedConfigurationParameter.getConfKey().equalsIgnoreCase("ssh_username")
          && passedConfigurationParameter.getValue() != null
          && !passedConfigurationParameter.getValue().isEmpty()) {
        isSshUsernameProvided = true;
      }
      if (passedConfigurationParameter.getConfKey().equals("ssh_password")
          && passedConfigurationParameter.getValue() != null
          && !passedConfigurationParameter.getValue().isEmpty()) {
        isSshPasswordProvided = true;
      }
    }
    // Throw an exception if only one of them is provided.
    // - username without password is not allowed
    // - password without username is not allowed
    // - username and password is allowed
    // - no username and no password is allowed because this configuration can be done in the configuration file of
    //    the Fixed-host VNFM.
    if (isSshPasswordProvided != isSshUsernameProvided) {
      throw new NotFoundException(
          "Provide both ssh_username and ssh_password for the vnfd: " + vnfd.getName());
    }
  }
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:34,代码来源:NetworkServiceRecordManagement.java

示例12: createConfigutation

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
private Configuration createConfigutation() {
  Configuration configuration = new Configuration();
  configuration.setProjectId(projectId);
  configuration.setName("configuration_name");
  configuration.setConfigurationParameters(
      new HashSet<ConfigurationParameter>() {
        {
          ConfigurationParameter configurationParameter = new ConfigurationParameter();
          configurationParameter.setConfKey("key");
          configurationParameter.setValue("value");
          add(configurationParameter);
        }
      });
  return configuration;
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:16,代码来源:ConfigurationManagementClassSuiteTest.java

示例13: fillVnfrVnfc

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的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

示例14: parseVNFDTemplate

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
/**
 * Parser of the VNF template
 *
 * @param VNFDTemplate
 * @return
 */
public VirtualNetworkFunctionDescriptor parseVNFDTemplate(VNFDTemplate VNFDTemplate)
    throws NotFoundException {

  VirtualNetworkFunctionDescriptor vnfd = new VirtualNetworkFunctionDescriptor();

  // ADD SETTINGS
  if (VNFDTemplate.getMetadata() == null)
    throw new NotFoundException("The VNFD Template must have contain metadata child!");
  vnfd.setName(VNFDTemplate.getMetadata().getID());
  vnfd.setVendor(VNFDTemplate.getMetadata().getVendor());
  vnfd.setVersion(VNFDTemplate.getMetadata().getVersion());

  if (VNFDTemplate.getInputs() == null)
    throw new NotFoundException(
        "You should specify at least endpoint, deployment_flavour and type in inputs");
  vnfd.setDeployment_flavour(VNFDTemplate.getInputs().getDeploymentFlavourConverted());
  vnfd.setVnfPackageLocation(VNFDTemplate.getInputs().getVnfPackageLocation());
  if (VNFDTemplate.getInputs().getEndpoint() == null)
    throw new NotFoundException("No endpoint specified in inputs!");
  vnfd.setEndpoint(VNFDTemplate.getInputs().getEndpoint());
  if (VNFDTemplate.getInputs().getType() == null)
    throw new NotFoundException("No type specified in inputs!");
  vnfd.setType(VNFDTemplate.getInputs().getType());

  // ADD VDUs
  Set<VirtualDeploymentUnit> vdus = new HashSet<>();
  for (VDUNodeTemplate vdu : VNFDTemplate.getTopology_template().getVDUNodes()) {
    vdus.add(parseVDUTemplate(vdu, VNFDTemplate.getTopology_template().getCPNodes()));
  }
  vnfd.setVdu(vdus);

  // ADD VLs
  Set<InternalVirtualLink> vls = new HashSet<>();

  for (VLNodeTemplate vl : VNFDTemplate.getTopology_template().getVLNodes()) {

    vls.add(parseVL(vl));
  }

  vnfd.setVirtual_link(vls);
  vnfd.setLifecycle_event(VNFDTemplate.getInputs().getInterfaces().getOpLifecycle());

  //ADD CONFIGURATIONS
  if (VNFDTemplate.getInputs().getConfigurations() != null) {

    VNFConfigurations configurations = VNFDTemplate.getInputs().getConfigurations();

    Configuration configuration = new Configuration();
    configuration.setName(configurations.getName());

    Set<ConfigurationParameter> configurationParameters = new HashSet<>();

    for (HashMap<String, String> pair : configurations.getConfigurationParameters()) {

      ConfigurationParameter configurationParameter = new ConfigurationParameter();
      configurationParameter.setConfKey((String) pair.keySet().toArray()[0]);
      configurationParameter.setValue((String) pair.values().toArray()[0]);
      configurationParameters.add(configurationParameter);
    }

    configuration.setConfigurationParameters(configurationParameters);
    vnfd.setConfigurations(configuration);
  }

  return vnfd;
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:73,代码来源:TOSCAParser.java

示例15: fillDeploymentTimeIPs

import org.openbaton.catalogue.nfvo.ConfigurationParameter; //导入依赖的package包/类
private void fillDeploymentTimeIPs(
    NetworkServiceDescriptor networkServiceDescriptor,
    DeployNSRBody body,
    Map<String, Set<String>> vduVimInstances)
    throws NotFoundException {
  for (VirtualNetworkFunctionDescriptor virtualNetworkFunctionDescriptor :
      networkServiceDescriptor.getVnfd()) {

    if (!virtualNetworkFunctionDescriptor.getEndpoint().equals("fixed-host")) {
      continue;
    }

    // Here we assume the VNFD contains only one VDU and one VNF component.
    VirtualDeploymentUnit vdu = virtualNetworkFunctionDescriptor.getVdu().iterator().next();
    VNFComponent vnfComponent = vdu.getVnfc().iterator().next();

    boolean isFixedHostVimUsed = false;
    for (BaseVimInstance vimInstance :
        vimInstanceRepository.findByProjectId(virtualNetworkFunctionDescriptor.getProjectId())) {
      if (vduVimInstances.get(vdu.getId()).contains(vimInstance.getName())
          && vimInstance.getType().equals("fixed-host")) {
        isFixedHostVimUsed = true;
      }
    }

    for (ConfigurationParameter passedConfigurationParameter :
        body.getConfigurations()
            .get(virtualNetworkFunctionDescriptor.getName())
            .getConfigurationParameters()) {
      if (passedConfigurationParameter.getConfKey().startsWith("ssh_")
          && passedConfigurationParameter.getConfKey().endsWith("_ip")) {
        if (passedConfigurationParameter.getValue().equals("random") && isFixedHostVimUsed) {
          throw new NotFoundException(
              "Specify the parameter "
                  + passedConfigurationParameter.getConfKey()
                  + " of the vnfd "
                  + virtualNetworkFunctionDescriptor.getName()
                  + " with a valid IP");
        }
        for (VNFDConnectionPoint vnfdConnectionPoint : vnfComponent.getConnection_point()) {
          if (passedConfigurationParameter
              .getConfKey()
              .contains(vnfdConnectionPoint.getVirtual_link_reference())) {
            log.debug(
                "VNF: "
                    + virtualNetworkFunctionDescriptor.getName()
                    + ", setting ip: "
                    + passedConfigurationParameter.getValue()
                    + " to cp: "
                    + vnfdConnectionPoint.getVirtual_link_reference());
            vnfdConnectionPoint.setFloatingIp(passedConfigurationParameter.getValue());
            break;
          }
        }
      }
    }
  }
}
 
开发者ID:openbaton,项目名称:NFVO,代码行数:59,代码来源:NetworkServiceRecordManagement.java


注:本文中的org.openbaton.catalogue.nfvo.ConfigurationParameter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。