示例#1
0
  private ServiceFunction buildServiceFunction(
      SfName name,
      Class<? extends ServiceFunctionTypeIdentity> type,
      IpAddress ipMgmtAddress,
      List<SfDataPlaneLocator> dsfDataPlaneLocatorList,
      Boolean nshAware) {

    ServiceFunctionBuilder sfBuilder = new ServiceFunctionBuilder();
    sfBuilder
        .setName(name)
        .setKey(new ServiceFunctionKey(name))
        .setType(type)
        .setIpMgmtAddress(ipMgmtAddress)
        .setSfDataPlaneLocator(dsfDataPlaneLocatorList)
        .setNshAware(nshAware);

    return sfBuilder.build();
  }
示例#2
0
  @Override
  public Future<RpcResult<Void>> putServiceFunction(PutServiceFunctionInput input) {
    printTraceStart(LOG);
    LOG.info("\n####### Input: " + input);

    if (dataBroker != null) {

      // Data PLane Locator
      List<SfDataPlaneLocator> sfDataPlaneLocatorList = input.getSfDataPlaneLocator();

      ServiceFunctionBuilder sfbuilder = new ServiceFunctionBuilder();
      ServiceFunctionKey sfkey = new ServiceFunctionKey(input.getName());
      ServiceFunction sf =
          sfbuilder
              .setName(input.getName())
              .setType(input.getType())
              .setKey(sfkey)
              .setIpMgmtAddress(input.getIpMgmtAddress())
              .setSfDataPlaneLocator(sfDataPlaneLocatorList)
              .build();

      InstanceIdentifier<ServiceFunction> sfEntryIID =
          InstanceIdentifier.builder(ServiceFunctions.class)
              .child(ServiceFunction.class, sf.getKey())
              .toInstance();

      WriteTransaction writeTx = dataBroker.newWriteOnlyTransaction();
      writeTx.merge(LogicalDatastoreType.CONFIGURATION, sfEntryIID, sf);
      writeTx.commit();

    } else {
      LOG.warn("\n####### Data Provider is NULL : {}", Thread.currentThread().getStackTrace()[1]);
    }
    printTraceStop(LOG);
    return Futures.immediateFuture(Rpcs.<Void>getRpcResult(true, Collections.<RpcError>emptySet()));
  }