Program: 105270
Project: 105270
Buggy source:
@Override @DB @ActionEvent(eventType=EventTypes.EVENT_NETWORK_CREATE,eventDescription="String_Node_Str") public Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
  Long networkOfferingId=cmd.getNetworkOfferingId();
  String gateway=cmd.getGateway();
  String startIP=cmd.getStartIp();
  String endIP=cmd.getEndIp();
  String netmask=cmd.getNetmask();
  String networkDomain=cmd.getNetworkDomain();
  String vlanId=null;
  if (cmd instanceof CreateNetworkCmdByAdmin) {
    vlanId=((CreateNetworkCmdByAdmin)cmd).getVlan();
  }
  String name=cmd.getNetworkName();
  String displayText=cmd.getDisplayText();
  Account caller=CallContext.current().getCallingAccount();
  Long physicalNetworkId=cmd.getPhysicalNetworkId();
  Long zoneId=cmd.getZoneId();
  String aclTypeStr=cmd.getAclType();
  Long domainId=cmd.getDomainId();
  boolean isDomainSpecific=false;
  Boolean subdomainAccess=cmd.getSubdomainAccess();
  Long vpcId=cmd.getVpcId();
  String startIPv6=cmd.getStartIpv6();
  String endIPv6=cmd.getEndIpv6();
  String ip6Gateway=cmd.getIp6Gateway();
  String ip6Cidr=cmd.getIp6Cidr();
  Boolean displayNetwork=cmd.getDisplayNetwork();
  Long aclId=cmd.getAclId();
  String isolatedPvlan=cmd.getIsolatedPvlan();
  NetworkOfferingVO ntwkOff=_networkOfferingDao.findById(networkOfferingId);
  if (ntwkOff == null || ntwkOff.isSystemOnly()) {
    InvalidParameterValueException ex=new InvalidParameterValueException("String_Node_Str");
    if (ntwkOff != null) {
      ex.addProxyObject(ntwkOff.getUuid(),"String_Node_Str");
    }
    throw ex;
  }
  PhysicalNetwork pNtwk=null;
  if (physicalNetworkId != null) {
    pNtwk=_physicalNetworkDao.findById(physicalNetworkId);
    if (pNtwk == null) {
      throw new InvalidParameterValueException("String_Node_Str");
    }
  }
  if (zoneId == null) {
    zoneId=pNtwk.getDataCenterId();
  }
  if (displayNetwork == null) {
    displayNetwork=true;
  }
  DataCenter zone=_dcDao.findById(zoneId);
  if (zone == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getId())) {
    PermissionDeniedException ex=new PermissionDeniedException("String_Node_Str");
    ex.addProxyObject(zone.getUuid(),"String_Node_Str");
    throw ex;
  }
  ACLType aclType=null;
  if (aclTypeStr != null) {
    if (aclTypeStr.equalsIgnoreCase(ACLType.Account.toString())) {
      aclType=ACLType.Account;
    }
 else     if (aclTypeStr.equalsIgnoreCase(ACLType.Domain.toString())) {
      aclType=ACLType.Domain;
    }
 else {
      throw new InvalidParameterValueException("String_Node_Str");
    }
    if (ntwkOff.getGuestType() == GuestType.Isolated) {
      if (aclType != ACLType.Account) {
        throw new InvalidParameterValueException("String_Node_Str" + ACLType.Account + "String_Node_Str"+ Network.GuestType.Isolated);
      }
    }
 else     if (ntwkOff.getGuestType() == GuestType.Shared) {
      if (!(aclType == ACLType.Domain || aclType == ACLType.Account)) {
        throw new InvalidParameterValueException("String_Node_Str" + ACLType.Domain + "String_Node_Str"+ ACLType.Account+ "String_Node_Str"+ Network.GuestType.Shared);
      }
    }
  }
 else {
    if (ntwkOff.getGuestType() == GuestType.Isolated) {
      aclType=ACLType.Account;
    }
 else     if (ntwkOff.getGuestType() == GuestType.Shared) {
      aclType=ACLType.Domain;
    }
  }
  if (ntwkOff.getGuestType() == GuestType.Shared && !_accountMgr.isAdmin(caller.getId())) {
    throw new InvalidParameterValueException("String_Node_Str" + GuestType.Shared);
  }
  if (aclType == ACLType.Domain) {
    if (!_accountMgr.isAdmin(caller.getId())) {
      throw new PermissionDeniedException("String_Node_Str");
    }
    if (ntwkOff.getGuestType() != GuestType.Shared) {
      throw new InvalidParameterValueException("String_Node_Str" + GuestType.Shared + "String_Node_Str"+ ACLType.Domain);
    }
    if (domainId != null) {
      if (ntwkOff.getTrafficType() != TrafficType.Guest || ntwkOff.getGuestType() != Network.GuestType.Shared) {
        throw new InvalidParameterValueException("String_Node_Str" + TrafficType.Guest + "String_Node_Str"+ Network.GuestType.Shared);
      }
      DomainVO domain=_domainDao.findById(domainId);
      if (domain == null) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
      _accountMgr.checkAccess(caller,domain);
    }
    isDomainSpecific=true;
  }
 else   if (subdomainAccess != null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  Account owner=null;
  if ((cmd.getAccountName() != null && domainId != null) || cmd.getProjectId() != null) {
    owner=_accountMgr.finalizeOwner(caller,cmd.getAccountName(),domainId,cmd.getProjectId());
  }
 else {
    owner=caller;
  }
  boolean ipv4=true, ipv6=false;
  if (startIP != null) {
    ipv4=true;
  }
  if (startIPv6 != null) {
    ipv6=true;
  }
  if (gateway != null) {
    try {
      InetAddress gatewayAddress=InetAddress.getByName(gateway);
      if (gatewayAddress instanceof Inet6Address) {
        ipv6=true;
      }
 else {
        ipv4=true;
      }
    }
 catch (    UnknownHostException e) {
      s_logger.error("String_Node_Str",e);
      throw new InvalidParameterValueException("String_Node_Str");
    }
  }
  String cidr=null;
  if (ipv4) {
    if (startIP != null) {
      if (!NetUtils.isValidIp(startIP)) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
      if (endIP == null) {
        endIP=startIP;
      }
 else       if (!NetUtils.isValidIp(endIP)) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
    }
    if (startIP != null && endIP != null) {
      if (!(gateway != null && netmask != null)) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
    }
    if (gateway != null && netmask != null) {
      if (!NetUtils.isValidIp(gateway)) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
      if (!NetUtils.isValidNetmask(netmask)) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
      cidr=NetUtils.ipAndNetMaskToCidr(gateway,netmask);
    }
  }
  if (ipv6) {
    if (endIPv6 == null) {
      endIPv6=startIPv6;
    }
    _networkModel.checkIp6Parameters(startIPv6,endIPv6,ip6Gateway,ip6Cidr);
    if (zone.getNetworkType() != NetworkType.Advanced || ntwkOff.getGuestType() != Network.GuestType.Shared) {
      throw new InvalidParameterValueException("String_Node_Str");
    }
  }
  if (isolatedPvlan != null && (zone.getNetworkType() != NetworkType.Advanced || ntwkOff.getGuestType() != Network.GuestType.Shared)) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (isolatedPvlan != null && ipv6) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (_accountMgr.isNormalUser(caller.getId()) && (ntwkOff.getTrafficType() != TrafficType.Guest || ntwkOff.getGuestType() != Network.GuestType.Isolated && areServicesSupportedByNetworkOffering(ntwkOff.getId(),Service.SourceNat))) {
    throw new InvalidParameterValueException("String_Node_Str" + "String_Node_Str" + TrafficType.Guest + "String_Node_Str"+ Network.GuestType.Isolated+ "String_Node_Str"+ Service.SourceNat.getName()+ "String_Node_Str");
  }
  if (!_accountMgr.isRootAdmin(caller.getId()) && (ntwkOff.getSpecifyVlan() || vlanId != null)) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (ipv4) {
    if (!_accountMgr.isRootAdmin(caller.getId()) && cidr != null) {
      String[] cidrPair=cidr.split("String_Node_Str");
      int cidrSize=Integer.valueOf(cidrPair[1]);
      if (cidrSize < _cidrLimit) {
        throw new InvalidParameterValueException("String_Node_Str" + _cidrLimit);
      }
    }
  }
  Collection<String> ntwkProviders=_networkMgr.finalizeServicesAndProvidersForNetwork(ntwkOff,physicalNetworkId).values();
  if (ipv6 && providersConfiguredForExternalNetworking(ntwkProviders)) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (isolatedPvlan != null && providersConfiguredForExternalNetworking(ntwkProviders)) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (cidr != null && providersConfiguredForExternalNetworking(ntwkProviders)) {
    if (ntwkOff.getGuestType() == GuestType.Shared && (zone.getNetworkType() == NetworkType.Advanced) && isSharedNetworkOfferingWithServices(networkOfferingId)) {
      checkSharedNetworkCidrOverlap(zoneId,pNtwk.getId(),cidr);
    }
 else {
      if (vpcId == null)       throw new InvalidParameterValueException("String_Node_Str");
    }
  }
  boolean createVlan=(startIP != null && endIP != null && zone.getNetworkType() == NetworkType.Advanced && ((ntwkOff.getGuestType() == Network.GuestType.Shared) || (ntwkOff.getGuestType() == GuestType.Isolated && !areServicesSupportedByNetworkOffering(ntwkOff.getId(),Service.SourceNat))));
  if (!createVlan) {
    if (ipv6) {
      createVlan=true;
    }
  }
  if (createVlan && !ntwkOff.getSpecifyIpRanges()) {
    InvalidParameterValueException ex=new InvalidParameterValueException("String_Node_Str");
    ex.addProxyObject(ntwkOff.getUuid(),"String_Node_Str");
    throw ex;
  }
  Network network=commitNetwork(networkOfferingId,gateway,startIP,endIP,netmask,networkDomain,vlanId,name,displayText,caller,physicalNetworkId,zoneId,domainId,isDomainSpecific,subdomainAccess,vpcId,startIPv6,endIPv6,ip6Gateway,ip6Cidr,displayNetwork,aclId,isolatedPvlan,ntwkOff,pNtwk,aclType,owner,cidr,createVlan);
  if (ntwkOff.getIsPersistent()) {
    try {
      if (network.getState() == Network.State.Setup) {
        s_logger.debug("String_Node_Str" + network.getId() + "String_Node_Str");
        return network;
      }
      DeployDestination dest=new DeployDestination(zone,null,null,null);
      UserVO callerUser=_userDao.findById(CallContext.current().getCallingUserId());
      Journal journal=new Journal.LogJournal("String_Node_Str" + network,s_logger);
      ReservationContext context=new ReservationContextImpl(UUID.randomUUID().toString(),journal,callerUser,caller);
      s_logger.debug("String_Node_Str" + network + "String_Node_Str");
      Pair<? extends NetworkGuru,? extends Network> implementedNetwork=_networkMgr.implementNetwork(network.getId(),dest,context);
      if (implementedNetwork == null || implementedNetwork.first() == null) {
        s_logger.warn("String_Node_Str" + network);
      }
      network=implementedNetwork.second();
    }
 catch (    ResourceUnavailableException ex) {
      s_logger.warn("String_Node_Str" + network + "String_Node_Str",ex);
      CloudRuntimeException e=new CloudRuntimeException("String_Node_Str");
      e.addProxyObject(network.getUuid(),"String_Node_Str");
      throw e;
    }
  }
  return network;
}

