use of org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd in project cloudstack by apache.
the class ManagementServerMock method createPublicVlanIpRange.
private void createPublicVlanIpRange() {
CreateVlanIpRangeCmd cmd = new CreateVlanIpRangeCmd();
BaseCmd proxy = ComponentContext.inject(cmd);
Long public_net_id = null;
List<NetworkVO> nets = _networksDao.listByZoneAndTrafficType(_zone.getId(), TrafficType.Public);
if (nets != null && !nets.isEmpty()) {
NetworkVO public_net = nets.get(0);
public_net_id = public_net.getId();
} else {
s_logger.debug("no public network found in the zone: " + _zone.getId());
}
Account system = _accountMgr.getSystemAccount();
setParameter(cmd, "accountName", BaseCmd.CommandType.STRING, system.getAccountName());
setParameter(cmd, "domainId", BaseCmd.CommandType.LONG, Domain.ROOT_DOMAIN);
setParameter(cmd, "startIp", BaseCmd.CommandType.STRING, "10.84.60.200");
setParameter(cmd, "endIp", BaseCmd.CommandType.STRING, "10.84.60.250");
setParameter(cmd, ApiConstants.GATEWAY, BaseCmd.CommandType.STRING, "10.84.60.254");
setParameter(cmd, ApiConstants.NETMASK, BaseCmd.CommandType.STRING, "255.255.255.0");
setParameter(cmd, "networkID", BaseCmd.CommandType.LONG, public_net_id);
setParameter(cmd, "zoneId", BaseCmd.CommandType.LONG, _zone.getId());
setParameter(cmd, "vlan", BaseCmd.CommandType.STRING, "untagged");
s_logger.debug("createPublicVlanIpRange execute : zone id: " + _zone.getId() + ", public net id: " + public_net_id);
try {
_configService.createVlanAndPublicIpRange(cmd);
} catch (Exception e) {
s_logger.debug("createPublicVlanIpRange: " + e);
}
}
Aggregations