public boolean gatewayIP_Pool_overlap() { for (NeutronSubnetIPAllocationPool pool : allocationPools) { if (ipVersion == IPV4_VERSION && pool.contains(gatewayIP)) { return true; } if (ipVersion == IPV6_VERSION && pool.containsV6(gatewayIP)) { return true; } } return false; }
public List<NeutronLoadBalancerPoolMember> getLoadBalancerPoolMembers() { /* * Update the pool_id of the member to that this.loadBalancerPoolID */ if (loadBalancerPoolMembers != null) { for (NeutronLoadBalancerPoolMember member: loadBalancerPoolMembers) { member.setPoolID(loadBalancerPoolID); } return loadBalancerPoolMembers; } return loadBalancerPoolMembers; }
/** * This method determines if this allocation pool contains the * input IPv4 address * * @param inputString * IPv4 address in dotted decimal format * @return a boolean on whether the pool contains the address or not */ public boolean contains(String inputString) { long inputIP = convert(inputString); long startIP = convert(poolStart); long endIP = convert(poolEnd); return (inputIP >= startIP && inputIP <= endIP); }
public NeutronSecurityGroup extractFields(List<String> fields) { NeutronSecurityGroup ans = new NeutronSecurityGroup (); for (String s : fields) { switch (s) { case "id": ans.setID(this.getID()); break; case "name": ans.setSecurityGroupName(this.getSecurityGroupName()); break; case "description": ans.setSecurityGroupDescription(this.getSecurityGroupDescription()); break; case "tenant_id": ans.setSecurityGroupTenantID(this.getSecurityGroupTenantID()); break; } } return ans; }
@Override public boolean updateFloatingIP(String uuid, NeutronFloatingIP delta) { NeutronFloatingIP target = getFloatingIP(uuid); if (target == null) { return false; } delta.setPortUUID(target.getPortUUID()); delta.setFixedIPAddress(target.getFixedIPAddress()); return updateMd(delta); }
@Override public boolean addNeutronSecurityGroup(NeutronSecurityGroup input) { if (neutronSecurityGroupExists(input.getID())) { return false; } addMd(input); return true; }
@Override public boolean addPort(NeutronPort input) { if (portExists(input.getID())) { return false; } addMd(input); return true; }
@Override public boolean addSubnet(NeutronSubnet input) { String id = input.getID(); if (subnetExists(id)) { return false; } addMd(input); return true; }
@Override public boolean addNetwork(NeutronNetwork input) { if (networkExists(input.getID())) { return false; } addMd(input); return true; }
private NeutronSubnet getExternalNetworkSubnet(NeutronPort gatewayPort){ if (gatewayPort.getFixedIPs() == null) { return null; } for (Neutron_IPs neutronIPs : gatewayPort.getFixedIPs()) { String subnetUUID = neutronIPs.getSubnetUUID(); NeutronSubnet extSubnet = neutronSubnetCache.getSubnet(subnetUUID); if (extSubnet != null && extSubnet.getGatewayIP() != null) { return extSubnet; } if (extSubnet == null) { // TODO: when subnet is created, try again. LOG.debug("subnet {} in not found", subnetUUID); } } return null; }
private void processNeutronSecurityRuleAdded(NeutronSecurityRule neutronSecurityRule) { List<NeutronPort> portList = getPortWithSecurityGroup(neutronSecurityRule.getSecurityRuleGroupID()); for (NeutronPort port:portList) { syncSecurityGroup(neutronSecurityRule,port,true); } }
@Override public boolean addNeutronSecurityRule(NeutronSecurityRule input) { if (neutronSecurityRuleExists(input.getID())) { return false; } addMd(input); return true; }
@Override public boolean addFloatingIP(NeutronFloatingIP input) { if (floatingIPExists(input.getID())) { return false; } return addMd(input); }
@Override public boolean addRouter(NeutronRouter input) { if (routerExists(input.getID())) { return false; } addMd(input); return true; }
private boolean isPortSecurityEnableUpdated(NeutronPort neutronPort) { LOG.trace("isPortSecuirtyEnableUpdated:" + neutronPort); if (neutronPort != null && neutronPort.getOriginalPort() != null && neutronPort.getOriginalPort().getPortSecurityEnabled() != null && neutronPort.getPortSecurityEnabled() != null && neutronPort.getOriginalPort().getPortSecurityEnabled() != neutronPort .getPortSecurityEnabled()) { return true; } return false; }
private void storeNetworkInCleanupCache(NeutronNetwork network) { if (network != null) { this.networkCleanupCache.put(network.getNetworkUUID(), network); } }
public void removePortFromCleanupCache(NeutronPort port) { if(port != null) { this.portCleanupCache.remove(port.getPortUUID()); } }
/** * Process the event. * * @param action the {@link Action} action to be handled. * @param neutronRouter An instance of NeutronRouter object. */ public void handleNeutronRouterEvent(final NeutronRouter neutronRouter, Action action) { LOG.debug("Neutron router {} event : {}", action, neutronRouter.toString()); }
@Override public int canDeleteNeutronLoadBalancerPool(NeutronLoadBalancerPool neutronLBPool) { String poolProtocol = neutronLBPool.getLoadBalancerPoolProtocol(); if (poolProtocol == null) { return HttpURLConnection.HTTP_BAD_REQUEST; } else if (!(poolProtocol.equalsIgnoreCase(LoadBalancerConfiguration.PROTOCOL_TCP) || poolProtocol.equalsIgnoreCase(LoadBalancerConfiguration.PROTOCOL_HTTP) || poolProtocol.equalsIgnoreCase(LoadBalancerConfiguration.PROTOCOL_HTTPS))) { return HttpURLConnection.HTTP_NOT_ACCEPTABLE; } else { return HttpURLConnection.HTTP_OK; } }
private void processNeutronSecurityRuleDeleted(NeutronSecurityRule neutronSecurityRule) { List<NeutronPort> portList = getPortWithSecurityGroup(neutronSecurityRule.getSecurityRuleGroupID()); for (NeutronPort port:portList) { syncSecurityGroup(neutronSecurityRule,port,false); } }