@Override public boolean applyDhcpEntry(final Network network, final NicProfile nic, final VirtualMachineProfile profile, final DeployDestination dest, final DomainRouterVO router) throws ResourceUnavailableException { s_logger.debug("APPLYING VPC DHCP ENTRY RULES"); final String typeString = "dhcp entry"; final Long podId = null; final boolean isPodLevelException = false; final boolean failWhenDisconnect = false; final DhcpEntryRules dhcpRules = new DhcpEntryRules(network, nic, profile, dest); return applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(dhcpRules)); }
@Override public boolean saveUserDataToRouter(final Network network, final NicProfile nic, final VirtualMachineProfile profile, final VirtualRouter router) throws ResourceUnavailableException { s_logger.debug("SAVE USERDATA TO ROUTE RULES"); final String typeString = "save userdata entry"; final boolean isPodLevelException = false; final boolean failWhenDisconnect = false; final Long podId = null; final UserdataToRouterRules userdataToRouterRules = new UserdataToRouterRules(network, nic, profile); return applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(userdataToRouterRules)); }
@Override public boolean saveSSHPublicKeyToRouter(final Network network, final NicProfile nic, final VirtualMachineProfile profile, final VirtualRouter router, final String sshPublicKey) throws ResourceUnavailableException { s_logger.debug("SAVE SSH PUB KEY TO ROUTE RULES"); final String typeString = "save SSHkey entry"; final boolean isPodLevelException = false; final boolean failWhenDisconnect = false; final Long podId = null; final SshKeyToRouterRules keyToRouterRules = new SshKeyToRouterRules(network, nic, profile, sshPublicKey); return applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(keyToRouterRules)); }
@Override public boolean applyUserData(final Network network, final NicProfile nic, final VirtualMachineProfile profile, final DeployDestination dest, final DomainRouterVO router) throws ResourceUnavailableException { s_logger.debug("APPLYING VPC USERDATA RULES"); final String typeString = "userdata and password entry"; final boolean isPodLevelException = false; final boolean failWhenDisconnect = false; final Long podId = null; final UserdataPwdRules pwdRules = new UserdataPwdRules(network, nic, profile, dest); return applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(pwdRules)); }
@Override public boolean savePasswordToRouter(final Network network, final NicProfile nic, final VirtualMachineProfile profile, final VirtualRouter router) throws ResourceUnavailableException { s_logger.debug("SAVE PASSWORD TO ROUTE RULES"); final String typeString = "save password entry"; final boolean isPodLevelException = false; final boolean failWhenDisconnect = false; final Long podId = null; final PasswordToRouterRules routerRules = new PasswordToRouterRules(network, nic, profile); return applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(routerRules)); }
@Override public boolean applyStaticNats(final Network network, final List<? extends StaticNat> rules, final VirtualRouter router) throws ResourceUnavailableException { if (rules == null || rules.isEmpty()) { s_logger.debug("No static nat rules to be applied for network " + network.getId()); return true; } s_logger.debug("APPLYING STATIC NAT RULES"); final String typeString = "static nat rules"; final boolean isPodLevelException = false; final boolean failWhenDisconnect = false; final Long podId = null; final StaticNatRules natRules = new StaticNatRules(network, rules); return applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(natRules)); }
@Override public boolean associatePublicIP(final Network network, final List<? extends PublicIpAddress> ipAddress, final VirtualRouter router) throws ResourceUnavailableException { if (ipAddress == null || ipAddress.isEmpty()) { s_logger.debug("No ip association rules to be applied for network " + network.getId()); return true; } s_logger.debug("APPLYING IP RULES"); final String typeString = "ip association"; final boolean isPodLevelException = false; final boolean failWhenDisconnect = false; final Long podId = null; final IpAssociationRules ipAddresses = new IpAssociationRules(network, ipAddress); return applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(ipAddresses)); }
@Override public boolean applyLoadBalancingRules(final Network network, final List<LoadBalancingRule> rules, final VirtualRouter router) throws ResourceUnavailableException { if (rules == null || rules.isEmpty()) { s_logger.debug("No lb rules to be applied for network " + network.getId()); return true; } s_logger.debug("APPLYING LOAD BALANCING RULES"); final String typeString = "loadbalancing rules"; final boolean isPodLevelException = false; final boolean failWhenDisconnect = false; final Long podId = null; final LoadBalancingRules loadBalancingRules = new LoadBalancingRules(network, rules); return applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(loadBalancingRules)); }
@Override public boolean applyFirewallRules(final Network network, final List<? extends FirewallRule> rules, final VirtualRouter router) throws ResourceUnavailableException { if (rules == null || rules.isEmpty()) { s_logger.debug("No firewall rules to be applied for network " + network.getId()); return true; } s_logger.debug("APPLYING FIREWALL RULES"); final String typeString = "firewall rules"; final boolean isPodLevelException = false; final boolean failWhenDisconnect = false; final Long podId = null; final FirewallRules firewallRules = new FirewallRules(network, rules); return applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(firewallRules)); }
@Override public boolean applyNetworkACLs(final Network network, final List<? extends NetworkACLItem> rules, final VirtualRouter router, final boolean isPrivateGateway) throws ResourceUnavailableException { if (rules == null || rules.isEmpty()) { s_logger.debug("No network ACLs to be applied for network " + network.getId()); return true; } s_logger.debug("APPLYING NETWORK ACLs RULES"); final String typeString = "network acls"; final boolean isPodLevelException = false; final boolean failWhenDisconnect = false; final Long podId = null; final NetworkAclsRules aclsRules = new NetworkAclsRules(network, rules, isPrivateGateway); final boolean result = applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(aclsRules)); return result; } }
@Override public boolean associatePublicIP(final Network network, final List<? extends PublicIpAddress> ipAddresses, final VirtualRouter router) throws ResourceUnavailableException { if (ipAddresses == null || ipAddresses.isEmpty()) { s_logger.debug("No ip association rules to be applied for network " + network.getId()); return true; } if (network.getVpcId() == null) { return super.associatePublicIP(network, ipAddresses, router); } s_logger.debug("APPLYING VPC IP RULES"); final String typeString = "vpc ip association"; final boolean isPodLevelException = false; final boolean failWhenDisconnect = false; final Long podId = null; final NicPlugInOutRules nicPlugInOutRules = new NicPlugInOutRules(network, ipAddresses); nicPlugInOutRules.accept(_advancedVisitor, router); final VpcIpAssociationRules ipAssociationRules = new VpcIpAssociationRules(network, ipAddresses); final boolean result = applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(ipAssociationRules)); if (result) { _advancedVisitor.visit(nicPlugInOutRules); } return result; }
@Override public boolean applyUserData(final Network network, final NicProfile nic, final VirtualMachineProfile profile, final DeployDestination dest, final DomainRouterVO router) throws ResourceUnavailableException { s_logger.debug("APPLYING USERDATA RULES"); final String typeString = "userdata and password entry"; final Long podId = dest.getPod().getId(); boolean isPodLevelException = false; if (podId != null && profile.getVirtualMachine().getType() == VirtualMachine.Type.User && network.getTrafficType() == TrafficType.Guest && network.getGuestType() == Network.GuestType.Shared) { isPodLevelException = true; } final boolean failWhenDisconnect = false; final UserdataPwdRules pwdRules = new UserdataPwdRules(network, nic, profile, dest); return applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(pwdRules)); }
@Override public boolean applyDhcpEntry(final Network network, final NicProfile nic, final VirtualMachineProfile profile, final DeployDestination dest, final DomainRouterVO router) throws ResourceUnavailableException { s_logger.debug("APPLYING DHCP ENTRY RULES"); final String typeString = "dhcp entry"; final Long podId = dest.getPod().getId(); boolean isPodLevelException = false; // for user vm in Basic zone we should try to re-deploy vm in a diff pod // if it fails to deploy in original pod; so throwing exception with Pod // scope if (podId != null && profile.getVirtualMachine().getType() == VirtualMachine.Type.User && network.getTrafficType() == TrafficType.Guest && network.getGuestType() == Network.GuestType.Shared) { isPodLevelException = true; } final boolean failWhenDisconnect = false; final DhcpEntryRules dhcpRules = new DhcpEntryRules(network, nic, profile, dest); return applyRules(network, router, typeString, isPodLevelException, podId, failWhenDisconnect, new RuleApplierWrapper<RuleApplier>(dhcpRules)); }