use of com.cloud.agent.resource.virtualnetwork.model.GuestNetwork in project cloudstack by apache.
the class SetGuestNetworkConfigItem method generateConfig.
@Override
public List<ConfigItem> generateConfig(final NetworkElementCommand cmd) {
final SetupGuestNetworkCommand command = (SetupGuestNetworkCommand) cmd;
final NicTO nic = command.getNic();
final String routerGIP = command.getAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP);
final String gateway = command.getAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY);
final String cidr = Long.toString(NetUtils.getCidrSize(nic.getNetmask()));
final String netmask = nic.getNetmask();
final String domainName = command.getNetworkDomain();
String dns = command.getDefaultDns1();
if (dns == null || dns.isEmpty()) {
dns = command.getDefaultDns2();
} else {
final String dns2 = command.getDefaultDns2();
if (dns2 != null && !dns2.isEmpty()) {
dns += "," + dns2;
}
}
final GuestNetwork guestNetwork = new GuestNetwork(command.isAdd(), nic.getMac(), "eth" + nic.getDeviceId(), routerGIP, netmask, gateway, cidr, dns, domainName);
return generateConfigItems(guestNetwork);
}
Aggregations