private CreateGatewayOutputImpl(CreateGatewayOutputBuilder base) { this._fabricAcl = base.getFabricAcl(); this._lportUuid = base.getLportUuid(); this._name = base.getName(); this._portFunction = base.getPortFunction(); this._portLayer = base.getPortLayer(); this._tpId = base.getTpId(); this._underlayerPorts = base.getUnderlayerPorts(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.services.rev150930.CreateGatewayOutput>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.services.rev150930.CreateGatewayOutput>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.services.rev150930.CreateGatewayOutput>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.services.rev150930.CreateGatewayOutput>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public CreateGatewayOutputBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.services.rev150930.CreateGatewayOutput>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.services.rev150930.CreateGatewayOutput> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
trans.put(LogicalDatastoreType.OPERATIONAL,tpIId, tpBuilder.build(), true); outputBuilder.setTpId(tpid); outputBuilder.setPortLayer(lpAttr.getPortLayer());
@Override public Future<RpcResult<CreateGatewayOutput>> createGateway(CreateGatewayInput input) { final RpcResultBuilder<CreateGatewayOutput> resultBuilder = RpcResultBuilder .<CreateGatewayOutput>success(); CreateGatewayOutputBuilder outputBuilder = new CreateGatewayOutputBuilder(); final FabricId fabricId = input.getFabricId(); final NodeId routerId = input.getLogicalRouter(); final NodeId swId = input.getLogicalSwitch(); final FabricInstance fabricObj = FabricInstanceCache.INSTANCE.retrieveFabric(fabricId); if (fabricObj == null) { return Futures.immediateFailedFuture( new IllegalArgumentException(String.format("fabric %s does not exist", fabricId))); } WriteTransaction trans = dataBroker.newWriteOnlyTransaction(); // add logic port to Router TpId tpid1 = createGWPortOnRouter(input, outputBuilder, trans, fabricObj); // add logic port to switch TpId tpid2 = createGWPortOnSwitch(fabricId, swId, trans); // add link LinkId linkId = createGatewayLink(routerId, tpid1); createLogicLink(fabricId, routerId, swId, trans, tpid1, tpid2, linkId); return Futures.transform(trans.submit(), new AsyncFunction<Void, RpcResult<CreateGatewayOutput>>() { @Override public ListenableFuture<RpcResult<CreateGatewayOutput>> apply(Void submitResult) throws Exception { resultBuilder.withResult(outputBuilder); return Futures.immediateFuture(resultBuilder.build()); } }, executor); }