コード例 #1
0
  @Override
  public boolean removePort(String uuid) {
    if (!portExists(uuid)) {
      return false;
    }
    NeutronPort port = getPort(uuid);
    portDB.remove(uuid);
    INeutronNetworkCRUD networkCRUD = NeutronCRUDInterfaces.getINeutronNetworkCRUD(this);
    INeutronSubnetCRUD systemCRUD = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this);

    NeutronNetwork network = networkCRUD.getNetwork(port.getNetworkUUID());
    network.removePort(port);
    Iterator<Neutron_IPs> fixedIPIterator = port.getFixedIPs().iterator();
    while (fixedIPIterator.hasNext()) {
      Neutron_IPs ip = fixedIPIterator.next();
      NeutronSubnet subnet = systemCRUD.getSubnet(ip.getSubnetUUID());
      if (!ip.getIpAddress().equals(subnet.getGatewayIP())) {
        subnet.releaseIP(ip.getIpAddress());
      } else {
        subnet.resetGatewayIPAllocated();
      }
      subnet.removePort(port);
    }
    return true;
  }
コード例 #2
0
  @Override
  public boolean updatePort(String uuid, NeutronPort delta) {
    if (!portExists(uuid)) {
      return false;
    }
    NeutronPort target = portDB.get(uuid);
    // remove old Fixed_IPs
    if (delta.getFixedIPs() != null) {
      NeutronPort port = getPort(uuid);
      INeutronSubnetCRUD systemCRUD = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this);
      for (Neutron_IPs ip : port.getFixedIPs()) {
        NeutronSubnet subnet = systemCRUD.getSubnet(ip.getSubnetUUID());
        subnet.releaseIP(ip.getIpAddress());
      }

      // allocate new Fixed_IPs
      for (Neutron_IPs ip : delta.getFixedIPs()) {
        NeutronSubnet subnet = systemCRUD.getSubnet(ip.getSubnetUUID());
        if (ip.getIpAddress() == null) {
          ip.setIpAddress(subnet.getLowAddr());
        }
        subnet.allocateIP(ip.getIpAddress());
      }
    }
    return overwrite(target, delta);
  }
コード例 #3
0
 public static void tombstoneEGWs(
     IfOpenDoveServiceApplianceCRUD serviceApplianceDB,
     IfSBDoveGwIpv4CRUD gatewayIPDB,
     NeutronSubnet subnet,
     OpenDoveNetwork network) {
   for (OpenDoveGwIpv4 gwIP : gatewayIPDB.getGwIpv4Pool()) {
     if (subnet.isValidIP(gwIP.getIP())) {
       subnet.releaseIP(gwIP.getIP());
       gwIP.setTombstoneFlag(true);
       gatewayIPDB.updateGwIpv4(gwIP);
       network.removeEGW(serviceApplianceDB.getDoveServiceAppliance(gwIP.getGWUUID()));
     }
   }
 }