Ejemplo n.º 1
0
  @SuppressWarnings("unused")
  private ServiceFunctionChain findServiceFunctionChain(String name) {
    ServiceFunctionChainKey key = new ServiceFunctionChainKey(name);
    InstanceIdentifier<ServiceFunctionChain> serviceFunctionChainInstanceIdentifier =
        InstanceIdentifier.builder(ServiceFunctionChains.class)
            .child(ServiceFunctionChain.class, key)
            .build();

    ServiceFunctionChain serviceFunctionChain =
        SfcDataStoreAPI.readTransactionAPI(
            serviceFunctionChainInstanceIdentifier, LogicalDatastoreType.CONFIGURATION);
    if (serviceFunctionChain == null) {
      LOG.error("Failed to find Service Function Chain: {}", name);
    }
    return serviceFunctionChain;
  }
Ejemplo n.º 2
0
  @Override
  public Future<RpcResult<Void>> putServiceFunctionChains(PutServiceFunctionChainsInput input) {
    printTraceStart(LOG);
    ServiceFunctionChainsBuilder serviceFunctionChainsBuilder = new ServiceFunctionChainsBuilder();
    serviceFunctionChainsBuilder =
        serviceFunctionChainsBuilder.setServiceFunctionChain(input.getServiceFunctionChain());
    ServiceFunctionChains sfcs = serviceFunctionChainsBuilder.build();

    if (!SfcDataStoreAPI.writeMergeTransactionAPI(
        OpendaylightSfc.SFC_IID, sfcs, LogicalDatastoreType.CONFIGURATION)) {
      LOG.error(
          "Failed to create service function chain: {}",
          input.getServiceFunctionChain().toString());
    }
    return Futures.immediateFuture(Rpcs.<Void>getRpcResult(true, Collections.<RpcError>emptySet()));
  }