mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
introduce 'RegionLevelVpc' as capability of 'Connectivity' service. Add support for CreateVPCOffering to take the 'regionlevelvpc' as capability of service 'connectivity'. introduces new capability 'StretchedL2Subnet' for 'Connectivity' service. Also add support to createNetworkOffering api to allow StretchedL2Subnet capablity for the connectivity service. adds check to ensure 'Connectivity' service provider supports 'StretchedL2Subnet' and 'RegionLevelVpc' capabilities when specified in createNetworkOffering and createVpcOffering respectivley enable ovs plug-in to support both StretchedL2Subnet and RegionLevelVpc capabilities make zone id optional parameter in createVpc, zone id can be null only if vpc offfering supports region level VPC in region level vpc, let the network/tier to be created in any zone of the region keep zoneid as required param for createVpc skip external guest network guru if 'Connectivy' service is present in network offering fix build break in contrail manager permit VM's to be created in different zone that in which network is created if the network support streched L2 subnet add integration tests for region level VPC rebase to master Conflicts: setup/db/db/schema-430to440.sql Conflicts: api/src/org/apache/cloudstack/api/ApiConstants.java engine/schema/src/com/cloud/network/vpc/VpcVO.java setup/db/db/schema-430to440.sql
141 lines
3.9 KiB
Java
141 lines
3.9 KiB
Java
// Licensed to the Apache Software Foundation (ASF) under one
|
|
// or more contributor license agreements. See the NOTICE file
|
|
// distributed with this work for additional information
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
// to you under the Apache License, Version 2.0 (the
|
|
// "License"); you may not use this file except in compliance
|
|
// with the License. You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing,
|
|
// software distributed under the License is distributed on an
|
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
// KIND, either express or implied. See the License for the
|
|
// specific language governing permissions and limitations
|
|
// under the License.
|
|
package com.cloud.vpc.dao;
|
|
|
|
import java.lang.reflect.Field;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import javax.ejb.Local;
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
import com.cloud.network.vpc.Vpc;
|
|
import com.cloud.network.vpc.Vpc.State;
|
|
import com.cloud.network.vpc.VpcVO;
|
|
import com.cloud.network.vpc.dao.VpcDao;
|
|
import com.cloud.utils.db.DB;
|
|
import com.cloud.utils.db.GenericDaoBase;
|
|
|
|
@Local(value = VpcDao.class)
|
|
@DB()
|
|
public class MockVpcDaoImpl extends GenericDaoBase<VpcVO, Long> implements VpcDao {
|
|
private static final Logger s_logger = Logger.getLogger(MockNetworkOfferingDaoImpl.class);
|
|
|
|
/* (non-Javadoc)
|
|
* @see com.cloud.network.vpc.Dao.VpcDao#getVpcCountByOfferingId(long)
|
|
*/
|
|
@Override
|
|
public int getVpcCountByOfferingId(long offId) {
|
|
return 100;
|
|
}
|
|
|
|
/* (non-Javadoc)
|
|
* @see com.cloud.network.vpc.Dao.VpcDao#getActiveVpcById(long)
|
|
*/
|
|
@Override
|
|
public Vpc getActiveVpcById(long vpcId) {
|
|
Vpc vpc = findById(vpcId);
|
|
if (vpc != null && vpc.getState() == Vpc.State.Enabled) {
|
|
return vpc;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
/* (non-Javadoc)
|
|
* @see com.cloud.network.vpc.Dao.VpcDao#listByAccountId(long)
|
|
*/
|
|
@Override
|
|
public List<? extends Vpc> listByAccountId(long accountId) {
|
|
// TODO Auto-generated method stub
|
|
return null;
|
|
}
|
|
|
|
/* (non-Javadoc)
|
|
* @see com.cloud.network.vpc.Dao.VpcDao#listInactiveVpcs()
|
|
*/
|
|
@Override
|
|
public List<VpcVO> listInactiveVpcs() {
|
|
// TODO Auto-generated method stub
|
|
return null;
|
|
}
|
|
|
|
/* (non-Javadoc)
|
|
* @see com.cloud.network.vpc.Dao.VpcDao#countByAccountId(long)
|
|
*/
|
|
@Override
|
|
public long countByAccountId(long accountId) {
|
|
// TODO Auto-generated method stub
|
|
return 0;
|
|
}
|
|
|
|
@Override
|
|
public VpcVO persist(VpcVO vpc, Map<String, List<String>> serviceProviderMap) {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public void persistVpcServiceProviders(long vpcId, Map<String, List<String>> serviceProviderMap) {
|
|
return;
|
|
}
|
|
|
|
@Override
|
|
public VpcVO findById(Long id) {
|
|
VpcVO vo = null;
|
|
if (id.longValue() == 1) {
|
|
vo = new VpcVO(1, "new vpc", "new vpc", 1, 1, 1, "0.0.0.0/0", "vpc domain", false, false);
|
|
} else if (id.longValue() == 2) {
|
|
vo = new VpcVO(1, "new vpc", "new vpc", 1, 1, 1, "0.0.0.0/0", "vpc domain", false, false);
|
|
vo.setState(State.Inactive);
|
|
}
|
|
|
|
vo = setId(vo, id);
|
|
|
|
return vo;
|
|
}
|
|
|
|
private VpcVO setId(VpcVO vo, long id) {
|
|
VpcVO voToReturn = vo;
|
|
Class<?> c = voToReturn.getClass();
|
|
try {
|
|
Field f = c.getDeclaredField("id");
|
|
f.setAccessible(true);
|
|
f.setLong(voToReturn, id);
|
|
} catch (NoSuchFieldException ex) {
|
|
s_logger.warn(ex);
|
|
return null;
|
|
} catch (IllegalAccessException ex) {
|
|
s_logger.warn(ex);
|
|
return null;
|
|
}
|
|
|
|
return voToReturn;
|
|
}
|
|
|
|
@Override
|
|
public boolean remove(Long id) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean update(Long id, VpcVO vo) {
|
|
return true;
|
|
}
|
|
|
|
}
|