Fixed version (ground truth):
@Override @DB @ActionEvent(eventType=EventTypes.EVENT_NETWORK_CREATE,eventDescription="String_Node_Str") public Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
  Long networkOfferingId=cmd.getNetworkOfferingId();
  String gateway=cmd.getGateway();
  String startIP=cmd.getStartIp();
  String endIP=cmd.getEndIp();
  String netmask=cmd.getNetmask();
  String networkDomain=cmd.getNetworkDomain();
  String vlanId=null;
  if (cmd instanceof CreateNetworkCmdByAdmin) {
    vlanId=((CreateNetworkCmdByAdmin)cmd).getVlan();
  }
  String name=cmd.getNetworkName();
  String displayText=cmd.getDisplayText();
  Account caller=CallContext.current().getCallingAccount();
  Long physicalNetworkId=cmd.getPhysicalNetworkId();
  Long zoneId=cmd.getZoneId();
  String aclTypeStr=cmd.getAclType();
  Long domainId=cmd.getDomainId();
  boolean isDomainSpecific=false;
  Boolean subdomainAccess=cmd.getSubdomainAccess();
  Long vpcId=cmd.getVpcId();
  String startIPv6=cmd.getStartIpv6();
  String endIPv6=cmd.getEndIpv6();
  String ip6Gateway=cmd.getIp6Gateway();
  String ip6Cidr=cmd.getIp6Cidr();
  Boolean displayNetwork=cmd.getDisplayNetwork();
  Long aclId=cmd.getAclId();
  String isolatedPvlan=cmd.getIsolatedPvlan();
  NetworkOfferingVO ntwkOff=_networkOfferingDao.findById(networkOfferingId);
  if (ntwkOff == null || ntwkOff.isSystemOnly()) {
    InvalidParameterValueException ex=new InvalidParameterValueException("String_Node_Str");
    if (ntwkOff != null) {
      ex.addProxyObject(ntwkOff.getUuid(),"String_Node_Str");
    }
    throw ex;
  }
  PhysicalNetwork pNtwk=null;
  if (physicalNetworkId != null) {
    pNtwk=_physicalNetworkDao.findById(physicalNetworkId);
    if (pNtwk == null) {
      throw new InvalidParameterValueException("String_Node_Str");
    }
  }
  if (zoneId == null) {
    zoneId=pNtwk.getDataCenterId();
  }
  if (displayNetwork == null) {
    displayNetwork=true;
  }
  DataCenter zone=_dcDao.findById(zoneId);
  if (zone == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getId())) {
    PermissionDeniedException ex=new PermissionDeniedException("String_Node_Str");
    ex.addProxyObject(zone.getUuid(),"String_Node_Str");
    throw ex;
  }
  ACLType aclType=null;
  if (aclTypeStr != null) {
    if (aclTypeStr.equalsIgnoreCase(ACLType.Account.toString())) {
      aclType=ACLType.Account;
    }
 else     if (aclTypeStr.equalsIgnoreCase(ACLType.Domain.toString())) {
      aclType=ACLType.Domain;
    }
 else {
      throw new InvalidParameterValueException("String_Node_Str");
    }
    if (ntwkOff.getGuestType() == GuestType.Isolated) {
      if (aclType != ACLType.Account) {
        throw new InvalidParameterValueException("String_Node_Str" + ACLType.Account + "String_Node_Str"+ Network.GuestType.Isolated);
      }
    }
 else     if (ntwkOff.getGuestType() == GuestType.Shared) {
      if (!(aclType == ACLType.Domain || aclType == ACLType.Account)) {
        throw new InvalidParameterValueException("String_Node_Str" + ACLType.Domain + "String_Node_Str"+ ACLType.Account+ "String_Node_Str"+ Network.GuestType.Shared);
      }
    }
  }
 else {
    if (ntwkOff.getGuestType() == GuestType.Isolated) {
      aclType=ACLType.Account;
    }
 else     if (ntwkOff.getGuestType() == GuestType.Shared) {
      aclType=ACLType.Domain;
    }
  }
  if (ntwkOff.getGuestType() == GuestType.Shared && !_accountMgr.isAdmin(caller.getId())) {
    throw new InvalidParameterValueException("String_Node_Str" + GuestType.Shared);
  }
  if (aclType == ACLType.Domain) {
    if (!_accountMgr.isAdmin(caller.getId())) {
      throw new PermissionDeniedException("String_Node_Str");
    }
    if (ntwkOff.getGuestType() != GuestType.Shared) {
      throw new InvalidParameterValueException("String_Node_Str" + GuestType.Shared + "String_Node_Str"+ ACLType.Domain);
    }
    if (domainId != null) {
      if (ntwkOff.getTrafficType() != TrafficType.Guest || ntwkOff.getGuestType() != Network.GuestType.Shared) {
        throw new InvalidParameterValueException("String_Node_Str" + TrafficType.Guest + "String_Node_Str"+ Network.GuestType.Shared);
      }
      DomainVO domain=_domainDao.findById(domainId);
      if (domain == null) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
      _accountMgr.checkAccess(caller,domain);
    }
    isDomainSpecific=true;
  }
 else   if (subdomainAccess != null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  Account owner=null;
  if ((cmd.getAccountName() != null && domainId != null) || cmd.getProjectId() != null) {
    owner=_accountMgr.finalizeOwner(caller,cmd.getAccountName(),domainId,cmd.getProjectId());
  }
 else {
    owner=caller;
  }
  boolean ipv4=true, ipv6=false;
  if (startIP != null) {
    ipv4=true;
  }
  if (startIPv6 != null) {
    ipv6=true;
  }
  if (gateway != null) {
    try {
      InetAddress gatewayAddress=InetAddress.getByName(gateway);
      if (gatewayAddress instanceof Inet6Address) {
        ipv6=true;
      }
 else {
        ipv4=true;
      }
    }
 catch (    UnknownHostException e) {
      s_logger.error("String_Node_Str",e);
      throw new InvalidParameterValueException("String_Node_Str");
    }
  }
  String cidr=null;
  if (ipv4) {
    if (startIP != null) {
      if (!NetUtils.isValidIp(startIP)) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
      if (endIP == null) {
        endIP=startIP;
      }
 else       if (!NetUtils.isValidIp(endIP)) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
    }
    if (startIP != null && endIP != null) {
      if (!(gateway != null && netmask != null)) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
    }
    if (gateway != null && netmask != null) {
      if (!NetUtils.isValidIp(gateway)) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
      if (!NetUtils.isValidNetmask(netmask)) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
      cidr=NetUtils.ipAndNetMaskToCidr(gateway,netmask);
    }
  }
  if (ipv6) {
    if (endIPv6 == null) {
      endIPv6=startIPv6;
    }
    _networkModel.checkIp6Parameters(startIPv6,endIPv6,ip6Gateway,ip6Cidr);
    if (zone.getNetworkType() != NetworkType.Advanced || ntwkOff.getGuestType() != Network.GuestType.Shared) {
      throw new InvalidParameterValueException("String_Node_Str");
    }
  }
  if (isolatedPvlan != null && (zone.getNetworkType() != NetworkType.Advanced || ntwkOff.getGuestType() != Network.GuestType.Shared)) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (isolatedPvlan != null && ipv6) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (_accountMgr.isNormalUser(caller.getId()) && (ntwkOff.getTrafficType() != TrafficType.Guest || ntwkOff.getGuestType() != Network.GuestType.Isolated && areServicesSupportedByNetworkOffering(ntwkOff.getId(),Service.SourceNat))) {
    throw new InvalidParameterValueException("String_Node_Str" + "String_Node_Str" + TrafficType.Guest + "String_Node_Str"+ Network.GuestType.Isolated+ "String_Node_Str"+ Service.SourceNat.getName()+ "String_Node_Str");
  }
  if (!_accountMgr.isRootAdmin(caller.getId()) && (ntwkOff.getSpecifyVlan() || vlanId != null)) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (ipv4) {
    if (!_accountMgr.isRootAdmin(caller.getId()) && cidr != null) {
      String[] cidrPair=cidr.split("String_Node_Str");
      int cidrSize=Integer.parseInt(cidrPair[1]);
      if (cidrSize < _cidrLimit) {
        throw new InvalidParameterValueException("String_Node_Str" + _cidrLimit);
      }
    }
  }
  Collection<String> ntwkProviders=_networkMgr.finalizeServicesAndProvidersForNetwork(ntwkOff,physicalNetworkId).values();
  if (ipv6 && providersConfiguredForExternalNetworking(ntwkProviders)) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (isolatedPvlan != null && providersConfiguredForExternalNetworking(ntwkProviders)) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (cidr != null && providersConfiguredForExternalNetworking(ntwkProviders)) {
    if (ntwkOff.getGuestType() == GuestType.Shared && (zone.getNetworkType() == NetworkType.Advanced) && isSharedNetworkOfferingWithServices(networkOfferingId)) {
      checkSharedNetworkCidrOverlap(zoneId,pNtwk.getId(),cidr);
    }
 else {
      if (vpcId == null)       throw new InvalidParameterValueException("String_Node_Str");
    }
  }
  boolean createVlan=(startIP != null && endIP != null && zone.getNetworkType() == NetworkType.Advanced && ((ntwkOff.getGuestType() == Network.GuestType.Shared) || (ntwkOff.getGuestType() == GuestType.Isolated && !areServicesSupportedByNetworkOffering(ntwkOff.getId(),Service.SourceNat))));
  if (!createVlan) {
    if (ipv6) {
      createVlan=true;
    }
  }
  if (createVlan && !ntwkOff.getSpecifyIpRanges()) {
    InvalidParameterValueException ex=new InvalidParameterValueException("String_Node_Str");
    ex.addProxyObject(ntwkOff.getUuid(),"String_Node_Str");
    throw ex;
  }
  Network network=commitNetwork(networkOfferingId,gateway,startIP,endIP,netmask,networkDomain,vlanId,name,displayText,caller,physicalNetworkId,zoneId,domainId,isDomainSpecific,subdomainAccess,vpcId,startIPv6,endIPv6,ip6Gateway,ip6Cidr,displayNetwork,aclId,isolatedPvlan,ntwkOff,pNtwk,aclType,owner,cidr,createVlan);
  if (ntwkOff.getIsPersistent()) {
    try {
      if (network.getState() == Network.State.Setup) {
        s_logger.debug("String_Node_Str" + network.getId() + "String_Node_Str");
        return network;
      }
      DeployDestination dest=new DeployDestination(zone,null,null,null);
      UserVO callerUser=_userDao.findById(CallContext.current().getCallingUserId());
      Journal journal=new Journal.LogJournal("String_Node_Str" + network,s_logger);
      ReservationContext context=new ReservationContextImpl(UUID.randomUUID().toString(),journal,callerUser,caller);
      s_logger.debug("String_Node_Str" + network + "String_Node_Str");
      Pair<? extends NetworkGuru,? extends Network> implementedNetwork=_networkMgr.implementNetwork(network.getId(),dest,context);
      if (implementedNetwork == null || implementedNetwork.first() == null) {
        s_logger.warn("String_Node_Str" + network);
      }
      network=implementedNetwork.second();
    }
 catch (    ResourceUnavailableException ex) {
      s_logger.warn("String_Node_Str" + network + "String_Node_Str",ex);
      CloudRuntimeException e=new CloudRuntimeException("String_Node_Str");
      e.addProxyObject(network.getUuid(),"String_Node_Str");
      throw e;
    }
  }
  return network;
}