- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {}
@Override public List<ConfigItem> generateConfig(final NetworkElementCommand cmd) { final IpAssocCommand command = (IpAssocCommand) cmd; final List<IpAddress> ips = new LinkedList<IpAddress>(); for (final IpAddressTO ip : command.getIpAddresses()) { final IpAddress ipAddress = new IpAddress(ip.getPublicIp(), ip.isSourceNat(), ip.isAdd(), ip.isOneToOneNat(), ip.isFirstIP(), ip.getVlanGateway(), ip.getVlanNetmask(), ip.getVifMacAddress(), ip.getNicDevId(), ip.isNewNic(), ip.getTrafficType().toString()); ips.add(ipAddress); } final IpAssociation ipAssociation = new IpAssociation(ips.toArray(new IpAddress[ips.size()])); return generateConfigItems(ipAssociation); }
protected Answer execute(final IpAssocCommand cmd) { if (s_logger.isInfoEnabled()) { s_logger.info("Executing resource IPAssocCommand: " + s_gson.toJson(cmd)); } int i = 0; final String[] results = new String[cmd.getIpAddresses().length]; try { final IpAddressTO[] ips = cmd.getIpAddresses(); final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); final String controlIp = getRouterSshControlIp(cmd); for (final IpAddressTO ip : ips) { assignPublicIpAddress(routerName, controlIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), ip.isSourceNat(), ip.getBroadcastUri(), ip.getVlanGateway(), ip.getVlanNetmask(), ip.getVifMacAddress()); results[i++] = ip.getPublicIp() + " - success"; } for (; i < cmd.getIpAddresses().length; i++) { results[i++] = IpAssocAnswer.errorResult; } } catch (final Throwable e) { s_logger.error("Unexpected exception: " + e.toString() + " will shortcut rest of IPAssoc commands", e); for (; i < cmd.getIpAddresses().length; i++) { results[i++] = IpAssocAnswer.errorResult; } } return new IpAssocAnswer(cmd, results); }
GuestNetworkType type = GuestNetworkType.INTERFACE_NAT; if (ip.isSourceNat()) { type = GuestNetworkType.SOURCE_NAT;