public CreateGatewayInputBuilder(CreateGatewayInput base) { this._fabricId = base.getFabricId(); this._ipAddress = base.getIpAddress(); this._logicalRouter = base.getLogicalRouter(); this._logicalSwitch = base.getLogicalSwitch(); this._network = base.getNetwork(); if (base instanceof CreateGatewayInputImpl) { CreateGatewayInputImpl impl = (CreateGatewayInputImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.services.rev150930.CreateGatewayInput> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.faas.fabric.services.rev150930.CreateGatewayInput>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
@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); }
if (!Objects.equals(_fabricId, other.getFabricId())) { return false; if (!Objects.equals(_ipAddress, other.getIpAddress())) { return false; if (!Objects.equals(_logicalRouter, other.getLogicalRouter())) { return false; if (!Objects.equals(_logicalSwitch, other.getLogicalSwitch())) { return false; if (!Objects.equals(_network, other.getNetwork())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
private TpId createGWPortOnRouter(CreateGatewayInput input, CreateGatewayOutputBuilder outputBuilder, WriteTransaction trans, FabricInstance fabricObj) { final FabricId fabricId = input.getFabricId(); final NodeId routerId = input.getLogicalRouter(); final NodeId swId = input.getLogicalSwitch(); final IpAddress gwIp = input.getIpAddress(); IpPrefix network = input.getNetwork(); if (network == null) { network = IpAddressUtils.createDefaultPrefix(gwIp);