From ec438637ca302ccd5ed7d9b2c21ea92d21f4913e Mon Sep 17 00:00:00 2001 From: Ryan Moats Date: Fri, 13 Feb 2015 10:19:49 -0600 Subject: [PATCH] Remove neutron post project split Now that neutron code has been split into own repo, clean up here Change-Id: I6529bedf160c1e1d0ba2c35a37a9b01284fe03a3 Signed-off-by: Ryan Moats --- .../adsal/northbound/swagger-ui/pom.xml | 16 - .../neutron/features/pom.xml | 134 ---- .../features/src/main/resources/features.xml | 37 - .../neutron/implementation/pom.xml | 63 -- .../neutron/implementation/Activator.java | 135 ---- .../NeutronFirewallInterface.java | 117 ---- .../NeutronFirewallPolicyInterface.java | 116 ---- .../NeutronFirewallRuleInterface.java | 116 ---- .../NeutronFloatingIPInterface.java | 162 ----- ...ronLoadBalancerHealthMonitorInterface.java | 117 ---- .../NeutronLoadBalancerInterface.java | 118 ---- .../NeutronLoadBalancerListenerInterface.java | 118 ---- .../NeutronLoadBalancerPoolInterface.java | 118 ---- ...eutronLoadBalancerPoolMemberInterface.java | 117 ---- .../NeutronNetworkInterface.java | 127 ---- .../implementation/NeutronPortInterface.java | 219 ------ .../NeutronRouterInterface.java | 124 ---- .../NeutronSecurityGroupInterface.java | 119 ---- .../NeutronSecurityRuleInterface.java | 116 ---- .../NeutronSubnetInterface.java | 135 ---- .../neutron/northbound/enunciate.xml | 12 - .../neutron/northbound/pom.xml | 94 --- .../northbound/BadRequestException.java | 27 - .../neutron/northbound/INeutronRequest.java | 27 - .../InternalServerErrorException.java | 38 -- .../northbound/NeutronFirewallNorthbound.java | 400 ----------- .../NeutronFirewallPolicyNorthbound.java | 394 ----------- .../NeutronFirewallPolicyRequest.java | 58 -- .../northbound/NeutronFirewallRequest.java | 58 -- .../NeutronFirewallRuleRequest.java | 58 -- .../NeutronFirewallRulesNorthbound.java | 447 ------------ .../northbound/NeutronFloatingIPRequest.java | 52 -- .../NeutronFloatingIPsNorthbound.java | 443 ------------ ...onLoadBalancerHealthMonitorNorthbound.java | 430 ------------ ...utronLoadBalancerHealthMonitorRequest.java | 58 -- ...NeutronLoadBalancerListenerNorthbound.java | 411 ----------- .../NeutronLoadBalancerListenerRequest.java | 58 -- .../NeutronLoadBalancerNorthbound.java | 402 ----------- .../NeutronLoadBalancerPoolMemberRequest.java | 51 -- ...tronLoadBalancerPoolMembersNorthbound.java | 380 ----------- .../NeutronLoadBalancerPoolNorthbound.java | 414 ----------- .../NeutronLoadBalancerPoolRequest.java | 58 -- .../NeutronLoadBalancerRequest.java | 58 -- .../northbound/NeutronNetworkRequest.java | 65 -- .../northbound/NeutronNetworksNorthbound.java | 411 ----------- .../NeutronNorthboundRSApplication.java | 71 -- .../neutron/northbound/NeutronPageLink.java | 44 -- .../northbound/NeutronPortRequest.java | 65 -- .../northbound/NeutronPortsNorthbound.java | 554 --------------- .../northbound/NeutronRouterRequest.java | 57 -- .../northbound/NeutronRoutersNorthbound.java | 642 ------------------ .../NeutronSecurityGroupRequest.java | 59 -- .../NeutronSecurityGroupsNorthbound.java | 383 ----------- .../NeutronSecurityRuleRequest.java | 59 -- .../NeutronSecurityRulesNorthbound.java | 432 ------------ .../northbound/NeutronSubnetRequest.java | 68 -- .../northbound/NeutronSubnetsNorthbound.java | 447 ------------ .../neutron/northbound/NeutronUtil.java | 32 - .../northbound/PaginatedRequestFactory.java | 156 ----- .../northbound/ResourceConflictException.java | 37 - .../northbound/ResourceNotFoundException.java | 37 - .../neutron/northbound/RestMessages.java | 33 - .../ServiceUnavailableException.java | 39 -- .../src/main/resources/WEB-INF/web.xml | 57 -- .../neutron/northbound/jaxb.properties | 1 - .../networkconfiguration/neutron/pom.xml | 65 -- .../neutron/INeutronFirewallAware.java | 85 --- .../neutron/INeutronFirewallCRUD.java | 97 --- .../neutron/INeutronFirewallPolicyAware.java | 85 --- .../neutron/INeutronFirewallPolicyCRUD.java | 97 --- .../neutron/INeutronFirewallRuleAware.java | 85 --- .../neutron/INeutronFirewallRuleCRUD.java | 97 --- .../neutron/INeutronFloatingIPAware.java | 85 --- .../neutron/INeutronFloatingIPCRUD.java | 85 --- .../neutron/INeutronLoadBalancerAware.java | 85 --- .../neutron/INeutronLoadBalancerCRUD.java | 97 --- ...NeutronLoadBalancerHealthMonitorAware.java | 86 --- ...INeutronLoadBalancerHealthMonitorCRUD.java | 97 --- .../INeutronLoadBalancerListenerAware.java | 86 --- .../INeutronLoadBalancerListenerCRUD.java | 97 --- .../INeutronLoadBalancerPoolAware.java | 85 --- .../neutron/INeutronLoadBalancerPoolCRUD.java | 97 --- .../INeutronLoadBalancerPoolMemberAware.java | 86 --- .../INeutronLoadBalancerPoolMemberCRUD.java | 98 --- ...INeutronLoadBalancerPoolMemberRequest.java | 50 -- .../neutron/INeutronNetworkAware.java | 85 --- .../neutron/INeutronNetworkCRUD.java | 97 --- .../networkconfig/neutron/INeutronObject.java | 22 - .../neutron/INeutronPortAware.java | 85 --- .../neutron/INeutronPortCRUD.java | 107 --- .../neutron/INeutronRouterAware.java | 135 ---- .../neutron/INeutronRouterCRUD.java | 95 --- .../neutron/INeutronSecurityGroupAware.java | 79 --- .../neutron/INeutronSecurityGroupCRUD.java | 90 --- .../neutron/INeutronSecurityRuleAware.java | 79 --- .../neutron/INeutronSecurityRuleCRUD.java | 91 --- .../neutron/INeutronSubnetAware.java | 86 --- .../neutron/INeutronSubnetCRUD.java | 97 --- .../neutron/NeutronCRUDInterfaces.java | 112 --- .../neutron/NeutronFirewall.java | 176 ----- .../neutron/NeutronFirewallPolicy.java | 163 ----- .../neutron/NeutronFirewallRule.java | 321 --------- .../neutron/NeutronFloatingIP.java | 139 ---- .../neutron/NeutronLoadBalancer.java | 159 ----- .../NeutronLoadBalancerHealthMonitor.java | 228 ------- .../neutron/NeutronLoadBalancerListener.java | 225 ------ .../neutron/NeutronLoadBalancerPool.java | 209 ------ .../NeutronLoadBalancerPoolMember.java | 180 ----- .../networkconfig/neutron/NeutronNetwork.java | 257 ------- .../networkconfig/neutron/NeutronPort.java | 313 --------- .../networkconfig/neutron/NeutronRouter.java | 206 ------ .../neutron/NeutronRouter_Interface.java | 73 -- .../NeutronRouter_NetworkReference.java | 40 -- .../neutron/NeutronSecurityGroup.java | 140 ---- .../neutron/NeutronSecurityRule.java | 215 ------ .../networkconfig/neutron/NeutronSubnet.java | 506 -------------- .../neutron/NeutronSubnet_HostRoute.java | 33 - .../NeutronSubnet_IPAllocationPool.java | 184 ----- .../networkconfig/neutron/Neutron_IPs.java | 61 -- pom.xml | 6 - 120 files changed, 17340 deletions(-) delete mode 100644 opendaylight/networkconfiguration/neutron/features/pom.xml delete mode 100644 opendaylight/networkconfiguration/neutron/features/src/main/resources/features.xml delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/pom.xml delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/Activator.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallPolicyInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallRuleInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFloatingIPInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerHealthMonitorInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerListenerInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolMemberInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronNetworkInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronPortInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronRouterInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityGroupInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityRuleInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSubnetInterface.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/enunciate.xml delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/pom.xml delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/BadRequestException.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/INeutronRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/InternalServerErrorException.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRuleRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRulesNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPsNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMemberRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMembersNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworkRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworksNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNorthboundRSApplication.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPageLink.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRouterRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRoutersNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupsNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRuleRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRulesNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetsNorthbound.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronUtil.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceConflictException.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceNotFoundException.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/RestMessages.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ServiceUnavailableException.java delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/resources/WEB-INF/web.xml delete mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/resources/org/opendaylight/controller/networkconfig/neutron/northbound/jaxb.properties delete mode 100644 opendaylight/networkconfiguration/neutron/pom.xml delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallPolicyAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallPolicyCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallRuleAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallRuleCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerHealthMonitorAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerHealthMonitorCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerListenerAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerListenerCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolMemberAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolMemberCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolMemberRequest.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronObject.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityGroupAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityGroupCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityRuleAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityRuleCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetAware.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetCRUD.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewall.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallPolicy.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallRule.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancer.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerHealthMonitor.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerListener.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPool.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPoolMember.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_Interface.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_NetworkReference.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityGroup.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityRule.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_HostRoute.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java delete mode 100644 opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java diff --git a/opendaylight/adsal/northbound/swagger-ui/pom.xml b/opendaylight/adsal/northbound/swagger-ui/pom.xml index ba1e5c0bc4..8c1c8a1bdd 100644 --- a/opendaylight/adsal/northbound/swagger-ui/pom.xml +++ b/opendaylight/adsal/northbound/swagger-ui/pom.xml @@ -71,10 +71,6 @@ org.opendaylight.controller usermanager.northbound - - org.opendaylight.controller - networkconfig.neutron.northbound - org.slf4j slf4j-api @@ -161,7 +157,6 @@ - @@ -181,7 +176,6 @@ - @@ -196,16 +190,6 @@ - - - - - - - - - - { } ] } diff --git a/opendaylight/networkconfiguration/neutron/features/pom.xml b/opendaylight/networkconfiguration/neutron/features/pom.xml deleted file mode 100644 index cd7dce53d4..0000000000 --- a/opendaylight/networkconfiguration/neutron/features/pom.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - 4.0.0 - - org.opendaylight.controller - commons.opendaylight - 1.5.0-SNAPSHOT - ../../opendaylight/commons/opendaylight - - features-neutron - ${networkconfig.neutron.version} - jar - - - features.xml - - - - - org.opendaylight.aaa - features-aaa - ${aaa.version} - features - xml - - - org.opendaylight.controller - networkconfig.neutron - - - org.osgi - org.osgi.core - - - com.sun.jersey - jersey-core - - - com.sun.jersey - jersey-server - - - com.sun.jersey - jersey-servlet - - - org.eclipse.persistence - org.eclipse.persistence.moxy - - - org.eclipse.persistence - org.eclipse.persistence.core - - - org.opendaylight.controller - networkconfig.neutron - - - commons-net - commons-net - - - - org.opendaylight.yangtools - features-test - - - - - - - true - src/main/resources - - - - - org.apache.maven.plugins - maven-resources-plugin - - - filter - - resources - - generate-resources - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-artifacts - - attach-artifact - - package - - - - ${project.build.directory}/classes/${features.file} - xml - features - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - org.opendaylight.controller - opendaylight-karaf-empty - ${commons.opendaylight.version} - - - org.opendaylight.yangtools:features-test - - - - - - - scm:git:ssh://git.opendaylight.org:29418/controller.git - scm:git:ssh://git.opendaylight.org:29418/controller.git - HEAD - https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - - diff --git a/opendaylight/networkconfiguration/neutron/features/src/main/resources/features.xml b/opendaylight/networkconfiguration/neutron/features/src/main/resources/features.xml deleted file mode 100644 index b244d4d2a9..0000000000 --- a/opendaylight/networkconfiguration/neutron/features/src/main/resources/features.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - mvn:org.opendaylight.aaa/features-aaa/${aaa.version}/xml/features - - odl-neutron-api - odl-neutron-northbound - odl-neutron-implementation - - - odl-aaa-authn - war - odl-neutron-api - mvn:org.eclipse.persistence/org.eclipse.persistence.moxy/${eclipse.persistence.version} - mvn:org.eclipse.persistence/org.eclipse.persistence.core/${eclipse.persistence.version} - mvn:org.eclipse.persistence/org.eclipse.persistence.antlr/${eclipse.persistence.version} - mvn:org.opendaylight.controller/networkconfig.neutron.northbound/${networkconfig.neutron.northbound.version} - mvn:com.sun.jersey/jersey-core/${jersey.version} - mvn:com.sun.jersey/jersey-server/${jersey.version} - mvn:com.sun.jersey/jersey-servlet/${jersey.version} - mvn:org.osgi/org.osgi.core/${osgi.core.version} - - - - mvn:org.opendaylight.controller/networkconfig.neutron/${networkconfig.neutron.version} - mvn:commons-net/commons-net/${commons.net.version} - mvn:org.osgi/org.osgi.core/${osgi.core.version} - - - odl-neutron-api - war - mvn:org.opendaylight.controller/networkconfig.neutron.implementation/${networkconfig.neutron.implementation.version} - mvn:org.osgi/org.osgi.core/${osgi.core.version} - - diff --git a/opendaylight/networkconfiguration/neutron/implementation/pom.xml b/opendaylight/networkconfiguration/neutron/implementation/pom.xml deleted file mode 100644 index 9eaebb283c..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/pom.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - 4.0.0 - - org.opendaylight.controller - commons.opendaylight - 1.5.0-SNAPSHOT - ../../../commons/opendaylight - - networkconfig.neutron.implementation - 0.5.0-SNAPSHOT - bundle - - - org.opendaylight.controller - networkconfig.neutron - - - org.osgi - org.osgi.core - - - - - - org.apache.felix - maven-bundle-plugin - true - - - * - org.opendaylight.controller.networkconfig.neutron.implementation.Activator - - ${project.basedir}/src/main/resources/META-INF - - - - - - scm:git:ssh://git.opendaylight.org:29418/controller.git - scm:git:ssh://git.opendaylight.org:29418/controller.git - HEAD - https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main - - - - - - opendaylight-release - ${nexusproxy}/repositories/${nexus.repository.release}/ - - - - opendaylight-snapshot - ${nexusproxy}/repositories/${nexus.repository.snapshot}/ - - - - website - ${sitedeploy} - - - diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/Activator.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/Activator.java deleted file mode 100644 index 0fbf933c17..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/Activator.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import java.util.ArrayList; -import java.util.List; - -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolMemberCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Activator implements BundleActivator { - protected static final Logger logger = LoggerFactory - .getLogger(Activator.class); - private List> registrations = new ArrayList>(); - - @Override - public void start(BundleContext context) throws Exception { - NeutronRouterInterface neutronRouterInterface = new NeutronRouterInterface(); - ServiceRegistration neutronRouterInterfaceRegistration = context.registerService(INeutronRouterCRUD.class, neutronRouterInterface, null); - if(neutronRouterInterfaceRegistration != null) { - registrations.add(neutronRouterInterfaceRegistration); - } - NeutronPortInterface neutronPortInterface = new NeutronPortInterface(); - ServiceRegistration neutronPortInterfaceRegistration = context.registerService(INeutronPortCRUD.class, neutronPortInterface, null); - if(neutronPortInterfaceRegistration != null) { - registrations.add(neutronPortInterfaceRegistration); - } - - NeutronSubnetInterface neutronSubnetInterface = new NeutronSubnetInterface(); - ServiceRegistration neutronSubnetInterfaceRegistration = context.registerService(INeutronSubnetCRUD.class, neutronSubnetInterface, null); - if(neutronSubnetInterfaceRegistration != null) { - registrations.add(neutronSubnetInterfaceRegistration); - } - - NeutronNetworkInterface neutronNetworkInterface = new NeutronNetworkInterface(); - ServiceRegistration neutronNetworkInterfaceRegistration = context.registerService(INeutronNetworkCRUD.class, neutronNetworkInterface, null); - if(neutronNetworkInterfaceRegistration != null) { - registrations.add(neutronNetworkInterfaceRegistration); - } - - NeutronSecurityGroupInterface neutronSecurityGroupInterface = new NeutronSecurityGroupInterface(); - ServiceRegistration neutronSecurityGroupInterfaceRegistration = context.registerService(INeutronSecurityGroupCRUD.class, neutronSecurityGroupInterface, null); - if(neutronSecurityGroupInterfaceRegistration != null) { - registrations.add(neutronSecurityGroupInterfaceRegistration); - } - - NeutronSecurityRuleInterface neutronSecurityRuleInterface = new NeutronSecurityRuleInterface(); - ServiceRegistration neutronSecurityRuleInterfaceRegistration = context.registerService(INeutronSecurityRuleCRUD.class, neutronSecurityRuleInterface, null); - if(neutronSecurityRuleInterfaceRegistration != null) { - registrations.add(neutronSecurityRuleInterfaceRegistration); - } - - NeutronFirewallInterface neutronFirewallInterface = new NeutronFirewallInterface(); - ServiceRegistration neutronFirewallInterfaceRegistration = context.registerService(INeutronFirewallCRUD.class, neutronFirewallInterface, null); - if(neutronFirewallInterfaceRegistration != null) { - registrations.add(neutronFirewallInterfaceRegistration); - } - - NeutronFirewallPolicyInterface neutronFirewallPolicyInterface = new NeutronFirewallPolicyInterface(); - ServiceRegistration neutronFirewallPolicyInterfaceRegistration = context.registerService(INeutronFirewallPolicyCRUD.class, neutronFirewallPolicyInterface, null); - if(neutronFirewallPolicyInterfaceRegistration != null) { - registrations.add(neutronFirewallPolicyInterfaceRegistration); - } - - NeutronFirewallRuleInterface neutronFirewallRuleInterface = new NeutronFirewallRuleInterface(); - ServiceRegistration neutronFirewallRuleInterfaceRegistration = context.registerService(INeutronFirewallRuleCRUD.class, neutronFirewallRuleInterface, null); - if(neutronFirewallRuleInterfaceRegistration != null) { - registrations.add(neutronFirewallRuleInterfaceRegistration); - } - - NeutronLoadBalancerInterface neutronLoadBalancerInterface = new NeutronLoadBalancerInterface(); - ServiceRegistration neutronLoadBalancerInterfaceRegistration = context.registerService(INeutronLoadBalancerCRUD.class, neutronLoadBalancerInterface, null); - if(neutronFirewallInterfaceRegistration != null) { - registrations.add(neutronLoadBalancerInterfaceRegistration); - } - - NeutronLoadBalancerPoolInterface neutronLoadBalancerPoolInterface = new NeutronLoadBalancerPoolInterface(); - ServiceRegistration neutronLoadBalancerPoolInterfaceRegistration = context.registerService(INeutronLoadBalancerPoolCRUD.class, neutronLoadBalancerPoolInterface, null); - if(neutronLoadBalancerPoolInterfaceRegistration != null) { - registrations.add(neutronLoadBalancerPoolInterfaceRegistration); - } - - NeutronLoadBalancerListenerInterface neutronLoadBalancerListenerInterface = new NeutronLoadBalancerListenerInterface(); - ServiceRegistration neutronLoadBalancerListenerInterfaceRegistration = context.registerService(INeutronLoadBalancerListenerCRUD.class, neutronLoadBalancerListenerInterface, null); - if(neutronLoadBalancerListenerInterfaceRegistration != null) { - registrations.add(neutronLoadBalancerListenerInterfaceRegistration); - } - - NeutronLoadBalancerHealthMonitorInterface neutronLoadBalancerHealthMonitorInterface = new NeutronLoadBalancerHealthMonitorInterface(); - ServiceRegistration neutronLoadBalancerHealthMonitorInterfaceRegistration = context.registerService(INeutronLoadBalancerHealthMonitorCRUD.class, neutronLoadBalancerHealthMonitorInterface, null); - if(neutronLoadBalancerHealthMonitorInterfaceRegistration != null) { - registrations.add(neutronLoadBalancerHealthMonitorInterfaceRegistration); - } - - NeutronLoadBalancerPoolMemberInterface neutronLoadBalancerPoolMemberInterface = new NeutronLoadBalancerPoolMemberInterface(); - ServiceRegistration neutronLoadBalancerPoolMemberInterfaceRegistration = context.registerService(INeutronLoadBalancerPoolMemberCRUD.class, neutronLoadBalancerPoolMemberInterface, null); - if(neutronLoadBalancerPoolMemberInterfaceRegistration != null) { - registrations.add(neutronLoadBalancerPoolMemberInterfaceRegistration); - } - - } - - @Override - public void stop(BundleContext context) throws Exception { - for(ServiceRegistration registration : registrations) { - if(registration != null) { - registration.unregister(); - } - } - - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallInterface.java deleted file mode 100644 index 421f850a0e..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallInterface.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronFirewall; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class NeutronFirewallInterface implements INeutronFirewallCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronFirewallInterface.class); - - private ConcurrentMap firewallDB = new ConcurrentHashMap(); - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for (Method toMethod : methods) { - if (toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")) { - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[]) null); - if (value != null) { - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - @Override - public boolean neutronFirewallExists(String uuid) { - return firewallDB.containsKey(uuid); - } - - @Override - public NeutronFirewall getNeutronFirewall(String uuid) { - if (!neutronFirewallExists(uuid)) { - logger.debug("No Firewall Have Been Defined"); - return null; - } - return firewallDB.get(uuid); - } - - @Override - public List getAllNeutronFirewalls() { - Set allFirewalls = new HashSet(); - for (Entry entry : firewallDB.entrySet()) { - NeutronFirewall firewall = entry.getValue(); - allFirewalls.add(firewall); - } - logger.debug("Exiting getFirewalls, Found {} OpenStackFirewall", allFirewalls.size()); - List ans = new ArrayList(); - ans.addAll(allFirewalls); - return ans; - } - - @Override - public boolean addNeutronFirewall(NeutronFirewall input) { - if (neutronFirewallExists(input.getFirewallUUID())) { - return false; - } - firewallDB.putIfAbsent(input.getFirewallUUID(), input); - return true; - } - - @Override - public boolean removeNeutronFirewall(String uuid) { - if (!neutronFirewallExists(uuid)) { - return false; - } - firewallDB.remove(uuid); - return true; - } - - @Override - public boolean updateNeutronFirewall(String uuid, NeutronFirewall delta) { - if (!neutronFirewallExists(uuid)) { - return false; - } - NeutronFirewall target = firewallDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean neutronFirewallInUse(String firewallUUID) { - return !neutronFirewallExists(firewallUUID); - } - - -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallPolicyInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallPolicyInterface.java deleted file mode 100644 index 886d7fd265..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallPolicyInterface.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallPolicy; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class NeutronFirewallPolicyInterface implements INeutronFirewallPolicyCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronFirewallPolicyInterface.class); - - private ConcurrentMap firewallPolicyDB = new ConcurrentHashMap(); - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for(Method toMethod: methods){ - if(toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")){ - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[])null); - if(value != null){ - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - @Override - public boolean neutronFirewallPolicyExists(String uuid) { - return firewallPolicyDB.containsKey(uuid); - } - - @Override - public NeutronFirewallPolicy getNeutronFirewallPolicy(String uuid) { - if (!neutronFirewallPolicyExists(uuid)) { - logger.debug("No Firewall Rule Have Been Defined"); - return null; - } - return firewallPolicyDB.get(uuid); - } - - @Override - public List getAllNeutronFirewallPolicies() { - Set allFirewallPolicies = new HashSet(); - for (Entry entry : firewallPolicyDB.entrySet()) { - NeutronFirewallPolicy firewallPolicy = entry.getValue(); - allFirewallPolicies.add(firewallPolicy); - } - logger.debug("Exiting getFirewallPolicies, Found {} OpenStackFirewallPolicy", allFirewallPolicies.size()); - List ans = new ArrayList(); - ans.addAll(allFirewallPolicies); - return ans; - } - - @Override - public boolean addNeutronFirewallPolicy(NeutronFirewallPolicy input) { - if (neutronFirewallPolicyExists(input.getFirewallPolicyUUID())) { - return false; - } - firewallPolicyDB.putIfAbsent(input.getFirewallPolicyUUID(), input); - return true; - } - - @Override - public boolean removeNeutronFirewallPolicy(String uuid) { - if (!neutronFirewallPolicyExists(uuid)) { - return false; - } - firewallPolicyDB.remove(uuid); - return true; - } - - @Override - public boolean updateNeutronFirewallPolicy(String uuid, NeutronFirewallPolicy delta) { - if (!neutronFirewallPolicyExists(uuid)) { - return false; - } - NeutronFirewallPolicy target = firewallPolicyDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean neutronFirewallPolicyInUse(String firewallPolicyUUID) { - return !neutronFirewallPolicyExists(firewallPolicyUUID); - } - -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallRuleInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallRuleInterface.java deleted file mode 100644 index cd0f39a76f..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallRuleInterface.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallRule; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class NeutronFirewallRuleInterface implements INeutronFirewallRuleCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronFirewallRuleInterface.class); - - private ConcurrentMap firewallRuleDB = new ConcurrentHashMap(); - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for(Method toMethod: methods){ - if(toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")){ - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[])null); - if(value != null){ - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - @Override - public boolean neutronFirewallRuleExists(String uuid) { - return firewallRuleDB.containsKey(uuid); - } - - @Override - public NeutronFirewallRule getNeutronFirewallRule(String uuid) { - if (!neutronFirewallRuleExists(uuid)) { - logger.debug("No Firewall Rule Have Been Defined"); - return null; - } - return firewallRuleDB.get(uuid); - } - - @Override - public List getAllNeutronFirewallRules() { - Set allFirewallRules = new HashSet(); - for (Entry entry : firewallRuleDB.entrySet()) { - NeutronFirewallRule firewallRule = entry.getValue(); - allFirewallRules.add(firewallRule); - } - logger.debug("Exiting getFirewallRules, Found {} OpenStackFirewallRule", allFirewallRules.size()); - List ans = new ArrayList(); - ans.addAll(allFirewallRules); - return ans; - } - - @Override - public boolean addNeutronFirewallRule(NeutronFirewallRule input) { - if (neutronFirewallRuleExists(input.getFirewallRuleUUID())) { - return false; - } - firewallRuleDB.putIfAbsent(input.getFirewallRuleUUID(), input); - return true; - } - - @Override - public boolean removeNeutronFirewallRule(String uuid) { - if (!neutronFirewallRuleExists(uuid)) { - return false; - } - firewallRuleDB.remove(uuid); - return true; - } - - @Override - public boolean updateNeutronFirewallRule(String uuid, NeutronFirewallRule delta) { - if (!neutronFirewallRuleExists(uuid)) { - return false; - } - NeutronFirewallRule target = firewallRuleDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean neutronFirewallRuleInUse(String firewallRuleUUID) { - return !neutronFirewallRuleExists(firewallRuleUUID); - } - -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFloatingIPInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFloatingIPInterface.java deleted file mode 100644 index 51824d6ce1..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFloatingIPInterface.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP; -import org.opendaylight.controller.networkconfig.neutron.NeutronPort; -import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class NeutronFloatingIPInterface implements INeutronFloatingIPCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronFloatingIPInterface.class); - - private ConcurrentMap floatingIPDB = new ConcurrentHashMap(); - - // this method uses reflection to update an object from it's delta. - - @SuppressWarnings("unused") - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for(Method toMethod: methods){ - if(toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")){ - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[])null); - if(value != null){ - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - // IfNBFloatingIPCRUD interface methods - - @Override - public boolean floatingIPExists(String uuid) { - return floatingIPDB.containsKey(uuid); - } - - @Override - public NeutronFloatingIP getFloatingIP(String uuid) { - if (!floatingIPExists(uuid)) { - return null; - } - return floatingIPDB.get(uuid); - } - - @Override - public List getAllFloatingIPs() { - Set allIPs = new HashSet(); - for (Entry entry : floatingIPDB.entrySet()) { - NeutronFloatingIP floatingip = entry.getValue(); - allIPs.add(floatingip); - } - logger.debug("Exiting getAllFloatingIPs, Found {} FloatingIPs", allIPs.size()); - List ans = new ArrayList(); - ans.addAll(allIPs); - return ans; - } - - @Override - public boolean addFloatingIP(NeutronFloatingIP input) { - INeutronNetworkCRUD networkCRUD = NeutronCRUDInterfaces.getINeutronNetworkCRUD(this); - INeutronSubnetCRUD subnetCRUD = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this); - INeutronPortCRUD portCRUD = NeutronCRUDInterfaces.getINeutronPortCRUD(this); - - if (floatingIPExists(input.getID())) { - return false; - } - //if floating_ip_address isn't there, allocate from the subnet pool - NeutronSubnet subnet = subnetCRUD.getSubnet(networkCRUD.getNetwork(input.getFloatingNetworkUUID()).getSubnets().get(0)); - if (input.getFloatingIPAddress() == null) { - input.setFloatingIPAddress(subnet.getLowAddr()); - } - subnet.allocateIP(input.getFloatingIPAddress()); - - //if port_id is there, bind port to this floating ip - if (input.getPortUUID() != null) { - NeutronPort port = portCRUD.getPort(input.getPortUUID()); - port.addFloatingIP(input.getFixedIPAddress(), input); - } - - floatingIPDB.putIfAbsent(input.getID(), input); - return true; - } - - @Override - public boolean removeFloatingIP(String uuid) { - INeutronNetworkCRUD networkCRUD = NeutronCRUDInterfaces.getINeutronNetworkCRUD(this); - INeutronSubnetCRUD subnetCRUD = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this); - INeutronPortCRUD portCRUD = NeutronCRUDInterfaces.getINeutronPortCRUD(this); - - if (!floatingIPExists(uuid)) { - return false; - } - NeutronFloatingIP floatIP = getFloatingIP(uuid); - //if floating_ip_address isn't there, allocate from the subnet pool - NeutronSubnet subnet = subnetCRUD.getSubnet(networkCRUD.getNetwork(floatIP.getFloatingNetworkUUID()).getSubnets().get(0)); - subnet.releaseIP(floatIP.getFloatingIPAddress()); - if (floatIP.getPortUUID() != null) { - NeutronPort port = portCRUD.getPort(floatIP.getPortUUID()); - port.removeFloatingIP(floatIP.getFixedIPAddress()); - } - floatingIPDB.remove(uuid); - return true; - } - - @Override - public boolean updateFloatingIP(String uuid, NeutronFloatingIP delta) { - INeutronPortCRUD portCRUD = NeutronCRUDInterfaces.getINeutronPortCRUD(this); - - if (!floatingIPExists(uuid)) { - return false; - } - NeutronFloatingIP target = floatingIPDB.get(uuid); - if (target.getPortUUID() != null) { - NeutronPort port = portCRUD.getPort(target.getPortUUID()); - port.removeFloatingIP(target.getFixedIPAddress()); - } - - //if port_id is there, bind port to this floating ip - if (delta.getPortUUID() != null) { - NeutronPort port = portCRUD.getPort(delta.getPortUUID()); - port.addFloatingIP(delta.getFixedIPAddress(), delta); - } - - target.setPortUUID(delta.getPortUUID()); - target.setFixedIPAddress(delta.getFixedIPAddress()); - return true; - } -} diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerHealthMonitorInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerHealthMonitorInterface.java deleted file mode 100644 index ecf3994fb5..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerHealthMonitorInterface.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerHealthMonitor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class NeutronLoadBalancerHealthMonitorInterface implements INeutronLoadBalancerHealthMonitorCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerHealthMonitorInterface.class); - private ConcurrentMap loadBalancerHealthMonitorDB = new ConcurrentHashMap(); - - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for (Method toMethod : methods) { - if (toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")) { - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[]) null); - if (value != null) { - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - @Override - public boolean neutronLoadBalancerHealthMonitorExists(String uuid) { - return loadBalancerHealthMonitorDB.containsKey(uuid); - } - - @Override - public NeutronLoadBalancerHealthMonitor getNeutronLoadBalancerHealthMonitor(String uuid) { - if (!neutronLoadBalancerHealthMonitorExists(uuid)) { - logger.debug("No LoadBalancerHealthMonitor has Been Defined"); - return null; - } - return loadBalancerHealthMonitorDB.get(uuid); - } - - @Override - public List getAllNeutronLoadBalancerHealthMonitors() { - Set allLoadBalancerHealthMonitors = new HashSet(); - for (Entry entry : loadBalancerHealthMonitorDB.entrySet()) { - NeutronLoadBalancerHealthMonitor loadBalancerHealthMonitor = entry.getValue(); - allLoadBalancerHealthMonitors.add(loadBalancerHealthMonitor); - } - logger.debug("Exiting getLoadBalancerHealthMonitors, Found {} OpenStackLoadBalancerHealthMonitor", allLoadBalancerHealthMonitors.size()); - List ans = new ArrayList(); - ans.addAll(allLoadBalancerHealthMonitors); - return ans; - } - - @Override - public boolean addNeutronLoadBalancerHealthMonitor(NeutronLoadBalancerHealthMonitor input) { - if (neutronLoadBalancerHealthMonitorExists(input.getLoadBalancerHealthMonitorID())) { - return false; - } - loadBalancerHealthMonitorDB.putIfAbsent(input.getLoadBalancerHealthMonitorID(), input); - //TODO: add code to find INeutronLoadBalancerHealthMonitorAware services and call newtorkCreated on them - return true; - } - - @Override - public boolean removeNeutronLoadBalancerHealthMonitor(String uuid) { - if (!neutronLoadBalancerHealthMonitorExists(uuid)) { - return false; - } - loadBalancerHealthMonitorDB.remove(uuid); - //TODO: add code to find INeutronLoadBalancerHealthMonitorAware services and call newtorkDeleted on them - return true; - } - - @Override - public boolean updateNeutronLoadBalancerHealthMonitor(String uuid, NeutronLoadBalancerHealthMonitor delta) { - if (!neutronLoadBalancerHealthMonitorExists(uuid)) { - return false; - } - NeutronLoadBalancerHealthMonitor target = loadBalancerHealthMonitorDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean neutronLoadBalancerHealthMonitorInUse(String loadBalancerHealthMonitorUUID) { - return !neutronLoadBalancerHealthMonitorExists(loadBalancerHealthMonitorUUID); - } -} diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerInterface.java deleted file mode 100644 index 472de90358..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerInterface.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class NeutronLoadBalancerInterface implements INeutronLoadBalancerCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerInterface.class); - private ConcurrentMap loadBalancerDB = new ConcurrentHashMap(); - - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for (Method toMethod : methods) { - if (toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")) { - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[]) null); - if (value != null) { - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - @Override - public boolean neutronLoadBalancerExists(String uuid) { - return loadBalancerDB.containsKey(uuid); - } - - @Override - public NeutronLoadBalancer getNeutronLoadBalancer(String uuid) { - if (!neutronLoadBalancerExists(uuid)) { - logger.debug("No LoadBalancer Have Been Defined"); - return null; - } - return loadBalancerDB.get(uuid); - } - - @Override - public List getAllNeutronLoadBalancers() { - Set allLoadBalancers = new HashSet(); - for (Entry entry : loadBalancerDB.entrySet()) { - NeutronLoadBalancer loadBalancer = entry.getValue(); - allLoadBalancers.add(loadBalancer); - } - logger.debug("Exiting getLoadBalancers, Found {} OpenStackLoadBalancer", allLoadBalancers.size()); - List ans = new ArrayList(); - ans.addAll(allLoadBalancers); - return ans; - } - - @Override - public boolean addNeutronLoadBalancer(NeutronLoadBalancer input) { - if (neutronLoadBalancerExists(input.getLoadBalancerID())) { - return false; - } - loadBalancerDB.putIfAbsent(input.getLoadBalancerID(), input); - //TODO: add code to find INeutronLoadBalancerAware services and call newtorkCreated on them - return true; - } - - @Override - public boolean removeNeutronLoadBalancer(String uuid) { - if (!neutronLoadBalancerExists(uuid)) { - return false; - } - loadBalancerDB.remove(uuid); - //TODO: add code to find INeutronLoadBalancerAware services and call newtorkDeleted on them - return true; - } - - @Override - public boolean updateNeutronLoadBalancer(String uuid, NeutronLoadBalancer delta) { - if (!neutronLoadBalancerExists(uuid)) { - return false; - } - NeutronLoadBalancer target = loadBalancerDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean neutronLoadBalancerInUse(String loadBalancerUUID) { - return !neutronLoadBalancerExists(loadBalancerUUID); - } - -} diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerListenerInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerListenerInterface.java deleted file mode 100644 index 6acc06deb3..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerListenerInterface.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerListener; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class NeutronLoadBalancerListenerInterface implements INeutronLoadBalancerListenerCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerListenerInterface.class); - private ConcurrentMap loadBalancerListenerDB = new ConcurrentHashMap(); - - - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for (Method toMethod : methods) { - if (toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")) { - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[]) null); - if (value != null) { - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - @Override - public boolean neutronLoadBalancerListenerExists(String uuid) { - return loadBalancerListenerDB.containsKey(uuid); - } - - @Override - public NeutronLoadBalancerListener getNeutronLoadBalancerListener(String uuid) { - if (!neutronLoadBalancerListenerExists(uuid)) { - logger.debug("No LoadBalancerListener Have Been Defined"); - return null; - } - return loadBalancerListenerDB.get(uuid); - } - - @Override - public List getAllNeutronLoadBalancerListeners() { - Set allLoadBalancerListeners = new HashSet(); - for (Entry entry : loadBalancerListenerDB.entrySet()) { - NeutronLoadBalancerListener loadBalancerListener = entry.getValue(); - allLoadBalancerListeners.add(loadBalancerListener); - } - logger.debug("Exiting getLoadBalancerListeners, Found {} OpenStackLoadBalancerListener", allLoadBalancerListeners.size()); - List ans = new ArrayList(); - ans.addAll(allLoadBalancerListeners); - return ans; - } - - @Override - public boolean addNeutronLoadBalancerListener(NeutronLoadBalancerListener input) { - if (neutronLoadBalancerListenerExists(input.getLoadBalancerListenerID())) { - return false; - } - loadBalancerListenerDB.putIfAbsent(input.getLoadBalancerListenerID(), input); - //TODO: add code to find INeutronLoadBalancerListenerAware services and call newtorkCreated on them - return true; - } - - @Override - public boolean removeNeutronLoadBalancerListener(String uuid) { - if (!neutronLoadBalancerListenerExists(uuid)) { - return false; - } - loadBalancerListenerDB.remove(uuid); - //TODO: add code to find INeutronLoadBalancerListenerAware services and call newtorkDeleted on them - return true; - } - - @Override - public boolean updateNeutronLoadBalancerListener(String uuid, NeutronLoadBalancerListener delta) { - if (!neutronLoadBalancerListenerExists(uuid)) { - return false; - } - NeutronLoadBalancerListener target = loadBalancerListenerDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean neutronLoadBalancerListenerInUse(String loadBalancerListenerUUID) { - return !neutronLoadBalancerListenerExists(loadBalancerListenerUUID); - } -} diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolInterface.java deleted file mode 100644 index 03c9cd94e3..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolInterface.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class NeutronLoadBalancerPoolInterface implements INeutronLoadBalancerPoolCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerPoolInterface.class); - private ConcurrentMap loadBalancerPoolDB = new ConcurrentHashMap(); - - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for (Method toMethod : methods) { - if (toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")) { - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[]) null); - if (value != null) { - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - @Override - public boolean neutronLoadBalancerPoolExists(String uuid) { - return loadBalancerPoolDB.containsKey(uuid); - } - - @Override - public NeutronLoadBalancerPool getNeutronLoadBalancerPool(String uuid) { - if (!neutronLoadBalancerPoolExists(uuid)) { - logger.debug("No LoadBalancerPool has Been Defined"); - return null; - } - return loadBalancerPoolDB.get(uuid); - } - - @Override - public List getAllNeutronLoadBalancerPools() { - Set allLoadBalancerPools = new HashSet(); - for (Entry entry : loadBalancerPoolDB.entrySet()) { - NeutronLoadBalancerPool loadBalancerPool = entry.getValue(); - allLoadBalancerPools.add(loadBalancerPool); - } - logger.debug("Exiting getLoadBalancerPools, Found {} OpenStackLoadBalancerPool", allLoadBalancerPools.size()); - List ans = new ArrayList(); - ans.addAll(allLoadBalancerPools); - return ans; - } - - @Override - public boolean addNeutronLoadBalancerPool(NeutronLoadBalancerPool input) { - if (neutronLoadBalancerPoolExists(input.getLoadBalancerPoolID())) { - return false; - } - loadBalancerPoolDB.putIfAbsent(input.getLoadBalancerPoolID(), input); - //TODO: add code to find INeutronLoadBalancerPoolAware services and call newtorkCreated on them - return true; - } - - @Override - public boolean removeNeutronLoadBalancerPool(String uuid) { - if (!neutronLoadBalancerPoolExists(uuid)) { - return false; - } - loadBalancerPoolDB.remove(uuid); - //TODO: add code to find INeutronLoadBalancerPoolAware services and call newtorkDeleted on them - return true; - } - - @Override - public boolean updateNeutronLoadBalancerPool(String uuid, NeutronLoadBalancerPool delta) { - if (!neutronLoadBalancerPoolExists(uuid)) { - return false; - } - NeutronLoadBalancerPool target = loadBalancerPoolDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean neutronLoadBalancerPoolInUse(String loadBalancerPoolUUID) { - return !neutronLoadBalancerPoolExists(loadBalancerPoolUUID); - } - -} diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolMemberInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolMemberInterface.java deleted file mode 100644 index 8ed3a36826..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolMemberInterface.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolMemberCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class NeutronLoadBalancerPoolMemberInterface - implements INeutronLoadBalancerPoolMemberCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerPoolMemberInterface.class); - private ConcurrentMap loadBalancerPoolMemberDB = new ConcurrentHashMap(); - - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for (Method toMethod : methods) { - if (toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")) { - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[]) null); - if (value != null) { - toMethod.invoke(target, value); - } - } catch(Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - @Override - public boolean neutronLoadBalancerPoolMemberExists(String uuid) { - return loadBalancerPoolMemberDB.containsKey(uuid); - } - - @Override - public NeutronLoadBalancerPoolMember getNeutronLoadBalancerPoolMember(String uuid) { - if (!neutronLoadBalancerPoolMemberExists(uuid)) { - logger.debug("No LoadBalancerPoolMember Have Been Defined"); - return null; - } - return loadBalancerPoolMemberDB.get(uuid); - } - - @Override - public List getAllNeutronLoadBalancerPoolMembers() { - Set allLoadBalancerPoolMembers = new HashSet(); - for (Map.Entry entry : loadBalancerPoolMemberDB.entrySet()) { - NeutronLoadBalancerPoolMember loadBalancerPoolMember = entry.getValue(); - allLoadBalancerPoolMembers.add(loadBalancerPoolMember); - } - logger.debug("Exiting getLoadBalancerPoolMembers, Found {} OpenStackLoadBalancerPoolMember", - allLoadBalancerPoolMembers.size()); - List ans = new ArrayList(); - ans.addAll(allLoadBalancerPoolMembers); - return ans; - } - - @Override - public boolean addNeutronLoadBalancerPoolMember(NeutronLoadBalancerPoolMember input) { - if (neutronLoadBalancerPoolMemberExists(input.getPoolMemberID())) { - return false; - } - loadBalancerPoolMemberDB.putIfAbsent(input.getPoolMemberID(), input); - return true; - } - - @Override - public boolean removeNeutronLoadBalancerPoolMember(String uuid) { - if (!neutronLoadBalancerPoolMemberExists(uuid)) { - return false; - } - loadBalancerPoolMemberDB.remove(uuid); - return true; - } - - @Override - public boolean updateNeutronLoadBalancerPoolMember(String uuid, NeutronLoadBalancerPoolMember delta) { - if (!neutronLoadBalancerPoolMemberExists(uuid)) { - return false; - } - NeutronLoadBalancerPoolMember target = loadBalancerPoolMemberDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean neutronLoadBalancerPoolMemberInUse(String loadBalancerPoolMemberID) { - return !neutronLoadBalancerPoolMemberExists(loadBalancerPoolMemberID); - } -} diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronNetworkInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronNetworkInterface.java deleted file mode 100644 index c9e1549520..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronNetworkInterface.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class NeutronNetworkInterface implements INeutronNetworkCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronNetworkInterface.class); - private ConcurrentMap networkDB = new ConcurrentHashMap(); - - - - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for(Method toMethod: methods){ - if(toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")){ - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[])null); - if(value != null){ - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - // IfNBNetworkCRUD methods - - @Override - public boolean networkExists(String uuid) { - return networkDB.containsKey(uuid); - } - - @Override - public NeutronNetwork getNetwork(String uuid) { - if (!networkExists(uuid)) { - return null; - } - return networkDB.get(uuid); - } - - @Override - public List getAllNetworks() { - Set allNetworks = new HashSet(); - for (Entry entry : networkDB.entrySet()) { - NeutronNetwork network = entry.getValue(); - allNetworks.add(network); - } - logger.debug("Exiting getAllNetworks, Found {} OpenStackNetworks", allNetworks.size()); - List ans = new ArrayList(); - ans.addAll(allNetworks); - return ans; - } - - @Override - public boolean addNetwork(NeutronNetwork input) { - if (networkExists(input.getID())) { - return false; - } - networkDB.putIfAbsent(input.getID(), input); - //TODO: add code to find INeutronNetworkAware services and call newtorkCreated on them - return true; - } - - @Override - public boolean removeNetwork(String uuid) { - if (!networkExists(uuid)) { - return false; - } - networkDB.remove(uuid); - //TODO: add code to find INeutronNetworkAware services and call newtorkDeleted on them - return true; - } - - @Override - public boolean updateNetwork(String uuid, NeutronNetwork delta) { - if (!networkExists(uuid)) { - return false; - } - NeutronNetwork target = networkDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean networkInUse(String netUUID) { - if (!networkExists(netUUID)) { - return true; - } - NeutronNetwork target = networkDB.get(netUUID); - if (target.getPortsOnNetwork().size() > 0) { - return true; - } - return false; - } -} diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronPortInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronPortInterface.java deleted file mode 100644 index 5c8780028d..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronPortInterface.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork; -import org.opendaylight.controller.networkconfig.neutron.NeutronPort; -import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet; -import org.opendaylight.controller.networkconfig.neutron.Neutron_IPs; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class NeutronPortInterface implements INeutronPortCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronPortInterface.class); - private ConcurrentMap portDB = new ConcurrentHashMap(); - - - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for(Method toMethod: methods){ - if(toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")){ - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[])null); - if(value != null){ - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - // IfNBPortCRUD methods - - @Override - public boolean portExists(String uuid) { - return portDB.containsKey(uuid); - } - - @Override - public NeutronPort getPort(String uuid) { - if (!portExists(uuid)) { - return null; - } - return portDB.get(uuid); - } - - @Override - public List getAllPorts() { - Set allPorts = new HashSet(); - for (Entry entry : portDB.entrySet()) { - NeutronPort port = entry.getValue(); - allPorts.add(port); - } - logger.debug("Exiting getAllPorts, Found {} OpenStackPorts", allPorts.size()); - List ans = new ArrayList(); - ans.addAll(allPorts); - return ans; - } - - @Override - public boolean addPort(NeutronPort input) { - if (portExists(input.getID())) { - return false; - } - portDB.putIfAbsent(input.getID(), input); - // if there are no fixed IPs, allocate one for each subnet in the network - INeutronSubnetCRUD systemCRUD = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this); - if (input.getFixedIPs() == null){ - input.setFixedIPs(new ArrayList()); - } - if (input.getFixedIPs().size() == 0) { - List list = input.getFixedIPs(); - Iterator subnetIterator = systemCRUD.getAllSubnets().iterator(); - while (subnetIterator.hasNext()) { - NeutronSubnet subnet = subnetIterator.next(); - if (subnet.getNetworkUUID().equals(input.getNetworkUUID())) { - list.add(new Neutron_IPs(subnet.getID())); - } - } - } - Iterator fixedIPIterator = input.getFixedIPs().iterator(); - while (fixedIPIterator.hasNext()) { - Neutron_IPs ip = fixedIPIterator.next(); - NeutronSubnet subnet = systemCRUD.getSubnet(ip.getSubnetUUID()); - if (ip.getIpAddress() == null) { - ip.setIpAddress(subnet.getLowAddr()); - } - if (!ip.getIpAddress().equals(subnet.getGatewayIP())) { - subnet.allocateIP(ip.getIpAddress()); - } - else { - subnet.setGatewayIPAllocated(); - } - subnet.addPort(input); - } - INeutronNetworkCRUD networkIf = NeutronCRUDInterfaces.getINeutronNetworkCRUD(this); - - NeutronNetwork network = networkIf.getNetwork(input.getNetworkUUID()); - network.addPort(input); - return true; - } - - @Override - public boolean removePort(String uuid) { - if (!portExists(uuid)) { - return false; - } - NeutronPort port = getPort(uuid); - portDB.remove(uuid); - INeutronNetworkCRUD networkCRUD = NeutronCRUDInterfaces.getINeutronNetworkCRUD(this); - INeutronSubnetCRUD systemCRUD = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this); - - NeutronNetwork network = networkCRUD.getNetwork(port.getNetworkUUID()); - network.removePort(port); - Iterator fixedIPIterator = port.getFixedIPs().iterator(); - while (fixedIPIterator.hasNext()) { - Neutron_IPs ip = fixedIPIterator.next(); - NeutronSubnet subnet = systemCRUD.getSubnet(ip.getSubnetUUID()); - if (!ip.getIpAddress().equals(subnet.getGatewayIP())) { - subnet.releaseIP(ip.getIpAddress()); - } - else { - subnet.resetGatewayIPAllocated(); - } - subnet.removePort(port); - } - return true; - } - - @Override - public boolean updatePort(String uuid, NeutronPort delta) { - if (!portExists(uuid)) { - return false; - } - NeutronPort target = portDB.get(uuid); - // remove old Fixed_IPs - if (delta.getFixedIPs() != null) { - NeutronPort port = getPort(uuid); - INeutronSubnetCRUD systemCRUD = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this); - for (Neutron_IPs ip: port.getFixedIPs()) { - NeutronSubnet subnet = systemCRUD.getSubnet(ip.getSubnetUUID()); - subnet.releaseIP(ip.getIpAddress()); - } - - // allocate new Fixed_IPs - for (Neutron_IPs ip: delta.getFixedIPs()) { - NeutronSubnet subnet = systemCRUD.getSubnet(ip.getSubnetUUID()); - if (ip.getIpAddress() == null) { - ip.setIpAddress(subnet.getLowAddr()); - } - subnet.allocateIP(ip.getIpAddress()); - } - } - return overwrite(target, delta); - } - - @Override - public boolean macInUse(String macAddress) { - List ports = getAllPorts(); - Iterator portIterator = ports.iterator(); - while (portIterator.hasNext()) { - NeutronPort port = portIterator.next(); - if (macAddress.equalsIgnoreCase(port.getMacAddress())) { - return true; - } - } - return false; - } - - @Override - public NeutronPort getGatewayPort(String subnetUUID) { - INeutronSubnetCRUD systemCRUD = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this); - NeutronSubnet subnet = systemCRUD.getSubnet(subnetUUID); - Iterator portIterator = getAllPorts().iterator(); - while (portIterator.hasNext()) { - NeutronPort port = portIterator.next(); - List fixedIPs = port.getFixedIPs(); - if (fixedIPs.size() == 1) { - if (subnet.getGatewayIP().equals(fixedIPs.get(0).getIpAddress())) { - return port; - } - } - } - return null; - } -} diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronRouterInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronRouterInterface.java deleted file mode 100644 index 5e4c5a4277..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronRouterInterface.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronRouter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class NeutronRouterInterface implements INeutronRouterCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronRouterInterface.class); - private ConcurrentMap routerDB = new ConcurrentHashMap(); - // methods needed for creating caches - - - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for(Method toMethod: methods){ - if(toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")){ - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[])null); - if(value != null){ - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - - // IfNBRouterCRUD Interface methods - - @Override - public boolean routerExists(String uuid) { - return routerDB.containsKey(uuid); - } - - @Override - public NeutronRouter getRouter(String uuid) { - if (!routerExists(uuid)) { - return null; - } - return routerDB.get(uuid); - } - - @Override - public List getAllRouters() { - Set allRouters = new HashSet(); - for (Entry entry : routerDB.entrySet()) { - NeutronRouter router = entry.getValue(); - allRouters.add(router); - } - logger.debug("Exiting getAllRouters, Found {} Routers", allRouters.size()); - List ans = new ArrayList(); - ans.addAll(allRouters); - return ans; - } - - @Override - public boolean addRouter(NeutronRouter input) { - if (routerExists(input.getID())) { - return false; - } - routerDB.putIfAbsent(input.getID(), input); - return true; - } - - @Override - public boolean removeRouter(String uuid) { - if (!routerExists(uuid)) { - return false; - } - routerDB.remove(uuid); - return true; - } - - @Override - public boolean updateRouter(String uuid, NeutronRouter delta) { - if (!routerExists(uuid)) { - return false; - } - NeutronRouter target = routerDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean routerInUse(String routerUUID) { - if (!routerExists(routerUUID)) { - return true; - } - NeutronRouter target = routerDB.get(routerUUID); - return (target.getInterfaces().size() > 0); - } - -} diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityGroupInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityGroupInterface.java deleted file mode 100644 index d59bf9e093..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityGroupInterface.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Map.Entry; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityGroup; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class NeutronSecurityGroupInterface implements INeutronSecurityGroupCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronSecurityGroupInterface.class); - private ConcurrentMap securityGroupDB = new ConcurrentHashMap(); - - - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for(Method toMethod: methods){ - if(toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")){ - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[])null); - if(value != null){ - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - @Override - public boolean neutronSecurityGroupExists(String uuid) { - return securityGroupDB.containsKey(uuid); - } - - @Override - public NeutronSecurityGroup getNeutronSecurityGroup(String uuid) { - if (!neutronSecurityGroupExists(uuid)) { - logger.debug("No Security Groups Have Been Defined"); - return null; - } - return securityGroupDB.get(uuid); - } - - @Override - public List getAllNeutronSecurityGroups() { - Set allSecurityGroups = new HashSet(); - for (Entry entry : securityGroupDB.entrySet()) { - NeutronSecurityGroup securityGroup = entry.getValue(); - allSecurityGroups.add(securityGroup); - } - logger.debug("Exiting getSecurityGroups, Found {} OpenStackSecurityGroup", allSecurityGroups.size()); - List ans = new ArrayList(); - ans.addAll(allSecurityGroups); - return ans; - } - - @Override - public boolean addNeutronSecurityGroup(NeutronSecurityGroup input) { - if (neutronSecurityGroupExists(input.getSecurityGroupUUID())) { - return false; - } - securityGroupDB.putIfAbsent(input.getSecurityGroupUUID(), input); - return true; - } - - @Override - public boolean removeNeutronSecurityGroup(String uuid) { - if (!neutronSecurityGroupExists(uuid)) { - return false; - } - securityGroupDB.remove(uuid); - return true; - } - - @Override - public boolean updateNeutronSecurityGroup(String uuid, NeutronSecurityGroup delta) { - if (!neutronSecurityGroupExists(uuid)) { - return false; - } - NeutronSecurityGroup target = securityGroupDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean neutronSecurityGroupInUse(String securityGroupUUID) { - return !neutronSecurityGroupExists(securityGroupUUID); - } - -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityRuleInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityRuleInterface.java deleted file mode 100644 index 884d15f452..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityRuleInterface.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Map.Entry; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityRule; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class NeutronSecurityRuleInterface implements INeutronSecurityRuleCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronSecurityRuleInterface.class); - private ConcurrentMap securityRuleDB = new ConcurrentHashMap(); - - // this method uses reflection to update an object from it's delta. - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for (Method toMethod : methods) { - if (toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")) { - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[]) null); - if (value != null) { - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - @Override - public boolean neutronSecurityRuleExists(String uuid) { - return securityRuleDB.containsKey(uuid); - } - - @Override - public NeutronSecurityRule getNeutronSecurityRule(String uuid) { - if (!neutronSecurityRuleExists(uuid)) { - logger.debug("No Security Rules Have Been Defined"); - return null; - } - return securityRuleDB.get(uuid); - } - - @Override - public List getAllNeutronSecurityRules() { - Set allSecurityRules = new HashSet(); - for (Entry entry : securityRuleDB.entrySet()) { - NeutronSecurityRule securityRule = entry.getValue(); - allSecurityRules.add(securityRule); - } - logger.debug("Exiting getSecurityRule, Found {} OpenStackSecurityRule", allSecurityRules.size()); - List ans = new ArrayList(); - ans.addAll(allSecurityRules); - return ans; - } - - @Override - public boolean addNeutronSecurityRule(NeutronSecurityRule input) { - if (neutronSecurityRuleExists(input.getSecurityRuleUUID())) { - return false; - } - securityRuleDB.putIfAbsent(input.getSecurityRuleUUID(), input); - return true; - } - - @Override - public boolean removeNeutronSecurityRule(String uuid) { - if (!neutronSecurityRuleExists(uuid)) { - return false; - } - securityRuleDB.remove(uuid); - return true; - } - - @Override - public boolean updateNeutronSecurityRule(String uuid, NeutronSecurityRule delta) { - if (!neutronSecurityRuleExists(uuid)) { - return false; - } - NeutronSecurityRule target = securityRuleDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean neutronSecurityRuleInUse(String securityRuleUUID) { - return !neutronSecurityRuleExists(securityRuleUUID); - } - -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSubnetInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSubnetInterface.java deleted file mode 100644 index 81fa107fd8..0000000000 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSubnetInterface.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.implementation; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork; -import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class NeutronSubnetInterface implements INeutronSubnetCRUD { - private static final Logger logger = LoggerFactory.getLogger(NeutronSubnetInterface.class); - private ConcurrentMap subnetDB = new ConcurrentHashMap(); - - - - // this method uses reflection to update an object from it's delta. - - private boolean overwrite(Object target, Object delta) { - Method[] methods = target.getClass().getMethods(); - - for(Method toMethod: methods){ - if(toMethod.getDeclaringClass().equals(target.getClass()) - && toMethod.getName().startsWith("set")){ - - String toName = toMethod.getName(); - String fromName = toName.replace("set", "get"); - - try { - Method fromMethod = delta.getClass().getMethod(fromName); - Object value = fromMethod.invoke(delta, (Object[])null); - if(value != null){ - toMethod.invoke(target, value); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - return true; - } - - - // IfNBSubnetCRUD methods - - @Override - public boolean subnetExists(String uuid) { - return subnetDB.containsKey(uuid); - } - - @Override - public NeutronSubnet getSubnet(String uuid) { - if (!subnetExists(uuid)) { - return null; - } - return subnetDB.get(uuid); - } - - @Override - public List getAllSubnets() { - Set allSubnets = new HashSet(); - for (Entry entry : subnetDB.entrySet()) { - NeutronSubnet subnet = entry.getValue(); - allSubnets.add(subnet); - } - logger.debug("Exiting getAllSubnets, Found {} OpenStackSubnets", allSubnets.size()); - List ans = new ArrayList(); - ans.addAll(allSubnets); - return ans; - } - - @Override - public boolean addSubnet(NeutronSubnet input) { - String id = input.getID(); - if (subnetExists(id)) { - return false; - } - subnetDB.putIfAbsent(id, input); - INeutronNetworkCRUD networkIf = NeutronCRUDInterfaces.getINeutronNetworkCRUD(this); - - NeutronNetwork targetNet = networkIf.getNetwork(input.getNetworkUUID()); - targetNet.addSubnet(id); - return true; - } - - @Override - public boolean removeSubnet(String uuid) { - if (!subnetExists(uuid)) { - return false; - } - NeutronSubnet target = subnetDB.get(uuid); - INeutronNetworkCRUD networkIf = NeutronCRUDInterfaces.getINeutronNetworkCRUD(this); - - NeutronNetwork targetNet = networkIf.getNetwork(target.getNetworkUUID()); - targetNet.removeSubnet(uuid); - subnetDB.remove(uuid); - return true; - } - - @Override - public boolean updateSubnet(String uuid, NeutronSubnet delta) { - if (!subnetExists(uuid)) { - return false; - } - NeutronSubnet target = subnetDB.get(uuid); - return overwrite(target, delta); - } - - @Override - public boolean subnetInUse(String subnetUUID) { - if (!subnetExists(subnetUUID)) { - return true; - } - NeutronSubnet target = subnetDB.get(subnetUUID); - return (target.getPortsInSubnet().size() > 0); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/enunciate.xml b/opendaylight/networkconfiguration/neutron/northbound/enunciate.xml deleted file mode 100644 index 66160255f3..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/enunciate.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - diff --git a/opendaylight/networkconfiguration/neutron/northbound/pom.xml b/opendaylight/networkconfiguration/neutron/northbound/pom.xml deleted file mode 100644 index 1e7bcf0ae6..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/pom.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - 4.0.0 - - org.opendaylight.controller - enunciate-parent - 1.5.0-SNAPSHOT - ../../../commons/enunciate-parent - - networkconfig.neutron.northbound - 0.5.0-SNAPSHOT - bundle - - - com.sun.jersey - jersey-core - - - com.sun.jersey - jersey-server - - - com.sun.jersey - jersey-servlet - - - org.codehaus.enunciate - enunciate-core-annotations - - - org.eclipse.persistence - org.eclipse.persistence.moxy - - - org.opendaylight.controller - networkconfig.neutron - - - org.osgi - org.osgi.core - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.opendaylight.controller.networkconfig.neutron, - org.eclipse.persistence.jaxb.rs, - com.sun.jersey.spi.container.servlet, - javax.ws.rs, - javax.ws.rs.ext, - javax.ws.rs.core, - javax.xml.bind.annotation, - javax.xml.bind, - org.slf4j, - org.osgi.framework, - !org.codehaus.enunciate.jaxrs - /controller/nb/v2/neutron - - ${project.basedir}/src/main/resources/META-INF - - - - - - scm:git:ssh://git.opendaylight.org:29418/controller.git - scm:git:ssh://git.opendaylight.org:29418/controller.git - HEAD - https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main - - - - - - opendaylight-release - ${nexusproxy}/repositories/${nexus.repository.release}/ - - - - opendaylight-snapshot - ${nexusproxy}/repositories/${nexus.repository.snapshot}/ - - - - website - ${sitedeploy} - - - diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/BadRequestException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/BadRequestException.java deleted file mode 100644 index 9db8633b99..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/BadRequestException.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -/** - * Status Code 400 (Bad Request) - * - * The request could not be understood by the server due to malformed syntax. - * The client SHOULD NOT repeat the request without modifications. - */ -public class BadRequestException extends WebApplicationException { - private static final long serialVersionUID = 1L; - - public BadRequestException(String string) { - super(Response.status(Response.Status.BAD_REQUEST).entity(string).type(MediaType.TEXT_PLAIN).build()); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/INeutronRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/INeutronRequest.java deleted file mode 100644 index 8325d84e35..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/INeutronRequest.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Authors : Dave Tucker - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.opendaylight.controller.networkconfig.neutron.INeutronObject; - -import java.util.List; - -/** - * This interface defines the methods for Neutron Requests - * - * @deprecated Replaced by {@link org.opendaylight.neutron.northbound.api.INeutronRequest} - */ -@Deprecated -public interface INeutronRequest { - public T getSingleton(); - public boolean isSingleton(); - public List getBulk(); -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/InternalServerErrorException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/InternalServerErrorException.java deleted file mode 100644 index 5a40a1861b..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/InternalServerErrorException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.MediaType; - -/** - * Status Code 500 (Internal Server Error) - * - * The server encountered an unexpected condition which prevented - * it from fulfilling the request. - * - * - * - */ -public class InternalServerErrorException extends WebApplicationException { - private static final long serialVersionUID = 1L; - - /** - * Constructor for the INTERNAL_SERVER_ERROR custom handler - * - * @param string Error message to specify further the - * INTERNAL_SERVER_ERROR response - * - */ - public InternalServerErrorException(String string) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( - string).type(MediaType.TEXT_PLAIN).build()); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallNorthbound.java deleted file mode 100644 index b97a554f60..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallNorthbound.java +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronFirewall; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -/** - * Neutron Northbound REST APIs for Firewall.
- * This class provides REST APIs for managing neutron Firewall - * - *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * - */ -@Path("/fw/firewalls") -public class NeutronFirewallNorthbound { - - private NeutronFirewall extractFields(NeutronFirewall o, List fields) { - return o.extractFields(fields); - } - - /** - * Returns a list of all Firewalls */ - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - - public Response listGroups( - // return fields - @QueryParam("fields") List fields, - // OpenStack firewall attributes - @QueryParam("id") String queryFirewallUUID, - @QueryParam("tenant_id") String queryFirewallTenantID, - @QueryParam("name") String queryFirewallName, - @QueryParam("description") String queryFirewallDescription, - @QueryParam("shared") Boolean queryFirewallAdminStateIsUp, - @QueryParam("status") String queryFirewallStatus, - @QueryParam("shared") Boolean queryFirewallIsShared, - @QueryParam("firewall_policy_id") String queryFirewallPolicyID, - // pagination - @QueryParam("limit") String limit, - @QueryParam("marker") String marker, - @QueryParam("page_reverse") String pageReverse - // sorting not supported - ) { - INeutronFirewallCRUD firewallInterface = NeutronCRUDInterfaces.getINeutronFirewallCRUD(this); - INeutronFirewallRuleCRUD firewallRuleInterface = NeutronCRUDInterfaces.getINeutronFirewallRuleCRUD(this); - - if (firewallInterface == null) { - throw new ServiceUnavailableException("Firewall CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allFirewalls = firewallInterface.getAllNeutronFirewalls(); - List ans = new ArrayList(); - Iterator i = allFirewalls.iterator(); - while (i.hasNext()) { - NeutronFirewall nsg = i.next(); - if ((queryFirewallUUID == null || - queryFirewallUUID.equals(nsg.getFirewallUUID())) && - (queryFirewallTenantID == null || - queryFirewallTenantID.equals(nsg.getFirewallTenantID())) && - (queryFirewallName == null || - queryFirewallName.equals(nsg.getFirewallName())) && - (queryFirewallDescription == null || - queryFirewallDescription.equals(nsg.getFirewallDescription())) && - (queryFirewallAdminStateIsUp == null || - queryFirewallAdminStateIsUp.equals(nsg.getFirewallAdminStateIsUp())) && - (queryFirewallStatus == null || - queryFirewallStatus.equals(nsg.getFirewallStatus())) && - (queryFirewallIsShared == null || - queryFirewallIsShared.equals(nsg.getFirewallIsShared())) && - (queryFirewallPolicyID == null || - queryFirewallPolicyID.equals(nsg.getFirewallPolicyID()))) { - if (fields.size() > 0) { - ans.add(extractFields(nsg,fields)); - } else { - ans.add(nsg); - } - } - } - //TODO: apply pagination to results - return Response.status(200).entity( - new NeutronFirewallRequest(ans)).build(); - } - - /** - * Returns a specific Firewall */ - - @Path("{firewallUUID}") - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response showFirewall(@PathParam("firewallUUID") String firewallUUID, - // return fields - @QueryParam("fields") List fields) { - INeutronFirewallCRUD firewallInterface = NeutronCRUDInterfaces.getINeutronFirewallCRUD(this); - if (firewallInterface == null) { - throw new ServiceUnavailableException("Firewall CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!firewallInterface.neutronFirewallExists(firewallUUID)) { - throw new ResourceNotFoundException("Firewall UUID does not exist."); - } - if (fields.size() > 0) { - NeutronFirewall ans = firewallInterface.getNeutronFirewall(firewallUUID); - return Response.status(200).entity( - new NeutronFirewallRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200).entity(new NeutronFirewallRequest(firewallInterface.getNeutronFirewall(firewallUUID))).build(); - } - } - - /** - * Creates new Firewall */ - - @POST - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 201, condition = "Created"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response createFirewalls(final NeutronFirewallRequest input) { - INeutronFirewallCRUD firewallInterface = NeutronCRUDInterfaces.getINeutronFirewallCRUD(this); - if (firewallInterface == null) { - throw new ServiceUnavailableException("Firewall CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (input.isSingleton()) { - NeutronFirewall singleton = input.getSingleton(); - - /* - * Verify that the Firewall doesn't already exist. - */ - if (firewallInterface.neutronFirewallExists(singleton.getFirewallUUID())) { - throw new BadRequestException("Firewall UUID already exists"); - } - firewallInterface.addNeutronFirewall(singleton); - Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFirewallAware service = (INeutronFirewallAware) instance; - int status = service.canCreateNeutronFirewall(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - firewallInterface.addNeutronFirewall(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronFirewallAware service = (INeutronFirewallAware) instance; - service.neutronFirewallCreated(singleton); - } - } - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this); - while (i.hasNext()) { - NeutronFirewall test = i.next(); - - /* - * Verify that the secruity group doesn't already exist - */ - if (firewallInterface.neutronFirewallExists(test.getFirewallUUID())) { - throw new BadRequestException("Firewall UUID already is already created"); - } - if (testMap.containsKey(test.getFirewallUUID())) { - throw new BadRequestException("Firewall UUID already exists"); - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFirewallAware service = (INeutronFirewallAware) instance; - int status = service.canCreateNeutronFirewall(test); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - } - - /* - * now, each element of the bulk request can be added to the cache - */ - i = bulk.iterator(); - while (i.hasNext()) { - NeutronFirewall test = i.next(); - firewallInterface.addNeutronFirewall(test); - if (instances != null) { - for (Object instance : instances) { - INeutronFirewallAware service = (INeutronFirewallAware) instance; - service.neutronFirewallCreated(test); - } - } - } - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a Firewall */ - - @Path("{firewallUUID}") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response updateFirewall( - @PathParam("firewallUUID") String firewallUUID, final NeutronFirewallRequest input) { - INeutronFirewallCRUD firewallInterface = NeutronCRUDInterfaces.getINeutronFirewallCRUD(this); - if (firewallInterface == null) { - throw new ServiceUnavailableException("Firewall CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the Firewall exists and there is only one delta provided - */ - if (!firewallInterface.neutronFirewallExists(firewallUUID)) { - throw new ResourceNotFoundException("Firewall UUID does not exist."); - } - if (!input.isSingleton()) { - throw new BadRequestException("Only singleton edit supported"); - } - NeutronFirewall delta = input.getSingleton(); - NeutronFirewall original = firewallInterface.getNeutronFirewall(firewallUUID); - - /* - * updates restricted by Neutron - */ - if (delta.getFirewallUUID() != null || - delta.getFirewallTenantID() != null || - delta.getFirewallName() != null || - delta.getFirewallDescription() != null || - delta.getFirewallAdminStateIsUp() != null || - delta.getFirewallStatus() != null || - delta.getFirewallIsShared() != null || - delta.getFirewallPolicyID() != null) { - throw new BadRequestException("Attribute edit blocked by Neutron"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFirewallAware service = (INeutronFirewallAware) instance; - int status = service.canUpdateNeutronFirewall(delta, original); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * update the object and return it - */ - firewallInterface.updateNeutronFirewall(firewallUUID, delta); - NeutronFirewall updatedFirewall = firewallInterface.getNeutronFirewall(firewallUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronFirewallAware service = (INeutronFirewallAware) instance; - service.neutronFirewallUpdated(updatedFirewall); - } - } - return Response.status(200).entity(new NeutronFirewallRequest(firewallInterface.getNeutronFirewall(firewallUUID))).build(); - } - - /** - * Deletes a Firewall */ - - @Path("{firewallUUID}") - @DELETE - @StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response deleteFirewall( - @PathParam("firewallUUID") String firewallUUID) { - INeutronFirewallCRUD firewallInterface = NeutronCRUDInterfaces.getINeutronFirewallCRUD(this); - if (firewallInterface == null) { - throw new ServiceUnavailableException("Firewall CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the Firewall exists and it isn't currently in use - */ - if (!firewallInterface.neutronFirewallExists(firewallUUID)) { - throw new ResourceNotFoundException("Firewall UUID does not exist."); - } - if (firewallInterface.neutronFirewallInUse(firewallUUID)) { - return Response.status(409).build(); - } - NeutronFirewall singleton = firewallInterface.getNeutronFirewall(firewallUUID); - Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFirewallAware service = (INeutronFirewallAware) instance; - int status = service.canDeleteNeutronFirewall(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * remove it and return 204 status - */ - firewallInterface.removeNeutronFirewall(firewallUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronFirewallAware service = (INeutronFirewallAware) instance; - service.neutronFirewallDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java deleted file mode 100644 index e9b813d731..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java +++ /dev/null @@ -1,394 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallPolicy; - -/** - * Neutron Northbound REST APIs for Firewall Policies.
- * This class provides REST APIs for managing neutron Firewall Policies - * - *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * - */ -@Path("/fw/firewalls_policies") -public class NeutronFirewallPolicyNorthbound { - - private NeutronFirewallPolicy extractFields(NeutronFirewallPolicy o, List fields) { - return o.extractFields(fields); - } - - /** - * Returns a list of all Firewall Policies */ - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - - public Response listGroups( - // return fields - @QueryParam("fields") List fields, - // OpenStack Firewall Policy attributes - @QueryParam("id") String queryFirewallPolicyUUID, - @QueryParam("tenant_id") String queryFirewallPolicyTenantID, - @QueryParam("name") String queryFirewallPolicyName, - @QueryParam("description") String querySecurityPolicyDescription, - @QueryParam("shared") String querySecurityPolicyIsShared, - @QueryParam("firewall_rules") List querySecurityPolicyFirewallRules, - @QueryParam("audited") Boolean querySecurityPolicyIsAudited, - // pagination - @QueryParam("limit") String limit, - @QueryParam("marker") String marker, - @QueryParam("page_reverse") String pageReverse - // sorting not supported - ) { - INeutronFirewallPolicyCRUD firewallPolicyInterface = NeutronCRUDInterfaces.getINeutronFirewallPolicyCRUD(this); - - if (firewallPolicyInterface == null) { - throw new ServiceUnavailableException("Firewall Policy CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allFirewallPolicies = firewallPolicyInterface.getAllNeutronFirewallPolicies(); - List ans = new ArrayList(); - Iterator i = allFirewallPolicies.iterator(); - while (i.hasNext()) { - NeutronFirewallPolicy nsg = i.next(); - if ((queryFirewallPolicyUUID == null || - queryFirewallPolicyUUID.equals(nsg.getFirewallPolicyUUID())) && - (queryFirewallPolicyTenantID == null || - queryFirewallPolicyTenantID.equals(nsg.getFirewallPolicyTenantID())) && - (queryFirewallPolicyName == null || - queryFirewallPolicyName.equals(nsg.getFirewallPolicyName())) && - (querySecurityPolicyDescription == null || - querySecurityPolicyDescription.equals(nsg.getFirewallPolicyDescription())) && - (querySecurityPolicyIsShared == null || - querySecurityPolicyIsShared.equals(nsg.getFirewallPolicyIsShared())) && - (querySecurityPolicyFirewallRules.size() == 0 || - querySecurityPolicyFirewallRules.equals(nsg.getFirewallPolicyRules())) && - (querySecurityPolicyIsAudited == null || - querySecurityPolicyIsAudited.equals(nsg.getFirewallPolicyIsAudited()))) { - if (fields.size() > 0) { - ans.add(extractFields(nsg,fields)); - } else { - ans.add(nsg); - } - } - } // ans.add((NeutronFirewallPolicy) rules); - //TODO: apply pagination to results - return Response.status(200).entity( - new NeutronFirewallPolicyRequest(ans)).build(); - } - - /** - * Returns a specific Firewall Policy */ - - @Path("{firewallPolicyUUID}") - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response showFirewallPolicy(@PathParam("firewallPolicyUUID") String firewallPolicyUUID, - // return fields - @QueryParam("fields") List fields) { - INeutronFirewallPolicyCRUD firewallPolicyInterface = NeutronCRUDInterfaces.getINeutronFirewallPolicyCRUD(this); - if (firewallPolicyInterface == null) { - throw new ServiceUnavailableException("Firewall Policy CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!firewallPolicyInterface.neutronFirewallPolicyExists(firewallPolicyUUID)) { - throw new ResourceNotFoundException("Firewall Policy UUID does not exist."); - } - if (fields.size() > 0) { - NeutronFirewallPolicy ans = firewallPolicyInterface.getNeutronFirewallPolicy(firewallPolicyUUID); - return Response.status(200).entity( - new NeutronFirewallPolicyRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200).entity(new NeutronFirewallPolicyRequest(firewallPolicyInterface.getNeutronFirewallPolicy(firewallPolicyUUID))).build(); - } - } - - /** - * Creates new Firewall Policy - * */ - @POST - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 201, condition = "Created"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response createFirewallPolicies(final NeutronFirewallPolicyRequest input) { - INeutronFirewallPolicyCRUD firewallPolicyInterface = NeutronCRUDInterfaces.getINeutronFirewallPolicyCRUD(this); - if (firewallPolicyInterface == null) { - throw new ServiceUnavailableException("Firewall Policy CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (input.isSingleton()) { - NeutronFirewallPolicy singleton = input.getSingleton(); - - /* - * Verify that the Firewall Policy doesn't already exist. - */ - if (firewallPolicyInterface.neutronFirewallPolicyExists(singleton.getFirewallPolicyUUID())) { - throw new BadRequestException("Firewall Policy UUID already exists"); - } - firewallPolicyInterface.addNeutronFirewallPolicy(singleton); - - Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance; - int status = service.canCreateNeutronFirewallPolicy(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - firewallPolicyInterface.addNeutronFirewallPolicy(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance; - service.neutronFirewallPolicyCreated(singleton); - } - } - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this); - while (i.hasNext()) { - NeutronFirewallPolicy test = i.next(); - - /* - * Verify that the firewall policy doesn't already exist - */ - - if (firewallPolicyInterface.neutronFirewallPolicyExists(test.getFirewallPolicyUUID())) { - throw new BadRequestException("Firewall Policy UUID already is already created"); - } - if (testMap.containsKey(test.getFirewallPolicyUUID())) { - throw new BadRequestException("Firewall Policy UUID already exists"); - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance; - int status = service.canCreateNeutronFirewallPolicy(test); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - } - /* - * now, each element of the bulk request can be added to the cache - */ - i = bulk.iterator(); - while (i.hasNext()) { - NeutronFirewallPolicy test = i.next(); - firewallPolicyInterface.addNeutronFirewallPolicy(test); - if (instances != null) { - for (Object instance : instances) { - INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance; - service.neutronFirewallPolicyCreated(test); - } - } - } - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a Firewall Policy - */ - @Path("{firewallPolicyUUID}") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackSubnets.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response updateFirewallPolicy( - @PathParam("firewallPolicyUUID") String firewallPolicyUUID, final NeutronFirewallPolicyRequest input) { - INeutronFirewallPolicyCRUD firewallPolicyInterface = NeutronCRUDInterfaces.getINeutronFirewallPolicyCRUD(this); - if (firewallPolicyInterface == null) { - throw new ServiceUnavailableException("Firewall Policy CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the Firewall Policy exists and there is only one delta provided - */ - if (!firewallPolicyInterface.neutronFirewallPolicyExists(firewallPolicyUUID)) { - throw new ResourceNotFoundException("Firewall Policy UUID does not exist."); - } - if (!input.isSingleton()) { - throw new BadRequestException("Only singleton edit supported"); - } - NeutronFirewallPolicy delta = input.getSingleton(); - NeutronFirewallPolicy original = firewallPolicyInterface.getNeutronFirewallPolicy(firewallPolicyUUID); - - /* - * updates restricted by Neutron - */ - if (delta.getFirewallPolicyUUID() != null || - delta.getFirewallPolicyTenantID() != null || - delta.getFirewallPolicyName() != null || - delta.getFirewallPolicyDescription() != null || - delta.getFirewallPolicyIsShared() != null || - delta.getFirewallPolicyRules().size() > 0 || - delta.getFirewallPolicyIsAudited() != null) { - throw new BadRequestException("Attribute edit blocked by Neutron"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance; - int status = service.canUpdateNeutronFirewallPolicy(delta, original); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * update the object and return it - */ - firewallPolicyInterface.updateNeutronFirewallPolicy(firewallPolicyUUID, delta); - NeutronFirewallPolicy updatedFirewallPolicy = firewallPolicyInterface.getNeutronFirewallPolicy(firewallPolicyUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance; - service.neutronFirewallPolicyUpdated(updatedFirewallPolicy); - } - } - return Response.status(200).entity(new NeutronFirewallPolicyRequest(firewallPolicyInterface.getNeutronFirewallPolicy(firewallPolicyUUID))).build(); - } - - /** - * Deletes a Firewall Policy */ - - @Path("{firewallPolicyUUID}") - @DELETE - @StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response deleteFirewallPolicy( - @PathParam("firewallPolicyUUID") String firewallPolicyUUID) { - INeutronFirewallPolicyCRUD firewallPolicyInterface = NeutronCRUDInterfaces.getINeutronFirewallPolicyCRUD(this); - if (firewallPolicyInterface == null) { - throw new ServiceUnavailableException("Firewall Policy CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the Firewall Policy exists and it isn't currently in use - */ - if (!firewallPolicyInterface.neutronFirewallPolicyExists(firewallPolicyUUID)) { - throw new ResourceNotFoundException("Firewall Policy UUID does not exist."); - } - if (firewallPolicyInterface.neutronFirewallPolicyInUse(firewallPolicyUUID)) { - return Response.status(409).build(); - } - NeutronFirewallPolicy singleton = firewallPolicyInterface.getNeutronFirewallPolicy(firewallPolicyUUID); - Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance; - int status = service.canDeleteNeutronFirewallPolicy(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - firewallPolicyInterface.removeNeutronFirewallPolicy(firewallPolicyUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance; - service.neutronFirewallPolicyDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyRequest.java deleted file mode 100644 index 473846a6d9..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallPolicy; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; - - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronFirewallPolicyRequest { - /** - * See OpenStack Network API v2.0 Reference for description of - * http://docs.openstack.org/api/openstack-network/2.0/content/ - */ - - @XmlElement(name="firewall_policy") - NeutronFirewallPolicy singletonFirewallPolicy; - - @XmlElement(name="firewall_policies") - List bulkRequest; - - NeutronFirewallPolicyRequest() { - } - - NeutronFirewallPolicyRequest(List bulk) { - bulkRequest = bulk; - singletonFirewallPolicy = null; - } - - NeutronFirewallPolicyRequest(NeutronFirewallPolicy group) { - singletonFirewallPolicy = group; - } - - public List getBulk() { - return bulkRequest; - } - - public NeutronFirewallPolicy getSingleton() { - return singletonFirewallPolicy; - } - - public boolean isSingleton() { - return (singletonFirewallPolicy != null); - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRequest.java deleted file mode 100644 index 11a7836b22..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.opendaylight.controller.networkconfig.neutron.NeutronFirewall; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; - - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronFirewallRequest { - /** - * See OpenStack Network API v2.0 Reference for description of - * http://docs.openstack.org/api/openstack-network/2.0/content/ - */ - - @XmlElement(name="firewall") - NeutronFirewall singletonFirewall; - - @XmlElement(name="firewalls") - List bulkRequest; - - NeutronFirewallRequest() { - } - - NeutronFirewallRequest(List bulk) { - bulkRequest = bulk; - singletonFirewall = null; - } - - NeutronFirewallRequest(NeutronFirewall group) { - singletonFirewall = group; - } - - public List getBulk() { - return bulkRequest; - } - - public NeutronFirewall getSingleton() { - return singletonFirewall; - } - - public boolean isSingleton() { - return (singletonFirewall != null); - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRuleRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRuleRequest.java deleted file mode 100644 index 19e67dd234..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRuleRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallRule; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; - - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronFirewallRuleRequest { - /** - * See OpenStack Network API v2.0 Reference for description of - * http://docs.openstack.org/api/openstack-network/2.0/content/ - */ - - @XmlElement(name="firewall_rule") - NeutronFirewallRule singletonFirewallRule; - - @XmlElement(name="firewall_rules") - List bulkRequest; - - NeutronFirewallRuleRequest() { - } - - NeutronFirewallRuleRequest(List bulk) { - bulkRequest = bulk; - singletonFirewallRule = null; - } - - NeutronFirewallRuleRequest(NeutronFirewallRule group) { - singletonFirewallRule = group; - } - - public List getBulk() { - return bulkRequest; - } - - public NeutronFirewallRule getSingleton() { - return singletonFirewallRule; - } - - public boolean isSingleton() { - return (singletonFirewallRule != null); - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRulesNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRulesNorthbound.java deleted file mode 100644 index 40b830da55..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRulesNorthbound.java +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallRule; - -/** - * Neutron Northbound REST APIs for Firewall Rule.
- * This class provides REST APIs for managing neutron Firewall Rule - * - *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - */ - -@Path("fw/firewalls_rules") -public class NeutronFirewallRulesNorthbound { - - private NeutronFirewallRule extractFields(NeutronFirewallRule o, List fields) { - return o.extractFields(fields); - } - - /** - * Returns a list of all Firewall Rules - */ - @GET - @Produces({MediaType.APPLICATION_JSON}) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented")}) - public Response listRules( - // return fields - @QueryParam("fields") List fields, - // OpenStack firewall rule attributes - @QueryParam("id") String queryFirewallRuleUUID, - @QueryParam("tenant_id") String queryFirewallRuleTenantID, - @QueryParam("name") String queryFirewallRuleName, - @QueryParam("description") String queryFirewallRuleDescription, - @QueryParam("admin_state_up") Boolean queryFirewallRuleAdminStateIsUp, - @QueryParam("status") String queryFirewallRuleStatus, - @QueryParam("shared") Boolean queryFirewallRuleIsShared, - @QueryParam("firewall_policy_id") String queryFirewallRulePolicyID, - @QueryParam("protocol") String queryFirewallRuleProtocol, - @QueryParam("ip_version") Integer queryFirewallRuleIpVer, - @QueryParam("source_ip_address") String queryFirewallRuleSrcIpAddr, - @QueryParam("destination_ip_address") String queryFirewallRuleDstIpAddr, - @QueryParam("source_port") Integer queryFirewallRuleSrcPort, - @QueryParam("destination_port") Integer queryFirewallRuleDstPort, - @QueryParam("position") Integer queryFirewallRulePosition, - @QueryParam("action") String queryFirewallRuleAction, - @QueryParam("enabled") Boolean queryFirewallRuleIsEnabled, - // pagination - @QueryParam("limit") String limit, - @QueryParam("marker") String marker, - @QueryParam("page_reverse") String pageReverse - // sorting not supported - ) { - INeutronFirewallRuleCRUD firewallRuleInterface = NeutronCRUDInterfaces.getINeutronFirewallRuleCRUD(this); - if (firewallRuleInterface == null) { - throw new ServiceUnavailableException("Firewall Rule CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allFirewallRules = firewallRuleInterface.getAllNeutronFirewallRules(); - List ans = new ArrayList(); - Iterator i = allFirewallRules.iterator(); - while (i.hasNext()) { - NeutronFirewallRule nsr = i.next(); - if ((queryFirewallRuleUUID == null || - queryFirewallRuleUUID.equals(nsr.getFirewallRuleUUID())) && - (queryFirewallRuleTenantID == null || - queryFirewallRuleTenantID.equals(nsr.getFirewallRuleTenantID())) && - (queryFirewallRuleName == null || - queryFirewallRuleName.equals(nsr.getFirewallRuleName())) && - (queryFirewallRuleDescription == null || - queryFirewallRuleDescription.equals(nsr.getFirewallRuleDescription())) && - (queryFirewallRuleAdminStateIsUp == null || - queryFirewallRuleAdminStateIsUp.equals(nsr.getFirewallRuleAdminStateIsUp())) && - (queryFirewallRuleStatus == null || - queryFirewallRuleStatus.equals(nsr.getFirewallRuleStatus())) && - (queryFirewallRuleIsShared == null || - queryFirewallRuleIsShared.equals(nsr.getFirewallRuleIsShared())) && - (queryFirewallRulePolicyID == null || - queryFirewallRulePolicyID.equals(nsr.getFirewallRulePolicyID())) && - (queryFirewallRuleProtocol == null || - queryFirewallRuleProtocol.equals(nsr.getFirewallRuleProtocol())) && - (queryFirewallRuleIpVer == null || - queryFirewallRuleIpVer.equals(nsr.getFirewallRuleIpVer())) && - (queryFirewallRuleSrcIpAddr == null || - queryFirewallRuleSrcIpAddr.equals(nsr.getFirewallRuleSrcIpAddr())) && - (queryFirewallRuleDstIpAddr == null || - queryFirewallRuleDstIpAddr.equals(nsr.getFirewallRuleDstIpAddr())) && - (queryFirewallRuleSrcPort == null || - queryFirewallRuleSrcPort.equals(nsr.getFirewallRuleSrcPort())) && - (queryFirewallRuleDstPort == null || - queryFirewallRuleDstPort.equals(nsr.getFirewallRuleDstPort())) && - (queryFirewallRulePosition == null || - queryFirewallRulePosition.equals(nsr.getFirewallRulePosition())) && - (queryFirewallRuleAction == null || - queryFirewallRuleAction.equals(nsr.getFirewallRuleAction())) && - (queryFirewallRuleIsEnabled == null || - queryFirewallRuleIsEnabled.equals(nsr.getFirewallRuleIsEnabled()))) { - if (fields.size() > 0) { - ans.add(extractFields(nsr, fields)); - } else { - ans.add(nsr); - } - } - } - //TODO: apply pagination to results - return Response.status(200).entity( - new NeutronFirewallRuleRequest(ans)).build(); - } - - /** - * Returns a specific Firewall Rule - */ - - @Path("{firewallRuleUUID}") - @GET - @Produces({MediaType.APPLICATION_JSON}) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented")}) - public Response showFirewallRule(@PathParam("firewallRuleUUID") String firewallRuleUUID, - // return fields - @QueryParam("fields") List fields) { - INeutronFirewallRuleCRUD firewallRuleInterface = NeutronCRUDInterfaces.getINeutronFirewallRuleCRUD(this); - if (firewallRuleInterface == null) { - throw new ServiceUnavailableException("Firewall Rule CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!firewallRuleInterface.neutronFirewallRuleExists(firewallRuleUUID)) { - throw new ResourceNotFoundException("Firewall Rule UUID does not exist."); - } - if (fields.size() > 0) { - NeutronFirewallRule ans = firewallRuleInterface.getNeutronFirewallRule(firewallRuleUUID); - return Response.status(200).entity( - new NeutronFirewallRuleRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200) - .entity(new NeutronFirewallRuleRequest( - firewallRuleInterface.getNeutronFirewallRule(firewallRuleUUID))) - .build(); - } - } - - /** - * Creates new Firewall Rule - */ - - @POST - @Produces({MediaType.APPLICATION_JSON}) - @Consumes({MediaType.APPLICATION_JSON}) - @StatusCodes({ - @ResponseCode(code = 201, condition = "Created"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented")}) - public Response createFirewallRules(final NeutronFirewallRuleRequest input) { - INeutronFirewallRuleCRUD firewallRuleInterface = NeutronCRUDInterfaces.getINeutronFirewallRuleCRUD(this); - if (firewallRuleInterface == null) { - throw new ServiceUnavailableException("Firewall Rule CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronFirewallPolicyCRUD firewallPolicyInterface = NeutronCRUDInterfaces.getINeutronFirewallPolicyCRUD(this); - if (firewallPolicyInterface == null) { - throw new ServiceUnavailableException("Firewall Policy CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - if (input.isSingleton()) { - NeutronFirewallRule singleton = input.getSingleton(); - if (firewallRuleInterface.neutronFirewallRuleExists(singleton.getFirewallRuleUUID())) { - throw new BadRequestException("Firewall Rule UUID already exists"); - } - firewallRuleInterface.addNeutronFirewallRule(singleton); - Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance; - int status = service.canCreateNeutronFirewallRule(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - // add rule to cache - singleton.initDefaults(); - firewallRuleInterface.addNeutronFirewallRule(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance; - service.neutronFirewallRuleCreated(singleton); - } - } - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this); - while (i.hasNext()) { - NeutronFirewallRule test = i.next(); - - /* - * Verify that the Firewall rule doesn't already exist - */ - - if (firewallRuleInterface.neutronFirewallRuleExists(test.getFirewallRuleUUID())) { - throw new BadRequestException("Firewall Rule UUID already exists"); - } - if (testMap.containsKey(test.getFirewallRuleUUID())) { - throw new BadRequestException("Firewall Rule UUID already exists"); - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance; - int status = service.canCreateNeutronFirewallRule(test); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - } - /* - * now, each element of the bulk request can be added to the cache - */ - i = bulk.iterator(); - while (i.hasNext()) { - NeutronFirewallRule test = i.next(); - firewallRuleInterface.addNeutronFirewallRule(test); - if (instances != null) { - for (Object instance : instances) { - INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance; - service.neutronFirewallRuleCreated(test); - } - } - } - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a Firewall Rule - */ - @Path("{firewallRuleUUID}") - @PUT - @Produces({MediaType.APPLICATION_JSON}) - @Consumes({MediaType.APPLICATION_JSON}) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented")}) - public Response updateFirewallRule( - @PathParam("firewallRuleUUID") String firewallRuleUUID, final NeutronFirewallRuleRequest input) { - INeutronFirewallRuleCRUD firewallRuleInterface = NeutronCRUDInterfaces.getINeutronFirewallRuleCRUD(this); - if (firewallRuleInterface == null) { - throw new ServiceUnavailableException("Firewall Rule CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - /* - * verify the Firewall Rule exists - */ - if (!firewallRuleInterface.neutronFirewallRuleExists(firewallRuleUUID)) { - throw new ResourceNotFoundException("Firewall Rule UUID does not exist."); - } - if (!input.isSingleton()) { - throw new BadRequestException("Only singleton edit supported"); - } - NeutronFirewallRule delta = input.getSingleton(); - NeutronFirewallRule original = firewallRuleInterface.getNeutronFirewallRule(firewallRuleUUID); - - /* - * updates restricted by Neutron - * - */ - if (delta.getFirewallRuleUUID() != null || - delta.getFirewallRuleTenantID() != null || - delta.getFirewallRuleName() != null || - delta.getFirewallRuleDescription() != null || - delta.getFirewallRuleAdminStateIsUp() != null || - delta.getFirewallRuleStatus() != null || - delta.getFirewallRuleIsShared() != null || - delta.getFirewallRulePolicyID() != null || - delta.getFirewallRuleProtocol() != null || - delta.getFirewallRuleIpVer() != null || - delta.getFirewallRuleSrcIpAddr() != null || - delta.getFirewallRuleDstIpAddr() != null || - delta.getFirewallRuleSrcPort() != null || - delta.getFirewallRuleDstPort() != null || - delta.getFirewallRulePosition() != null || - delta.getFirewallRuleAction() != null || - delta.getFirewallRuleIsEnabled() != null) { - throw new BadRequestException("Attribute edit blocked by Neutron"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance; - int status = service.canUpdateNeutronFirewallRule(delta, original); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * update the object and return it - */ - firewallRuleInterface.updateNeutronFirewallRule(firewallRuleUUID, delta); - NeutronFirewallRule updatedFirewallRule = firewallRuleInterface.getNeutronFirewallRule(firewallRuleUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance; - service.neutronFirewallRuleUpdated(updatedFirewallRule); - } - } - return Response.status(200) - .entity(new NeutronFirewallRuleRequest(firewallRuleInterface.getNeutronFirewallRule(firewallRuleUUID))) - .build(); - } - - /** - * Deletes a Firewall Rule - */ - - @Path("{firewallRuleUUID}") - @DELETE - @StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented")}) - public Response deleteFirewallRule( - @PathParam("firewallRuleUUID") String firewallRuleUUID) { - INeutronFirewallRuleCRUD firewallRuleInterface = NeutronCRUDInterfaces.getINeutronFirewallRuleCRUD(this); - if (firewallRuleInterface == null) { - throw new ServiceUnavailableException("Firewall Rule CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the Firewall Rule exists and it isn't currently in use - */ - if (!firewallRuleInterface.neutronFirewallRuleExists(firewallRuleUUID)) { - throw new ResourceNotFoundException("Firewall Rule UUID does not exist."); - } - if (firewallRuleInterface.neutronFirewallRuleInUse(firewallRuleUUID)) { - return Response.status(409).build(); - } - NeutronFirewallRule singleton = firewallRuleInterface.getNeutronFirewallRule(firewallRuleUUID); - Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance; - int status = service.canDeleteNeutronFirewallRule(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * remove it and return 204 status - */ - firewallRuleInterface.removeNeutronFirewallRule(firewallRuleUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance; - service.neutronFirewallRuleDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPRequest.java deleted file mode 100644 index efb86e0542..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPRequest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -public class NeutronFloatingIPRequest { - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement(name="floatingip") - NeutronFloatingIP singletonFloatingIP; - - @XmlElement(name="floatingips") - List bulkRequest; - - NeutronFloatingIPRequest() { - } - - NeutronFloatingIPRequest(List bulk) { - bulkRequest = bulk; - singletonFloatingIP = null; - } - - NeutronFloatingIPRequest(NeutronFloatingIP singleton) { - bulkRequest = null; - singletonFloatingIP = singleton; - } - - public NeutronFloatingIP getSingleton() { - return singletonFloatingIP; - } - - public boolean isSingleton() { - return (singletonFloatingIP != null); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPsNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPsNorthbound.java deleted file mode 100644 index 3e6c2a4feb..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPsNorthbound.java +++ /dev/null @@ -1,443 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP; -import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork; -import org.opendaylight.controller.networkconfig.neutron.NeutronPort; -import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet; -import org.opendaylight.controller.networkconfig.neutron.Neutron_IPs; - -/** - * Neutron Northbound REST APIs.
- * This class provides REST APIs for managing Neutron Floating IPs - * - *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * - */ - -@Path("/floatingips") -public class NeutronFloatingIPsNorthbound { - - private NeutronFloatingIP extractFields(NeutronFloatingIP o, List fields) { - return o.extractFields(fields); - } - - /** - * Returns a list of all FloatingIPs */ - - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response listFloatingIPs( - // return fields - @QueryParam("fields") List fields, - // note: openstack isn't clear about filtering on lists, so we aren't handling them - @QueryParam("id") String queryID, - @QueryParam("floating_network_id") String queryFloatingNetworkId, - @QueryParam("port_id") String queryPortId, - @QueryParam("fixed_ip_address") String queryFixedIPAddress, - @QueryParam("floating_ip_address") String queryFloatingIPAddress, - @QueryParam("tenant_id") String queryTenantID, - // pagination - @QueryParam("limit") String limit, - @QueryParam("marker") String marker, - @QueryParam("page_reverse") String pageReverse - // sorting not supported - ) { - INeutronFloatingIPCRUD floatingIPInterface = NeutronCRUDInterfaces.getINeutronFloatingIPCRUD(this); - if (floatingIPInterface == null) { - throw new ServiceUnavailableException("Floating IP CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allFloatingIPs = floatingIPInterface.getAllFloatingIPs(); - List ans = new ArrayList(); - Iterator i = allFloatingIPs.iterator(); - while (i.hasNext()) { - NeutronFloatingIP oSS = i.next(); - //match filters: TODO provider extension and router extension - if ((queryID == null || queryID.equals(oSS.getID())) && - (queryFloatingNetworkId == null || queryFloatingNetworkId.equals(oSS.getFloatingNetworkUUID())) && - (queryPortId == null || queryPortId.equals(oSS.getPortUUID())) && - (queryFixedIPAddress == null || queryFixedIPAddress.equals(oSS.getFixedIPAddress())) && - (queryFloatingIPAddress == null || queryFloatingIPAddress.equals(oSS.getFloatingIPAddress())) && - (queryTenantID == null || queryTenantID.equals(oSS.getTenantUUID()))) { - if (fields.size() > 0) - ans.add(extractFields(oSS,fields)); - else - ans.add(oSS); - } - } - //TODO: apply pagination to results - return Response.status(200).entity( - new NeutronFloatingIPRequest(ans)).build(); - } - - /** - * Returns a specific FloatingIP */ - - @Path("{floatingipUUID}") - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response showFloatingIP( - @PathParam("floatingipUUID") String floatingipUUID, - // return fields - @QueryParam("fields") List fields ) { - INeutronFloatingIPCRUD floatingIPInterface = NeutronCRUDInterfaces.getINeutronFloatingIPCRUD(this); - if (floatingIPInterface == null) { - throw new ServiceUnavailableException("Floating IP CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!floatingIPInterface.floatingIPExists(floatingipUUID)) - throw new ResourceNotFoundException("Floating IP UUID doesn't exist."); - if (fields.size() > 0) { - NeutronFloatingIP ans = floatingIPInterface.getFloatingIP(floatingipUUID); - return Response.status(200).entity( - new NeutronFloatingIPRequest(extractFields(ans, fields))).build(); - } else - return Response.status(200).entity( - new NeutronFloatingIPRequest(floatingIPInterface.getFloatingIP(floatingipUUID))).build(); - - } - - /** - * Creates new FloatingIPs */ - - @POST - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 201, condition = "Created"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response createFloatingIPs(final NeutronFloatingIPRequest input) { - INeutronFloatingIPCRUD floatingIPInterface = NeutronCRUDInterfaces.getINeutronFloatingIPCRUD(this); - if (floatingIPInterface == null) { - throw new ServiceUnavailableException("Floating IP CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronNetworkCRUD networkInterface = NeutronCRUDInterfaces.getINeutronNetworkCRUD( this); - if (networkInterface == null) { - throw new ServiceUnavailableException("Network CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronSubnetCRUD subnetInterface = NeutronCRUDInterfaces.getINeutronSubnetCRUD( this); - if (subnetInterface == null) { - throw new ServiceUnavailableException("Subnet CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronPortCRUD portInterface = NeutronCRUDInterfaces.getINeutronPortCRUD( this); - if (portInterface == null) { - throw new ServiceUnavailableException("Port CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (input.isSingleton()) { - NeutronFloatingIP singleton = input.getSingleton(); - // check existence of id in cache and return badrequest if exists - if (floatingIPInterface.floatingIPExists(singleton.getID())) - throw new BadRequestException("Floating IP UUID already exists."); - // check if the external network is specified, exists, and is an external network - String externalNetworkUUID = singleton.getFloatingNetworkUUID(); - if (externalNetworkUUID == null) - throw new BadRequestException("external network UUID doesn't exist."); - if (!networkInterface.networkExists(externalNetworkUUID)) - throw new BadRequestException("external network UUID doesn't exist."); - NeutronNetwork externNetwork = networkInterface.getNetwork(externalNetworkUUID); - if (!externNetwork.isRouterExternal()) - throw new BadRequestException("external network isn't marked router:external"); - // if floating IP is specified, make sure it can come from the network - String floatingIP = singleton.getFloatingIPAddress(); - if (floatingIP != null) { - if (externNetwork.getSubnets().size() != 1) - throw new BadRequestException("external network doesn't have a subnet"); - NeutronSubnet externSubnet = subnetInterface.getSubnet(externNetwork.getSubnets().get(0)); - if (!externSubnet.isValidIP(floatingIP)) - throw new BadRequestException("external IP isn't valid for the specified subnet."); - if (externSubnet.isIPInUse(floatingIP)) - throw new ResourceConflictException("floating IP is in use."); - } - // if port_id is specified, then check that the port exists and has at least one IP - String port_id = singleton.getPortUUID(); - if (port_id != null) { - String fixedIP = null; // used for the fixedIP calculation - if (!portInterface.portExists(port_id)) - throw new ResourceNotFoundException("Port UUID doesn't exist."); - NeutronPort port = portInterface.getPort(port_id); - if (port.getFixedIPs().size() < 1) - throw new BadRequestException("port UUID doesn't have an IP address."); - // if there is more than one fixed IP then check for fixed_ip_address - // and that it is in the list of port addresses - if (port.getFixedIPs().size() > 1) { - fixedIP = singleton.getFixedIPAddress(); - if (fixedIP == null) - throw new BadRequestException("fixed IP address doesn't exist."); - Iterator i = port.getFixedIPs().iterator(); - boolean validFixedIP = false; - while (i.hasNext() && !validFixedIP) { - Neutron_IPs ip = i.next(); - if (ip.getIpAddress().equals(fixedIP)) - validFixedIP = true; - } - if (!validFixedIP) - throw new BadRequestException("can't find a valid fixed IP address"); - } else { - fixedIP = port.getFixedIPs().get(0).getIpAddress(); - if (singleton.getFixedIPAddress() != null && !fixedIP.equalsIgnoreCase(singleton.getFixedIPAddress())) - throw new BadRequestException("mismatched fixed IP address in request"); - } - //lastly check that this fixed IP address isn't already used - if (port.isBoundToFloatingIP(fixedIP)) - throw new ResourceConflictException("fixed IP is in use."); - singleton.setFixedIPAddress(fixedIP); - } - Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance; - int status = service.canCreateFloatingIP(singleton); - if (status < 200 || status > 299) - return Response.status(status).build(); - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - floatingIPInterface.addFloatingIP(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance; - service.neutronFloatingIPCreated(singleton); - } - } - } else { - throw new BadRequestException("only singleton requests allowed."); - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a FloatingIP */ - - @Path("{floatingipUUID}") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response updateFloatingIP( - @PathParam("floatingipUUID") String floatingipUUID, - NeutronFloatingIPRequest input - ) { - INeutronFloatingIPCRUD floatingIPInterface = NeutronCRUDInterfaces.getINeutronFloatingIPCRUD(this); - if (floatingIPInterface == null) { - throw new ServiceUnavailableException("Floating IP CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronNetworkCRUD networkInterface = NeutronCRUDInterfaces.getINeutronNetworkCRUD( this); - if (networkInterface == null) { - throw new ServiceUnavailableException("Network CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronSubnetCRUD subnetInterface = NeutronCRUDInterfaces.getINeutronSubnetCRUD( this); - if (subnetInterface == null) { - throw new ServiceUnavailableException("Subnet CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronPortCRUD portInterface = NeutronCRUDInterfaces.getINeutronPortCRUD( this); - if (portInterface == null) { - throw new ServiceUnavailableException("Port CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!floatingIPInterface.floatingIPExists(floatingipUUID)) - throw new ResourceNotFoundException("Floating IP UUID doesn't exist."); - - NeutronFloatingIP sourceFloatingIP = floatingIPInterface.getFloatingIP(floatingipUUID); - if (!input.isSingleton()) - throw new BadRequestException("only singleton requests allowed."); - NeutronFloatingIP singleton = input.getSingleton(); - if (singleton.getID() == null) - throw new BadRequestException("singleton UUID doesn't exist."); - - NeutronNetwork externNetwork = networkInterface.getNetwork( - sourceFloatingIP.getFloatingNetworkUUID()); - - // if floating IP is specified, make sure it can come from the network - String floatingIP = singleton.getFloatingIPAddress(); - if (floatingIP != null) { - if (externNetwork.getSubnets().size() != 1) - throw new BadRequestException("external network doesn't have a subnet."); - NeutronSubnet externSubnet = subnetInterface.getSubnet(externNetwork.getSubnets().get(0)); - if (!externSubnet.isValidIP(floatingIP)) - throw new BadRequestException("floating IP not valid for external subnet"); - if (externSubnet.isIPInUse(floatingIP)) - throw new ResourceConflictException("floating IP is in use."); - } - - // if port_id is specified, then check that the port exists and has at least one IP - String port_id = singleton.getPortUUID(); - if (port_id != null) { - String fixedIP = null; // used for the fixedIP calculation - if (!portInterface.portExists(port_id)) - throw new ResourceNotFoundException("Port UUID doesn't exist."); - NeutronPort port = portInterface.getPort(port_id); - if (port.getFixedIPs().size() < 1) - throw new BadRequestException("port ID doesn't have a fixed IP address."); - // if there is more than one fixed IP then check for fixed_ip_address - // and that it is in the list of port addresses - if (port.getFixedIPs().size() > 1) { - fixedIP = singleton.getFixedIPAddress(); - if (fixedIP == null) - throw new BadRequestException("request doesn't have a fixed IP address"); - Iterator i = port.getFixedIPs().iterator(); - boolean validFixedIP = false; - while (i.hasNext() && !validFixedIP) { - Neutron_IPs ip = i.next(); - if (ip.getIpAddress().equals(fixedIP)) - validFixedIP = true; - } - if (!validFixedIP) - throw new BadRequestException("couldn't find a valid fixed IP address"); - } else { - fixedIP = port.getFixedIPs().get(0).getIpAddress(); - if (singleton.getFixedIPAddress() != null && - !fixedIP.equalsIgnoreCase(singleton.getFixedIPAddress())) - throw new BadRequestException("mismatch in fixed IP addresses"); - } - //lastly check that this fixed IP address isn't already used - if (port.isBoundToFloatingIP(fixedIP)) - throw new ResourceConflictException("fixed IP is in use."); - singleton.setFixedIPAddress(fixedIP); - } - NeutronFloatingIP target = floatingIPInterface.getFloatingIP(floatingipUUID); - Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance; - int status = service.canUpdateFloatingIP(singleton, target); - if (status < 200 || status > 299) - return Response.status(status).build(); - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - floatingIPInterface.updateFloatingIP(floatingipUUID, singleton); - target = floatingIPInterface.getFloatingIP(floatingipUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance; - service.neutronFloatingIPUpdated(target); - } - } - return Response.status(200).entity( - new NeutronFloatingIPRequest(target)).build(); - - } - - /** - * Deletes a FloatingIP */ - - @Path("{floatingipUUID}") - @DELETE - @StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response deleteFloatingIP( - @PathParam("floatingipUUID") String floatingipUUID) { - INeutronFloatingIPCRUD floatingIPInterface = NeutronCRUDInterfaces.getINeutronFloatingIPCRUD(this); - if (floatingIPInterface == null) { - throw new ServiceUnavailableException("Floating IP CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!floatingIPInterface.floatingIPExists(floatingipUUID)) - throw new ResourceNotFoundException("Floating IP UUID doesn't exist."); - // TODO: need to undo port association if it exists - NeutronFloatingIP singleton = floatingIPInterface.getFloatingIP(floatingipUUID); - Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance; - int status = service.canDeleteFloatingIP(singleton); - if (status < 200 || status > 299) - return Response.status(status).build(); - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - floatingIPInterface.removeFloatingIP(floatingipUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance; - service.neutronFloatingIPDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorNorthbound.java deleted file mode 100644 index aa30e948a2..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorNorthbound.java +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerHealthMonitor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Neutron Northbound REST APIs for Load Balancer HealthMonitor.
- * This class provides REST APIs for managing neutron LoadBalancerHealthMonitor - * - *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * - */ -@Path("/healthmonitors") -public class NeutronLoadBalancerHealthMonitorNorthbound { - private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancer.class); - - private NeutronLoadBalancerHealthMonitor extractFields(NeutronLoadBalancerHealthMonitor o, List fields) { - return o.extractFields(fields); - } - - /** - * Returns a list of all LoadBalancerHealthMonitor */ - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - - public Response listGroups( - // return fields - @QueryParam("fields") List fields, - // OpenStack LoadBalancerHealthMonitor attributes - @QueryParam("id") String queryLoadBalancerHealthMonitorID, - @QueryParam("tenant_id") String queryLoadBalancerHealthMonitorTenantID, - // TODO "type" is being a property by the JSON parser. - @QueryParam("type") String queryLoadBalancerHealthMonitorType, - @QueryParam("delay") Integer queryLoadBalancerHealthMonitorDelay, - @QueryParam("timeout") Integer queryLoadBalancerHealthMonitorTimeout, - @QueryParam("max_retries") Integer queryLoadBalancerHealthMonitorMaxRetries, - @QueryParam("http_method") String queryLoadBalancerHealthMonitorHttpMethod, - @QueryParam("url_path") String queryLoadBalancerHealthMonitorUrlPath, - @QueryParam("expected_codes") String queryLoadBalancerHealthMonitorExpectedCodes, - @QueryParam("admin_state_up") Boolean queryLoadBalancerHealthMonitorIsAdminStateUp, - @QueryParam("status") String queryLoadBalancerHealthMonitorStatus, - // pagination - @QueryParam("limit") String limit, - @QueryParam("marker") String marker, - @QueryParam("page_reverse") String pageReverse - // sorting not supported - ) { - INeutronLoadBalancerHealthMonitorCRUD loadBalancerHealthMonitorInterface = NeutronCRUDInterfaces - .getINeutronLoadBalancerHealthMonitorCRUD(this); - if (loadBalancerHealthMonitorInterface == null) { - throw new ServiceUnavailableException("LoadBalancerHealthMonitor CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allLoadBalancerHealthMonitors = loadBalancerHealthMonitorInterface.getAllNeutronLoadBalancerHealthMonitors(); - List ans = new ArrayList(); - Iterator i = allLoadBalancerHealthMonitors.iterator(); - while (i.hasNext()) { - NeutronLoadBalancerHealthMonitor nsg = i.next(); - if ((queryLoadBalancerHealthMonitorID == null || - queryLoadBalancerHealthMonitorID.equals(nsg.getLoadBalancerHealthMonitorID())) && - (queryLoadBalancerHealthMonitorTenantID == null || - queryLoadBalancerHealthMonitorTenantID.equals - (nsg.getLoadBalancerHealthMonitorTenantID())) && - (queryLoadBalancerHealthMonitorType == null || - queryLoadBalancerHealthMonitorType.equals - (nsg.getLoadBalancerHealthMonitorType())) && - (queryLoadBalancerHealthMonitorDelay == null || - queryLoadBalancerHealthMonitorDelay.equals - (nsg.getLoadBalancerHealthMonitorDelay())) && - (queryLoadBalancerHealthMonitorTimeout == null || - queryLoadBalancerHealthMonitorTimeout.equals - (nsg.getLoadBalancerHealthMonitorTimeout())) && - (queryLoadBalancerHealthMonitorMaxRetries == null || - queryLoadBalancerHealthMonitorMaxRetries.equals - (nsg.getLoadBalancerHealthMonitorMaxRetries())) && - (queryLoadBalancerHealthMonitorHttpMethod == null || - queryLoadBalancerHealthMonitorHttpMethod.equals - (nsg.getLoadBalancerHealthMonitorHttpMethod())) && - (queryLoadBalancerHealthMonitorUrlPath == null || - queryLoadBalancerHealthMonitorUrlPath.equals - (nsg.getLoadBalancerHealthMonitorUrlPath())) && - (queryLoadBalancerHealthMonitorExpectedCodes == null || - queryLoadBalancerHealthMonitorExpectedCodes.equals - (nsg.getLoadBalancerHealthMonitorExpectedCodes())) && - (queryLoadBalancerHealthMonitorIsAdminStateUp == null || - queryLoadBalancerHealthMonitorIsAdminStateUp.equals - (nsg.getLoadBalancerHealthMonitorAdminStateIsUp())) && - (queryLoadBalancerHealthMonitorStatus == null || - queryLoadBalancerHealthMonitorStatus.equals - (nsg.getLoadBalancerHealthMonitorStatus()))) { - if (fields.size() > 0) { - ans.add(extractFields(nsg,fields)); - } else { - ans.add(nsg); - } - } - } - return Response.status(200).entity( - new NeutronLoadBalancerHealthMonitorRequest(ans)).build(); - } - - /** - * Returns a specific LoadBalancerHealthMonitor */ - - @Path("{loadBalancerHealthMonitorID}") - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response showLoadBalancerHealthMonitor(@PathParam("loadBalancerHealthMonitorID") String loadBalancerHealthMonitorID, - // return fields - @QueryParam("fields") List fields) { - INeutronLoadBalancerHealthMonitorCRUD loadBalancerHealthMonitorInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerHealthMonitorCRUD(this); - if (loadBalancerHealthMonitorInterface == null) { - throw new ServiceUnavailableException("LoadBalancerHealthMonitor CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!loadBalancerHealthMonitorInterface.neutronLoadBalancerHealthMonitorExists(loadBalancerHealthMonitorID)) { - throw new ResourceNotFoundException("LoadBalancerHealthMonitor UUID does not exist."); - } - if (fields.size() > 0) { - NeutronLoadBalancerHealthMonitor ans = loadBalancerHealthMonitorInterface.getNeutronLoadBalancerHealthMonitor(loadBalancerHealthMonitorID); - return Response.status(200).entity( - new NeutronLoadBalancerHealthMonitorRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200).entity(new NeutronLoadBalancerHealthMonitorRequest(loadBalancerHealthMonitorInterface.getNeutronLoadBalancerHealthMonitor(loadBalancerHealthMonitorID))).build(); - } - } - - /** - * Creates new LoadBalancerHealthMonitor */ - - @POST - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 201, condition = "Created"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response createLoadBalancerHealthMonitors(final NeutronLoadBalancerHealthMonitorRequest input) { - INeutronLoadBalancerHealthMonitorCRUD loadBalancerHealthMonitorInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerHealthMonitorCRUD(this); - if (loadBalancerHealthMonitorInterface == null) { - throw new ServiceUnavailableException("LoadBalancerHealthMonitor CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (input.isSingleton()) { - NeutronLoadBalancerHealthMonitor singleton = input.getSingleton(); - - /* - * Verify that the LoadBalancerHealthMonitor doesn't already exist. - */ - if (loadBalancerHealthMonitorInterface.neutronLoadBalancerHealthMonitorExists(singleton.getLoadBalancerHealthMonitorID())) { - throw new BadRequestException("LoadBalancerHealthMonitor UUID already exists"); - } - loadBalancerHealthMonitorInterface.addNeutronLoadBalancerHealthMonitor(singleton); - - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance; - int status = service.canCreateNeutronLoadBalancerHealthMonitor(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - loadBalancerHealthMonitorInterface.addNeutronLoadBalancerHealthMonitor(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance; - service.neutronLoadBalancerHealthMonitorCreated(singleton); - } - } - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this); - while (i.hasNext()) { - NeutronLoadBalancerHealthMonitor test = i.next(); - - /* - * Verify that the firewall policy doesn't already exist - */ - - if (loadBalancerHealthMonitorInterface - .neutronLoadBalancerHealthMonitorExists(test.getLoadBalancerHealthMonitorID())) { - throw new BadRequestException("LoadBalancerHealthMonitor UUID already is already created"); - } - if (testMap.containsKey(test.getLoadBalancerHealthMonitorID())) { - throw new BadRequestException("LoadBalancerHealthMonitor UUID already exists"); - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance; - int status = service.canCreateNeutronLoadBalancerHealthMonitor(test); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - } - /* - * now, each element of the bulk request can be added to the cache - */ - i = bulk.iterator(); - while (i.hasNext()) { - NeutronLoadBalancerHealthMonitor test = i.next(); - loadBalancerHealthMonitorInterface.addNeutronLoadBalancerHealthMonitor(test); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance; - service.neutronLoadBalancerHealthMonitorCreated(test); - } - } - } - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a LoadBalancerHealthMonitor Policy - */ - @Path("{loadBalancerHealthMonitorID}") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response updateLoadBalancerHealthMonitor( - @PathParam("loadBalancerHealthMonitorID") String loadBalancerHealthMonitorID, - final NeutronLoadBalancerHealthMonitorRequest input) { - INeutronLoadBalancerHealthMonitorCRUD loadBalancerHealthMonitorInterface = NeutronCRUDInterfaces - .getINeutronLoadBalancerHealthMonitorCRUD(this); - if (loadBalancerHealthMonitorInterface == null) { - throw new ServiceUnavailableException("LoadBalancerHealthMonitor CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the LoadBalancerHealthMonitor exists and there is only one delta provided - */ - if (!loadBalancerHealthMonitorInterface.neutronLoadBalancerHealthMonitorExists(loadBalancerHealthMonitorID)) { - throw new ResourceNotFoundException("LoadBalancerHealthMonitor UUID does not exist."); - } - if (!input.isSingleton()) { - throw new BadRequestException("Only singleton edit supported"); - } - NeutronLoadBalancerHealthMonitor delta = input.getSingleton(); - NeutronLoadBalancerHealthMonitor original = loadBalancerHealthMonitorInterface - .getNeutronLoadBalancerHealthMonitor(loadBalancerHealthMonitorID); - - /* - * updates restricted by Neutron - */ - if (delta.getLoadBalancerHealthMonitorID() != null || - delta.getLoadBalancerHealthMonitorTenantID() != null || - delta.getLoadBalancerHealthMonitorType() != null || - delta.getLoadBalancerHealthMonitorDelay() != null || - delta.getLoadBalancerHealthMonitorTimeout() != null || - delta.getLoadBalancerHealthMonitorMaxRetries() != null || - delta.getLoadBalancerHealthMonitorHttpMethod() != null || - delta.getLoadBalancerHealthMonitorUrlPath() != null || - delta.getLoadBalancerHealthMonitorExpectedCodes() != null || - delta.getLoadBalancerHealthMonitorAdminStateIsUp() != null || - delta.getLoadBalancerHealthMonitorStatus() != null) { - throw new BadRequestException("Attribute edit blocked by Neutron"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance; - int status = service.canUpdateNeutronLoadBalancerHealthMonitor(delta, original); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * update the object and return it - */ - loadBalancerHealthMonitorInterface.updateNeutronLoadBalancerHealthMonitor(loadBalancerHealthMonitorID, delta); - NeutronLoadBalancerHealthMonitor updatedLoadBalancerHealthMonitor = loadBalancerHealthMonitorInterface - .getNeutronLoadBalancerHealthMonitor(loadBalancerHealthMonitorID); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance; - service.neutronLoadBalancerHealthMonitorUpdated(updatedLoadBalancerHealthMonitor); - } - } - return Response.status(200).entity(new NeutronLoadBalancerHealthMonitorRequest - (loadBalancerHealthMonitorInterface.getNeutronLoadBalancerHealthMonitor - (loadBalancerHealthMonitorID))).build(); - } - - - - /** - * Deletes a LoadBalancerHealthMonitor - * */ - @Path("{loadBalancerHealthMonitorID}") - @DELETE - @StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response deleteLoadBalancerHealthMonitor( - @PathParam("loadBalancerHealthMonitorID") String loadBalancerHealthMonitorID) { - INeutronLoadBalancerHealthMonitorCRUD loadBalancerHealthMonitorInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerHealthMonitorCRUD(this); - if (loadBalancerHealthMonitorInterface == null) { - throw new ServiceUnavailableException("LoadBalancerHealthMonitor CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - /* - * verify the LoadBalancerHealthMonitor exists and it isn't currently in use - */ - if (!loadBalancerHealthMonitorInterface.neutronLoadBalancerHealthMonitorExists(loadBalancerHealthMonitorID)) { - throw new ResourceNotFoundException("LoadBalancerHealthMonitor UUID does not exist."); - } - if (loadBalancerHealthMonitorInterface.neutronLoadBalancerHealthMonitorInUse(loadBalancerHealthMonitorID)) { - return Response.status(409).build(); - } - NeutronLoadBalancerHealthMonitor singleton = loadBalancerHealthMonitorInterface.getNeutronLoadBalancerHealthMonitor(loadBalancerHealthMonitorID); - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance; - int status = service.canDeleteNeutronLoadBalancerHealthMonitor(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - loadBalancerHealthMonitorInterface.removeNeutronLoadBalancerHealthMonitor(loadBalancerHealthMonitorID); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance; - service.neutronLoadBalancerHealthMonitorDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorRequest.java deleted file mode 100644 index dc4af2f31f..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerHealthMonitor; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; - - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronLoadBalancerHealthMonitorRequest { - /** - * See OpenStack Network API v2.0 Reference for description of - * http://docs.openstack.org/api/openstack-network/2.0/content/ - */ - - @XmlElement(name="healthmonitor") - NeutronLoadBalancerHealthMonitor singletonLoadBalancerHealthMonitor; - - @XmlElement(name="healthmonitors") - List bulkRequest; - - NeutronLoadBalancerHealthMonitorRequest() { - } - - NeutronLoadBalancerHealthMonitorRequest(List bulk) { - bulkRequest = bulk; - singletonLoadBalancerHealthMonitor = null; - } - - NeutronLoadBalancerHealthMonitorRequest(NeutronLoadBalancerHealthMonitor group) { - singletonLoadBalancerHealthMonitor = group; - } - - public List getBulk() { - return bulkRequest; - } - - public NeutronLoadBalancerHealthMonitor getSingleton() { - return singletonLoadBalancerHealthMonitor; - } - - public boolean isSingleton() { - return (singletonLoadBalancerHealthMonitor != null); - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerNorthbound.java deleted file mode 100644 index 5d877c59f4..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerNorthbound.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerListener; - -/** - * Neutron Northbound REST APIs for LoadBalancerListener Policies.
- * This class provides REST APIs for managing neutron LoadBalancerListener Policies - * - *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * - */ -@Path("/listeners") -public class NeutronLoadBalancerListenerNorthbound { - - private NeutronLoadBalancerListener extractFields(NeutronLoadBalancerListener o, List fields) { - return o.extractFields(fields); - } - - /** - * Returns a list of all LoadBalancerListener */ - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - - public Response listGroups( - // return fields - @QueryParam("fields") List fields, - // OpenStack LoadBalancerListener attributes - @QueryParam("id") String queryLoadBalancerListenerID, - @QueryParam("default_pool_id") String queryLoadBalancerListenerDefaultPoolID, - @QueryParam("tenant_id") String queryLoadBalancerListenerTenantID, - @QueryParam("name") String queryLoadBalancerListenerName, - @QueryParam("description") String queryLoadBalancerListenerDescription, - @QueryParam("shared") String queryLoadBalancerListenerIsShared, - @QueryParam("protocol") String queryLoadBalancerListenerProtocol, - @QueryParam("protocol_port") String queryLoadBalancerListenerProtocolPort, - @QueryParam("load_balancer_id") String queryLoadBalancerListenerLoadBalancerID, - @QueryParam("admin_state_up") String queryLoadBalancerListenerAdminIsUp, - @QueryParam("status") String queryLoadBalancerListenerStatus, - // pagination - @QueryParam("limit") String limit, - @QueryParam("marker") String marker, - @QueryParam("page_reverse") String pageReverse - // sorting not supported - ) { - INeutronLoadBalancerListenerCRUD loadBalancerListenerInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerListenerCRUD(this); - // INeutronLoadBalancerListenerRuleCRUD firewallRuleInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerListenerRuleCRUD(this); - - if (loadBalancerListenerInterface == null) { - throw new ServiceUnavailableException("LoadBalancerListener CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allLoadBalancerListeners = loadBalancerListenerInterface.getAllNeutronLoadBalancerListeners(); - // List allLoadBalancerListenerRules = firewallRuleInterface.getAllNeutronLoadBalancerListenerRules(); - List ans = new ArrayList(); - // List rules = new ArrayList(); - Iterator i = allLoadBalancerListeners.iterator(); - while (i.hasNext()) { - NeutronLoadBalancerListener nsg = i.next(); - if ((queryLoadBalancerListenerID == null || - queryLoadBalancerListenerID.equals(nsg.getLoadBalancerListenerID())) && - (queryLoadBalancerListenerDefaultPoolID == null || - queryLoadBalancerListenerDefaultPoolID.equals(nsg.getNeutronLoadBalancerListenerDefaultPoolID())) && - (queryLoadBalancerListenerTenantID == null || - queryLoadBalancerListenerTenantID.equals(nsg.getLoadBalancerListenerTenantID())) && - (queryLoadBalancerListenerName == null || - queryLoadBalancerListenerName.equals(nsg.getLoadBalancerListenerName())) && - (queryLoadBalancerListenerDescription == null || - queryLoadBalancerListenerDescription.equals(nsg.getLoadBalancerListenerDescription())) && - (queryLoadBalancerListenerIsShared == null || - queryLoadBalancerListenerIsShared.equals(nsg.getLoadBalancerListenerIsShared())) && - (queryLoadBalancerListenerProtocol == null || - queryLoadBalancerListenerProtocol.equals(nsg.getNeutronLoadBalancerListenerProtocol())) && - (queryLoadBalancerListenerProtocolPort == null || - queryLoadBalancerListenerProtocolPort.equals(nsg.getNeutronLoadBalancerListenerProtocolPort())) && - (queryLoadBalancerListenerLoadBalancerID == null || - queryLoadBalancerListenerLoadBalancerID.equals(nsg.getNeutronLoadBalancerListenerLoadBalancerID())) && - (queryLoadBalancerListenerAdminIsUp == null || - queryLoadBalancerListenerAdminIsUp.equals(nsg.getLoadBalancerListenerAdminStateIsUp())) && - (queryLoadBalancerListenerStatus == null || - queryLoadBalancerListenerStatus.equals(nsg.getLoadBalancerListenerStatus()))) { - if (fields.size() > 0) { - ans.add(extractFields(nsg,fields)); - } else { - ans.add(nsg); - } - } - } - return Response.status(200).entity( - new NeutronLoadBalancerListenerRequest(ans)).build(); - } - - /** - * Returns a specific LoadBalancerListener */ - - @Path("{loadBalancerListenerID}") - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response showLoadBalancerListener(@PathParam("loadBalancerListenerID") String loadBalancerListenerID, - // return fields - @QueryParam("fields") List fields) { - INeutronLoadBalancerListenerCRUD loadBalancerListenerInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerListenerCRUD(this); - if (loadBalancerListenerInterface == null) { - throw new ServiceUnavailableException("LoadBalancerListener CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!loadBalancerListenerInterface.neutronLoadBalancerListenerExists(loadBalancerListenerID)) { - throw new ResourceNotFoundException("LoadBalancerListener UUID does not exist."); - } - if (fields.size() > 0) { - NeutronLoadBalancerListener ans = loadBalancerListenerInterface.getNeutronLoadBalancerListener(loadBalancerListenerID); - return Response.status(200).entity( - new NeutronLoadBalancerListenerRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200).entity(new NeutronLoadBalancerListenerRequest(loadBalancerListenerInterface.getNeutronLoadBalancerListener(loadBalancerListenerID))).build(); - } - } - - /** - * Creates new LoadBalancerListener */ - - @POST - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 201, condition = "Created"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response createLoadBalancerListeners(final NeutronLoadBalancerListenerRequest input) { - INeutronLoadBalancerListenerCRUD loadBalancerListenerInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerListenerCRUD(this); - if (loadBalancerListenerInterface == null) { - throw new ServiceUnavailableException("LoadBalancerListener CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (input.isSingleton()) { - NeutronLoadBalancerListener singleton = input.getSingleton(); - - /* - * Verify that the LoadBalancerListener doesn't already exist. - */ - if (loadBalancerListenerInterface.neutronLoadBalancerListenerExists(singleton.getLoadBalancerListenerID())) { - throw new BadRequestException("LoadBalancerListener UUID already exists"); - } - loadBalancerListenerInterface.addNeutronLoadBalancerListener(singleton); - - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance; - int status = service.canCreateNeutronLoadBalancerListener(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - loadBalancerListenerInterface.addNeutronLoadBalancerListener(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance; - service.neutronLoadBalancerListenerCreated(singleton); - } - } - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this); - while (i.hasNext()) { - NeutronLoadBalancerListener test = i.next(); - - /* - * Verify that the firewall policy doesn't already exist - */ - - if (loadBalancerListenerInterface.neutronLoadBalancerListenerExists(test.getLoadBalancerListenerID())) { - throw new BadRequestException("LoadBalancerListener UUID already is already created"); - } - if (testMap.containsKey(test.getLoadBalancerListenerID())) { - throw new BadRequestException("LoadBalancerListener UUID already exists"); - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance; - int status = service.canCreateNeutronLoadBalancerListener(test); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - } - /* - * now, each element of the bulk request can be added to the cache - */ - i = bulk.iterator(); - while (i.hasNext()) { - NeutronLoadBalancerListener test = i.next(); - loadBalancerListenerInterface.addNeutronLoadBalancerListener(test); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance; - service.neutronLoadBalancerListenerCreated(test); - } - } - } - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a LoadBalancerListener Policy - */ - @Path("{loadBalancerListenerID}") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response updateLoadBalancerListener( - @PathParam("loadBalancerListenerID") String loadBalancerListenerID, final NeutronLoadBalancerListenerRequest input) { - INeutronLoadBalancerListenerCRUD loadBalancerListenerInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerListenerCRUD(this); - if (loadBalancerListenerInterface == null) { - throw new ServiceUnavailableException("LoadBalancerListener CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the LoadBalancerListener exists and there is only one delta provided - */ - if (!loadBalancerListenerInterface.neutronLoadBalancerListenerExists(loadBalancerListenerID)) { - throw new ResourceNotFoundException("LoadBalancerListener UUID does not exist."); - } - if (!input.isSingleton()) { - throw new BadRequestException("Only singleton edit supported"); - } - NeutronLoadBalancerListener delta = input.getSingleton(); - NeutronLoadBalancerListener original = loadBalancerListenerInterface.getNeutronLoadBalancerListener(loadBalancerListenerID); - - /* - * updates restricted by Neutron - */ - if (delta.getLoadBalancerListenerID() != null || - delta.getNeutronLoadBalancerListenerDefaultPoolID() != null || - delta.getLoadBalancerListenerTenantID() != null || - delta.getLoadBalancerListenerName() != null || - delta.getLoadBalancerListenerDescription() != null || - delta.getLoadBalancerListenerIsShared() != null || - delta.getNeutronLoadBalancerListenerProtocol() != null || - delta.getNeutronLoadBalancerListenerProtocolPort() != null || - delta.getNeutronLoadBalancerListenerLoadBalancerID() != null || - delta.getLoadBalancerListenerAdminStateIsUp() != null || - delta.getLoadBalancerListenerStatus() != null) { - throw new BadRequestException("Attribute edit blocked by Neutron"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance; - int status = service.canUpdateNeutronLoadBalancerListener(delta, original); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * update the object and return it - */ - loadBalancerListenerInterface.updateNeutronLoadBalancerListener(loadBalancerListenerID, delta); - NeutronLoadBalancerListener updatedLoadBalancerListener = loadBalancerListenerInterface.getNeutronLoadBalancerListener(loadBalancerListenerID); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance; - service.neutronLoadBalancerListenerUpdated(updatedLoadBalancerListener); - } - } - return Response.status(200).entity(new NeutronLoadBalancerListenerRequest(loadBalancerListenerInterface.getNeutronLoadBalancerListener(loadBalancerListenerID))).build(); - } - - /** - * Deletes a LoadBalancerListener */ - - @Path("{loadBalancerListenerID}") - @DELETE - @StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response deleteLoadBalancerListener( - @PathParam("loadBalancerListenerID") String loadBalancerListenerID) { - INeutronLoadBalancerListenerCRUD loadBalancerListenerInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerListenerCRUD(this); - if (loadBalancerListenerInterface == null) { - throw new ServiceUnavailableException("LoadBalancerListener CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the LoadBalancerListener exists and it isn't currently in use - */ - if (!loadBalancerListenerInterface.neutronLoadBalancerListenerExists(loadBalancerListenerID)) { - throw new ResourceNotFoundException("LoadBalancerListener UUID does not exist."); - } - if (loadBalancerListenerInterface.neutronLoadBalancerListenerInUse(loadBalancerListenerID)) { - return Response.status(409).build(); - } - NeutronLoadBalancerListener singleton = loadBalancerListenerInterface.getNeutronLoadBalancerListener(loadBalancerListenerID); - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance; - int status = service.canDeleteNeutronLoadBalancerListener(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - loadBalancerListenerInterface.removeNeutronLoadBalancerListener(loadBalancerListenerID); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance; - service.neutronLoadBalancerListenerDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerRequest.java deleted file mode 100644 index ba375af926..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerListener; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; - - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronLoadBalancerListenerRequest { - /** - * See OpenStack Network API v2.0 Reference for description of - * http://docs.openstack.org/api/openstack-network/2.0/content/ - */ - - @XmlElement(name="listener") - NeutronLoadBalancerListener singletonLoadBalancerListener; - - @XmlElement(name="listeners") - List bulkRequest; - - NeutronLoadBalancerListenerRequest() { - } - - NeutronLoadBalancerListenerRequest(List bulk) { - bulkRequest = bulk; - singletonLoadBalancerListener = null; - } - - NeutronLoadBalancerListenerRequest(NeutronLoadBalancerListener group) { - singletonLoadBalancerListener = group; - } - - public List getBulk() { - return bulkRequest; - } - - public NeutronLoadBalancerListener getSingleton() { - return singletonLoadBalancerListener; - } - - public boolean isSingleton() { - return (singletonLoadBalancerListener != null); - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerNorthbound.java deleted file mode 100644 index 67557ce41f..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerNorthbound.java +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer; - -/** - * Neutron Northbound REST APIs for LoadBalancers.
- * This class provides REST APIs for managing neutron LoadBalancers - * - *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * - */ -@Path("/loadbalancers") -public class NeutronLoadBalancerNorthbound { - - private NeutronLoadBalancer extractFields(NeutronLoadBalancer o, List fields) { - return o.extractFields(fields); - } - - /** - * Returns a list of all LoadBalancer */ - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - - public Response listGroups( - // return fields - @QueryParam("fields") List fields, - // OpenStack LoadBalancer attributes - @QueryParam("id") String queryLoadBalancerID, - @QueryParam("tenant_id") String queryLoadBalancerTenantID, - @QueryParam("name") String queryLoadBalancerName, - @QueryParam("description") String queryLoadBalancerDescription, - @QueryParam("status") String queryLoadBalancerStatus, - @QueryParam("vip_address") String queryLoadBalancerVipAddress, - @QueryParam("vip_subnet") String queryLoadBalancerVipSubnet, - // pagination - @QueryParam("limit") String limit, - @QueryParam("marker") String marker, - @QueryParam("page_reverse") String pageReverse - // sorting not supported - ) { - INeutronLoadBalancerCRUD loadBalancerInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerCRUD(this); - - if (loadBalancerInterface == null) { - throw new ServiceUnavailableException("LoadBalancer CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allLoadBalancers = loadBalancerInterface.getAllNeutronLoadBalancers(); - // List allLoadBalancerRules = firewallRuleInterface.getAllNeutronLoadBalancerRules(); - List ans = new ArrayList(); - // List rules = new ArrayList(); - Iterator i = allLoadBalancers.iterator(); - while (i.hasNext()) { - NeutronLoadBalancer nsg = i.next(); - if ((queryLoadBalancerID == null || - queryLoadBalancerID.equals(nsg.getLoadBalancerID())) && - (queryLoadBalancerTenantID == null || - queryLoadBalancerTenantID.equals(nsg.getLoadBalancerTenantID())) && - (queryLoadBalancerName == null || - queryLoadBalancerName.equals(nsg.getLoadBalancerName())) && - (queryLoadBalancerDescription == null || - queryLoadBalancerDescription.equals(nsg.getLoadBalancerDescription())) && - (queryLoadBalancerVipAddress == null || - queryLoadBalancerVipAddress.equals(nsg.getLoadBalancerVipAddress())) && - (queryLoadBalancerVipSubnet == null || - queryLoadBalancerVipSubnet.equals(nsg.getLoadBalancerVipSubnetID()))) { - if (fields.size() > 0) { - ans.add(extractFields(nsg,fields)); - } else { - ans.add(nsg); - } - } - } - return Response.status(200).entity( - new NeutronLoadBalancerRequest(ans)).build(); - } - - /** - * Returns a specific LoadBalancer */ - - @Path("{loadBalancerID}") - @GET - @Produces({ MediaType.APPLICATION_JSON }) - - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response showLoadBalancer(@PathParam("loadBalancerID") String loadBalancerID, - // return fields - @QueryParam("fields") List fields) { - INeutronLoadBalancerCRUD loadBalancerInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerCRUD( - this); - if (loadBalancerInterface == null) { - throw new ServiceUnavailableException("LoadBalancer CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!loadBalancerInterface.neutronLoadBalancerExists(loadBalancerID)) { - throw new ResourceNotFoundException("LoadBalancer UUID does not exist."); - } - if (fields.size() > 0) { - NeutronLoadBalancer ans = loadBalancerInterface.getNeutronLoadBalancer(loadBalancerID); - return Response.status(200).entity( - new NeutronLoadBalancerRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200).entity(new NeutronLoadBalancerRequest(loadBalancerInterface.getNeutronLoadBalancer( - loadBalancerID))).build(); - } - } - - /** - * Creates new LoadBalancer */ - - @POST - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - - @StatusCodes({ - @ResponseCode(code = 201, condition = "Created"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response createLoadBalancers(final NeutronLoadBalancerRequest input) { - INeutronLoadBalancerCRUD loadBalancerInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerCRUD( - this); - if (loadBalancerInterface == null) { - throw new ServiceUnavailableException("LoadBalancer CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (input.isSingleton()) { - NeutronLoadBalancer singleton = input.getSingleton(); - - /* - * Verify that the LoadBalancer doesn't already exist. - */ - if (loadBalancerInterface.neutronLoadBalancerExists(singleton.getLoadBalancerID())) { - throw new BadRequestException("LoadBalancer UUID already exists"); - } - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance; - int status = service.canCreateNeutronLoadBalancer(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - loadBalancerInterface.addNeutronLoadBalancer(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance; - service.neutronLoadBalancerCreated(singleton); - } - } - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this); - while (i.hasNext()) { - NeutronLoadBalancer test = i.next(); - - /* - * Verify that the loadbalancer doesn't already exist - */ - - if (loadBalancerInterface.neutronLoadBalancerExists(test.getLoadBalancerID())) { - throw new BadRequestException("Load Balancer Pool UUID already is already created"); - } - if (testMap.containsKey(test.getLoadBalancerID())) { - throw new BadRequestException("Load Balancer Pool UUID already exists"); - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance; - int status = service.canCreateNeutronLoadBalancer(test); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - } - /* - * now, each element of the bulk request can be added to the cache - */ - i = bulk.iterator(); - while (i.hasNext()) { - NeutronLoadBalancer test = i.next(); - loadBalancerInterface.addNeutronLoadBalancer(test); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance; - service.neutronLoadBalancerCreated(test); - } - } - } - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a LoadBalancer Policy - */ - @Path("{loadBalancerID}") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response updateLoadBalancer( - @PathParam("loadBalancerID") String loadBalancerID, final NeutronLoadBalancerRequest input) { - INeutronLoadBalancerCRUD loadBalancerInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerCRUD( - this); - if (loadBalancerInterface == null) { - throw new ServiceUnavailableException("LoadBalancer CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the LoadBalancer exists and there is only one delta provided - */ - if (!loadBalancerInterface.neutronLoadBalancerExists(loadBalancerID)) { - throw new ResourceNotFoundException("LoadBalancer UUID does not exist."); - } - if (!input.isSingleton()) { - throw new BadRequestException("Only singleton edit supported"); - } - NeutronLoadBalancer delta = input.getSingleton(); - NeutronLoadBalancer original = loadBalancerInterface.getNeutronLoadBalancer(loadBalancerID); - - /* - * updates restricted by Neutron - */ - if (delta.getLoadBalancerID() != null || - delta.getLoadBalancerTenantID() != null || - delta.getLoadBalancerName() != null || - delta.getLoadBalancerDescription() != null || - delta.getLoadBalancerStatus() != null || - delta.getLoadBalancerVipAddress() != null || - delta.getLoadBalancerVipSubnetID() != null) { - throw new BadRequestException("Attribute edit blocked by Neutron"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance; - int status = service.canUpdateNeutronLoadBalancer(delta, original); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * update the object and return it - */ - loadBalancerInterface.updateNeutronLoadBalancer(loadBalancerID, delta); - NeutronLoadBalancer updatedLoadBalancer = loadBalancerInterface.getNeutronLoadBalancer( - loadBalancerID); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance; - service.neutronLoadBalancerUpdated(updatedLoadBalancer); - } - } - return Response.status(200).entity(new NeutronLoadBalancerRequest(loadBalancerInterface.getNeutronLoadBalancer( - loadBalancerID))).build(); - } - - /** - * Deletes a LoadBalancer */ - - @Path("{loadBalancerID}") - @DELETE - @StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response deleteLoadBalancer( - @PathParam("loadBalancerID") String loadBalancerID) { - INeutronLoadBalancerCRUD loadBalancerInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerCRUD( - this); - if (loadBalancerInterface == null) { - throw new ServiceUnavailableException("LoadBalancer CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the LoadBalancer exists and it isn't currently in use - */ - if (!loadBalancerInterface.neutronLoadBalancerExists(loadBalancerID)) { - throw new ResourceNotFoundException("LoadBalancer UUID does not exist."); - } - if (loadBalancerInterface.neutronLoadBalancerInUse(loadBalancerID)) { - return Response.status(409).build(); - } - NeutronLoadBalancer singleton = loadBalancerInterface.getNeutronLoadBalancer(loadBalancerID); - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance; - int status = service.canDeleteNeutronLoadBalancer(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - - loadBalancerInterface.removeNeutronLoadBalancer(loadBalancerID); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance; - service.neutronLoadBalancerDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMemberRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMemberRequest.java deleted file mode 100644 index 9b949da72e..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMemberRequest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember; - -import javax.xml.bind.annotation.XmlElement; -import java.util.List; - -public class NeutronLoadBalancerPoolMemberRequest { - - /** - * See OpenStack Network API v2.0 Reference for description of - * http://docs.openstack.org/api/openstack-network/2.0/content/ - */ - - @XmlElement(name="member") - NeutronLoadBalancerPoolMember singletonLoadBalancerPoolMember; - - @XmlElement(name="members") - List bulkRequest; - - NeutronLoadBalancerPoolMemberRequest() { - } - - NeutronLoadBalancerPoolMemberRequest(List bulk) { - bulkRequest = bulk; - singletonLoadBalancerPoolMember = null; - } - - NeutronLoadBalancerPoolMemberRequest(NeutronLoadBalancerPoolMember group) { - singletonLoadBalancerPoolMember = group; - } - - public List getBulk() { - return bulkRequest; - } - - public NeutronLoadBalancerPoolMember getSingleton() { - return singletonLoadBalancerPoolMember; - } - - public boolean isSingleton() { - return (singletonLoadBalancerPoolMember != null); - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMembersNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMembersNorthbound.java deleted file mode 100644 index 22d118ae79..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMembersNorthbound.java +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (C) 2014 SDN Hub, LLC. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Authors : Srini Seetharaman - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolMemberAware; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember; - -@Path("/pools/{loadBalancerPoolUUID}/members") -public class NeutronLoadBalancerPoolMembersNorthbound { - private NeutronLoadBalancerPoolMember extractFields(NeutronLoadBalancerPoolMember o, List fields) { - return o.extractFields(fields); - } -/** - * Returns a list of all LoadBalancerPoolMembers in specified pool - */ -@GET -@Produces({MediaType.APPLICATION_JSON}) -@StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented")}) - -public Response listMembers( - //Path param - @PathParam("loadBalancerPoolUUID") String loadBalancerPoolUUID, - - // return fields - @QueryParam("fields") List fields, - - // OpenStack LoadBalancerPool attributes - @QueryParam("id") String queryLoadBalancerPoolMemberID, - @QueryParam("tenant_id") String queryLoadBalancerPoolMemberTenantID, - @QueryParam("address") String queryLoadBalancerPoolMemberAddress, - @QueryParam("protocol_port") String queryLoadBalancerPoolMemberProtoPort, - @QueryParam("admin_state_up") String queryLoadBalancerPoolMemberAdminStateUp, - @QueryParam("weight") String queryLoadBalancerPoolMemberWeight, - @QueryParam("subnet_id") String queryLoadBalancerPoolMemberSubnetID, - @QueryParam("status") String queryLoadBalancerPoolMemberStatus, - - // pagination - @QueryParam("limit") String limit, - @QueryParam("marker") String marker, - @QueryParam("page_reverse") String pageReverse - // sorting not supported -) { - INeutronLoadBalancerPoolCRUD loadBalancerPoolInterface = NeutronCRUDInterfaces - .getINeutronLoadBalancerPoolCRUD(this); - if (loadBalancerPoolInterface == null) { - throw new ServiceUnavailableException("LoadBalancerPool CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!loadBalancerPoolInterface.neutronLoadBalancerPoolExists(loadBalancerPoolUUID)) { - throw new ResourceNotFoundException("loadBalancerPool UUID does not exist."); - } - List members = - loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolUUID).getLoadBalancerPoolMembers(); - List ans = new ArrayList(); - Iterator i = members.iterator(); - while (i.hasNext()) { - NeutronLoadBalancerPoolMember nsg = i.next(); - if ((queryLoadBalancerPoolMemberID == null || - queryLoadBalancerPoolMemberID.equals(nsg.getPoolMemberID())) && - loadBalancerPoolUUID.equals(nsg.getPoolID()) && - (queryLoadBalancerPoolMemberTenantID == null || - queryLoadBalancerPoolMemberTenantID.equals(nsg.getPoolMemberTenantID())) && - (queryLoadBalancerPoolMemberAddress == null || - queryLoadBalancerPoolMemberAddress.equals(nsg.getPoolMemberAddress())) && - (queryLoadBalancerPoolMemberAdminStateUp == null || - queryLoadBalancerPoolMemberAdminStateUp.equals(nsg.getPoolMemberAdminStateIsUp())) && - (queryLoadBalancerPoolMemberWeight == null || - queryLoadBalancerPoolMemberWeight.equals(nsg.getPoolMemberWeight())) && - (queryLoadBalancerPoolMemberSubnetID == null || - queryLoadBalancerPoolMemberSubnetID.equals(nsg.getPoolMemberSubnetID())) && - (queryLoadBalancerPoolMemberStatus == null || - queryLoadBalancerPoolMemberStatus.equals(nsg.getPoolMemberStatus()))) { - if (fields.size() > 0) { - ans.add(extractFields(nsg, fields)); - } else { - ans.add(nsg); - } - } - } - return Response.status(200).entity( - new NeutronLoadBalancerPoolMemberRequest(ans)).build(); -} - -/** - * Returns a specific LoadBalancerPoolMember - */ - -@Path("{loadBalancerPoolMemberUUID}") -@GET -@Produces({ MediaType.APPLICATION_JSON }) -//@TypeHint(OpenStackLoadBalancerPoolMembers.class) -@StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) -public Response showLoadBalancerPoolMember( - @PathParam("loadBalancerPoolUUID") String loadBalancerPoolUUID, - @PathParam("loadBalancerPoolMemberUUID") String loadBalancerPoolMemberUUID, - // return fields - @QueryParam("fields") List fields ) { - - INeutronLoadBalancerPoolCRUD loadBalancerPoolInterface = NeutronCRUDInterfaces - .getINeutronLoadBalancerPoolCRUD(this); - if (loadBalancerPoolInterface == null) { - throw new ServiceUnavailableException("LoadBalancerPool CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!loadBalancerPoolInterface.neutronLoadBalancerPoolExists(loadBalancerPoolUUID)) { - throw new ResourceNotFoundException("loadBalancerPool UUID does not exist."); - } - List members = - loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolUUID).getLoadBalancerPoolMembers(); - for (NeutronLoadBalancerPoolMember ans: members) { - if (!ans.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) - continue; - - if (fields.size() > 0) { - return Response.status(200).entity( - new NeutronLoadBalancerPoolMemberRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200).entity( - new NeutronLoadBalancerPoolMemberRequest(ans)).build(); - } - } - return Response.status(204).build(); -} - -/** - * Adds a Member to an LBaaS Pool member - */ -@PUT -@Produces({MediaType.APPLICATION_JSON}) -@Consumes({MediaType.APPLICATION_JSON}) -@StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented")}) -public Response createLoadBalancerPoolMember( - @PathParam("loadBalancerPoolUUID") String loadBalancerPoolUUID, - final NeutronLoadBalancerPoolMemberRequest input) { - - INeutronLoadBalancerPoolCRUD loadBalancerPoolInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerPoolCRUD(this); - if (loadBalancerPoolInterface == null) { - throw new ServiceUnavailableException("LoadBalancerPool CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - // Verify that the loadBalancerPool exists, for the member to be added to its cache - if (!loadBalancerPoolInterface.neutronLoadBalancerPoolExists(loadBalancerPoolUUID)) { - throw new ResourceNotFoundException("loadBalancerPool UUID does not exist."); - } - NeutronLoadBalancerPool singletonPool = loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolUUID); - - if (input.isSingleton()) { - NeutronLoadBalancerPoolMember singleton = input.getSingleton(); - singleton.setPoolID(loadBalancerPoolUUID); - String loadBalancerPoolMemberUUID = singleton.getPoolMemberID(); - - /* - * Verify that the LoadBalancerPoolMember doesn't already exist. - */ - List members = singletonPool.getLoadBalancerPoolMembers(); - for (NeutronLoadBalancerPoolMember member: members) { - if (member.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) - throw new BadRequestException("LoadBalancerPoolMember UUID already exists"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolMemberAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerPoolMemberAware service = (INeutronLoadBalancerPoolMemberAware) instance; - int status = service.canCreateNeutronLoadBalancerPoolMember(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerPoolMemberAware service = (INeutronLoadBalancerPoolMemberAware) instance; - service.neutronLoadBalancerPoolMemberCreated(singleton); - } - } - - /** - * Add the member from the neutron load balancer pool as well - */ - singletonPool.addLoadBalancerPoolMember(singleton); - - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolMemberAware.class, this); - while (i.hasNext()) { - NeutronLoadBalancerPoolMember test = i.next(); - String loadBalancerPoolMemberUUID = test.getPoolMemberID(); - - /* - * Verify that the LoadBalancerPoolMember doesn't already exist. - */ - List members = singletonPool.getLoadBalancerPoolMembers(); - for (NeutronLoadBalancerPoolMember member: members) { - if (member.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) - throw new BadRequestException("LoadBalancerPoolMember UUID already exists"); - } - - if (testMap.containsKey(test.getPoolMemberID())) { - throw new BadRequestException("Load Balancer PoolMember UUID already exists"); - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerPoolMemberAware service = (INeutronLoadBalancerPoolMemberAware) instance; - int status = service.canCreateNeutronLoadBalancerPoolMember(test); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - } - /* - * now, each element of the bulk request can be added to the cache - */ - i = bulk.iterator(); - while (i.hasNext()) { - NeutronLoadBalancerPoolMember test = i.next(); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerPoolMemberAware service = (INeutronLoadBalancerPoolMemberAware) instance; - service.neutronLoadBalancerPoolMemberCreated(test); - } - } - singletonPool.addLoadBalancerPoolMember(test); - } - } - return Response.status(201).entity(input).build(); -} - -/** - * Updates a LB member pool - */ - -@Path("{loadBalancerPoolMemberUUID}") -@PUT -@Produces({ MediaType.APPLICATION_JSON }) -@Consumes({ MediaType.APPLICATION_JSON }) -@StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) -public Response updateLoadBalancerPoolMember( - @PathParam("loadBalancerPoolUUID") String loadBalancerPoolUUID, - @PathParam("loadBalancerPoolMemberUUID") String loadBalancerPoolMemberUUID, - final NeutronLoadBalancerPoolMemberRequest input) { - - //TODO: Implement update LB member pool - return Response.status(501).entity(input).build(); -} - -/** - * Deletes a LoadBalancerPoolMember - */ - -@Path("{loadBalancerPoolMemberUUID}") -@DELETE -@StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) -public Response deleteLoadBalancerPoolMember( - @PathParam("loadBalancerPoolUUID") String loadBalancerPoolUUID, - @PathParam("loadBalancerPoolMemberUUID") String loadBalancerPoolMemberUUID) { - INeutronLoadBalancerPoolCRUD loadBalancerPoolInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerPoolCRUD(this); - if (loadBalancerPoolInterface == null) { - throw new ServiceUnavailableException("LoadBalancerPool CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - // Verify that the loadBalancerPool exists, for the member to be removed from its cache - if (!loadBalancerPoolInterface.neutronLoadBalancerPoolExists(loadBalancerPoolUUID)) { - throw new ResourceNotFoundException("loadBalancerPool UUID does not exist."); - } - - //Verify that the LB pool member exists - NeutronLoadBalancerPoolMember singleton = null; - List members = - loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolUUID).getLoadBalancerPoolMembers(); - for (NeutronLoadBalancerPoolMember member: members) { - if (member.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) { - singleton = member; - break; - } - } - if (singleton == null) - throw new BadRequestException("LoadBalancerPoolMember UUID does not exist."); - - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolMemberAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerPoolMemberAware service = (INeutronLoadBalancerPoolMemberAware) instance; - int status = service.canDeleteNeutronLoadBalancerPoolMember(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerPoolMemberAware service = (INeutronLoadBalancerPoolMemberAware) instance; - service.neutronLoadBalancerPoolMemberDeleted(singleton); - } - } - - /** - * Remove the member from the neutron load balancer pool - */ - NeutronLoadBalancerPool singletonPool = loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolUUID); - singletonPool.removeLoadBalancerPoolMember(singleton); - - return Response.status(204).build(); -} -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolNorthbound.java deleted file mode 100644 index ea4e2d1c9a..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolNorthbound.java +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright (C) 2014 SDN Hub, LLC. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Authors : Srini Seetharaman - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool; -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember; - -/** - * Neutron Northbound REST APIs for LoadBalancerPool Policies.
- * This class provides REST APIs for managing neutron LoadBalancerPool Policies - * - *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * - */ - -/** - * For now, the LB pool member data is maintained with the INeutronLoadBalancerPoolCRUD, - * and not duplicated within the INeutronLoadBalancerPoolMemberCRUD's cache. - */ - -@Path("/pools") -public class NeutronLoadBalancerPoolNorthbound { - - private NeutronLoadBalancerPool extractFields(NeutronLoadBalancerPool o, List fields) { - return o.extractFields(fields); - } - - /** - * Returns a list of all LoadBalancerPool - * */ - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - - public Response listGroups( - // return fields - @QueryParam("fields") List fields, - // OpenStack LoadBalancerPool attributes - @QueryParam("id") String queryLoadBalancerPoolID, - @QueryParam("tenant_id") String queryLoadBalancerPoolTenantID, - @QueryParam("name") String queryLoadBalancerPoolName, - @QueryParam("description") String queryLoadBalancerDescription, - @QueryParam("protocol") String queryLoadBalancerProtocol, - @QueryParam("lb_algorithm") String queryLoadBalancerPoolLbAlgorithm, - @QueryParam("healthmonitor_id") String queryLoadBalancerPoolHealthMonitorID, - @QueryParam("admin_state_up") String queryLoadBalancerIsAdminStateUp, - @QueryParam("status") String queryLoadBalancerPoolStatus, - @QueryParam("members") List queryLoadBalancerPoolMembers, - // pagination - @QueryParam("limit") String limit, - @QueryParam("marker") String marker, - @QueryParam("page_reverse") String pageReverse - // sorting not supported - ) { - INeutronLoadBalancerPoolCRUD loadBalancerPoolInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerPoolCRUD(this); - if (loadBalancerPoolInterface == null) { - throw new ServiceUnavailableException("LoadBalancerPool CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allLoadBalancerPools = loadBalancerPoolInterface.getAllNeutronLoadBalancerPools(); - List ans = new ArrayList(); - Iterator i = allLoadBalancerPools.iterator(); - while (i.hasNext()) { - NeutronLoadBalancerPool nsg = i.next(); - if ((queryLoadBalancerPoolID == null || - queryLoadBalancerPoolID.equals(nsg.getLoadBalancerPoolID())) && - (queryLoadBalancerPoolTenantID == null || - queryLoadBalancerPoolTenantID.equals(nsg.getLoadBalancerPoolTenantID())) && - (queryLoadBalancerPoolName == null || - queryLoadBalancerPoolName.equals(nsg.getLoadBalancerPoolName())) && - (queryLoadBalancerDescription == null || - queryLoadBalancerDescription.equals(nsg.getLoadBalancerPoolDescription())) && - (queryLoadBalancerPoolLbAlgorithm == null || - queryLoadBalancerPoolLbAlgorithm.equals(nsg.getLoadBalancerPoolLbAlgorithm())) && - (queryLoadBalancerPoolHealthMonitorID == null || - queryLoadBalancerPoolHealthMonitorID.equals(nsg.getNeutronLoadBalancerPoolHealthMonitorID())) && - (queryLoadBalancerIsAdminStateUp == null || - queryLoadBalancerIsAdminStateUp.equals(nsg.getLoadBalancerPoolAdminIsStateIsUp())) && - (queryLoadBalancerPoolStatus == null || - queryLoadBalancerPoolStatus.equals(nsg.getLoadBalancerPoolStatus())) && - (queryLoadBalancerPoolMembers.size() == 0 || - queryLoadBalancerPoolMembers.equals(nsg.getLoadBalancerPoolMembers()))) { - if (fields.size() > 0) { - ans.add(extractFields(nsg,fields)); - } else { - ans.add(nsg); - } - } - } - return Response.status(200).entity( - new NeutronLoadBalancerPoolRequest(ans)).build(); - } - - /** - * Returns a specific LoadBalancerPool */ - - @Path("{loadBalancerPoolID}") - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response showLoadBalancerPool(@PathParam("loadBalancerPoolID") String loadBalancerPoolID, - // return fields - @QueryParam("fields") List fields) { - INeutronLoadBalancerPoolCRUD loadBalancerPoolInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerPoolCRUD(this); - if (loadBalancerPoolInterface == null) { - throw new ServiceUnavailableException("LoadBalancerPool CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!loadBalancerPoolInterface.neutronLoadBalancerPoolExists(loadBalancerPoolID)) { - throw new ResourceNotFoundException("LoadBalancerPool UUID does not exist."); - } - if (fields.size() > 0) { - NeutronLoadBalancerPool ans = loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolID); - return Response.status(200).entity( - new NeutronLoadBalancerPoolRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200).entity(new NeutronLoadBalancerPoolRequest(loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolID))).build(); - } - } - - /** - * Creates new LoadBalancerPool */ - - @POST - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 201, condition = "Created"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response createLoadBalancerPools(final NeutronLoadBalancerPoolRequest input) { - INeutronLoadBalancerPoolCRUD loadBalancerPoolInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerPoolCRUD(this); - if (loadBalancerPoolInterface == null) { - throw new ServiceUnavailableException("LoadBalancerPool CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (input.isSingleton()) { - NeutronLoadBalancerPool singleton = input.getSingleton(); - - /* - * Verify that the LoadBalancerPool doesn't already exist. - */ - if (loadBalancerPoolInterface.neutronLoadBalancerPoolExists(singleton.getLoadBalancerPoolID())) { - throw new BadRequestException("LoadBalancerPool UUID already exists"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance; - int status = service.canCreateNeutronLoadBalancerPool(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - loadBalancerPoolInterface.addNeutronLoadBalancerPool(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance; - service.neutronLoadBalancerPoolCreated(singleton); - } - } - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this); - while (i.hasNext()) { - NeutronLoadBalancerPool test = i.next(); - - /* - * Verify that the loadBalancerPool doesn't already exist - */ - - if (loadBalancerPoolInterface.neutronLoadBalancerPoolExists(test.getLoadBalancerPoolID())) { - throw new BadRequestException("Load Balancer Pool UUID already is already created"); - } - if (testMap.containsKey(test.getLoadBalancerPoolID())) { - throw new BadRequestException("Load Balancer Pool UUID already exists"); - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance; - int status = service.canCreateNeutronLoadBalancerPool(test); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - } - /* - * now, each element of the bulk request can be added to the cache - */ - i = bulk.iterator(); - while (i.hasNext()) { - NeutronLoadBalancerPool test = i.next(); - loadBalancerPoolInterface.addNeutronLoadBalancerPool(test); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance; - service.neutronLoadBalancerPoolCreated(test); - } - } - } - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a LoadBalancerPool Policy - */ - @Path("{loadBalancerPoolID}") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response updateLoadBalancerPool( - @PathParam("loadBalancerPoolID") String loadBalancerPoolID, final NeutronLoadBalancerPoolRequest input) { - INeutronLoadBalancerPoolCRUD loadBalancerPoolInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerPoolCRUD(this); - if (loadBalancerPoolInterface == null) { - throw new ServiceUnavailableException("LoadBalancerPool CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the LoadBalancerPool exists and there is only one delta provided - */ - if (!loadBalancerPoolInterface.neutronLoadBalancerPoolExists(loadBalancerPoolID)) { - throw new ResourceNotFoundException("LoadBalancerPool UUID does not exist."); - } - if (!input.isSingleton()) { - throw new BadRequestException("Only singleton edit supported"); - } - NeutronLoadBalancerPool delta = input.getSingleton(); - NeutronLoadBalancerPool original = loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolID); - - /* - * updates restricted by Neutron - */ - if (delta.getLoadBalancerPoolID() != null || - delta.getLoadBalancerPoolTenantID() != null || - delta.getLoadBalancerPoolName() != null || - delta.getLoadBalancerPoolDescription() != null || - delta.getLoadBalancerPoolProtocol() != null || - delta.getLoadBalancerPoolLbAlgorithm() != null || - delta.getNeutronLoadBalancerPoolHealthMonitorID() != null || - delta.getLoadBalancerPoolAdminIsStateIsUp() != null || - delta.getLoadBalancerPoolStatus() != null || - delta.getLoadBalancerPoolMembers() != null) { - throw new BadRequestException("Attribute edit blocked by Neutron"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance; - int status = service.canUpdateNeutronLoadBalancerPool(delta, original); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * update the object and return it - */ - loadBalancerPoolInterface.updateNeutronLoadBalancerPool(loadBalancerPoolID, delta); - NeutronLoadBalancerPool updatedLoadBalancerPool = loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolID); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance; - service.neutronLoadBalancerPoolUpdated(updatedLoadBalancerPool); - } - } - return Response.status(200).entity(new NeutronLoadBalancerPoolRequest(loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolID))).build(); - } - - /** - * Deletes a LoadBalancerPool - */ - - @Path("{loadBalancerPoolUUID}") - @DELETE - @StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response deleteLoadBalancerPool( - @PathParam("loadBalancerPoolUUID") String loadBalancerPoolUUID) { - INeutronLoadBalancerPoolCRUD loadBalancerPoolInterface = NeutronCRUDInterfaces.getINeutronLoadBalancerPoolCRUD(this); - if (loadBalancerPoolInterface == null) { - throw new ServiceUnavailableException("LoadBalancerPool CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the LoadBalancerPool exists and it isn't currently in use - */ - if (!loadBalancerPoolInterface.neutronLoadBalancerPoolExists(loadBalancerPoolUUID)) { - throw new ResourceNotFoundException("LoadBalancerPool UUID does not exist."); - } - if (loadBalancerPoolInterface.neutronLoadBalancerPoolInUse(loadBalancerPoolUUID)) { - return Response.status(409).build(); - } - NeutronLoadBalancerPool singleton = loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolUUID); - Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance; - int status = service.canDeleteNeutronLoadBalancerPool(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * remove it and return 204 status - */ - loadBalancerPoolInterface.removeNeutronLoadBalancerPool(loadBalancerPoolUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance; - service.neutronLoadBalancerPoolDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolRequest.java deleted file mode 100644 index a1cdc419e1..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; - - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronLoadBalancerPoolRequest { - /** - * See OpenStack Network API v2.0 Reference for description of - * http://docs.openstack.org/api/openstack-network/2.0/content/ - */ - - @XmlElement(name="pool") - NeutronLoadBalancerPool singletonLoadBalancerPool; - - @XmlElement(name="pools") - List bulkRequest; - - NeutronLoadBalancerPoolRequest() { - } - - NeutronLoadBalancerPoolRequest(List bulk) { - bulkRequest = bulk; - singletonLoadBalancerPool = null; - } - - NeutronLoadBalancerPoolRequest(NeutronLoadBalancerPool group) { - singletonLoadBalancerPool = group; - } - - public List getBulk() { - return bulkRequest; - } - - public NeutronLoadBalancerPool getSingleton() { - return singletonLoadBalancerPool; - } - - public boolean isSingleton() { - return (singletonLoadBalancerPool != null); - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerRequest.java deleted file mode 100644 index 1cf4e7016d..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; - - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronLoadBalancerRequest { - /** - * See OpenStack Network API v2.0 Reference for description of - * http://docs.openstack.org/api/openstack-network/2.0/content/ - */ - - @XmlElement(name="loadbalancer") - NeutronLoadBalancer singletonLoadBalancer; - - @XmlElement(name="loadbalancers") - List bulkRequest; - - NeutronLoadBalancerRequest() { - } - - NeutronLoadBalancerRequest(List bulk) { - bulkRequest = bulk; - singletonLoadBalancer = null; - } - - NeutronLoadBalancerRequest(NeutronLoadBalancer group) { - singletonLoadBalancer = group; - } - - public List getBulk() { - return bulkRequest; - } - - public NeutronLoadBalancer getSingleton() { - return singletonLoadBalancer; - } - - public boolean isSingleton() { - return (singletonLoadBalancer != null); - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworkRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworkRequest.java deleted file mode 100644 index 2001fb758a..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworkRequest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -public class NeutronNetworkRequest implements INeutronRequest { - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement(name="network") - NeutronNetwork singletonNetwork; - - @XmlElement(name="networks") - List bulkRequest; - - @XmlElement(name="networks_links") - List links; - - NeutronNetworkRequest() { - } - - NeutronNetworkRequest(List bulkRequest, List links) { - this.bulkRequest = bulkRequest; - this.links = links; - this.singletonNetwork = null; - } - - NeutronNetworkRequest(List bulk) { - bulkRequest = bulk; - singletonNetwork = null; - } - - NeutronNetworkRequest(NeutronNetwork net) { - singletonNetwork = net; - } - - @Override - public NeutronNetwork getSingleton() { - return singletonNetwork; - } - - @Override - public boolean isSingleton() { - return (singletonNetwork != null); - } - - @Override - public List getBulk() { - return bulkRequest; - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworksNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworksNorthbound.java deleted file mode 100644 index 3a3c657956..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworksNorthbound.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.codehaus.enunciate.jaxrs.TypeHint; -import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork; - -/** - * Neutron Northbound REST APIs for Network.
- * This class provides REST APIs for managing neutron Networks - * - *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * - */ - -@Path("/networks") -public class NeutronNetworksNorthbound { - - @Context - UriInfo uriInfo; - - private NeutronNetwork extractFields(NeutronNetwork o, List fields) { - return o.extractFields(fields); - } - - /** - * Returns a list of all Networks */ - - @GET - @Produces({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackNetworks.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized")}) - public Response listNetworks( - // return fields - @QueryParam("fields") List fields, - // note: openstack isn't clear about filtering on lists, so we aren't handling them - @QueryParam("id") String queryID, - @QueryParam("name") String queryName, - @QueryParam("admin_state_up") String queryAdminStateUp, - @QueryParam("status") String queryStatus, - @QueryParam("shared") String queryShared, - @QueryParam("tenant_id") String queryTenantID, - @QueryParam("router_external") String queryRouterExternal, - @QueryParam("provider_network_type") String queryProviderNetworkType, - @QueryParam("provider_physical_network") String queryProviderPhysicalNetwork, - @QueryParam("provider_segmentation_id") String queryProviderSegmentationID, - // linkTitle - @QueryParam("limit") Integer limit, - @QueryParam("marker") String marker, - @DefaultValue("false") @QueryParam("page_reverse") Boolean pageReverse - // sorting not supported - ) { - INeutronNetworkCRUD networkInterface = NeutronCRUDInterfaces.getINeutronNetworkCRUD(this); - if (networkInterface == null) { - throw new ServiceUnavailableException("Network CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allNetworks = networkInterface.getAllNetworks(); - List ans = new ArrayList(); - Iterator i = allNetworks.iterator(); - while (i.hasNext()) { - NeutronNetwork oSN = i.next(); - //match filters: TODO provider extension - Boolean bAdminStateUp = null; - Boolean bShared = null; - Boolean bRouterExternal = null; - if (queryAdminStateUp != null) { - bAdminStateUp = Boolean.valueOf(queryAdminStateUp); - } - if (queryShared != null) { - bShared = Boolean.valueOf(queryShared); - } - if (queryRouterExternal != null) { - bRouterExternal = Boolean.valueOf(queryRouterExternal); - } - if ((queryID == null || queryID.equals(oSN.getID())) && - (queryName == null || queryName.equals(oSN.getNetworkName())) && - (bAdminStateUp == null || bAdminStateUp.booleanValue() == oSN.isAdminStateUp()) && - (queryStatus == null || queryStatus.equals(oSN.getStatus())) && - (bShared == null || bShared.booleanValue() == oSN.isShared()) && - (bRouterExternal == null || bRouterExternal.booleanValue() == oSN.isRouterExternal()) && - (queryTenantID == null || queryTenantID.equals(oSN.getTenantID()))) { - if (fields.size() > 0) { - ans.add(extractFields(oSN,fields)); - } else { - ans.add(oSN); - } - } - } - - if (limit != null && ans.size() > 1) { - // Return a paginated request - NeutronNetworkRequest request = (NeutronNetworkRequest) PaginatedRequestFactory.createRequest(limit, - marker, pageReverse, uriInfo, ans, NeutronNetwork.class); - return Response.status(200).entity(request).build(); - } - - return Response.status(200).entity(new NeutronNetworkRequest(ans)).build(); - - } - - /** - * Returns a specific Network */ - - @Path("{netUUID}") - @GET - @Produces({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackNetworks.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found") }) - public Response showNetwork( - @PathParam("netUUID") String netUUID, - // return fields - @QueryParam("fields") List fields - ) { - INeutronNetworkCRUD networkInterface = NeutronCRUDInterfaces.getINeutronNetworkCRUD( this); - if (networkInterface == null) { - throw new ServiceUnavailableException("Network CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!networkInterface.networkExists(netUUID)) { - throw new ResourceNotFoundException("network UUID does not exist."); - } - if (fields.size() > 0) { - NeutronNetwork ans = networkInterface.getNetwork(netUUID); - return Response.status(200).entity( - new NeutronNetworkRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200).entity( - new NeutronNetworkRequest(networkInterface.getNetwork(netUUID))).build(); - } - } - - /** - * Creates new Networks */ - @POST - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - @TypeHint(NeutronNetwork.class) - @StatusCodes({ - @ResponseCode(code = 201, condition = "Created"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized") }) - public Response createNetworks(final NeutronNetworkRequest input) { - INeutronNetworkCRUD networkInterface = NeutronCRUDInterfaces.getINeutronNetworkCRUD( this); - if (networkInterface == null) { - throw new ServiceUnavailableException("Network CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (input.isSingleton()) { - NeutronNetwork singleton = input.getSingleton(); - - /* - * network ID can't already exist - */ - if (networkInterface.networkExists(singleton.getID())) { - throw new BadRequestException("network UUID already exists"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronNetworkAware service = (INeutronNetworkAware) instance; - int status = service.canCreateNetwork(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - // add network to cache - singleton.initDefaults(); - networkInterface.addNetwork(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronNetworkAware service = (INeutronNetworkAware) instance; - service.neutronNetworkCreated(singleton); - } - } - - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this); - while (i.hasNext()) { - NeutronNetwork test = i.next(); - - /* - * network ID can't already exist, nor can there be an entry for this UUID - * already in this bulk request - */ - if (networkInterface.networkExists(test.getID())) { - throw new BadRequestException("network UUID already exists"); - } - if (testMap.containsKey(test.getID())) { - throw new BadRequestException("network UUID already exists"); - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance: instances) { - INeutronNetworkAware service = (INeutronNetworkAware) instance; - int status = service.canCreateNetwork(test); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - testMap.put(test.getID(),test); - } - - // now that everything passed, add items to the cache - i = bulk.iterator(); - while (i.hasNext()) { - NeutronNetwork test = i.next(); - test.initDefaults(); - networkInterface.addNetwork(test); - if (instances != null) { - for (Object instance: instances) { - INeutronNetworkAware service = (INeutronNetworkAware) instance; - service.neutronNetworkCreated(test); - } - } - } - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a Network */ - @Path("{netUUID}") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackNetworks.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), }) - public Response updateNetwork( - @PathParam("netUUID") String netUUID, final NeutronNetworkRequest input - ) { - INeutronNetworkCRUD networkInterface = NeutronCRUDInterfaces.getINeutronNetworkCRUD( this); - if (networkInterface == null) { - throw new ServiceUnavailableException("Network CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * network has to exist and only a single delta is supported - */ - if (!networkInterface.networkExists(netUUID)) { - throw new ResourceNotFoundException("network UUID does not exist."); - } - if (!input.isSingleton()) { - throw new BadRequestException("only singleton edits supported"); - } - NeutronNetwork delta = input.getSingleton(); - - /* - * transitions forbidden by Neutron - */ - if (delta.getID() != null || delta.getTenantID() != null || - delta.getStatus() != null) { - throw new BadRequestException("attribute edit blocked by Neutron"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronNetworkAware service = (INeutronNetworkAware) instance; - NeutronNetwork original = networkInterface.getNetwork(netUUID); - int status = service.canUpdateNetwork(delta, original); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - // update network object and return the modified object - networkInterface.updateNetwork(netUUID, delta); - NeutronNetwork updatedSingleton = networkInterface.getNetwork(netUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronNetworkAware service = (INeutronNetworkAware) instance; - service.neutronNetworkUpdated(updatedSingleton); - } - } - return Response.status(200).entity( - new NeutronNetworkRequest(networkInterface.getNetwork(netUUID))).build(); - } - - /** - * Deletes a Network */ - - @Path("{netUUID}") - @DELETE - @StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Network In Use") }) - public Response deleteNetwork( - @PathParam("netUUID") String netUUID) { - INeutronNetworkCRUD networkInterface = NeutronCRUDInterfaces.getINeutronNetworkCRUD( this); - if (networkInterface == null) { - throw new ServiceUnavailableException("Network CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * network has to exist and not be in use before it can be removed - */ - if (!networkInterface.networkExists(netUUID)) { - throw new ResourceNotFoundException("network UUID does not exist."); - } - if (networkInterface.networkInUse(netUUID)) { - throw new ResourceConflictException("Network ID in use"); - } - - NeutronNetwork singleton = networkInterface.getNetwork(netUUID); - Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronNetworkAware service = (INeutronNetworkAware) instance; - int status = service.canDeleteNetwork(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - networkInterface.removeNetwork(netUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronNetworkAware service = (INeutronNetworkAware) instance; - service.neutronNetworkDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNorthboundRSApplication.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNorthboundRSApplication.java deleted file mode 100644 index 052d3dc2dd..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNorthboundRSApplication.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.eclipse.persistence.jaxb.rs.MOXyJsonProvider; - -import javax.ws.rs.core.Application; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - - -/** - * This class is an instance of javax.ws.rs.core.Application and is used to return the classes - * that will be instantiated for JAXRS processing. This is necessary - * because package scanning in jersey doesn't yet work in OSGi environment. - * - */ -public class NeutronNorthboundRSApplication extends Application { - @Override - public Set> getClasses() { - Set> classes = new HashSet>(); -// northbound URIs - classes.add(NeutronNetworksNorthbound.class); - classes.add(NeutronSubnetsNorthbound.class); - classes.add(NeutronPortsNorthbound.class); - classes.add(NeutronRoutersNorthbound.class); - classes.add(NeutronFloatingIPsNorthbound.class); - classes.add(NeutronSecurityGroupsNorthbound.class); - classes.add(NeutronSecurityRulesNorthbound.class); - classes.add(NeutronFirewallNorthbound.class); - classes.add(NeutronFirewallPolicyNorthbound.class); - classes.add(NeutronFirewallRulesNorthbound.class); - classes.add(NeutronLoadBalancerNorthbound.class); - classes.add(NeutronLoadBalancerListenerNorthbound.class); - classes.add(NeutronLoadBalancerPoolNorthbound.class); - classes.add(NeutronLoadBalancerHealthMonitorNorthbound.class); - classes.add(NeutronLoadBalancerPoolMembersNorthbound.class); - classes.add(MOXyJsonProvider.class); - return classes; - } - - @Override - public Set getSingletons() { - MOXyJsonProvider moxyJsonProvider = new MOXyJsonProvider(); - - moxyJsonProvider.setAttributePrefix("@"); - moxyJsonProvider.setFormattedOutput(true); - moxyJsonProvider.setIncludeRoot(false); - moxyJsonProvider.setMarshalEmptyCollections(true); - moxyJsonProvider.setValueWrapper("$"); - - Map namespacePrefixMapper = new HashMap(3); - namespacePrefixMapper.put("router", "router"); // FIXME: fill in with XSD - namespacePrefixMapper.put("provider", "provider"); // FIXME: fill in with XSD - namespacePrefixMapper.put("binding", "binding"); - moxyJsonProvider.setNamespacePrefixMapper(namespacePrefixMapper); - moxyJsonProvider.setNamespaceSeparator(':'); - - HashSet set = new HashSet(1); - set.add(moxyJsonProvider); - return set; - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPageLink.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPageLink.java deleted file mode 100644 index f65d7f694b..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPageLink.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2014 Hewlett-Packard Development Company L.P - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Authors : Dave Tucker - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronPageLink { - - @XmlElement(name="ref") - String ref; - - @XmlElement (name="href") - String href; - - public String getRef() { - return ref; - } - - public void setRef(String ref) { - this.ref = ref; - } - - public String getHref() { - return href; - } - - public void setHref(String href) { - this.href = href; - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortRequest.java deleted file mode 100644 index 3bfac8a4fd..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortRequest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import org.opendaylight.controller.networkconfig.neutron.NeutronPort; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -public class NeutronPortRequest implements INeutronRequest { - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement(name="port") - NeutronPort singletonPort; - - @XmlElement(name="ports") - List bulkRequest; - - @XmlElement(name="ports_links") - List links; - - NeutronPortRequest() { - } - - public NeutronPortRequest(List bulkRequest, List links) { - this.bulkRequest = bulkRequest; - this.links = links; - this.singletonPort = null; - } - - NeutronPortRequest(List bulk) { - bulkRequest = bulk; - singletonPort = null; - } - - NeutronPortRequest(NeutronPort port) { - singletonPort = port; - } - - @Override - public NeutronPort getSingleton() { - return singletonPort; - } - - @Override - public boolean isSingleton() { - return (singletonPort != null); - } - - @Override - public List getBulk() { - return bulkRequest; - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java deleted file mode 100644 index 5ff3de58d6..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java +++ /dev/null @@ -1,554 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronPortAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronPort; -import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet; -import org.opendaylight.controller.networkconfig.neutron.Neutron_IPs; - -/** - * Neutron Northbound REST APIs.
- * This class provides REST APIs for managing neutron port objects - * - *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * - */ - -@Path("/ports") -public class NeutronPortsNorthbound { - - final String mac_regex="^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"; - - private NeutronPort extractFields(NeutronPort o, List fields) { - return o.extractFields(fields); - } - - @Context - UriInfo uriInfo; - - /** - * Returns a list of all Ports */ - - @GET - @Produces({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackPorts.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response listPorts( - // return fields - @QueryParam("fields") List fields, - // note: openstack isn't clear about filtering on lists, so we aren't handling them - @QueryParam("id") String queryID, - @QueryParam("network_id") String queryNetworkID, - @QueryParam("name") String queryName, - @QueryParam("admin_state_up") String queryAdminStateUp, - @QueryParam("status") String queryStatus, - @QueryParam("mac_address") String queryMACAddress, - @QueryParam("device_id") String queryDeviceID, - @QueryParam("device_owner") String queryDeviceOwner, - @QueryParam("tenant_id") String queryTenantID, - // linkTitle - @QueryParam("limit") Integer limit, - @QueryParam("marker") String marker, - @DefaultValue("false") @QueryParam("page_reverse") Boolean pageReverse - // sorting not supported - ) { - INeutronPortCRUD portInterface = NeutronCRUDInterfaces.getINeutronPortCRUD(this); - if (portInterface == null) { - throw new ServiceUnavailableException("Port CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allPorts = portInterface.getAllPorts(); - List ans = new ArrayList(); - Iterator i = allPorts.iterator(); - while (i.hasNext()) { - NeutronPort oSS = i.next(); - if ((queryID == null || queryID.equals(oSS.getID())) && - (queryNetworkID == null || queryNetworkID.equals(oSS.getNetworkUUID())) && - (queryName == null || queryName.equals(oSS.getName())) && - (queryAdminStateUp == null || queryAdminStateUp.equals(oSS.getAdminStateUp())) && - (queryStatus == null || queryStatus.equals(oSS.getStatus())) && - (queryMACAddress == null || queryMACAddress.equals(oSS.getMacAddress())) && - (queryDeviceID == null || queryDeviceID.equals(oSS.getDeviceID())) && - (queryDeviceOwner == null || queryDeviceOwner.equals(oSS.getDeviceOwner())) && - (queryTenantID == null || queryTenantID.equals(oSS.getTenantID()))) { - if (fields.size() > 0) { - ans.add(extractFields(oSS,fields)); - } else { - ans.add(oSS); - } - } - } - - if (limit != null && ans.size() > 1) { - // Return a paginated request - NeutronPortRequest request = (NeutronPortRequest) PaginatedRequestFactory.createRequest(limit, - marker, pageReverse, uriInfo, ans, NeutronPort.class); - return Response.status(200).entity(request).build(); - } - - return Response.status(200).entity( - new NeutronPortRequest(ans)).build(); - } - - /** - * Returns a specific Port */ - - @Path("{portUUID}") - @GET - @Produces({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackPorts.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response showPort( - @PathParam("portUUID") String portUUID, - // return fields - @QueryParam("fields") List fields ) { - INeutronPortCRUD portInterface = NeutronCRUDInterfaces.getINeutronPortCRUD(this); - if (portInterface == null) { - throw new ServiceUnavailableException("Port CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!portInterface.portExists(portUUID)) { - throw new ResourceNotFoundException("port UUID does not exist."); - } - if (fields.size() > 0) { - NeutronPort ans = portInterface.getPort(portUUID); - return Response.status(200).entity( - new NeutronPortRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200).entity( - new NeutronPortRequest(portInterface.getPort(portUUID))).build(); - } - } - - /** - * Creates new Ports */ - - @POST - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackPorts.class) - @StatusCodes({ - @ResponseCode(code = 201, condition = "Created"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented"), - @ResponseCode(code = 503, condition = "MAC generation failure") }) - public Response createPorts(final NeutronPortRequest input) { - INeutronPortCRUD portInterface = NeutronCRUDInterfaces.getINeutronPortCRUD(this); - if (portInterface == null) { - throw new ServiceUnavailableException("Port CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronNetworkCRUD networkInterface = NeutronCRUDInterfaces.getINeutronNetworkCRUD( this); - if (networkInterface == null) { - throw new ServiceUnavailableException("Network CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronSubnetCRUD subnetInterface = NeutronCRUDInterfaces.getINeutronSubnetCRUD( this); - if (subnetInterface == null) { - throw new ServiceUnavailableException("Subnet CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (input.isSingleton()) { - NeutronPort singleton = input.getSingleton(); - - /* - * the port must be part of an existing network, must not already exist, - * have a valid MAC and the MAC not be in use - */ - if (singleton.getNetworkUUID() == null) { - throw new BadRequestException("network UUID musy be specified"); - } - if (portInterface.portExists(singleton.getID())) { - throw new BadRequestException("port UUID already exists"); - } - if (!networkInterface.networkExists(singleton.getNetworkUUID())) { - throw new ResourceNotFoundException("network UUID does not exist."); - } - if (singleton.getMacAddress() == null || - !singleton.getMacAddress().matches(mac_regex)) { - throw new BadRequestException("MAC address not properly formatted"); - } - if (portInterface.macInUse(singleton.getMacAddress())) { - throw new ResourceConflictException("MAC Address is in use."); - } - /* - * if fixed IPs are specified, each one has to have an existing subnet ID - * that is in the same scoping network as the port. In addition, if an IP - * address is specified it has to be a valid address for the subnet and not - * already in use - */ - List fixedIPs = singleton.getFixedIPs(); - if (fixedIPs != null && fixedIPs.size() > 0) { - Iterator fixedIPIterator = fixedIPs.iterator(); - while (fixedIPIterator.hasNext()) { - Neutron_IPs ip = fixedIPIterator.next(); - if (ip.getSubnetUUID() == null) { - throw new BadRequestException("subnet UUID not specified"); - } - if (!subnetInterface.subnetExists(ip.getSubnetUUID())) { - throw new BadRequestException("subnet UUID must exists"); - } - NeutronSubnet subnet = subnetInterface.getSubnet(ip.getSubnetUUID()); - if (!singleton.getNetworkUUID().equalsIgnoreCase(subnet.getNetworkUUID())) { - throw new BadRequestException("network UUID must match that of subnet"); - } - if (ip.getIpAddress() != null) { - if (!subnet.isValidIP(ip.getIpAddress())) { - throw new BadRequestException("IP address is not valid"); - } - if (subnet.isIPInUse(ip.getIpAddress())) { - throw new ResourceConflictException("IP address is in use."); - } - } - } - } - - Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronPortAware service = (INeutronPortAware) instance; - int status = service.canCreatePort(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - // add the port to the cache - portInterface.addPort(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronPortAware service = (INeutronPortAware) instance; - service.neutronPortCreated(singleton); - } - } - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this); - while (i.hasNext()) { - NeutronPort test = i.next(); - - /* - * the port must be part of an existing network, must not already exist, - * have a valid MAC and the MAC not be in use. Further the bulk request - * can't already contain a new port with the same UUID - */ - if (portInterface.portExists(test.getID())) { - throw new BadRequestException("port UUID already exists"); - } - if (testMap.containsKey(test.getID())) { - throw new BadRequestException("port UUID already exists"); - } - for (NeutronPort check : testMap.values()) { - if (test.getMacAddress().equalsIgnoreCase(check.getMacAddress())) { - throw new ResourceConflictException("MAC address already allocated"); - } - for (Neutron_IPs test_fixedIP : test.getFixedIPs()) { - for (Neutron_IPs check_fixedIP : check.getFixedIPs()) { - if (test_fixedIP.getIpAddress().equals(check_fixedIP.getIpAddress())) { - throw new ResourceConflictException("IP address already allocated"); - } - } - } - } - testMap.put(test.getID(), test); - if (!networkInterface.networkExists(test.getNetworkUUID())) { - throw new ResourceNotFoundException("network UUID does not exist."); - } - if (!test.getMacAddress().matches(mac_regex)) { - throw new BadRequestException("MAC address not properly formatted"); - } - if (portInterface.macInUse(test.getMacAddress())) { - throw new ResourceConflictException("MAC address in use"); - } - - /* - * if fixed IPs are specified, each one has to have an existing subnet ID - * that is in the same scoping network as the port. In addition, if an IP - * address is specified it has to be a valid address for the subnet and not - * already in use (or be the gateway IP address of the subnet) - */ - List fixedIPs = test.getFixedIPs(); - if (fixedIPs != null && fixedIPs.size() > 0) { - Iterator fixedIPIterator = fixedIPs.iterator(); - while (fixedIPIterator.hasNext()) { - Neutron_IPs ip = fixedIPIterator.next(); - if (ip.getSubnetUUID() == null) { - throw new BadRequestException("subnet UUID must be specified"); - } - if (!subnetInterface.subnetExists(ip.getSubnetUUID())) { - throw new BadRequestException("subnet UUID doesn't exists"); - } - NeutronSubnet subnet = subnetInterface.getSubnet(ip.getSubnetUUID()); - if (!test.getNetworkUUID().equalsIgnoreCase(subnet.getNetworkUUID())) { - throw new BadRequestException("network UUID must match that of subnet"); - } - if (ip.getIpAddress() != null) { - if (!subnet.isValidIP(ip.getIpAddress())) { - throw new BadRequestException("ip address not valid"); - } - //TODO: need to add consideration for a fixed IP being assigned the same address as a allocated IP in the - //same bulk create - if (subnet.isIPInUse(ip.getIpAddress())) { - throw new ResourceConflictException("IP address in use"); - } - } - } - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronPortAware service = (INeutronPortAware) instance; - int status = service.canCreatePort(test); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - } - - //once everything has passed, then we can add to the cache - i = bulk.iterator(); - while (i.hasNext()) { - NeutronPort test = i.next(); - portInterface.addPort(test); - if (instances != null) { - for (Object instance : instances) { - INeutronPortAware service = (INeutronPortAware) instance; - service.neutronPortCreated(test); - } - } - } - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a Port */ - - @Path("{portUUID}") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackPorts.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response updatePort( - @PathParam("portUUID") String portUUID, - NeutronPortRequest input - ) { - INeutronPortCRUD portInterface = NeutronCRUDInterfaces.getINeutronPortCRUD(this); - if (portInterface == null) { - throw new ServiceUnavailableException("Port CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronSubnetCRUD subnetInterface = NeutronCRUDInterfaces.getINeutronSubnetCRUD( this); - if (subnetInterface == null) { - throw new ServiceUnavailableException("Subnet CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - // port has to exist and only a single delta is supported - if (!portInterface.portExists(portUUID)) { - throw new ResourceNotFoundException("port UUID does not exist."); - } - NeutronPort target = portInterface.getPort(portUUID); - if (!input.isSingleton()) { - throw new BadRequestException("only singleton edit suported"); - } - NeutronPort singleton = input.getSingleton(); - NeutronPort original = portInterface.getPort(portUUID); - - // deltas restricted by Neutron - if (singleton.getID() != null || singleton.getTenantID() != null || - singleton.getStatus() != null) { - throw new BadRequestException("attribute change blocked by Neutron"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronPortAware service = (INeutronPortAware) instance; - int status = service.canUpdatePort(singleton, original); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - // Verify the new fixed ips are valid - List fixedIPs = singleton.getFixedIPs(); - if (fixedIPs != null && fixedIPs.size() > 0) { - Iterator fixedIPIterator = fixedIPs.iterator(); - while (fixedIPIterator.hasNext()) { - Neutron_IPs ip = fixedIPIterator.next(); - if (ip.getSubnetUUID() == null) { - throw new BadRequestException("subnet UUID must be specified"); - } - if (!subnetInterface.subnetExists(ip.getSubnetUUID())) { - throw new BadRequestException("subnet UUID doesn't exist."); - } - NeutronSubnet subnet = subnetInterface.getSubnet(ip.getSubnetUUID()); - if (!target.getNetworkUUID().equalsIgnoreCase(subnet.getNetworkUUID())) { - throw new BadRequestException("network UUID must match that of subnet"); - } - if (ip.getIpAddress() != null) { - if (!subnet.isValidIP(ip.getIpAddress())) { - throw new BadRequestException("invalid IP address"); - } - if (subnet.isIPInUse(ip.getIpAddress())) { - throw new ResourceConflictException("IP address in use"); - } - } - } - } - - // TODO: Support change of security groups - // update the port and return the modified object - portInterface.updatePort(portUUID, singleton); - NeutronPort updatedPort = portInterface.getPort(portUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronPortAware service = (INeutronPortAware) instance; - service.neutronPortUpdated(updatedPort); - } - } - return Response.status(200).entity( - new NeutronPortRequest(updatedPort)).build(); - - } - - /** - * Deletes a Port */ - - @Path("{portUUID}") - @DELETE - @StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response deletePort( - @PathParam("portUUID") String portUUID) { - INeutronPortCRUD portInterface = NeutronCRUDInterfaces.getINeutronPortCRUD(this); - if (portInterface == null) { - throw new ServiceUnavailableException("Port CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - // port has to exist and not be owned by anyone. then it can be removed from the cache - if (!portInterface.portExists(portUUID)) { - throw new ResourceNotFoundException("port UUID does not exist."); - } - NeutronPort port = portInterface.getPort(portUUID); - if (port.getDeviceID() != null || - port.getDeviceOwner() != null) { - Response.status(403).build(); - } - NeutronPort singleton = portInterface.getPort(portUUID); - Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronPortAware service = (INeutronPortAware) instance; - int status = service.canDeletePort(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - portInterface.removePort(portUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronPortAware service = (INeutronPortAware) instance; - service.neutronPortDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRouterRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRouterRequest.java deleted file mode 100644 index 806fd69e8a..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRouterRequest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import org.opendaylight.controller.networkconfig.neutron.NeutronRouter; - - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronRouterRequest { - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement(name="router") - NeutronRouter singletonRouter; - - @XmlElement(name="routers") - List bulkRequest; - - NeutronRouterRequest() { - } - - NeutronRouterRequest(List bulk) { - bulkRequest = bulk; - singletonRouter = null; - } - - NeutronRouterRequest(NeutronRouter router) { - singletonRouter = router; - } - - public List getBulk() { - return bulkRequest; - } - - public NeutronRouter getSingleton() { - return singletonRouter; - } - - public boolean isSingleton() { - return (singletonRouter != null); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRoutersNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRoutersNorthbound.java deleted file mode 100644 index ccf5ddd1a4..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRoutersNorthbound.java +++ /dev/null @@ -1,642 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronRouterAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork; -import org.opendaylight.controller.networkconfig.neutron.NeutronPort; -import org.opendaylight.controller.networkconfig.neutron.NeutronRouter; -import org.opendaylight.controller.networkconfig.neutron.NeutronRouter_Interface; -import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet; - - -/** - * Neutron Northbound REST APIs.
- * This class provides REST APIs for managing neutron routers - * - *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * - */ - -@Path("/routers") -public class NeutronRoutersNorthbound { - - private NeutronRouter extractFields(NeutronRouter o, List fields) { - return o.extractFields(fields); - } - - /** - * Returns a list of all Routers */ - - @GET - @Produces({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackRouters.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response listRouters( - // return fields - @QueryParam("fields") List fields, - // note: openstack isn't clear about filtering on lists, so we aren't handling them - @QueryParam("id") String queryID, - @QueryParam("name") String queryName, - @QueryParam("admin_state_up") String queryAdminStateUp, - @QueryParam("status") String queryStatus, - @QueryParam("tenant_id") String queryTenantID, - @QueryParam("external_gateway_info") String queryExternalGatewayInfo, - // pagination - @QueryParam("limit") String limit, - @QueryParam("marker") String marker, - @QueryParam("page_reverse") String pageReverse - // sorting not supported - ) { - INeutronRouterCRUD routerInterface = NeutronCRUDInterfaces.getINeutronRouterCRUD(this); - if (routerInterface == null) { - throw new ServiceUnavailableException("Router CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allRouters = routerInterface.getAllRouters(); - List ans = new ArrayList(); - Iterator i = allRouters.iterator(); - while (i.hasNext()) { - NeutronRouter oSS = i.next(); - if ((queryID == null || queryID.equals(oSS.getID())) && - (queryName == null || queryName.equals(oSS.getName())) && - (queryAdminStateUp == null || queryAdminStateUp.equals(oSS.getAdminStateUp())) && - (queryStatus == null || queryStatus.equals(oSS.getStatus())) && - (queryExternalGatewayInfo == null || queryExternalGatewayInfo.equals(oSS.getExternalGatewayInfo())) && - (queryTenantID == null || queryTenantID.equals(oSS.getTenantID()))) { - if (fields.size() > 0) - ans.add(extractFields(oSS,fields)); - else - ans.add(oSS); - } - } - //TODO: apply pagination to results - return Response.status(200).entity( - new NeutronRouterRequest(ans)).build(); - } - - /** - * Returns a specific Router */ - - @Path("{routerUUID}") - @GET - @Produces({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackRouters.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response showRouter( - @PathParam("routerUUID") String routerUUID, - // return fields - @QueryParam("fields") List fields) { - INeutronRouterCRUD routerInterface = NeutronCRUDInterfaces.getINeutronRouterCRUD(this); - if (routerInterface == null) { - throw new ServiceUnavailableException("Router CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!routerInterface.routerExists(routerUUID)) { - throw new ResourceNotFoundException("Router UUID not found"); - } - if (fields.size() > 0) { - NeutronRouter ans = routerInterface.getRouter(routerUUID); - return Response.status(200).entity( - new NeutronRouterRequest(extractFields(ans, fields))).build(); - } else - return Response.status(200).entity( - new NeutronRouterRequest(routerInterface.getRouter(routerUUID))).build(); - } - - /** - * Creates new Routers */ - - @POST - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackRouters.class) - @StatusCodes({ - @ResponseCode(code = 201, condition = "Created"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response createRouters(final NeutronRouterRequest input) { - INeutronRouterCRUD routerInterface = NeutronCRUDInterfaces.getINeutronRouterCRUD(this); - if (routerInterface == null) { - throw new ServiceUnavailableException("Router CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronNetworkCRUD networkInterface = NeutronCRUDInterfaces.getINeutronNetworkCRUD( this); - if (networkInterface == null) { - throw new ServiceUnavailableException("Network CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (input.isSingleton()) { - NeutronRouter singleton = input.getSingleton(); - - /* - * verify that the router doesn't already exist (issue: is deeper inspection necessary?) - * if there is external gateway information provided, verify that the specified network - * exists and has been designated as "router:external" - */ - if (routerInterface.routerExists(singleton.getID())) - throw new BadRequestException("router UUID already exists"); - if (singleton.getExternalGatewayInfo() != null) { - String externNetworkPtr = singleton.getExternalGatewayInfo().getNetworkID(); - if (!networkInterface.networkExists(externNetworkPtr)) - throw new BadRequestException("External Network Pointer doesn't exist"); - NeutronNetwork externNetwork = networkInterface.getNetwork(externNetworkPtr); - if (!externNetwork.isRouterExternal()) - throw new BadRequestException("External Network Pointer isn't marked as router:external"); - } - Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - int status = service.canCreateRouter(singleton); - if (status < 200 || status > 299) - return Response.status(status).build(); - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * add router to the cache - */ - routerInterface.addRouter(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - service.neutronRouterCreated(singleton); - } - } - } else { - - /* - * only singleton router creates supported - */ - throw new BadRequestException("Only singleton router creates supported"); - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a Router */ - - @Path("{routerUUID}") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackRouters.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response updateRouter( - @PathParam("routerUUID") String routerUUID, - NeutronRouterRequest input - ) { - INeutronRouterCRUD routerInterface = NeutronCRUDInterfaces.getINeutronRouterCRUD(this); - if (routerInterface == null) { - throw new ServiceUnavailableException("Router CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronNetworkCRUD networkInterface = NeutronCRUDInterfaces.getINeutronNetworkCRUD( this); - if (networkInterface == null) { - throw new ServiceUnavailableException("Network CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * router has to exist and only a single delta can be supplied - */ - if (!routerInterface.routerExists(routerUUID)) - throw new ResourceNotFoundException("Router UUID not found"); - if (!input.isSingleton()) - throw new BadRequestException("Only single router deltas supported"); - NeutronRouter singleton = input.getSingleton(); - NeutronRouter original = routerInterface.getRouter(routerUUID); - - /* - * attribute changes blocked by Neutron - */ - if (singleton.getID() != null || singleton.getTenantID() != null || - singleton.getStatus() != null) - throw new BadRequestException("Request attribute change not allowed"); - - Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - int status = service.canUpdateRouter(singleton, original); - if (status < 200 || status > 299) - return Response.status(status).build(); - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - /* - * if the external gateway info is being changed, verify that the new network - * exists and has been designated as an external network - */ - if (singleton.getExternalGatewayInfo() != null) { - String externNetworkPtr = singleton.getExternalGatewayInfo().getNetworkID(); - if (!networkInterface.networkExists(externNetworkPtr)) - throw new BadRequestException("External Network Pointer does not exist"); - NeutronNetwork externNetwork = networkInterface.getNetwork(externNetworkPtr); - if (!externNetwork.isRouterExternal()) - throw new BadRequestException("External Network Pointer isn't marked as router:external"); - } - - /* - * update the router entry and return the modified object - */ - routerInterface.updateRouter(routerUUID, singleton); - NeutronRouter updatedRouter = routerInterface.getRouter(routerUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - service.neutronRouterUpdated(updatedRouter); - } - } - return Response.status(200).entity( - new NeutronRouterRequest(routerInterface.getRouter(routerUUID))).build(); - - } - - /** - * Deletes a Router */ - - @Path("{routerUUID}") - @DELETE - @StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response deleteRouter( - @PathParam("routerUUID") String routerUUID) { - INeutronRouterCRUD routerInterface = NeutronCRUDInterfaces.getINeutronRouterCRUD(this); - if (routerInterface == null) { - throw new ServiceUnavailableException("Router CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify that the router exists and is not in use before removing it - */ - if (!routerInterface.routerExists(routerUUID)) - throw new ResourceNotFoundException("Router UUID not found"); - if (routerInterface.routerInUse(routerUUID)) - throw new ResourceConflictException("Router UUID in Use"); - NeutronRouter singleton = routerInterface.getRouter(routerUUID); - Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - int status = service.canDeleteRouter(singleton); - if (status < 200 || status > 299) - return Response.status(status).build(); - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - routerInterface.removeRouter(routerUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - service.neutronRouterDeleted(singleton); - } - } - return Response.status(204).build(); - } - - /** - * Adds an interface to a router */ - - @Path("{routerUUID}/add_router_interface") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackRouterInterfaces.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response addRouterInterface( - @PathParam("routerUUID") String routerUUID, - NeutronRouter_Interface input - ) { - INeutronRouterCRUD routerInterface = NeutronCRUDInterfaces.getINeutronRouterCRUD(this); - if (routerInterface == null) { - throw new ServiceUnavailableException("Router CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronPortCRUD portInterface = NeutronCRUDInterfaces.getINeutronPortCRUD(this); - if (portInterface == null) { - throw new ServiceUnavailableException("Port CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronSubnetCRUD subnetInterface = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this); - if (subnetInterface == null) { - throw new ServiceUnavailableException("Subnet CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * While the Neutron specification says that the router has to exist and the input can only specify either a subnet id - * or a port id, but not both, this code assumes that the plugin has filled everything in for us and so both must be present - */ - if (!routerInterface.routerExists(routerUUID)) - throw new BadRequestException("Router UUID doesn't exist"); - NeutronRouter target = routerInterface.getRouter(routerUUID); - if (input.getSubnetUUID() == null || - input.getPortUUID() == null) - throw new BadRequestException("Must specify at subnet id, port id or both"); - - // check that the port is part of the subnet - NeutronSubnet targetSubnet = subnetInterface.getSubnet(input.getSubnetUUID()); - if (targetSubnet == null) - throw new BadRequestException("Subnet id doesn't exist"); - NeutronPort targetPort = portInterface.getPort(input.getPortUUID()); - if (targetPort == null) - throw new BadRequestException("Port id doesn't exist"); - if (!targetSubnet.getPortsInSubnet().contains(targetPort)) - throw new BadRequestException("Port id not part of subnet id"); - - if (targetPort.getFixedIPs().size() != 1) - throw new BadRequestException("Port id must have a single fixedIP address"); - if (targetPort.getDeviceID() != null || - targetPort.getDeviceOwner() != null) - throw new ResourceConflictException("Target Port already allocated"); - Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - int status = service.canAttachInterface(target, input); - if (status < 200 || status > 299) - return Response.status(status).build(); - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - //mark the port device id and device owner fields - targetPort.setDeviceOwner("network:router_interface"); - targetPort.setDeviceID(routerUUID); - - target.addInterface(input.getPortUUID(), input); - if (instances != null) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - service.neutronRouterInterfaceAttached(target, input); - } - } - - return Response.status(200).entity(input).build(); - } - - /** - * Removes an interface to a router */ - - @Path("{routerUUID}/remove_router_interface") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackRouterInterfaces.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response removeRouterInterface( - @PathParam("routerUUID") String routerUUID, - NeutronRouter_Interface input - ) { - INeutronRouterCRUD routerInterface = NeutronCRUDInterfaces.getINeutronRouterCRUD(this); - if (routerInterface == null) { - throw new ServiceUnavailableException("Router CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronPortCRUD portInterface = NeutronCRUDInterfaces.getINeutronPortCRUD(this); - if (portInterface == null) { - throw new ServiceUnavailableException("Port CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronSubnetCRUD subnetInterface = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this); - if (subnetInterface == null) { - throw new ServiceUnavailableException("Subnet CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - // verify the router exists - if (!routerInterface.routerExists(routerUUID)) - throw new BadRequestException("Router does not exist"); - NeutronRouter target = routerInterface.getRouter(routerUUID); - - /* - * remove by subnet id. Collect information about the impacted router for the response and - * remove the port corresponding to the gateway IP address of the subnet - */ - if (input.getPortUUID() == null && - input.getSubnetUUID() != null) { - NeutronPort port = portInterface.getGatewayPort(input.getSubnetUUID()); - if (port == null) - throw new ResourceNotFoundException("Port UUID not found"); - input.setPortUUID(port.getID()); - input.setID(target.getID()); - input.setTenantID(target.getTenantID()); - - Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - int status = service.canDetachInterface(target, input); - if (status < 200 || status > 299) - return Response.status(status).build(); - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - // reset the port ownership - port.setDeviceID(null); - port.setDeviceOwner(null); - - target.removeInterface(input.getPortUUID()); - if (instances != null) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - service.neutronRouterInterfaceDetached(target, input); - } - } - return Response.status(200).entity(input).build(); - } - - /* - * remove by port id. collect information about the impacted router for the response - * remove the interface and reset the port ownership - */ - if (input.getPortUUID() != null && - input.getSubnetUUID() == null) { - NeutronRouter_Interface targetInterface = target.getInterfaces().get(input.getPortUUID()); - if (targetInterface == null) { - throw new ResourceNotFoundException("Router interface not found for given Port UUID"); - } - input.setSubnetUUID(targetInterface.getSubnetUUID()); - input.setID(target.getID()); - input.setTenantID(target.getTenantID()); - Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - int status = service.canDetachInterface(target, input); - if (status < 200 || status > 299) - return Response.status(status).build(); - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - NeutronPort port = portInterface.getPort(input.getPortUUID()); - port.setDeviceID(null); - port.setDeviceOwner(null); - target.removeInterface(input.getPortUUID()); - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - service.neutronRouterInterfaceDetached(target, input); - } - return Response.status(200).entity(input).build(); - } - - /* - * remove by both port and subnet ID. Verify that the first fixed IP of the port is a valid - * IP address for the subnet, and then remove the interface, collecting information about the - * impacted router for the response and reset port ownership - */ - if (input.getPortUUID() != null && - input.getSubnetUUID() != null) { - NeutronPort port = portInterface.getPort(input.getPortUUID()); - if (port == null) { - throw new ResourceNotFoundException("Port UUID not found"); - } - if (port.getFixedIPs() == null) { - throw new ResourceNotFoundException("Port UUID has no fixed IPs"); - } - NeutronSubnet subnet = subnetInterface.getSubnet(input.getSubnetUUID()); - if (subnet == null) { - throw new ResourceNotFoundException("Subnet UUID not found"); - } - if (!subnet.isValidIP(port.getFixedIPs().get(0).getIpAddress())) - throw new ResourceConflictException("Target Port IP not in Target Subnet"); - Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - int status = service.canDetachInterface(target, input); - if (status < 200 || status > 299) - return Response.status(status).build(); - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - input.setID(target.getID()); - input.setTenantID(target.getTenantID()); - port.setDeviceID(null); - port.setDeviceOwner(null); - target.removeInterface(input.getPortUUID()); - if (instances != null) { - for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - service.canDetachInterface(target, input); - } - } for (Object instance : instances) { - INeutronRouterAware service = (INeutronRouterAware) instance; - service.neutronRouterInterfaceDetached(target, input); - } - return Response.status(200).entity(input).build(); - } - - // have to specify either a port ID or a subnet ID - throw new BadRequestException("Must specify port id or subnet id or both"); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupRequest.java deleted file mode 100644 index 6e779d64e2..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupRequest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityGroup; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; - - -@XmlRootElement -@XmlAccessorType (XmlAccessType.NONE) - -public class NeutronSecurityGroupRequest { - /** - * See OpenStack Network API v2.0 Reference for a - * description of annotated attributes and operations - */ - - @XmlElement (name = "security_group") - NeutronSecurityGroup singletonSecurityGroup; - - @XmlElement (name = "security_groups") - List bulkRequest; - - NeutronSecurityGroupRequest() { - } - - NeutronSecurityGroupRequest(List bulk) { - bulkRequest = bulk; - singletonSecurityGroup = null; - } - - NeutronSecurityGroupRequest(NeutronSecurityGroup group) { - singletonSecurityGroup = group; - } - - public List getBulk() { - return bulkRequest; - } - - public NeutronSecurityGroup getSingleton() { - return singletonSecurityGroup; - } - - public boolean isSingleton() { - return (singletonSecurityGroup != null); - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupsNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupsNorthbound.java deleted file mode 100644 index d9ca6d4512..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupsNorthbound.java +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityGroup; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Neutron Northbound REST APIs for Security Group.
- * This class provides REST APIs for managing neutron Security Group - *

- *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - */ -@Path ("/security-groups") -public class NeutronSecurityGroupsNorthbound { - static final Logger logger = LoggerFactory.getLogger(NeutronSecurityGroupsNorthbound.class); - - private NeutronSecurityGroup extractFields(NeutronSecurityGroup o, List fields) { - return o.extractFields(fields); - } - - /** - * Returns a list of all Security Groups - */ - @GET - @Produces ({MediaType.APPLICATION_JSON}) - @StatusCodes ({ - @ResponseCode (code = 200, condition = "Operation successful"), - @ResponseCode (code = 401, condition = "Unauthorized"), - @ResponseCode (code = 501, condition = "Not Implemented")}) - - public Response listGroups( - // return fields - @QueryParam ("fields") List fields, - // OpenStack security group attributes - @QueryParam ("id") String querySecurityGroupUUID, - @QueryParam ("name") String querySecurityGroupName, - @QueryParam ("description") String querySecurityDescription, - @QueryParam ("tenant_id") String querySecurityTenantID, - @QueryParam ("limit") String limit, - @QueryParam ("marker") String marker, - @QueryParam ("page_reverse") String pageReverse - ) { - INeutronSecurityGroupCRUD securityGroupInterface = NeutronCRUDInterfaces.getINeutronSecurityGroupCRUD(this); - - if (securityGroupInterface == null) { - throw new ServiceUnavailableException("Security Group CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allSecurityGroups = securityGroupInterface.getAllNeutronSecurityGroups(); - List ans = new ArrayList(); - Iterator i = allSecurityGroups.iterator(); - while (i.hasNext()) { - NeutronSecurityGroup nsg = i.next(); - if ((querySecurityGroupUUID == null || - querySecurityGroupUUID.equals(nsg.getSecurityGroupUUID())) && - (querySecurityGroupName == null || - querySecurityGroupName.equals(nsg.getSecurityGroupName())) && - (querySecurityDescription == null || - querySecurityDescription.equals(nsg.getSecurityGroupDescription())) && - (querySecurityTenantID == null || - querySecurityTenantID.equals(nsg.getSecurityGroupTenantID()))) { - if (fields.size() > 0) { - ans.add(extractFields(nsg, fields)); - } else { - ans.add(nsg); - } - } - } - return Response.status(200).entity( - new NeutronSecurityGroupRequest(ans)).build(); - } - - /** - * Returns a specific Security Group - */ - - @Path ("{securityGroupUUID}") - @GET - @Produces ({MediaType.APPLICATION_JSON}) - @StatusCodes ({ - @ResponseCode (code = 200, condition = "Operation successful"), - @ResponseCode (code = 401, condition = "Unauthorized"), - @ResponseCode (code = 404, condition = "Not Found"), - @ResponseCode (code = 501, condition = "Not Implemented")}) - public Response showSecurityGroup(@PathParam ("securityGroupUUID") String securityGroupUUID, - // return fields - @QueryParam ("fields") List fields) { - INeutronSecurityGroupCRUD securityGroupInterface = NeutronCRUDInterfaces.getINeutronSecurityGroupCRUD(this); - if (securityGroupInterface == null) { - throw new ServiceUnavailableException("Security Group CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!securityGroupInterface.neutronSecurityGroupExists(securityGroupUUID)) { - throw new ResourceNotFoundException("Security Group UUID does not exist."); - } - if (!fields.isEmpty()) { - NeutronSecurityGroup ans = securityGroupInterface.getNeutronSecurityGroup(securityGroupUUID); - return Response.status(200).entity( - new NeutronSecurityGroupRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200).entity(new NeutronSecurityGroupRequest(securityGroupInterface.getNeutronSecurityGroup(securityGroupUUID))).build(); - } - } - - /** - * Creates new Security Group - */ - - @POST - @Produces ({MediaType.APPLICATION_JSON}) - @Consumes ({MediaType.APPLICATION_JSON}) - @StatusCodes ({ - @ResponseCode (code = 201, condition = "Created"), - @ResponseCode (code = 400, condition = "Bad Request"), - @ResponseCode (code = 401, condition = "Unauthorized"), - @ResponseCode (code = 403, condition = "Forbidden"), - @ResponseCode (code = 404, condition = "Not Found"), - @ResponseCode (code = 409, condition = "Conflict"), - @ResponseCode (code = 501, condition = "Not Implemented")}) - public Response createSecurityGroups(final NeutronSecurityGroupRequest input) { - INeutronSecurityGroupCRUD securityGroupInterface = NeutronCRUDInterfaces.getINeutronSecurityGroupCRUD(this); - if (securityGroupInterface == null) { - throw new ServiceUnavailableException("Security Group CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - if (input.isSingleton()) { - NeutronSecurityGroup singleton = input.getSingleton(); - - /* - * Verify that the Security Group doesn't already exist. - */ - if (securityGroupInterface.neutronSecurityGroupExists(singleton.getSecurityGroupUUID())) { - throw new BadRequestException("Security Group UUID already exists"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance; - int status = service.canCreateNeutronSecurityGroup(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - // Add to Neutron cache - securityGroupInterface.addNeutronSecurityGroup(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance; - service.neutronSecurityGroupCreated(singleton); - } - } - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this); - while (i.hasNext()) { - NeutronSecurityGroup test = i.next(); - - /* - * Verify that the security group doesn't already exist - */ - - if (securityGroupInterface.neutronSecurityGroupExists(test.getSecurityGroupUUID())) { - throw new BadRequestException("Security Group UUID already is already created"); - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance; - int status = service.canCreateNeutronSecurityGroup(test); - if ((status < 200) || (status > 299)) return Response.status(status).build(); - } - } else { - throw new BadRequestException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - } - - /* - * now, each element of the bulk request can be added to the cache - */ - i = bulk.iterator(); - while (i.hasNext()) { - NeutronSecurityGroup test = i.next(); - securityGroupInterface.addNeutronSecurityGroup(test); - if (instances != null) { - for (Object instance : instances) { - INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance; - service.neutronSecurityGroupCreated(test); - } - } - } - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a Security Group - */ - - @Path ("{securityGroupUUID}") - @PUT - @Produces ({MediaType.APPLICATION_JSON}) - @Consumes ({MediaType.APPLICATION_JSON}) - @StatusCodes ({ - @ResponseCode (code = 200, condition = "Operation successful"), - @ResponseCode (code = 400, condition = "Bad Request"), - @ResponseCode (code = 401, condition = "Unauthorized"), - @ResponseCode (code = 403, condition = "Forbidden"), - @ResponseCode (code = 404, condition = "Not Found"), - @ResponseCode (code = 501, condition = "Not Implemented")}) - public Response updateSecurityGroup( - @PathParam ("securityGroupUUID") String securityGroupUUID, final NeutronSecurityGroupRequest input) { - INeutronSecurityGroupCRUD securityGroupInterface = NeutronCRUDInterfaces.getINeutronSecurityGroupCRUD(this); - if (securityGroupInterface == null) { - throw new ServiceUnavailableException("Security Group CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the Security Group exists and there is only one delta provided - */ - if (!securityGroupInterface.neutronSecurityGroupExists(securityGroupUUID)) { - throw new ResourceNotFoundException("Security Group UUID does not exist."); - } - if (!input.isSingleton()) { - throw new BadRequestException("Only singleton edit supported"); - } - NeutronSecurityGroup delta = input.getSingleton(); - NeutronSecurityGroup original = securityGroupInterface.getNeutronSecurityGroup(securityGroupUUID); - - if (delta.getSecurityGroupUUID() != null || - delta.getSecurityGroupTenantID() != null || - delta.getSecurityGroupName() != null || - delta.getSecurityGroupDescription() != null) { - throw new BadRequestException("Attribute edit blocked by Neutron"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance; - int status = service.canUpdateNeutronSecurityGroup(delta, original); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * update the object and return it - */ - securityGroupInterface.updateNeutronSecurityGroup(securityGroupUUID, delta); - NeutronSecurityGroup updatedSecurityGroup = securityGroupInterface.getNeutronSecurityGroup(securityGroupUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance; - service.neutronSecurityGroupUpdated(updatedSecurityGroup); - } - } - return Response.status(200).entity(new NeutronSecurityGroupRequest(securityGroupInterface.getNeutronSecurityGroup(securityGroupUUID))).build(); - } - - /** - * Deletes a Security Group - */ - - @Path ("{securityGroupUUID}") - @DELETE - @StatusCodes ({ - @ResponseCode (code = 204, condition = "No Content"), - @ResponseCode (code = 401, condition = "Unauthorized"), - @ResponseCode (code = 404, condition = "Not Found"), - @ResponseCode (code = 409, condition = "Conflict"), - @ResponseCode (code = 501, condition = "Not Implemented")}) - public Response deleteSecurityGroup( - @PathParam ("securityGroupUUID") String securityGroupUUID) { - INeutronSecurityGroupCRUD securityGroupInterface = NeutronCRUDInterfaces.getINeutronSecurityGroupCRUD(this); - if (securityGroupInterface == null) { - throw new ServiceUnavailableException("Security Group CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the Security Group exists and it isn't currently in use - */ - if (!securityGroupInterface.neutronSecurityGroupExists(securityGroupUUID)) { - throw new ResourceNotFoundException("Security Group UUID does not exist."); - } - if (securityGroupInterface.neutronSecurityGroupInUse(securityGroupUUID)) { - return Response.status(409).build(); - } - NeutronSecurityGroup singleton = securityGroupInterface.getNeutronSecurityGroup(securityGroupUUID); - Object[] instances = NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance; - int status = service.canDeleteNeutronSecurityGroup(singleton); - if ((status < 200) || (status > 299)) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * remove it and return 204 status - */ - securityGroupInterface.removeNeutronSecurityGroup(securityGroupUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance; - service.neutronSecurityGroupDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRuleRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRuleRequest.java deleted file mode 100644 index b805bd63bc..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRuleRequest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityRule; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; - - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronSecurityRuleRequest { - /** - * See OpenStack Network API v2.0 Reference for a - * description of annotated attributes and operations - */ - - @XmlElement(name="security_group_rule") - NeutronSecurityRule singletonSecurityRule; - - @XmlElement(name="security_group_rules") - List bulkRequest; - - NeutronSecurityRuleRequest() { - } - - NeutronSecurityRuleRequest(List bulk) { - bulkRequest = bulk; - singletonSecurityRule = null; - } - - NeutronSecurityRuleRequest(NeutronSecurityRule rule) { - singletonSecurityRule = rule; - } - - public NeutronSecurityRule getSingleton() { - return singletonSecurityRule; - } - - public boolean isSingleton() { - return (singletonSecurityRule != null); - } - public List getBulk() { - return bulkRequest; - } - -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRulesNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRulesNorthbound.java deleted file mode 100644 index 9ce98e2b4f..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRulesNorthbound.java +++ /dev/null @@ -1,432 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityRule; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Neutron Northbound REST APIs for Security Rule.
- * This class provides REST APIs for managing neutron Security Rule - *

- *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - */ - -@Path ("/security-group-rules") -public class NeutronSecurityRulesNorthbound { - static final Logger logger = LoggerFactory.getLogger(NeutronSecurityRulesNorthbound.class); - - private NeutronSecurityRule extractFields(NeutronSecurityRule o, List fields) { - return o.extractFields(fields); - } - - /** - * Returns a list of all Security Rules - */ - @GET - @Produces ({MediaType.APPLICATION_JSON}) - @StatusCodes ({ - @ResponseCode (code = 200, condition = "Operation successful"), - @ResponseCode (code = 401, condition = "Unauthorized"), - @ResponseCode (code = 501, condition = "Not Implemented")}) - public Response listRules( - // return fields - @QueryParam ("fields") List fields, - // OpenStack security rule attributes - @QueryParam ("id") String querySecurityRuleUUID, - @QueryParam ("direction") String querySecurityRuleDirection, - @QueryParam ("protocol") String querySecurityRuleProtocol, - @QueryParam ("port_range_min") Integer querySecurityRulePortMin, - @QueryParam ("port_range_max") Integer querySecurityRulePortMax, - @QueryParam ("ethertype") String querySecurityRuleEthertype, - @QueryParam ("remote_ip_prefix") String querySecurityRuleIpPrefix, - @QueryParam ("remote_group_id") String querySecurityRemoteGroupID, - @QueryParam ("security_group_id") String querySecurityRuleGroupID, - @QueryParam ("tenant_id") String querySecurityRuleTenantID, - @QueryParam ("limit") String limit, - @QueryParam ("marker") String marker, - @QueryParam ("page_reverse") String pageReverse - ) { - INeutronSecurityRuleCRUD securityRuleInterface = NeutronCRUDInterfaces.getINeutronSecurityRuleCRUD(this); - if (securityRuleInterface == null) { - throw new ServiceUnavailableException("Security Rule CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allSecurityRules = securityRuleInterface.getAllNeutronSecurityRules(); - List ans = new ArrayList(); - Iterator i = allSecurityRules.iterator(); - while (i.hasNext()) { - NeutronSecurityRule nsr = i.next(); - if ((querySecurityRuleUUID == null || - querySecurityRuleUUID.equals(nsr.getSecurityRuleUUID())) && - (querySecurityRuleDirection == null || - querySecurityRuleDirection.equals(nsr.getSecurityRuleDirection())) && - (querySecurityRuleProtocol == null || - querySecurityRuleProtocol.equals(nsr.getSecurityRuleProtocol())) && - (querySecurityRulePortMin == null || - querySecurityRulePortMin.equals(nsr.getSecurityRulePortMin())) && - (querySecurityRulePortMax == null || - querySecurityRulePortMax.equals(nsr.getSecurityRulePortMax())) && - (querySecurityRuleEthertype == null || - querySecurityRuleEthertype.equals(nsr.getSecurityRuleEthertype())) && - (querySecurityRuleIpPrefix == null || - querySecurityRuleIpPrefix.equals(nsr.getSecurityRuleRemoteIpPrefix())) && - (querySecurityRuleGroupID == null || - querySecurityRuleGroupID.equals(nsr.getSecurityRuleGroupID())) && - (querySecurityRemoteGroupID == null || - querySecurityRemoteGroupID.equals(nsr.getSecurityRemoteGroupID())) && - (querySecurityRuleTenantID == null || - querySecurityRuleTenantID.equals(nsr.getSecurityRuleTenantID()))) { - if (fields.size() > 0) { - ans.add(extractFields(nsr, fields)); - } else { - ans.add(nsr); - } - } - } - return Response.status(200).entity( - new NeutronSecurityRuleRequest(ans)).build(); - } - - /** - * Returns a specific Security Rule - */ - - @Path ("{securityRuleUUID}") - @GET - @Produces ({MediaType.APPLICATION_JSON}) - @StatusCodes ({ - @ResponseCode (code = 200, condition = "Operation successful"), - @ResponseCode (code = 401, condition = "Unauthorized"), - @ResponseCode (code = 404, condition = "Not Found"), - @ResponseCode (code = 501, condition = "Not Implemented")}) - public Response showSecurityRule(@PathParam ("securityRuleUUID") String securityRuleUUID, - // return fields - @QueryParam ("fields") List fields) { - INeutronSecurityRuleCRUD securityRuleInterface = NeutronCRUDInterfaces.getINeutronSecurityRuleCRUD(this); - if (securityRuleInterface == null) { - throw new ServiceUnavailableException("Security Rule CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!securityRuleInterface.neutronSecurityRuleExists(securityRuleUUID)) { - throw new ResourceNotFoundException("Security Rule UUID does not exist."); - } - if (!fields.isEmpty()) { - NeutronSecurityRule ans = securityRuleInterface.getNeutronSecurityRule(securityRuleUUID); - return Response.status(200).entity( - new NeutronSecurityRuleRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200).entity(new NeutronSecurityRuleRequest(securityRuleInterface.getNeutronSecurityRule(securityRuleUUID))).build(); - } - } - - /** - * Creates new Security Rule - */ - - @POST - @Produces ({MediaType.APPLICATION_JSON}) - @Consumes ({MediaType.APPLICATION_JSON}) - @StatusCodes ({ - @ResponseCode (code = 201, condition = "Created"), - @ResponseCode (code = 400, condition = "Bad Request"), - @ResponseCode (code = 401, condition = "Unauthorized"), - @ResponseCode (code = 403, condition = "Forbidden"), - @ResponseCode (code = 404, condition = "Not Found"), - @ResponseCode (code = 409, condition = "Conflict"), - @ResponseCode (code = 501, condition = "Not Implemented")}) - public Response createSecurityRules(final NeutronSecurityRuleRequest input) { - INeutronSecurityRuleCRUD securityRuleInterface = NeutronCRUDInterfaces.getINeutronSecurityRuleCRUD(this); - if (securityRuleInterface == null) { - throw new ServiceUnavailableException("Security Rule CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronSecurityGroupCRUD securityGroupInterface = NeutronCRUDInterfaces.getINeutronSecurityGroupCRUD(this); - if (securityGroupInterface == null) { - throw new ServiceUnavailableException("Security Group CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * Existing entry checks - */ - - if (input.isSingleton()) { - NeutronSecurityRule singleton = input.getSingleton(); - - if (securityRuleInterface.neutronSecurityRuleExists(singleton.getSecurityRuleUUID())) { - throw new BadRequestException("Security Rule UUID already exists"); - } - Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance; - int status = service.canCreateNeutronSecurityRule(singleton); - if ((status < 200) || (status > 299)) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - // add rule to cache - singleton.initDefaults(); - securityRuleInterface.addNeutronSecurityRule(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance; - service.neutronSecurityRuleCreated(singleton); - } - } - - securityRuleInterface.addNeutronSecurityRule(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance; - service.neutronSecurityRuleCreated(singleton); - } - } - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this); - while (i.hasNext()) { - NeutronSecurityRule test = i.next(); - - /* - * Verify that the security rule doesn't already exist - */ - - if (securityRuleInterface.neutronSecurityRuleExists(test.getSecurityRuleUUID())) { - throw new BadRequestException("Security Rule UUID already exists"); - } - if (testMap.containsKey(test.getSecurityRuleUUID())) { - throw new BadRequestException("Security Rule UUID already exists"); - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance; - int status = service.canCreateNeutronSecurityRule(test); - if ((status < 200) || (status > 299)) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - } - - /* - * now, each element of the bulk request can be added to the cache - */ - i = bulk.iterator(); - while (i.hasNext()) { - NeutronSecurityRule test = i.next(); - securityRuleInterface.addNeutronSecurityRule(test); - if (instances != null) { - for (Object instance : instances) { - INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance; - service.neutronSecurityRuleCreated(test); - } - } - } - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a Security Rule - */ - - @Path ("{securityRuleUUID}") - @PUT - @Produces ({MediaType.APPLICATION_JSON}) - @Consumes ({MediaType.APPLICATION_JSON}) - @StatusCodes ({ - @ResponseCode (code = 200, condition = "Operation successful"), - @ResponseCode (code = 400, condition = "Bad Request"), - @ResponseCode (code = 401, condition = "Unauthorized"), - @ResponseCode (code = 403, condition = "Forbidden"), - @ResponseCode (code = 404, condition = "Not Found"), - @ResponseCode (code = 501, condition = "Not Implemented")}) - public Response updateSecurityRule( - @PathParam ("securityRuleUUID") String securityRuleUUID, final NeutronSecurityRuleRequest input) { - INeutronSecurityRuleCRUD securityRuleInterface = NeutronCRUDInterfaces.getINeutronSecurityRuleCRUD(this); - if (securityRuleInterface == null) { - throw new ServiceUnavailableException("Security Rule CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the Security Rule exists and there is only one delta provided - */ - if (!securityRuleInterface.neutronSecurityRuleExists(securityRuleUUID)) { - throw new ResourceNotFoundException("Security Rule UUID does not exist."); - } - if (!input.isSingleton()) { - throw new BadRequestException("Only singleton edit supported"); - } - NeutronSecurityRule delta = input.getSingleton(); - NeutronSecurityRule original = securityRuleInterface.getNeutronSecurityRule(securityRuleUUID); - - /* - * updates restricted by Neutron - * - */ - if (delta.getSecurityRuleUUID() != null || - delta.getSecurityRuleDirection() != null || - delta.getSecurityRuleProtocol() != null || - delta.getSecurityRulePortMin() != null || - delta.getSecurityRulePortMax() != null || - delta.getSecurityRuleEthertype() != null || - delta.getSecurityRuleRemoteIpPrefix() != null || - delta.getSecurityRuleGroupID() != null || - delta.getSecurityRemoteGroupID() != null || - delta.getSecurityRuleTenantID() != null) { - throw new BadRequestException("Attribute edit blocked by Neutron"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance; - int status = service.canUpdateNeutronSecurityRule(delta, original); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * update the object and return it - */ - securityRuleInterface.updateNeutronSecurityRule(securityRuleUUID, delta); - NeutronSecurityRule updatedSecurityRule = securityRuleInterface.getNeutronSecurityRule(securityRuleUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance; - service.neutronSecurityRuleUpdated(updatedSecurityRule); - } - } - return Response.status(200).entity(new NeutronSecurityRuleRequest(securityRuleInterface.getNeutronSecurityRule(securityRuleUUID))).build(); - } - - /** - * Deletes a Security Rule - */ - - @Path ("{securityRuleUUID}") - @DELETE - @StatusCodes ({ - @ResponseCode (code = 204, condition = "No Content"), - @ResponseCode (code = 401, condition = "Unauthorized"), - @ResponseCode (code = 404, condition = "Not Found"), - @ResponseCode (code = 409, condition = "Conflict"), - @ResponseCode (code = 501, condition = "Not Implemented")}) - public Response deleteSecurityRule( - @PathParam ("securityRuleUUID") String securityRuleUUID) { - INeutronSecurityRuleCRUD securityRuleInterface = NeutronCRUDInterfaces.getINeutronSecurityRuleCRUD(this); - if (securityRuleInterface == null) { - throw new ServiceUnavailableException("Security Rule CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the Security Rule exists and it isn't currently in use - */ - if (!securityRuleInterface.neutronSecurityRuleExists(securityRuleUUID)) { - throw new ResourceNotFoundException("Security Rule UUID does not exist."); - } - if (securityRuleInterface.neutronSecurityRuleInUse(securityRuleUUID)) { - return Response.status(409).build(); - } - NeutronSecurityRule singleton = securityRuleInterface.getNeutronSecurityRule(securityRuleUUID); - Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance; - int status = service.canDeleteNeutronSecurityRule(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - - /* - * remove it and return 204 status - */ - securityRuleInterface.removeNeutronSecurityRule(securityRuleUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance; - service.neutronSecurityRuleDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetRequest.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetRequest.java deleted file mode 100644 index 4c230c525b..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetRequest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -public class NeutronSubnetRequest implements INeutronRequest { - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement(name="subnet") - NeutronSubnet singletonSubnet; - - @XmlElement(name="subnets") - List bulkRequest; - - @XmlElement(name="subnets_links") - List links; - - NeutronSubnetRequest() { - } - - public NeutronSubnetRequest(List bulkRequest, List links) { - this.bulkRequest = bulkRequest; - this.links = links; - this.singletonSubnet = null; - } - - NeutronSubnetRequest(List bulk) { - bulkRequest = bulk; - singletonSubnet = null; - links = null; - } - - NeutronSubnetRequest(NeutronSubnet subnet) { - singletonSubnet = subnet; - bulkRequest = null; - links = null; - } - - @Override - public NeutronSubnet getSingleton() { - return singletonSubnet; - } - - @Override - public List getBulk() { - return bulkRequest; - } - - @Override - public boolean isSingleton() { - return (singletonSubnet != null); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetsNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetsNorthbound.java deleted file mode 100644 index fa66501d0e..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetsNorthbound.java +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright IBM Corporation and others, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import org.codehaus.enunciate.jaxrs.ResponseCode; -import org.codehaus.enunciate.jaxrs.StatusCodes; -import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware; -import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD; -import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; -import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet; - -/** - * Neutron Northbound REST APIs for Subnets.
- * This class provides REST APIs for managing neutron Subnets - * - *
- *
- * Authentication scheme : HTTP Basic
- * Authentication realm : opendaylight
- * Transport : HTTP and HTTPS
- *
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration - * - */ - -@Path("/subnets") -public class NeutronSubnetsNorthbound { - - private NeutronSubnet extractFields(NeutronSubnet o, List fields) { - return o.extractFields(fields); - } - - @Context - UriInfo uriInfo; - - /** - * Returns a list of all Subnets */ - @GET - @Produces({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackSubnets.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response listSubnets( - // return fields - @QueryParam("fields") List fields, - // note: openstack isn't clear about filtering on lists, so we aren't handling them - @QueryParam("id") String queryID, - @QueryParam("network_id") String queryNetworkID, - @QueryParam("name") String queryName, - @QueryParam("ip_version") String queryIPVersion, - @QueryParam("cidr") String queryCIDR, - @QueryParam("gateway_ip") String queryGatewayIP, - @QueryParam("enable_dhcp") String queryEnableDHCP, - @QueryParam("tenant_id") String queryTenantID, - @QueryParam("ipv6_address_mode") String queryIpV6AddressMode, - @QueryParam("ipv6_ra_mode") String queryIpV6RaMode, - // linkTitle - @QueryParam("limit") Integer limit, - @QueryParam("marker") String marker, - @DefaultValue("false") @QueryParam("page_reverse") Boolean pageReverse - // sorting not supported - ) { - INeutronSubnetCRUD subnetInterface = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this); - if (subnetInterface == null) { - throw new ServiceUnavailableException("Subnet CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - List allNetworks = subnetInterface.getAllSubnets(); - List ans = new ArrayList(); - Iterator i = allNetworks.iterator(); - while (i.hasNext()) { - NeutronSubnet oSS = i.next(); - if ((queryID == null || queryID.equals(oSS.getID())) && - (queryNetworkID == null || queryNetworkID.equals(oSS.getNetworkUUID())) && - (queryName == null || queryName.equals(oSS.getName())) && - (queryIPVersion == null || queryIPVersion.equals(oSS.getIpVersion())) && - (queryCIDR == null || queryCIDR.equals(oSS.getCidr())) && - (queryGatewayIP == null || queryGatewayIP.equals(oSS.getGatewayIP())) && - (queryEnableDHCP == null || queryEnableDHCP.equals(oSS.getEnableDHCP())) && - (queryTenantID == null || queryTenantID.equals(oSS.getTenantID())) && - (queryIpV6AddressMode == null || queryIpV6AddressMode.equals(oSS.getIpV6AddressMode())) && - (queryIpV6RaMode == null || queryIpV6RaMode.equals(oSS.getIpV6RaMode()))){ - if (fields.size() > 0) { - ans.add(extractFields(oSS,fields)); - } else { - ans.add(oSS); - } - } - } - - if (limit != null && ans.size() > 1) { - // Return a paginated request - NeutronSubnetRequest request = (NeutronSubnetRequest) PaginatedRequestFactory.createRequest(limit, - marker, pageReverse, uriInfo, ans, NeutronSubnet.class); - return Response.status(200).entity(request).build(); - } - - return Response.status(200).entity( - new NeutronSubnetRequest(ans)).build(); - } - - /** - * Returns a specific Subnet */ - - @Path("{subnetUUID}") - @GET - @Produces({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackSubnets.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response showSubnet( - @PathParam("subnetUUID") String subnetUUID, - // return fields - @QueryParam("fields") List fields) { - INeutronSubnetCRUD subnetInterface = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this); - if (subnetInterface == null) { - throw new ServiceUnavailableException("Subnet CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (!subnetInterface.subnetExists(subnetUUID)) { - throw new ResourceNotFoundException("subnet UUID does not exist."); - } - if (fields.size() > 0) { - NeutronSubnet ans = subnetInterface.getSubnet(subnetUUID); - return Response.status(200).entity( - new NeutronSubnetRequest(extractFields(ans, fields))).build(); - } else { - return Response.status(200).entity( - new NeutronSubnetRequest(subnetInterface.getSubnet(subnetUUID))).build(); - } - } - - /** - * Creates new Subnets */ - - @POST - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackSubnets.class) - @StatusCodes({ - @ResponseCode(code = 201, condition = "Created"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response createSubnets(final NeutronSubnetRequest input) { - INeutronSubnetCRUD subnetInterface = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this); - if (subnetInterface == null) { - throw new ServiceUnavailableException("Subnet CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - INeutronNetworkCRUD networkInterface = NeutronCRUDInterfaces.getINeutronNetworkCRUD( this); - if (networkInterface == null) { - throw new ServiceUnavailableException("Network CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - if (input.isSingleton()) { - NeutronSubnet singleton = input.getSingleton(); - - /* - * Verify that the subnet doesn't already exist (Issue: is a deeper check necessary?) - * the specified network exists, the subnet has a valid network address, - * and that the gateway IP doesn't overlap with the allocation pools - * *then* add the subnet to the cache - */ - if (subnetInterface.subnetExists(singleton.getID())) { - throw new BadRequestException("subnet UUID already exists"); - } - if (!networkInterface.networkExists(singleton.getNetworkUUID())) { - throw new ResourceNotFoundException("network UUID does not exist."); - } - if (!singleton.isValidCIDR()) { - throw new BadRequestException("invaild CIDR"); - } - if (!singleton.initDefaults()) { - throw new InternalServerErrorException("subnet object could not be initialized properly"); - } - if (singleton.gatewayIP_Pool_overlap()) { - throw new ResourceConflictException("IP pool overlaps with gateway"); - } - Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronSubnetAware service = (INeutronSubnetAware) instance; - int status = service.canCreateSubnet(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - subnetInterface.addSubnet(singleton); - if (instances != null) { - for (Object instance : instances) { - INeutronSubnetAware service = (INeutronSubnetAware) instance; - service.neutronSubnetCreated(singleton); - } - } - } else { - List bulk = input.getBulk(); - Iterator i = bulk.iterator(); - HashMap testMap = new HashMap(); - Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this); - while (i.hasNext()) { - NeutronSubnet test = i.next(); - - /* - * Verify that the subnet doesn't already exist (Issue: is a deeper check necessary?) - * the specified network exists, the subnet has a valid network address, - * and that the gateway IP doesn't overlap with the allocation pools, - * and that the bulk request doesn't already contain a subnet with this id - */ - - if (!test.initDefaults()) { - throw new InternalServerErrorException("subnet object could not be initialized properly"); - } - if (subnetInterface.subnetExists(test.getID())) { - throw new BadRequestException("subnet UUID already exists"); - } - if (testMap.containsKey(test.getID())) { - throw new BadRequestException("subnet UUID already exists"); - } - testMap.put(test.getID(), test); - if (!networkInterface.networkExists(test.getNetworkUUID())) { - throw new ResourceNotFoundException("network UUID does not exist."); - } - if (!test.isValidCIDR()) { - throw new BadRequestException("Invalid CIDR"); - } - if (test.gatewayIP_Pool_overlap()) { - throw new ResourceConflictException("IP pool overlaps with gateway"); - } - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronSubnetAware service = (INeutronSubnetAware) instance; - int status = service.canCreateSubnet(test); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - } - - /* - * now, each element of the bulk request can be added to the cache - */ - i = bulk.iterator(); - while (i.hasNext()) { - NeutronSubnet test = i.next(); - subnetInterface.addSubnet(test); - if (instances != null) { - for (Object instance : instances) { - INeutronSubnetAware service = (INeutronSubnetAware) instance; - service.neutronSubnetCreated(test); - } - } - } - } - return Response.status(201).entity(input).build(); - } - - /** - * Updates a Subnet */ - - @Path("{subnetUUID}") - @PUT - @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_JSON }) - //@TypeHint(OpenStackSubnets.class) - @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), - @ResponseCode(code = 400, condition = "Bad Request"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 403, condition = "Forbidden"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response updateSubnet( - @PathParam("subnetUUID") String subnetUUID, final NeutronSubnetRequest input - ) { - INeutronSubnetCRUD subnetInterface = NeutronCRUDInterfaces.getINeutronSubnetCRUD( this); - if (subnetInterface == null) { - throw new ServiceUnavailableException("Subnet CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the subnet exists and there is only one delta provided - */ - if (!subnetInterface.subnetExists(subnetUUID)) { - throw new ResourceNotFoundException("subnet UUID does not exist."); - } - if (!input.isSingleton()) { - throw new BadRequestException("Only singleton edit supported"); - } - NeutronSubnet delta = input.getSingleton(); - NeutronSubnet original = subnetInterface.getSubnet(subnetUUID); - - /* - * updates restricted by Neutron - */ - if (delta.getID() != null || delta.getTenantID() != null || - delta.getIpVersion() != null || delta.getCidr() != null || - delta.getAllocationPools() != null) { - throw new BadRequestException("Attribute edit blocked by Neutron"); - } - - Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronSubnetAware service = (INeutronSubnetAware) instance; - int status = service.canUpdateSubnet(delta, original); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * update the object and return it - */ - subnetInterface.updateSubnet(subnetUUID, delta); - NeutronSubnet updatedSubnet = subnetInterface.getSubnet(subnetUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronSubnetAware service = (INeutronSubnetAware) instance; - service.neutronSubnetUpdated(updatedSubnet); - } - } - return Response.status(200).entity( - new NeutronSubnetRequest(subnetInterface.getSubnet(subnetUUID))).build(); - } - - /** - * Deletes a Subnet */ - - @Path("{subnetUUID}") - @DELETE - @StatusCodes({ - @ResponseCode(code = 204, condition = "No Content"), - @ResponseCode(code = 401, condition = "Unauthorized"), - @ResponseCode(code = 404, condition = "Not Found"), - @ResponseCode(code = 409, condition = "Conflict"), - @ResponseCode(code = 501, condition = "Not Implemented") }) - public Response deleteSubnet( - @PathParam("subnetUUID") String subnetUUID) { - INeutronSubnetCRUD subnetInterface = NeutronCRUDInterfaces.getINeutronSubnetCRUD( this); - if (subnetInterface == null) { - throw new ServiceUnavailableException("Network CRUD Interface " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - /* - * verify the subnet exists and it isn't currently in use - */ - if (!subnetInterface.subnetExists(subnetUUID)) { - throw new ResourceNotFoundException("subnet UUID does not exist."); - } - if (subnetInterface.subnetInUse(subnetUUID)) { - return Response.status(409).build(); - } - NeutronSubnet singleton = subnetInterface.getSubnet(subnetUUID); - Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this); - if (instances != null) { - if (instances.length > 0) { - for (Object instance : instances) { - INeutronSubnetAware service = (INeutronSubnetAware) instance; - int status = service.canDeleteSubnet(singleton); - if (status < 200 || status > 299) { - return Response.status(status).build(); - } - } - } else { - throw new ServiceUnavailableException("No providers registered. Please try again later"); - } - } else { - throw new ServiceUnavailableException("Couldn't get providers list. Please try again later"); - } - - /* - * remove it and return 204 status - */ - subnetInterface.removeSubnet(subnetUUID); - if (instances != null) { - for (Object instance : instances) { - INeutronSubnetAware service = (INeutronSubnetAware) instance; - service.neutronSubnetDeleted(singleton); - } - } - return Response.status(204).build(); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronUtil.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronUtil.java deleted file mode 100644 index 481d95a89d..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronUtil.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class NeutronUtil { - private static final Logger logger = LoggerFactory - .getLogger(NeutronUtil.class); - public static Object[] getInstances(Class clazz,Object bundle) { - Object instances[] = null; - try { - BundleContext bCtx = FrameworkUtil.getBundle(bundle.getClass()) - .getBundleContext(); - - ServiceReference[] services = null; - services = bCtx.getServiceReferences(clazz.getName(), - null); - if (services != null) { - instances = new Object[services.length]; - for (int i = 0; i < services.length; i++) { - instances[i] = bCtx.getService(services[i]); - } - } - } catch (Exception e) { - logger.error("Instance reference is NULL"); - } - return instances; - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java deleted file mode 100644 index 25b5da1384..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Authors : Dave Tucker - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import javax.ws.rs.core.UriInfo; - -import org.opendaylight.controller.networkconfig.neutron.INeutronObject; -import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork; -import org.opendaylight.controller.networkconfig.neutron.NeutronPort; -import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet; - -public class PaginatedRequestFactory { - private static final Comparator NEUTRON_OBJECT_COMPARATOR = new Comparator() { - @Override - public int compare(INeutronObject o1, INeutronObject o2) { - return o1.getID().compareTo(o2.getID()); - } - }; - - public static class PaginationResults { - List collection; - List links; - - public PaginationResults(List collection, List links) { - this.collection = collection; - this.links = links; - } - } - - private static final class MarkerObject implements INeutronObject { - private final String id; - - MarkerObject(String id) { - this.id = id; - } - - @Override - public String getID() { - return id; - } - - @Override - public void setID(String id) { - throw new UnsupportedOperationException("Marker has constant ID"); - } - } - - /* - * SuppressWarnings is needed because the compiler does not understand that we - * are actually safe here. - * - * FIXME: the only caller performs a cast back, so this is not actually necessary. - */ - @SuppressWarnings("unchecked") - public static INeutronRequest createRequest(Integer limit, String marker, - Boolean pageReverse, - UriInfo uriInfo, - List collection, - Class clazz) { - PaginationResults results = _paginate(limit, marker, pageReverse, uriInfo, collection); - - if (clazz.equals(NeutronNetwork.class)){ - return (INeutronRequest) new NeutronNetworkRequest((List) results.collection, results.links); - } - if (clazz.equals(NeutronSubnet.class)){ - return (INeutronRequest) new NeutronSubnetRequest((List) results.collection, results.links); - } - if (clazz.equals(NeutronPort.class)){ - return (INeutronRequest) new NeutronPortRequest((List) results.collection, results.links); - } - return null; - } - - private static PaginationResults _paginate(Integer limit, String marker, Boolean pageReverse, UriInfo uriInfo, List collection) { - List links = new ArrayList<>(); - final int startPos; - String startMarker; - String endMarker; - Boolean firstPage = false; - Boolean lastPage = false; - - Collections.sort(collection, NEUTRON_OBJECT_COMPARATOR); - - if (marker != null) { - int offset = Collections.binarySearch(collection, new MarkerObject(marker), NEUTRON_OBJECT_COMPARATOR); - if (offset < 0) { - throw new ResourceNotFoundException("UUID for marker: " + marker + " could not be found"); - } - - if (!pageReverse) { - startPos = offset + 1; - } - else { - startPos = offset - limit; - } - } - else { - startPos = 0; - } - - if (startPos == 0){ - firstPage = true; - } - - if (startPos + limit >= collection.size()) { - collection = collection.subList(startPos, collection.size()); - startMarker = collection.get(0).getID(); - endMarker = collection.get(collection.size() - 1).getID(); - lastPage = true; - } - else if (startPos < 0) { - if (startPos + limit > 0) { - collection = collection.subList(0, startPos + limit); - startMarker = collection.get(0).getID(); - endMarker = collection.get(collection.size() - 1).getID(); - firstPage = true; - } - else { - throw new BadRequestException("Requested page is out of bounds. Please check the supplied limit and marker"); - } - } - else { - collection = collection.subList(startPos, startPos + limit); - startMarker = collection.get(0).getID(); - endMarker = collection.get(limit-1).getID(); - } - - if (!lastPage) { - NeutronPageLink next = new NeutronPageLink(); - next.setRef("next"); - next.setHref(uriInfo.getAbsolutePath().toString() + "?limit=" + limit.toString() + "&marker=" + endMarker); - links.add(next); - } - - if (!firstPage) { - NeutronPageLink previous = new NeutronPageLink(); - previous.setRef("previous"); - previous.setHref(uriInfo.getAbsolutePath().toString() + "?limit=" + limit.toString() + "&marker=" + startMarker + "&page_reverse=True"); - links.add(previous); - } - - return new PaginationResults(collection, links); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceConflictException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceConflictException.java deleted file mode 100644 index d9644dfe59..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceConflictException.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.MediaType; - -/** - * Status Code 409 (Conflict) - * - * The request could not be completed due to a conflict with the - * current state of the resource. This code is only allowed in - * situations where it is expected that the user might be able to - * resolve the conflict and resubmit the request. The response body - * SHOULD include enough information for the user to recognize the - * source of the conflict. Ideally, the response entity would include - * enough information for the user or user agent to fix the problem; - * however, that might not be possible and is not required. - * - * - * - */ -public class ResourceConflictException extends WebApplicationException { - private static final long serialVersionUID = 1L; - - public ResourceConflictException(String string) { - super(Response.status(Response.Status.CONFLICT).entity(string).type( - MediaType.TEXT_PLAIN).build()); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceNotFoundException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceNotFoundException.java deleted file mode 100644 index 3f39eb766c..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceNotFoundException.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.MediaType; - -/** - * Status Code 404 (Not Found) - * - * The server has not found anything matching the Request-URI. - * No indication is given of whether the condition is temporary or permanent. - * The 410 (Gone) status code SHOULD be used if the server knows, - * through some internally configurable mechanism, that an old resource - * is permanently unavailable and has no forwarding address. - * This status code is commonly used when the server does not wish to - * reveal exactly why the request has been refused, or when no other - * response is applicable. - * - * - * - */ -public class ResourceNotFoundException extends WebApplicationException { - private static final long serialVersionUID = 1L; - - public ResourceNotFoundException(String string) { - super(Response.status(Response.Status.NOT_FOUND).entity(string).type( - MediaType.TEXT_PLAIN).build()); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/RestMessages.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/RestMessages.java deleted file mode 100644 index e619974090..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/RestMessages.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -public enum RestMessages { - SUCCESS("Success"), NOCONTAINER("Container does not exist"), NOSUBNET("Subnet does not exist"), NOSTATICROUTE( - "Static Route does not exist"), NOHOST("Host does not exist"), NOFLOW("Flow does not exist"), NONODE( - "Node does not exist"), NOPOLICY("Policy does not exist"), NORESOURCE("Resource does not exist"), RESOURCECONFLICT( - "Operation failed due to Resource Conflict"), NODEFAULT("Container default is not a custom container"), DEFAULTDISABLED( - "Container(s) are configured. Container default is not operational"), NOTALLOWEDONDEFAULT( - "Container default is a static resource, no modification allowed on it"), UNKNOWNACTION("Unknown action"), INVALIDJSON( - "JSON message is invalid"), INVALIDADDRESS("Invalid InetAddress"), AVAILABLESOON( - "Resource is not implemented yet"), INTERNALERROR("Internal Error"), SERVICEUNAVAILABLE( - "Service is not available. Could be down for maintanence"), INVALIDDATA( - "Data is invalid or conflicts with URI"); - - private String message; - - private RestMessages(String msg) { - message = msg; - } - - @Override - public String toString() { - return message; - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ServiceUnavailableException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ServiceUnavailableException.java deleted file mode 100644 index 2d899a09e9..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ServiceUnavailableException.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron.northbound; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.MediaType; - -/** - * Status Code 503 (Service Unavailable Error) - * - * The server is currently unable to handle the request due to a temporary - * overloading or maintenance of the server. - * The implication is that this is a temporary condition which will be alleviated - * after some delay. - * - * - */ -public class ServiceUnavailableException extends WebApplicationException { - private static final long serialVersionUID = 1L; - - /** - * Constructor for the SERVICE_UNAVAILABLE custom handler - * - * @param string Error message to specify further the - * SERVICE_UNAVAILABLE response - * - */ - public ServiceUnavailableException(String string) { - super(Response.status(Response.Status.SERVICE_UNAVAILABLE).entity( - string).type(MediaType.TEXT_PLAIN).build()); - } -} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/resources/WEB-INF/web.xml b/opendaylight/networkconfiguration/neutron/northbound/src/main/resources/WEB-INF/web.xml deleted file mode 100644 index 08a314a42e..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/resources/WEB-INF/web.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - JAXRSNeutron - com.sun.jersey.spi.container.servlet.ServletContainer - - javax.ws.rs.Application - org.opendaylight.controller.networkconfig.neutron.northbound.NeutronNorthboundRSApplication - - - - com.sun.jersey.spi.container.ContainerRequestFilters - org.opendaylight.aaa.sts.TokenAuthFilter - - 1 - - - - JAXRSNeutron - /* - - - - cross-origin-restconf - org.eclipse.jetty.servlets.CrossOriginFilter - - allowedOrigins - * - - - allowedMethods - GET,POST,OPTIONS,DELETE,PUT,HEAD - - - allowedHeaders - origin, content-type, accept, authorization - - - - cross-origin-restconf - /* - - - - NB api - /* - POST - GET - PUT - PATCH - DELETE - HEAD - - - diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/resources/org/opendaylight/controller/networkconfig/neutron/northbound/jaxb.properties b/opendaylight/networkconfiguration/neutron/northbound/src/main/resources/org/opendaylight/controller/networkconfig/neutron/northbound/jaxb.properties deleted file mode 100644 index 5837a4c258..0000000000 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/resources/org/opendaylight/controller/networkconfig/neutron/northbound/jaxb.properties +++ /dev/null @@ -1 +0,0 @@ -javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/pom.xml b/opendaylight/networkconfiguration/neutron/pom.xml deleted file mode 100644 index ee206d4dbd..0000000000 --- a/opendaylight/networkconfiguration/neutron/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - 4.0.0 - - org.opendaylight.controller - commons.opendaylight - 1.5.0-SNAPSHOT - ../../commons/opendaylight - - networkconfig.neutron - 0.5.0-SNAPSHOT - bundle - - - commons-net - commons-net - - - org.osgi - org.osgi.core - - - org.slf4j - slf4j-api - - - - - - org.apache.felix - maven-bundle-plugin - true - - - * - - ${project.basedir}/src/main/resources/META-INF - - - - - - scm:git:ssh://git.opendaylight.org:29418/controller.git - scm:git:ssh://git.opendaylight.org:29418/controller.git - HEAD - https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main - - - - - opendaylight-release - ${nexusproxy}/repositories/${nexus.repository.release}/ - - - - opendaylight-snapshot - ${nexusproxy}/repositories/${nexus.repository.snapshot}/ - - - - website - ${sitedeploy} - - - diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallAware.java deleted file mode 100644 index e0a59091f1..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallAware.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of Firewall Rules needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronFirewallAware} - */ - -@Deprecated -public interface INeutronFirewallAware { - - /** - * Services provide this interface method to indicate if the specified firewall can be created - * - * @param firewall - * instance of proposed new Firewall object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateNeutronFirewall(NeutronFirewall firewall); - - /** - * Services provide this interface method for taking action after a firewall has been created - * - * @param firewall - * instance of new Firewall object - * @return void - */ - public void neutronFirewallCreated(NeutronFirewall firewall); - - /** - * Services provide this interface method to indicate if the specified firewall can be changed using the specified - * delta - * - * @param delta - * updates to the firewall object using patch semantics - * @param original - * instance of the Firewall object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateNeutronFirewall(NeutronFirewall delta, NeutronFirewall original); - - /** - * Services provide this interface method for taking action after a firewall has been updated - * - * @param firewall - * instance of modified Firewall object - * @return void - */ - public void neutronFirewallUpdated(NeutronFirewall firewall); - - /** - * Services provide this interface method to indicate if the specified firewall can be deleted - * - * @param firewall - * instance of the Firewall object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteNeutronFirewall(NeutronFirewall firewall); - - /** - * Services provide this interface method for taking action after a firewall has been deleted - * - * @param firewall - * instance of deleted Firewall object - * @return void - */ - public void neutronFirewallDeleted(NeutronFirewall firewall); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallCRUD.java deleted file mode 100644 index 5e7fbb2090..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallCRUD.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB OpenStack Firewall objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronFirewallCRUD} - */ - -@Deprecated -public interface INeutronFirewallCRUD { - /** - * Applications call this interface method to determine if a particular - *Firewall object exists - * - * @param uuid - * UUID of the Firewall object - * @return boolean - */ - - public boolean neutronFirewallExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * Firewall object exists - * - * @param uuid - * UUID of the Firewall object - * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronFirewall} - * OpenStackFirewall class - */ - - public NeutronFirewall getNeutronFirewall(String uuid); - - /** - * Applications call this interface method to return all Firewall objects - * - * @return List of OpenStackNetworks objects - */ - - public List getAllNeutronFirewalls(); - - /** - * Applications call this interface method to add a Firewall object to the - * concurrent map - * - * @param input - * OpenStackNetwork object - * @return boolean on whether the object was added or not - */ - - public boolean addNeutronFirewall(NeutronFirewall input); - - /** - * Applications call this interface method to remove a Neutron Firewall object to the - * concurrent map - * - * @param uuid - * identifier for the Firewall object - * @return boolean on whether the object was removed or not - */ - - public boolean removeNeutronFirewall(String uuid); - - /** - * Applications call this interface method to edit a Firewall object - * - * @param uuid - * identifier of the Firewall object - * @param delta - * OpenStackFirewall object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateNeutronFirewall(String uuid, NeutronFirewall delta); - - /** - * Applications call this interface method to see if a MAC address is in use - * - * @param uuid - * identifier of the Firewall object - * @return boolean on whether the macAddress is already associated with a - * port or not - */ - - public boolean neutronFirewallInUse(String uuid); - -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallPolicyAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallPolicyAware.java deleted file mode 100644 index ba467834d4..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallPolicyAware.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of Firewall Policys needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronFirewallPolicyAware} - */ - -@Deprecated -public interface INeutronFirewallPolicyAware { - - /** - * Services provide this interface method to indicate if the specified firewallPolicy can be created - * - * @param firewallPolicy - * instance of proposed new Firewall Policy object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateNeutronFirewallPolicy(NeutronFirewallPolicy firewallPolicy); - - /** - * Services provide this interface method for taking action after a firewallPolicy has been created - * - * @param firewallPolicy - * instance of new Firewall Policy object - * @return void - */ - public void neutronFirewallPolicyCreated(NeutronFirewallPolicy firewallPolicy); - - /** - * Services provide this interface method to indicate if the specified firewallPolicy can be changed using the specified - * delta - * - * @param delta - * updates to the firewallPolicy object using patch semantics - * @param original - * instance of the Firewall Policy object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateNeutronFirewallPolicy(NeutronFirewallPolicy delta, NeutronFirewallPolicy original); - - /** - * Services provide this interface method for taking action after a firewallPolicy has been updated - * - * @param firewallPolicy - * instance of modified Firewall Policy object - * @return void - */ - public void neutronFirewallPolicyUpdated(NeutronFirewallPolicy firewallPolicy); - - /** - * Services provide this interface method to indicate if the specified firewallPolicy can be deleted - * - * @param firewallPolicy - * instance of the Firewall Policy object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteNeutronFirewallPolicy(NeutronFirewallPolicy firewallPolicy); - - /** - * Services provide this interface method for taking action after a firewallPolicy has been deleted - * - * @param firewallPolicy - * instance of deleted Firewall Policy object - * @return void - */ - public void neutronFirewallPolicyDeleted(NeutronFirewallPolicy firewallPolicy); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallPolicyCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallPolicyCRUD.java deleted file mode 100644 index f280ff2266..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallPolicyCRUD.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB OpenStack Firewall Policy objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronFirewallPolicyCRUD} - */ - -@Deprecated -public interface INeutronFirewallPolicyCRUD { - /** - * Applications call this interface method to determine if a particular - *FirewallPolicy object exists - * - * @param uuid - * UUID of the Firewall Policy object - * @return boolean - */ - - public boolean neutronFirewallPolicyExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * FirewallPolicy object exists - * - * @param uuid - * UUID of the Firewall Policy object - * @return {@link NeutronFirewallPolicy} - * OpenStackFirewallPolicy class - */ - - public NeutronFirewallPolicy getNeutronFirewallPolicy(String uuid); - - /** - * Applications call this interface method to return all Firewall Policy objects - * - * @return List of OpenStack Firewall Policy objects - */ - - public List getAllNeutronFirewallPolicies(); - - /** - * Applications call this interface method to add a Firewall Policy object to the - * concurrent map - * - * @param input - * OpenStackNetwork object - * @return boolean on whether the object was added or not - */ - - public boolean addNeutronFirewallPolicy(NeutronFirewallPolicy input); - - /** - * Applications call this interface method to remove a Neutron FirewallPolicy object to the - * concurrent map - * - * @param uuid - * identifier for the Firewall Policy object - * @return boolean on whether the object was removed or not - */ - - public boolean removeNeutronFirewallPolicy(String uuid); - - /** - * Applications call this interface method to edit a FirewallPolicy object - * - * @param uuid - * identifier of the Firewall Policy object - * @param delta - * OpenStackFirewallPolicy object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateNeutronFirewallPolicy(String uuid, NeutronFirewallPolicy delta); - - /** - * Applications call this interface method to see if a MAC address is in use - * - * @param uuid - * identifier of the Firewall Policy object - * @return boolean on whether the macAddress is already associated with a - * port or not - */ - - public boolean neutronFirewallPolicyInUse(String uuid); - -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallRuleAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallRuleAware.java deleted file mode 100644 index 5863cdd0dc..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallRuleAware.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of Firewall Rules needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronFirewallRuleAware} - */ - -@Deprecated -public interface INeutronFirewallRuleAware { - - /** - * Services provide this interface method to indicate if the specified firewallRule can be created - * - * @param firewallRule - * instance of proposed new Firewall Rule object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateNeutronFirewallRule(NeutronFirewallRule firewallRule); - - /** - * Services provide this interface method for taking action after a firewallRule has been created - * - * @param firewallRule - * instance of new Firewall Rule object - * @return void - */ - public void neutronFirewallRuleCreated(NeutronFirewallRule firewallRule); - - /** - * Services provide this interface method to indicate if the specified firewallRule can be changed using the specified - * delta - * - * @param delta - * updates to the firewallRule object using patch semantics - * @param original - * instance of the Firewall Rule object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateNeutronFirewallRule(NeutronFirewallRule delta, NeutronFirewallRule original); - - /** - * Services provide this interface method for taking action after a firewallRule has been updated - * - * @param firewallRule - * instance of modified Firewall Rule object - * @return void - */ - public void neutronFirewallRuleUpdated(NeutronFirewallRule firewallRule); - - /** - * Services provide this interface method to indicate if the specified firewallRule can be deleted - * - * @param firewallRule - * instance of the Firewall Rule object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteNeutronFirewallRule(NeutronFirewallRule firewallRule); - - /** - * Services provide this interface method for taking action after a firewallRule has been deleted - * - * @param firewallRule - * instance of deleted Firewall Rule object - * @return void - */ - public void neutronFirewallRuleDeleted(NeutronFirewallRule firewallRule); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallRuleCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallRuleCRUD.java deleted file mode 100644 index b0c8c613c1..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFirewallRuleCRUD.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB OpenStack Firewall Rule objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronFirewallRuleCRUD} - */ - -@Deprecated -public interface INeutronFirewallRuleCRUD { - /** - * Applications call this interface method to determine if a particular - *FirewallRule object exists - * - * @param uuid - * UUID of the Firewall Rule object - * @return boolean - */ - - public boolean neutronFirewallRuleExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * FirewallRule object exists - * - * @param uuid - * UUID of the Firewall Rule object - * @return {@link NeutronFirewallRule} - * OpenStackFirewall Rule class - */ - - public NeutronFirewallRule getNeutronFirewallRule(String uuid); - - /** - * Applications call this interface method to return all Firewall Rule objects - * - * @return List of OpenStackNetworks objects - */ - - public List getAllNeutronFirewallRules(); - - /** - * Applications call this interface method to add a Firewall Rule object to the - * concurrent map - * - * @param input - * OpenStackNetwork object - * @return boolean on whether the object was added or not - */ - - public boolean addNeutronFirewallRule(NeutronFirewallRule input); - - /** - * Applications call this interface method to remove a Neutron FirewallRule object to the - * concurrent map - * - * @param uuid - * identifier for the Firewall Rule object - * @return boolean on whether the object was removed or not - */ - - public boolean removeNeutronFirewallRule(String uuid); - - /** - * Applications call this interface method to edit a FirewallRule object - * - * @param uuid - * identifier of the Firewall Rule object - * @param delta - * OpenStackFirewallRule object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateNeutronFirewallRule(String uuid, NeutronFirewallRule delta); - - /** - * Applications call this interface method to see if a MAC address is in use - * - * @param uuid - * identifier of the Firewall Rule object - * @return boolean on whether the macAddress is already associated with a - * port or not - */ - - public boolean neutronFirewallRuleInUse(String uuid); - -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPAware.java deleted file mode 100644 index 0a6c76ccb8..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPAware.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of Neutron FloatingIPs needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronFloatingIPAware} - */ - -@Deprecated -public interface INeutronFloatingIPAware { - - /** - * Services provide this interface method to indicate if the specified floatingIP can be created - * - * @param floatingIP - * instance of proposed new Neutron FloatingIP object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateFloatingIP(NeutronFloatingIP floatingIP); - - /** - * Services provide this interface method for taking action after a floatingIP has been created - * - * @param floatingIP - * instance of new Neutron FloatingIP object - * @return void - */ - public void neutronFloatingIPCreated(NeutronFloatingIP floatingIP); - - /** - * Services provide this interface method to indicate if the specified floatingIP can be changed using the specified - * delta - * - * @param delta - * updates to the floatingIP object using patch semantics - * @param floatingIP - * instance of the Neutron FloatingIP object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateFloatingIP(NeutronFloatingIP delta, NeutronFloatingIP original); - - /** - * Services provide this interface method for taking action after a floatingIP has been updated - * - * @param floatingIP - * instance of modified Neutron FloatingIP object - * @return void - */ - public void neutronFloatingIPUpdated(NeutronFloatingIP floatingIP); - - /** - * Services provide this interface method to indicate if the specified floatingIP can be deleted - * - * @param floatingIP - * instance of the Neutron FloatingIP object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteFloatingIP(NeutronFloatingIP floatingIP); - - /** - * Services provide this interface method for taking action after a floatingIP has been deleted - * - * @param floatingIP - * instance of deleted Neutron FloatingIP object - * @return void - */ - public void neutronFloatingIPDeleted(NeutronFloatingIP floatingIP); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPCRUD.java deleted file mode 100644 index 561e1dae73..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPCRUD.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB FloatingIP objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronFloatingIPCRUD} - */ - -@Deprecated -public interface INeutronFloatingIPCRUD { - /** - * Applications call this interface method to determine if a particular - * FloatingIP object exists - * - * @param uuid - * UUID of the FloatingIP object - * @return boolean - */ - - public boolean floatingIPExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * FloatingIP object exists - * - * @param uuid - * UUID of the FloatingIP object - * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP.OpenStackFloatingIPs} - * OpenStack FloatingIP class - */ - - public NeutronFloatingIP getFloatingIP(String uuid); - - /** - * Applications call this interface method to return all FloatingIP objects - * - * @return a Set of OpenStackFloatingIPs objects - */ - - public List getAllFloatingIPs(); - - /** - * Applications call this interface method to add a FloatingIP object to the - * concurrent map - * - * @param input - * OpenStackFloatingIP object - * @return boolean on whether the object was added or not - */ - - public boolean addFloatingIP(NeutronFloatingIP input); - - /** - * Applications call this interface method to remove a FloatingIP object to the - * concurrent map - * - * @param uuid - * identifier for the FloatingIP object - * @return boolean on whether the object was removed or not - */ - - public boolean removeFloatingIP(String uuid); - - /** - * Applications call this interface method to edit a FloatingIP object - * - * @param uuid - * identifier of the FloatingIP object - * @param delta - * OpenStackFloatingIP object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateFloatingIP(String uuid, NeutronFloatingIP delta); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerAware.java deleted file mode 100644 index 7202b01617..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerAware.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of LoadBalancer Rules needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronLoadBalancerAware} - */ - -@Deprecated -public interface INeutronLoadBalancerAware { - - /** - * Services provide this interface method to indicate if the specified loadBalancer can be created - * - * @param loadBalancer - * instance of proposed new LoadBalancer object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateNeutronLoadBalancer(NeutronLoadBalancer loadBalancer); - - /** - * Services provide this interface method for taking action after a loadBalancer has been created - * - * @param loadBalancer - * instance of new LoadBalancer object - * @return void - */ - public void neutronLoadBalancerCreated(NeutronLoadBalancer loadBalancer); - - /** - * Services provide this interface method to indicate if the specified loadBalancer can be changed using the specified - * delta - * - * @param delta - * updates to the loadBalancer object using patch semantics - * @param original - * instance of the LoadBalancer object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateNeutronLoadBalancer(NeutronLoadBalancer delta, NeutronLoadBalancer original); - - /** - * Services provide this interface method for taking action after a loadBalancer has been updated - * - * @param loadBalancer - * instance of modified LoadBalancer object - * @return void - */ - public void neutronLoadBalancerUpdated(NeutronLoadBalancer loadBalancer); - - /** - * Services provide this interface method to indicate if the specified loadBalancer can be deleted - * - * @param loadBalancer - * instance of the LoadBalancer object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteNeutronLoadBalancer(NeutronLoadBalancer loadBalancer); - - /** - * Services provide this interface method for taking action after a loadBalancer has been deleted - * - * @param loadBalancer - * instance of deleted LoadBalancer object - * @return void - */ - public void neutronLoadBalancerDeleted(NeutronLoadBalancer loadBalancer); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerCRUD.java deleted file mode 100644 index 394622fe6c..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerCRUD.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB OpenStack LoadBalancer objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronLoadBalancerCRUD} - */ - -@Deprecated -public interface INeutronLoadBalancerCRUD { - /** - * Applications call this interface method to determine if a particular - *LoadBalancer object exists - * - * @param uuid - * UUID of the LoadBalancer object - * @return boolean - */ - - public boolean neutronLoadBalancerExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * LoadBalancer object exists - * - * @param uuid - * UUID of the LoadBalancer object - * @return {@link NeutronLoadBalancer} - * OpenStackLoadBalancer class - */ - - public NeutronLoadBalancer getNeutronLoadBalancer(String uuid); - - /** - * Applications call this interface method to return all LoadBalancer objects - * - * @return List of OpenStackNetworks objects - */ - - public List getAllNeutronLoadBalancers(); - - /** - * Applications call this interface method to add a LoadBalancer object to the - * concurrent map - * - * @param input - * OpenStackNetwork object - * @return boolean on whether the object was added or not - */ - - public boolean addNeutronLoadBalancer(NeutronLoadBalancer input); - - /** - * Applications call this interface method to remove a Neutron LoadBalancer object to the - * concurrent map - * - * @param uuid - * identifier for the LoadBalancer object - * @return boolean on whether the object was removed or not - */ - - public boolean removeNeutronLoadBalancer(String uuid); - - /** - * Applications call this interface method to edit a LoadBalancer object - * - * @param uuid - * identifier of the LoadBalancer object - * @param delta - * OpenStackLoadBalancer object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateNeutronLoadBalancer(String uuid, NeutronLoadBalancer delta); - - /** - * Applications call this interface method to see if a MAC address is in use - * - * @param uuid - * identifier of the LoadBalancer object - * @return boolean on whether the macAddress is already associated with a - * port or not - */ - - public boolean neutronLoadBalancerInUse(String uuid); - -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerHealthMonitorAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerHealthMonitorAware.java deleted file mode 100644 index 2259435c9e..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerHealthMonitorAware.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of LoadBalancerHealthMonitor Rules needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronLoadBalancerHealthMonitorAware} - */ - -@Deprecated -public interface INeutronLoadBalancerHealthMonitorAware { - - /** - * Services provide this interface method to indicate if the specified loadBalancerHealthMonitor can be created - * - * @param loadBalancerHealthMonitor - * instance of proposed new LoadBalancerHealthMonitor object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateNeutronLoadBalancerHealthMonitor(NeutronLoadBalancerHealthMonitor loadBalancerHealthMonitor); - - /** - * Services provide this interface method for taking action after a loadBalancerHealthMonitor has been created - * - * @param loadBalancerHealthMonitor - * instance of new LoadBalancerHealthMonitor object - * @return void - */ - public void neutronLoadBalancerHealthMonitorCreated(NeutronLoadBalancerHealthMonitor loadBalancerHealthMonitor); - - /** - * Services provide this interface method to indicate if the specified loadBalancerHealthMonitor can be changed using the specified - * delta - * - * @param delta - * updates to the loadBalancerHealthMonitor object using patch semantics - * @param original - * instance of the LoadBalancerHealthMonitor object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateNeutronLoadBalancerHealthMonitor(NeutronLoadBalancerHealthMonitor delta, - NeutronLoadBalancerHealthMonitor original); - - /** - * Services provide this interface method for taking action after a loadBalancerHealthMonitor has been updated - * - * @param loadBalancerHealthMonitor - * instance of modified LoadBalancerHealthMonitor object - * @return void - */ - public void neutronLoadBalancerHealthMonitorUpdated(NeutronLoadBalancerHealthMonitor loadBalancerHealthMonitor); - - /** - * Services provide this interface method to indicate if the specified loadBalancerHealthMonitor can be deleted - * - * @param loadBalancerHealthMonitor - * instance of the LoadBalancerHealthMonitor object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteNeutronLoadBalancerHealthMonitor(NeutronLoadBalancerHealthMonitor loadBalancerHealthMonitor); - - /** - * Services provide this interface method for taking action after a loadBalancerHealthMonitor has been deleted - * - * @param loadBalancerHealthMonitor - * instance of deleted LoadBalancerHealthMonitor object - * @return void - */ - public void neutronLoadBalancerHealthMonitorDeleted(NeutronLoadBalancerHealthMonitor loadBalancerHealthMonitor); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerHealthMonitorCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerHealthMonitorCRUD.java deleted file mode 100644 index f7b11a53aa..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerHealthMonitorCRUD.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB OpenStack LoadBalancerHealthMonitor objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronLoadBalancerHealthMonitorCRUD} - */ - -@Deprecated -public interface INeutronLoadBalancerHealthMonitorCRUD { - /** - * Applications call this interface method to determine if a particular - *LoadBalancerHealthMonitor object exists - * - * @param uuid - * UUID of the LoadBalancerHealthMonitor object - * @return boolean - */ - - public boolean neutronLoadBalancerHealthMonitorExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * LoadBalancerHealthMonitor object exists - * - * @param uuid - * UUID of the LoadBalancerHealthMonitor object - * @return {@link NeutronLoadBalancerHealthMonitor} - * OpenStackLoadBalancerHealthMonitor class - */ - - public NeutronLoadBalancerHealthMonitor getNeutronLoadBalancerHealthMonitor(String uuid); - - /** - * Applications call this interface method to return all LoadBalancerHealthMonitor objects - * - * @return List of OpenStackNetworks objects - */ - - public List getAllNeutronLoadBalancerHealthMonitors(); - - /** - * Applications call this interface method to add a LoadBalancerHealthMonitor object to the - * concurrent map - * - * @param input - * OpenStackNetwork object - * @return boolean on whether the object was added or not - */ - - public boolean addNeutronLoadBalancerHealthMonitor(NeutronLoadBalancerHealthMonitor input); - - /** - * Applications call this interface method to remove a Neutron LoadBalancerHealthMonitor object to the - * concurrent map - * - * @param uuid - * identifier for the LoadBalancerHealthMonitor object - * @return boolean on whether the object was removed or not - */ - - public boolean removeNeutronLoadBalancerHealthMonitor(String uuid); - - /** - * Applications call this interface method to edit a LoadBalancerHealthMonitor object - * - * @param uuid - * identifier of the LoadBalancerHealthMonitor object - * @param delta - * OpenStackLoadBalancerHealthMonitor object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateNeutronLoadBalancerHealthMonitor(String uuid, NeutronLoadBalancerHealthMonitor delta); - - /** - * Applications call this interface method to see if a MAC address is in use - * - * @param uuid - * identifier of the LoadBalancerHealthMonitor object - * @return boolean on whether the macAddress is already associated with a - * port or not - */ - - public boolean neutronLoadBalancerHealthMonitorInUse(String uuid); - -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerListenerAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerListenerAware.java deleted file mode 100644 index 2043878905..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerListenerAware.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of LoadBalancerListener Rules needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronLoadBalancerListenerAware} - */ - -@Deprecated -public interface INeutronLoadBalancerListenerAware { - - /** - * Services provide this interface method to indicate if the specified loadBalancerListener can be created - * - * @param loadBalancerListener - * instance of proposed new LoadBalancerListener object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateNeutronLoadBalancerListener(NeutronLoadBalancerListener loadBalancerListener); - - /** - * Services provide this interface method for taking action after a loadBalancerListener has been created - * - * @param loadBalancerListener - * instance of new LoadBalancerListener object - * @return void - */ - public void neutronLoadBalancerListenerCreated(NeutronLoadBalancerListener loadBalancerListener); - - /** - * Services provide this interface method to indicate if the specified loadBalancerListener can be changed using the specified - * delta - * - * @param delta - * updates to the loadBalancerListener object using patch semantics - * @param original - * instance of the LoadBalancerListener object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateNeutronLoadBalancerListener(NeutronLoadBalancerListener delta, - NeutronLoadBalancerListener original); - - /** - * Services provide this interface method for taking action after a loadBalancerListener has been updated - * - * @param loadBalancerListener - * instance of modified LoadBalancerListener object - * @return void - */ - public void neutronLoadBalancerListenerUpdated(NeutronLoadBalancerListener loadBalancerListener); - - /** - * Services provide this interface method to indicate if the specified loadBalancerListener can be deleted - * - * @param loadBalancerListener - * instance of the LoadBalancerListener object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteNeutronLoadBalancerListener(NeutronLoadBalancerListener loadBalancerListener); - - /** - * Services provide this interface method for taking action after a loadBalancerListener has been deleted - * - * @param loadBalancerListener - * instance of deleted LoadBalancerListener object - * @return void - */ - public void neutronLoadBalancerListenerDeleted(NeutronLoadBalancerListener loadBalancerListener); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerListenerCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerListenerCRUD.java deleted file mode 100644 index 7336c76cd3..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerListenerCRUD.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB OpenStack LoadBalancerListener objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronLoadBalancerListenerCRUD} - */ - -@Deprecated -public interface INeutronLoadBalancerListenerCRUD { - /** - * Applications call this interface method to determine if a particular - *LoadBalancerListener object exists - * - * @param uuid - * UUID of the LoadBalancerListener object - * @return boolean - */ - - public boolean neutronLoadBalancerListenerExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * LoadBalancerListener object exists - * - * @param uuid - * UUID of the LoadBalancerListener object - * @return {@link NeutronLoadBalancerListener} - * OpenStackLoadBalancerListener class - */ - - public NeutronLoadBalancerListener getNeutronLoadBalancerListener(String uuid); - - /** - * Applications call this interface method to return all LoadBalancerListener objects - * - * @return List of OpenStackNetworks objects - */ - - public List getAllNeutronLoadBalancerListeners(); - - /** - * Applications call this interface method to add a LoadBalancerListener object to the - * concurrent map - * - * @param input - * OpenStackNetwork object - * @return boolean on whether the object was added or not - */ - - public boolean addNeutronLoadBalancerListener(NeutronLoadBalancerListener input); - - /** - * Applications call this interface method to remove a Neutron LoadBalancerListener object to the - * concurrent map - * - * @param uuid - * identifier for the LoadBalancerListener object - * @return boolean on whether the object was removed or not - */ - - public boolean removeNeutronLoadBalancerListener(String uuid); - - /** - * Applications call this interface method to edit a LoadBalancerListener object - * - * @param uuid - * identifier of the LoadBalancerListener object - * @param delta - * OpenStackLoadBalancerListener object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateNeutronLoadBalancerListener(String uuid, NeutronLoadBalancerListener delta); - - /** - * Applications call this interface method to see if a MAC address is in use - * - * @param uuid - * identifier of the LoadBalancerListener object - * @return boolean on whether the macAddress is already associated with a - * port or not - */ - - public boolean neutronLoadBalancerListenerInUse(String uuid); - -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolAware.java deleted file mode 100644 index 851df355bb..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolAware.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of LoadBalancerPool Rules needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronLoadBalancerPoolAware} - */ - -@Deprecated -public interface INeutronLoadBalancerPoolAware { - - /** - * Services provide this interface method to indicate if the specified loadBalancerPool can be created - * - * @param loadBalancerPool - * instance of proposed new LoadBalancerPool object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateNeutronLoadBalancerPool(NeutronLoadBalancerPool loadBalancerPool); - - /** - * Services provide this interface method for taking action after a loadBalancerPool has been created - * - * @param loadBalancerPool - * instance of new LoadBalancerPool object - * @return void - */ - public void neutronLoadBalancerPoolCreated(NeutronLoadBalancerPool loadBalancerPool); - - /** - * Services provide this interface method to indicate if the specified loadBalancerPool can be changed using the specified - * delta - * - * @param delta - * updates to the loadBalancerPool object using patch semantics - * @param original - * instance of the LoadBalancerPool object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateNeutronLoadBalancerPool(NeutronLoadBalancerPool delta, NeutronLoadBalancerPool original); - - /** - * Services provide this interface method for taking action after a loadBalancerPool has been updated - * - * @param loadBalancerPool - * instance of modified LoadBalancerPool object - * @return void - */ - public void neutronLoadBalancerPoolUpdated(NeutronLoadBalancerPool loadBalancerPool); - - /** - * Services provide this interface method to indicate if the specified loadBalancerPool can be deleted - * - * @param loadBalancerPool - * instance of the LoadBalancerPool object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteNeutronLoadBalancerPool(NeutronLoadBalancerPool loadBalancerPool); - - /** - * Services provide this interface method for taking action after a loadBalancerPool has been deleted - * - * @param loadBalancerPool - * instance of deleted LoadBalancerPool object - * @return void - */ - public void neutronLoadBalancerPoolDeleted(NeutronLoadBalancerPool loadBalancerPool); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolCRUD.java deleted file mode 100644 index 7fabcd9242..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolCRUD.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB OpenStack LoadBalancerPool objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronLoadBalancerPoolCRUD} - */ - -@Deprecated -public interface INeutronLoadBalancerPoolCRUD { - /** - * Applications call this interface method to determine if a particular - *LoadBalancerPool object exists - * - * @param uuid - * UUID of the LoadBalancerPool object - * @return boolean - */ - - public boolean neutronLoadBalancerPoolExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * LoadBalancerPool object exists - * - * @param uuid - * UUID of the LoadBalancerPool object - * @return {@link NeutronLoadBalancerPool} - * OpenStackLoadBalancerPool class - */ - - public NeutronLoadBalancerPool getNeutronLoadBalancerPool(String uuid); - - /** - * Applications call this interface method to return all LoadBalancerPool objects - * - * @return List of OpenStackNetworks objects - */ - - public List getAllNeutronLoadBalancerPools(); - - /** - * Applications call this interface method to add a LoadBalancerPool object to the - * concurrent map - * - * @param input - * OpenStackNetwork object - * @return boolean on whether the object was added or not - */ - - public boolean addNeutronLoadBalancerPool(NeutronLoadBalancerPool input); - - /** - * Applications call this interface method to remove a Neutron LoadBalancerPool object to the - * concurrent map - * - * @param uuid - * identifier for the LoadBalancerPool object - * @return boolean on whether the object was removed or not - */ - - public boolean removeNeutronLoadBalancerPool(String uuid); - - /** - * Applications call this interface method to edit a LoadBalancerPool object - * - * @param uuid - * identifier of the LoadBalancerPool object - * @param delta - * OpenStackLoadBalancerPool object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateNeutronLoadBalancerPool(String uuid, NeutronLoadBalancerPool delta); - - /** - * Applications call this interface method to see if a MAC address is in use - * - * @param uuid - * identifier of the LoadBalancerPool object - * @return boolean on whether the macAddress is already associated with a - * port or not - */ - - public boolean neutronLoadBalancerPoolInUse(String uuid); - -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolMemberAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolMemberAware.java deleted file mode 100644 index 88a16cae4d..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolMemberAware.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods for CRUD of NB OpenStack INeutronLoadBalancerPoolMemberAware objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronLoadBalancerPoolMemberAware} - */ - -@Deprecated -public interface INeutronLoadBalancerPoolMemberAware { - - - /** - * Services provide this interface method to indicate if the specified loadBalancerPoolMember can be created - * - * @param loadBalancerPoolMember - * instance of proposed new LoadBalancerPool object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateNeutronLoadBalancerPoolMember(NeutronLoadBalancerPoolMember loadBalancerPoolMember); - - /** - * Services provide this interface method for taking action after a loadBalancerPoolMember has been created - * - * @param loadBalancerPoolMember - * instance of new LoadBalancerPool object - * @return void - */ - public void neutronLoadBalancerPoolMemberCreated(NeutronLoadBalancerPoolMember loadBalancerPoolMember); - - /** - * Services provide this interface method to indicate if the specified loadBalancerPoolMember can be changed using the specified - * delta - * - * @param delta - * updates to the loadBalancerPoolMember object using patch semantics - * @param original - * instance of the LoadBalancerPool object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateNeutronLoadBalancerPoolMember(NeutronLoadBalancerPoolMember delta, - NeutronLoadBalancerPoolMember original); - - /** - * Services provide this interface method for taking action after a loadBalancerPoolMember has been updated - * - * @param loadBalancerPoolMember - * instance of modified LoadBalancerPool object - * @return void - */ - public void neutronLoadBalancerPoolMemberUpdated(NeutronLoadBalancerPoolMember loadBalancerPoolMember); - - /** - * Services provide this interface method to indicate if the specified loadBalancerPoolMember can be deleted - * - * @param loadBalancerPoolMember - * instance of the LoadBalancerPool object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteNeutronLoadBalancerPoolMember(NeutronLoadBalancerPoolMember loadBalancerPoolMember); - - /** - * Services provide this interface method for taking action after a loadBalancerPoolMember has been deleted - * - * @param loadBalancerPoolMember - * instance of deleted LoadBalancerPool object - * @return void - */ - public void neutronLoadBalancerPoolMemberDeleted(NeutronLoadBalancerPoolMember loadBalancerPoolMember); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolMemberCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolMemberCRUD.java deleted file mode 100644 index 99b32169e1..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolMemberCRUD.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB OpenStack INeutronLoadBalancerPoolMemberCRUD objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronLoadBalancerPoolMemberCRUD} - */ - -@Deprecated -public interface INeutronLoadBalancerPoolMemberCRUD { - - /** - * Applications call this interface method to determine if a particular - *NeutronLoadBalancerPoolMember object exists - * - * @param uuid - * UUID of the NeutronLoadBalancerPoolMember object - * @return boolean - */ - - public boolean neutronLoadBalancerPoolMemberExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * NeutronLoadBalancerPoolMember object exists - * - * @param uuid - * UUID of the NeutronLoadBalancerPoolMember object - * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember} - * OpenStackNeutronLoadBalancerPoolMember class - */ - - public NeutronLoadBalancerPoolMember getNeutronLoadBalancerPoolMember(String uuid); - - /** - * Applications call this interface method to return all NeutronLoadBalancerPoolMember objects - * - * @return List of OpenStackNetworks objects - */ - - public List getAllNeutronLoadBalancerPoolMembers(); - - /** - * Applications call this interface method to add a NeutronLoadBalancerPoolMember object to the - * concurrent map - * - * @param input - * OpenStackNetwork object - * @return boolean on whether the object was added or not - */ - - public boolean addNeutronLoadBalancerPoolMember(NeutronLoadBalancerPoolMember input); - - /** - * Applications call this interface method to remove a Neutron NeutronLoadBalancerPoolMember object to the - * concurrent map - * - * @param uuid - * identifier for the NeutronLoadBalancerPoolMember object - * @return boolean on whether the object was removed or not - */ - - public boolean removeNeutronLoadBalancerPoolMember(String uuid); - - /** - * Applications call this interface method to edit a NeutronLoadBalancerPoolMember object - * - * @param uuid - * identifier of the NeutronLoadBalancerPoolMember object - * @param delta - * OpenStackNeutronLoadBalancerPoolMember object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateNeutronLoadBalancerPoolMember(String uuid, NeutronLoadBalancerPoolMember delta); - - /** - * Applications call this interface method to see if a MAC address is in use - * - * @param uuid - * identifier of the NeutronLoadBalancerPoolMember object - * @return boolean on whether the macAddress is already associated with a - * port or not - */ - - public boolean neutronLoadBalancerPoolMemberInUse(String uuid); - -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolMemberRequest.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolMemberRequest.java deleted file mode 100644 index d8c5eb9e93..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronLoadBalancerPoolMemberRequest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import javax.xml.bind.annotation.XmlElement; -import java.util.List; - -public class INeutronLoadBalancerPoolMemberRequest { - - /** - * See OpenStack Network API v2.0 Reference for description of - * http://docs.openstack.org/api/openstack-network/2.0/content/ - */ - - @XmlElement(name="member") - NeutronLoadBalancerPoolMember singletonLoadBalancerPoolMember; - - @XmlElement(name="members") - List bulkRequest; - - INeutronLoadBalancerPoolMemberRequest() { - } - - public INeutronLoadBalancerPoolMemberRequest(List bulk) { - bulkRequest = bulk; - singletonLoadBalancerPoolMember = null; - } - - INeutronLoadBalancerPoolMemberRequest(NeutronLoadBalancerPoolMember group) { - singletonLoadBalancerPoolMember = group; - } - - public List getBulk() { - return bulkRequest; - } - - public NeutronLoadBalancerPoolMember getSingleton() { - return singletonLoadBalancerPoolMember; - } - - public boolean isSingleton() { - return (singletonLoadBalancerPoolMember != null); - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkAware.java deleted file mode 100644 index f5936a63a5..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkAware.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of Neutron Networks needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronNetworkAware} - */ - -@Deprecated -public interface INeutronNetworkAware { - - /** - * Services provide this interface method to indicate if the specified network can be created - * - * @param network - * instance of proposed new Neutron Network object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateNetwork(NeutronNetwork network); - - /** - * Services provide this interface method for taking action after a network has been created - * - * @param network - * instance of new Neutron Network object - * @return void - */ - public void neutronNetworkCreated(NeutronNetwork network); - - /** - * Services provide this interface method to indicate if the specified network can be changed using the specified - * delta - * - * @param delta - * updates to the network object using patch semantics - * @param network - * instance of the Neutron Network object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateNetwork(NeutronNetwork delta, NeutronNetwork original); - - /** - * Services provide this interface method for taking action after a network has been updated - * - * @param network - * instance of modified Neutron Network object - * @return void - */ - public void neutronNetworkUpdated(NeutronNetwork network); - - /** - * Services provide this interface method to indicate if the specified network can be deleted - * - * @param network - * instance of the Neutron Network object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteNetwork(NeutronNetwork network); - - /** - * Services provide this interface method for taking action after a network has been deleted - * - * @param network - * instance of deleted Neutron Network object - * @return void - */ - public void neutronNetworkDeleted(NeutronNetwork network); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkCRUD.java deleted file mode 100644 index 7f86536fd9..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkCRUD.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB network objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronNetworkCRUD} - */ - -@Deprecated -public interface INeutronNetworkCRUD { - /** - * Applications call this interface method to determine if a particular - * Network object exists - * - * @param uuid - * UUID of the Network object - * @return boolean - */ - - public boolean networkExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * Network object exists - * - * @param uuid - * UUID of the Network object - * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronNetwork.OpenStackNetworks} - * OpenStack Network class - */ - - public NeutronNetwork getNetwork(String uuid); - - /** - * Applications call this interface method to return all Network objects - * - * @return List of OpenStackNetworks objects - */ - - public List getAllNetworks(); - - /** - * Applications call this interface method to add a Network object to the - * concurrent map - * - * @param input - * OpenStackNetwork object - * @return boolean on whether the object was added or not - */ - - public boolean addNetwork(NeutronNetwork input); - - /** - * Applications call this interface method to remove a Network object to the - * concurrent map - * - * @param uuid - * identifier for the network object - * @return boolean on whether the object was removed or not - */ - - public boolean removeNetwork(String uuid); - - /** - * Applications call this interface method to edit a Network object - * - * @param uuid - * identifier of the network object - * @param delta - * OpenStackNetwork object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateNetwork(String uuid, NeutronNetwork delta); - - /** - * Applications call this interface method to determine if a Network object - * is use - * - * @param netUUID - * identifier of the network object - * - * @return boolean on whether the network is in use or not - */ - - public boolean networkInUse(String netUUID); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronObject.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronObject.java deleted file mode 100644 index e39c07eadc..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronObject.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Authors : Dave Tucker - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This class contains behaviour common to Neutron configuration objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronObject} - */ -@Deprecated -public interface INeutronObject { - public String getID(); - public void setID(String id); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortAware.java deleted file mode 100644 index 3a14c308a2..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortAware.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of Neutron Ports needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronPortAware} - */ - -@Deprecated -public interface INeutronPortAware { - - /** - * Services provide this interface method to indicate if the specified port can be created - * - * @param port - * instance of proposed new Neutron Port object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreatePort(NeutronPort port); - - /** - * Services provide this interface method for taking action after a port has been created - * - * @param port - * instance of new Neutron Port object - * @return void - */ - public void neutronPortCreated(NeutronPort port); - - /** - * Services provide this interface method to indicate if the specified port can be changed using the specified - * delta - * - * @param delta - * updates to the port object using patch semantics - * @param port - * instance of the Neutron Port object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdatePort(NeutronPort delta, NeutronPort original); - - /** - * Services provide this interface method for taking action after a port has been updated - * - * @param port - * instance of modified Neutron Port object - * @return void - */ - public void neutronPortUpdated(NeutronPort port); - - /** - * Services provide this interface method to indicate if the specified port can be deleted - * - * @param port - * instance of the Neutron Port object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeletePort(NeutronPort port); - - /** - * Services provide this interface method for taking action after a port has been deleted - * - * @param port - * instance of deleted Port Network object - * @return void - */ - public void neutronPortDeleted(NeutronPort port); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortCRUD.java deleted file mode 100644 index 58b007b65d..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortCRUD.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB Port objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronPortCRUD} - */ - -@Deprecated -public interface INeutronPortCRUD { - /** - * Applications call this interface method to determine if a particular - * Port object exists - * - * @param uuid - * UUID of the Port object - * @return boolean - */ - - public boolean portExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * Port object exists - * - * @param uuid - * UUID of the Port object - * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronPort.OpenStackPorts} - * OpenStack Port class - */ - - public NeutronPort getPort(String uuid); - - /** - * Applications call this interface method to return all Port objects - * - * @return List of OpenStackPorts objects - */ - - public List getAllPorts(); - - /** - * Applications call this interface method to add a Port object to the - * concurrent map - * - * @param input - * OpenStackPort object - * @return boolean on whether the object was added or not - */ - - public boolean addPort(NeutronPort input); - - /** - * Applications call this interface method to remove a Port object to the - * concurrent map - * - * @param uuid - * identifier for the Port object - * @return boolean on whether the object was removed or not - */ - - public boolean removePort(String uuid); - - /** - * Applications call this interface method to edit a Port object - * - * @param uuid - * identifier of the Port object - * @param delta - * OpenStackPort object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updatePort(String uuid, NeutronPort delta); - - /** - * Applications call this interface method to see if a MAC address is in use - * - * @param macAddress - * mac Address to be tested - * @return boolean on whether the macAddress is already associated with a - * port or not - */ - - public boolean macInUse(String macAddress); - - /** - * Applications call this interface method to retrieve the port associated with - * the gateway address of a subnet - * - * @param subnetUUID - * identifier of the subnet - * @return OpenStackPorts object if the port exists and null if it does not - */ - - public NeutronPort getGatewayPort(String subnetUUID); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterAware.java deleted file mode 100644 index f4c4434362..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterAware.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of Neutron Routers needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronRouterAware} - */ - -@Deprecated -public interface INeutronRouterAware { - - /** - * Services provide this interface method to indicate if the specified router can be created - * - * @param router - * instance of proposed new Neutron Router object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateRouter(NeutronRouter router); - - /** - * Services provide this interface method for taking action after a router has been created - * - * @param router - * instance of new Neutron Router object - * @return void - */ - public void neutronRouterCreated(NeutronRouter router); - - /** - * Services provide this interface method to indicate if the specified router can be changed using the specified - * delta - * - * @param delta - * updates to the router object using patch semantics - * @param router - * instance of the Neutron Router object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateRouter(NeutronRouter delta, NeutronRouter original); - - /** - * Services provide this interface method for taking action after a router has been updated - * - * @param router - * instance of modified Neutron Router object - * @return void - */ - public void neutronRouterUpdated(NeutronRouter router); - - /** - * Services provide this interface method to indicate if the specified router can be deleted - * - * @param router - * instance of the Neutron Router object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteRouter(NeutronRouter router); - - /** - * Services provide this interface method for taking action after a router has been deleted - * - * @param router - * instance of deleted Router Network object - * @return void - */ - public void neutronRouterDeleted(NeutronRouter router); - - /** - * Services provide this interface method to indicate if the specified interface can be attached to the specified route - * - * @param router - * instance of the base Neutron Router object - * @param routerInterface - * instance of the NeutronRouter_Interface to be attached to the router - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the attach operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canAttachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface); - - /** - * Services provide this interface method for taking action after an interface has been added to a router - * - * @param router - * instance of the base Neutron Router object - * @param routerInterface - * instance of the NeutronRouter_Interface being attached to the router - * @return void - */ - public void neutronRouterInterfaceAttached(NeutronRouter router, NeutronRouter_Interface routerInterface); - - /** - * Services provide this interface method to indicate if the specified interface can be detached from the specified router - * - * @param router - * instance of the base Neutron Router object - * @param routerInterface - * instance of the NeutronRouter_Interface to be detached to the router - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the detach operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDetachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface); - - /** - * Services provide this interface method for taking action after an interface has been removed from a router - * - * @param router - * instance of the base Neutron Router object - * @param routerInterface - * instance of the NeutronRouter_Interface being detached from the router - * @return void - */ - public void neutronRouterInterfaceDetached(NeutronRouter router, NeutronRouter_Interface routerInterface); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterCRUD.java deleted file mode 100644 index 37b2c940e0..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterCRUD.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB Router objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronRouterCRUD} - */ - -@Deprecated -public interface INeutronRouterCRUD { - /** - * Applications call this interface method to determine if a particular - * Router object exists - * - * @param uuid - * UUID of the Router object - * @return boolean - */ - - public boolean routerExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * Router object exists - * - * @param uuid - * UUID of the Router object - * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronRouter.OpenStackRouters} - * OpenStack Router class - */ - - public NeutronRouter getRouter(String uuid); - - /** - * Applications call this interface method to return all Router objects - * - * @return List of OpenStackRouters objects - */ - - public List getAllRouters(); - - /** - * Applications call this interface method to add a Router object to the - * concurrent map - * - * @param input - * OpenStackRouter object - * @return boolean on whether the object was added or not - */ - - public boolean addRouter(NeutronRouter input); - - /** - * Applications call this interface method to remove a Router object to the - * concurrent map - * - * @param uuid - * identifier for the Router object - * @return boolean on whether the object was removed or not - */ - - public boolean removeRouter(String uuid); - - /** - * Applications call this interface method to edit a Router object - * - * @param uuid - * identifier of the Router object - * @param delta - * OpenStackRouter object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateRouter(String uuid, NeutronRouter delta); - - /** - * Applications call this interface method to check if a router is in use - * - * @param uuid - * identifier of the Router object - * @return boolean on whether the router is in use or not - */ - - public boolean routerInUse(String routerUUID); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityGroupAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityGroupAware.java deleted file mode 100644 index b518924e19..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityGroupAware.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of Neutron Security Groups needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronSecurityGroupAware} - */ - -@Deprecated -public interface INeutronSecurityGroupAware { - - /** - * Services provide this interface method to indicate if the specified security group can be created - * - * @param securityGroup instance of proposed new Neutron Security Group object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateNeutronSecurityGroup(NeutronSecurityGroup securityGroup); - - /** - * Services provide this interface method for taking action after a security group has been created - * - * @param securityGroup instance of new Neutron Security Group object - * @return void - */ - public void neutronSecurityGroupCreated(NeutronSecurityGroup securityGroup); - - /** - * Services provide this interface method to indicate if the specified security group can be changed using the specified - * delta - * - * @param delta updates to the security group object using patch semantics - * @param original instance of the Neutron Security Group object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateNeutronSecurityGroup(NeutronSecurityGroup delta, NeutronSecurityGroup original); - - /** - * Services provide this interface method for taking action after a security group has been updated - * - * @param securityGroup instance of modified Neutron Security Group object - * @return void - */ - public void neutronSecurityGroupUpdated(NeutronSecurityGroup securityGroup); - - /** - * Services provide this interface method to indicate if the specified security group can be deleted - * - * @param securityGroup instance of the Neutron Security Group object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteNeutronSecurityGroup(NeutronSecurityGroup securityGroup); - - /** - * Services provide this interface method for taking action after a security group has been deleted - * - * @param securityGroup instance of deleted Neutron Security Group object - * @return void - */ - public void neutronSecurityGroupDeleted(NeutronSecurityGroup securityGroup); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityGroupCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityGroupCRUD.java deleted file mode 100644 index 6b20182eae..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityGroupCRUD.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB OpenStack Security Group objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronSecurityGroupCRUD} - */ - -@Deprecated -public interface INeutronSecurityGroupCRUD { - /** - * Applications call this interface method to determine if a particular - * Security Group object exists - * - * @param uuid UUID of the Security Group object - * @return boolean - */ - - public boolean neutronSecurityGroupExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * Security Group object exists - * - * @param uuid UUID of the Security Group object - * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronSecurityGroup.OpenStackSecurity Groups} - * OpenStack Security Group class - */ - - public NeutronSecurityGroup getNeutronSecurityGroup(String uuid); - - /** - * Applications call this interface method to return all Security Group objects - * - * @return List of OpenStackSecurity Groups objects - */ - - public List getAllNeutronSecurityGroups(); - - /** - * Applications call this interface method to add a Security Group object to the - * concurrent map - * - * @param input OpenStackSecurity Group object - * @return boolean on whether the object was added or not - */ - - public boolean addNeutronSecurityGroup(NeutronSecurityGroup input); - - /** - * Applications call this interface method to remove a Neutron Security Group object to the - * concurrent map - * - * @param uuid identifier for the security group object - * @return boolean on whether the object was removed or not - */ - - public boolean removeNeutronSecurityGroup(String uuid); - - /** - * Applications call this interface method to edit a Security Group object - * - * @param uuid identifier of the security group object - * @param delta OpenStackSecurity Group object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateNeutronSecurityGroup(String uuid, NeutronSecurityGroup delta); - - /** - * Applications call this interface method to see if a MAC address is in use - * - * @param uuid identifier of the security group object - * @return boolean on whether the Security Groups is already in use - */ - - public boolean neutronSecurityGroupInUse(String uuid); - -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityRuleAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityRuleAware.java deleted file mode 100644 index 3be9cc92b6..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityRuleAware.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods required to be aware of Neutron Security Rules - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronSecurityRuleAware} - */ - -@Deprecated -public interface INeutronSecurityRuleAware { - - /** - * Services provide this interface method to indicate if the specified security rule can be created - * - * @param securityRule instance of proposed new Neutron Security Rule object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateNeutronSecurityRule(NeutronSecurityRule securityRule); - - /** - * Services provide this interface method for taking action after a security rule has been created - * - * @param securityRule instance of new Neutron Security Rule object - * @return void - */ - public void neutronSecurityRuleCreated(NeutronSecurityRule securityRule); - - /** - * Services provide this interface method to indicate if the specified security rule can be changed using the specified - * delta - * - * @param delta updates to the security rule object using patch semantics - * @param original instance of the Neutron Security Rule object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateNeutronSecurityRule(NeutronSecurityRule delta, NeutronSecurityRule original); - - /** - * Services provide this interface method for taking action after a security rule has been updated - * - * @param securityRule instance of modified Neutron Security Rule object - * @return void - */ - public void neutronSecurityRuleUpdated(NeutronSecurityRule securityRule); - - /** - * Services provide this interface method to indicate if the specified security rule can be deleted - * - * @param securityRule instance of the Neutron Security Rule object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteNeutronSecurityRule(NeutronSecurityRule securityRule); - - /** - * Services provide this interface method for taking action after a security rule has been deleted - * - * @param securityRule instance of deleted Neutron Security Rule object - * @return void - */ - public void neutronSecurityRuleDeleted(NeutronSecurityRule securityRule); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityRuleCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityRuleCRUD.java deleted file mode 100644 index a5223b7e8d..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSecurityRuleCRUD.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB OpenStack Security Rule objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronSecurityRuleCRUD} - */ - -@Deprecated -public interface INeutronSecurityRuleCRUD { - /** - * Applications call this interface method to determine if a particular - * Security Rule object exists - * - * @param uuid UUID of theSecurity Rule object - * @return boolean - */ - - public boolean neutronSecurityRuleExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * Security Rule object exists - * - * @param uuid UUID of the security rule object - * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronSecurityRule.OpenStackNetworks} - * OpenStackSecurity Rule class - */ - - public NeutronSecurityRule getNeutronSecurityRule(String uuid); - - /** - * Applications call this interface method to return all Security Rule objects - * - * @return List of OpenStack SecurityRules objects - */ - - public List getAllNeutronSecurityRules(); - - /** - * Applications call this interface method to add a Security Rule object to the - * concurrent map - * - * @param input OpenStack security rule object - * @return boolean on whether the object was added or not - */ - - public boolean addNeutronSecurityRule(NeutronSecurityRule input); - - /** - * Applications call this interface method to remove a Neutron Security Rule object to the - * concurrent map - * - * @param uuid identifier for the security rule object - * @return boolean on whether the object was removed or not - */ - - public boolean removeNeutronSecurityRule(String uuid); - - /** - * Applications call this interface method to edit aSecurity Rule object - * - * @param uuid identifier of the security rule object - * @param delta OpenStackSecurity Rule object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateNeutronSecurityRule(String uuid, NeutronSecurityRule delta); - - /** - * Applications call this interface method to see if a MAC address is in use - * - * @param uuid identifier of the security rule object - * @return boolean on whether the macAddress is already associated with a - * port or not - */ - - public boolean neutronSecurityRuleInUse(String uuid); - -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetAware.java deleted file mode 100644 index 57d382b127..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetAware.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -/** - * This interface defines the methods a service that wishes to be aware of Neutron Subnets needs to implement - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronSubnetAware} - */ - -@Deprecated -public interface INeutronSubnetAware { - - /** - * Services provide this interface method to indicate if the specified subnet can be created - * - * @param subnet - * instance of proposed new Neutron Subnet object - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the create operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canCreateSubnet(NeutronSubnet subnet); - - /** - * Services provide this interface method for taking action after a subnet has been created - * - * @param subnet - * instance of new Neutron Subnet object - * @return void - */ - public void neutronSubnetCreated(NeutronSubnet subnet); - - /** - * Services provide this interface method to indicate if the specified subnet can be changed using the specified - * delta - * - * @param delta - * updates to the subnet object using patch semantics - * @param subnet - * instance of the Neutron Subnet object to be updated - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the update operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canUpdateSubnet(NeutronSubnet delta, NeutronSubnet original); - - /** - * Services provide this interface method for taking action after a subnet has been updated - * - * @param subnet - * instance of modified Neutron Subnet object - * @return void - */ - public void neutronSubnetUpdated(NeutronSubnet subnet); - - /** - * Services provide this interface method to indicate if the specified subnet can be deleted - * - * @param subnet - * instance of the Subnet Router object to be deleted - * @return integer - * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 - * results in the delete operation being interrupted and the returned status value reflected in the - * HTTP response. - */ - public int canDeleteSubnet(NeutronSubnet subnet); - - /** - * Services provide this interface method for taking action after a subnet has been deleted - * - * @param subnet - * instance of deleted Router Subnet object - * @return void - */ - public void neutronSubnetDeleted(NeutronSubnet subnet); - -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetCRUD.java deleted file mode 100644 index 8420682848..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetCRUD.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.util.List; - -/** - * This interface defines the methods for CRUD of NB Subnet objects - * - * @deprecated Replaced by {@link org.opendaylight.neutron.neutron.spi.INeutronSubnetCRUD} - */ - -@Deprecated -public interface INeutronSubnetCRUD { - /** - * Applications call this interface method to determine if a particular - * Subnet object exists - * - * @param uuid - * UUID of the Subnet object - * @return boolean - */ - - public boolean subnetExists(String uuid); - - /** - * Applications call this interface method to return if a particular - * Subnet object exists - * - * @param uuid - * UUID of the Subnet object - * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronSubnet.OpenStackSubnets} - * OpenStack Subnet class - */ - - public NeutronSubnet getSubnet(String uuid); - - /** - * Applications call this interface method to return all Subnet objects - * - * @return List of OpenStackSubnets objects - */ - - public List getAllSubnets(); - - /** - * Applications call this interface method to add a Subnet object to the - * concurrent map - * - * @param input - * OpenStackSubnet object - * @return boolean on whether the object was added or not - */ - - public boolean addSubnet(NeutronSubnet input); - - /** - * Applications call this interface method to remove a Subnet object to the - * concurrent map - * - * @param uuid - * identifier for the Subnet object - * @return boolean on whether the object was removed or not - */ - - public boolean removeSubnet(String uuid); - - /** - * Applications call this interface method to edit a Subnet object - * - * @param uuid - * identifier of the Subnet object - * @param delta - * OpenStackSubnet object containing changes to apply - * @return boolean on whether the object was updated or not - */ - - public boolean updateSubnet(String uuid, NeutronSubnet delta); - - /** - * Applications call this interface method to determine if a Subnet object - * is use - * - * @param subnetUUID - * identifier of the subnet object - * - * @return boolean on whether the subnet is in use or not - */ - - public boolean subnetInUse(String subnetUUID); -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java deleted file mode 100644 index 0ae523a138..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class NeutronCRUDInterfaces { - private static final Logger logger = LoggerFactory - .getLogger(NeutronCRUDInterfaces.class); - - public static INeutronNetworkCRUD getINeutronNetworkCRUD(Object o) { - INeutronNetworkCRUD answer = (INeutronNetworkCRUD) getInstances(INeutronNetworkCRUD.class, o); - return answer; - } - - public static INeutronSubnetCRUD getINeutronSubnetCRUD(Object o) { - INeutronSubnetCRUD answer = (INeutronSubnetCRUD) getInstances(INeutronSubnetCRUD.class, o); - return answer; - } - - public static INeutronPortCRUD getINeutronPortCRUD(Object o) { - INeutronPortCRUD answer = (INeutronPortCRUD) getInstances(INeutronPortCRUD.class, o); - return answer; - } - - public static INeutronRouterCRUD getINeutronRouterCRUD(Object o) { - INeutronRouterCRUD answer = (INeutronRouterCRUD) getInstances(INeutronRouterCRUD.class, o); - return answer; - } - - public static INeutronFloatingIPCRUD getINeutronFloatingIPCRUD(Object o) { - INeutronFloatingIPCRUD answer = (INeutronFloatingIPCRUD) getInstances(INeutronFloatingIPCRUD.class, o); - return answer; - } - - public static INeutronSecurityGroupCRUD getINeutronSecurityGroupCRUD(Object o) { - INeutronSecurityGroupCRUD answer = (INeutronSecurityGroupCRUD) getInstances(INeutronSecurityGroupCRUD.class, o); - return answer; - } - - public static INeutronSecurityRuleCRUD getINeutronSecurityRuleCRUD(Object o) { - INeutronSecurityRuleCRUD answer = (INeutronSecurityRuleCRUD) getInstances(INeutronSecurityRuleCRUD.class, o); - return answer; - } - - public static INeutronFirewallCRUD getINeutronFirewallCRUD(Object o) { - INeutronFirewallCRUD answer = (INeutronFirewallCRUD) getInstances(INeutronFirewallCRUD.class, o); - return answer; - } - - public static INeutronFirewallPolicyCRUD getINeutronFirewallPolicyCRUD(Object o) { - INeutronFirewallPolicyCRUD answer = (INeutronFirewallPolicyCRUD) getInstances(INeutronFirewallPolicyCRUD.class, o); - return answer; - } - - public static INeutronFirewallRuleCRUD getINeutronFirewallRuleCRUD(Object o) { - INeutronFirewallRuleCRUD answer = (INeutronFirewallRuleCRUD) getInstances(INeutronFirewallRuleCRUD.class, o); - return answer; - } - - public static INeutronLoadBalancerCRUD getINeutronLoadBalancerCRUD(Object o) { - INeutronLoadBalancerCRUD answer = (INeutronLoadBalancerCRUD) getInstances(INeutronLoadBalancerCRUD.class, o); - return answer; - } - - public static INeutronLoadBalancerPoolCRUD getINeutronLoadBalancerPoolCRUD(Object o) { - INeutronLoadBalancerPoolCRUD answer = (INeutronLoadBalancerPoolCRUD) getInstances(INeutronLoadBalancerPoolCRUD.class, o); - return answer; - } - - public static INeutronLoadBalancerListenerCRUD getINeutronLoadBalancerListenerCRUD(Object o) { - INeutronLoadBalancerListenerCRUD answer = (INeutronLoadBalancerListenerCRUD) getInstances(INeutronLoadBalancerListenerCRUD.class, o); - return answer; - } - - public static INeutronLoadBalancerHealthMonitorCRUD getINeutronLoadBalancerHealthMonitorCRUD(Object o) { - INeutronLoadBalancerHealthMonitorCRUD answer = (INeutronLoadBalancerHealthMonitorCRUD) getInstances(INeutronLoadBalancerHealthMonitorCRUD.class, o); - return answer; - } - - public static INeutronLoadBalancerPoolMemberCRUD getINeutronLoadBalancerPoolMemberCRUD(Object o) { - INeutronLoadBalancerPoolMemberCRUD answer = (INeutronLoadBalancerPoolMemberCRUD) getInstances(INeutronLoadBalancerPoolMemberCRUD.class, o); - return answer; - } - - public static Object getInstances(Class clazz,Object bundle) { - try { - BundleContext bCtx = FrameworkUtil.getBundle(bundle.getClass()) - .getBundleContext(); - - ServiceReference[] services = null; - services = bCtx.getServiceReferences(clazz.getName(), - null); - if (services != null) { - return bCtx.getService(services[0]); - } - } catch (Exception e) { - logger.error("Instance reference is NULL"); - } - return null; - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewall.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewall.java deleted file mode 100644 index 5d427ef12a..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewall.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -/** - * OpenStack Neutron v2.0 Firewall as a service - * (FWaaS) bindings. See OpenStack Network API - * v2.0 Reference for description of the fields: - * Implemented fields are as follows: - * - * id uuid-str - * tenant_id uuid-str - * name String - * description String - * admin_state_up Bool - * status String - * shared Bool - * firewall_policy_id uuid-str - * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf - */ - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronFirewall implements Serializable { - private static final long serialVersionUID = 1L; - - @XmlElement(name="id") - String firewallUUID; - - @XmlElement (name="tenant_id") - String firewallTenantID; - - @XmlElement (name="name") - String firewallName; - - @XmlElement (name="description") - String firewallDescription; - - @XmlElement (defaultValue="true", name="admin_state_up") - Boolean firewallAdminStateIsUp; - - @XmlElement (name="status") - String firewallStatus; - - @XmlElement (defaultValue="false", name="shared") - Boolean firewallIsShared; - - @XmlElement (name="firewall_policy_id") - String neutronFirewallPolicyID; - - public String getFirewallUUID() { - return firewallUUID; - } - - public void setFirewallUUID(String firewallUUID) { - this.firewallUUID = firewallUUID; - } - - public String getFirewallTenantID() { - return firewallTenantID; - } - - public void setFirewallTenantID(String firewallTenantID) { - this.firewallTenantID = firewallTenantID; - } - - public String getFirewallName() { - return firewallName; - } - - public void setFirewallName(String firewallName) { - this.firewallName = firewallName; - } - - public String getFirewallDescription() { - return firewallDescription; - } - - public void setFirewallDescription(String firewallDescription) { - this.firewallDescription = firewallDescription; - } - - public Boolean getFirewallAdminStateIsUp() { - return firewallAdminStateIsUp; - } - - public void setFirewallAdminStateIsUp(Boolean firewallAdminStateIsUp) { - this.firewallAdminStateIsUp = firewallAdminStateIsUp; - } - - public String getFirewallStatus() { - return firewallStatus; - } - - public void setFirewallStatus(String firewallStatus) { - this.firewallStatus = firewallStatus; - } - - public Boolean getFirewallIsShared() { - return firewallIsShared; - } - - public void setFirewallIsShared(Boolean firewallIsShared) { - this.firewallIsShared = firewallIsShared; - } - - public String getFirewallPolicyID() { - return neutronFirewallPolicyID; - } - - public void setNeutronFirewallPolicyID(String firewallPolicy) { - this.neutronFirewallPolicyID = firewallPolicy; - } - - public NeutronFirewall extractFields(List fields) { - NeutronFirewall ans = new NeutronFirewall(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setFirewallUUID(this.getFirewallUUID()); - } - if (s.equals("tenant_id")) { - ans.setFirewallTenantID(this.getFirewallTenantID()); - } - if (s.equals("name")) { - ans.setFirewallName(this.getFirewallName()); - } - if(s.equals("description")) { - ans.setFirewallDescription(this.getFirewallDescription()); - } - if (s.equals("admin_state_up")) { - ans.setFirewallAdminStateIsUp(firewallAdminStateIsUp); - } - if (s.equals("status")) { - ans.setFirewallStatus(this.getFirewallStatus()); - } - if (s.equals("shared")) { - ans.setFirewallIsShared(firewallIsShared); - } - if (s.equals("firewall_policy_id")) { - ans.setNeutronFirewallPolicyID(this.getFirewallPolicyID()); - } - } - return ans; - } - - @Override - public String toString() { - return "NeutronFirewall{" + - "firewallUUID='" + firewallUUID + '\'' + - ", firewallTenantID='" + firewallTenantID + '\'' + - ", firewallName='" + firewallName + '\'' + - ", firewallDescription='" + firewallDescription + '\'' + - ", firewallAdminStateIsUp=" + firewallAdminStateIsUp + - ", firewallStatus='" + firewallStatus + '\'' + - ", firewallIsShared=" + firewallIsShared + - ", firewallRulePolicyID=" + neutronFirewallPolicyID + - '}'; - } -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallPolicy.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallPolicy.java deleted file mode 100644 index 782e18bb89..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallPolicy.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * OpenStack Neutron v2.0 Firewall as a service - * (FWaaS) bindings. See OpenStack Network API - * v2.0 Reference for description of the fields. - * The implemented fields are as follows: - * - * id uuid-str - * tenant_id uuid-str - * name String - * description String - * shared Boolean - * firewall_rules List - * audited Boolean - * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf - */ - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronFirewallPolicy implements Serializable { - private static final long serialVersionUID = 1L; - - @XmlElement(name="id") - String firewallPolicyUUID; - - @XmlElement (name="tenant_id") - String firewallPolicyTenantID; - - @XmlElement (name="name") - String firewallPolicyName; - - @XmlElement (name="description") - String firewallPolicyDescription; - - @XmlElement (defaultValue="false", name="shared") - Boolean firewallPolicyIsShared; - - @XmlElement (name="firewall_rules") - List firewallPolicyRules; - - @XmlElement (defaultValue="false", name="audited") - String firewallPolicyIsAudited; - - public String getFirewallPolicyIsAudited() { - return firewallPolicyIsAudited; - } - - public void setFirewallPolicyIsAudited(String firewallPolicyIsAudited) { - this.firewallPolicyIsAudited = firewallPolicyIsAudited; - } - - public void setFirewallPolicyRules(List firewallPolicyRules) { - this.firewallPolicyRules = firewallPolicyRules; - } - - public List getFirewallPolicyRules() { - return firewallPolicyRules; - } - - public Boolean getFirewallPolicyIsShared() { - return firewallPolicyIsShared; - } - - public void setFirewallPolicyIsShared(Boolean firewallPolicyIsShared) { - this.firewallPolicyIsShared = firewallPolicyIsShared; - } - - public String getFirewallPolicyDescription() { - return firewallPolicyDescription; - } - - public void setFirewallPolicyDescription(String firewallPolicyDescription) { - this.firewallPolicyDescription = firewallPolicyDescription; - } - - public String getFirewallPolicyName() { - return firewallPolicyName; - } - - public void setFirewallPolicyName(String firewallPolicyName) { - this.firewallPolicyName = firewallPolicyName; - } - - public String getFirewallPolicyTenantID() { - return firewallPolicyTenantID; - } - - public void setFirewallPolicyTenantID(String firewallPolicyTenantID) { - this.firewallPolicyTenantID = firewallPolicyTenantID; - } - - public String getFirewallPolicyUUID() { - return firewallPolicyUUID; - } - - public void setFirewallPolicyUUID(String firewallPolicyUUID) { - this.firewallPolicyUUID = firewallPolicyUUID; - } - - public NeutronFirewallPolicy extractFields(List fields) { - NeutronFirewallPolicy ans = new NeutronFirewallPolicy(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setFirewallPolicyUUID(this.getFirewallPolicyUUID()); - } - if (s.equals("tenant_id")) { - ans.setFirewallPolicyTenantID(this.getFirewallPolicyTenantID()); - } - if (s.equals("name")) { - ans.setFirewallPolicyName(this.getFirewallPolicyName()); - } - if(s.equals("description")) { - ans.setFirewallPolicyDescription(this.getFirewallPolicyDescription()); - } - if (s.equals("shared")) { - ans.setFirewallPolicyIsShared(firewallPolicyIsShared); - } - if (s.equals("firewall_rules")) { - List firewallRuleList = new ArrayList(); - firewallRuleList.addAll(this.getFirewallPolicyRules()); - ans.setFirewallPolicyRules(firewallRuleList); - } - if (s.equals("audited")) { - ans.setFirewallPolicyIsAudited(firewallPolicyIsAudited); - } - } - return ans; - } - - @Override - public String toString() { - return "NeutronFirewallPolicy{" + - "firewallPolicyUUID='" + firewallPolicyUUID + '\'' + - ", firewallPolicyTenantID='" + firewallPolicyTenantID + '\'' + - ", firewallPolicyName='" + firewallPolicyName + '\'' + - ", firewallPolicyDescription='" + firewallPolicyDescription + '\'' + - ", firewallPolicyIsShared=" + firewallPolicyIsShared + - ", firewallPolicyRules=" + firewallPolicyRules + - ", firewallPolicyIsAudited='" + firewallPolicyIsAudited + '\'' + - '}'; - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallRule.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallRule.java deleted file mode 100644 index d4c239302a..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallRule.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -/** - * OpenStack Neutron v2.0 Firewall as a service - * (FWaaS) bindings. See OpenStack Network API - * v2.0 Reference for description of the fields. - * The implemented fields are as follows: - * - * tenant_id uuid-str - * name String - * description String - * admin_state_up Bool - * status String - * shared Bool - * firewall_policy_id uuid-str - * protocol String - * ip_version Integer - * source_ip_address String (IP addr or CIDR) - * destination_ip_address String (IP addr or CIDR) - * source_port Integer - * destination_port Integer - * position Integer - * action String - * enabled Bool - * id uuid-str - * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf - */ - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronFirewallRule implements Serializable { - private static final long serialVersionUID = 1L; - - @XmlElement(name = "id") - String firewallRuleUUID; - - @XmlElement(name = "tenant_id") - String firewallRuleTenantID; - - @XmlElement(name = "name") - String firewallRuleName; - - @XmlElement(name = "description") - String firewallRuleDescription; - - @XmlElement(defaultValue = "true", name = "admin_state_up") - Boolean firewallRuleAdminStateIsUp; - - @XmlElement(name = "status") - String firewallRuleStatus; - - @XmlElement(defaultValue = "false", name = "shared") - Boolean firewallRuleIsShared; - - @XmlElement(name = "firewall_policy_id") - String firewallRulePolicyID; - - @XmlElement(name = "protocol") - String firewallRuleProtocol; - - @XmlElement(name = "ip_version") - Integer firewallRuleIpVer; - - @XmlElement(name = "source_ip_address") - String firewallRuleSrcIpAddr; - - @XmlElement(name = "destination_ip_address") - String firewallRuleDstIpAddr; - - @XmlElement(name = "source_port") - Integer firewallRuleSrcPort; - - @XmlElement(name = "destination_port") - Integer firewallRuleDstPort; - - @XmlElement(name = "position") - Integer firewallRulePosition; - - @XmlElement(name = "action") - String firewallRuleAction; - - @XmlElement(name = "enabled") - Boolean firewallRuleIsEnabled; - - public Boolean getFirewallRuleIsEnabled() { - return firewallRuleIsEnabled; - } - - public void setFirewallRuleIsEnabled(Boolean firewallRuleIsEnabled) { - this.firewallRuleIsEnabled = firewallRuleIsEnabled; - } - - public String getFirewallRuleAction() { - return firewallRuleAction; - } - - public void setFirewallRuleAction(String firewallRuleAction) { - this.firewallRuleAction = firewallRuleAction; - } - - public Integer getFirewallRulePosition() { - return firewallRulePosition; - } - - public void setFirewallRulePosition(Integer firewallRulePosition) { - this.firewallRulePosition = firewallRulePosition; - } - - public Integer getFirewallRuleDstPort() { - return firewallRuleDstPort; - } - - public void setFirewallRuleDstPort(Integer firewallRuleDstPort) { - this.firewallRuleDstPort = firewallRuleDstPort; - } - - public Integer getFirewallRuleSrcPort() { - return firewallRuleSrcPort; - } - - public void setFirewallRuleSrcPort(Integer firewallRuleSrcPort) { - this.firewallRuleSrcPort = firewallRuleSrcPort; - } - - public String getFirewallRuleDstIpAddr() { - return firewallRuleDstIpAddr; - } - - public void setFirewallRuleDstIpAddr(String firewallRuleDstIpAddr) { - this.firewallRuleDstIpAddr = firewallRuleDstIpAddr; - } - - public String getFirewallRuleSrcIpAddr() { - return firewallRuleSrcIpAddr; - } - - public void setFirewallRuleSrcIpAddr(String firewallRuleSrcIpAddr) { - this.firewallRuleSrcIpAddr = firewallRuleSrcIpAddr; - } - - public Integer getFirewallRuleIpVer() { - return firewallRuleIpVer; - } - - public void setFirewallRuleIpVer(Integer firewallRuleIpVer) { - this.firewallRuleIpVer = firewallRuleIpVer; - } - - public String getFirewallRuleProtocol() { - return firewallRuleProtocol; - } - - public void setFirewallRuleProtocol(String firewallRuleProtocol) { - this.firewallRuleProtocol = firewallRuleProtocol; - } - - public String getFirewallRulePolicyID() { - return firewallRulePolicyID; - } - - public void setFirewallRulesPolicyID(String firewallRulePolicyID) { - this.firewallRulePolicyID = firewallRulePolicyID; - } - - public Boolean getFirewallRuleIsShared() { - return firewallRuleIsShared; - } - - public void setFirewallRuleIsShared(Boolean firewallRuleIsShared) { - this.firewallRuleIsShared = firewallRuleIsShared; - } - - public String getFirewallRuleStatus() { - return firewallRuleStatus; - } - - public void setFirewallRuleStatus(String firewallRuleStatus) { - this.firewallRuleStatus = firewallRuleStatus; - } - - public Boolean getFirewallRuleAdminStateIsUp() { - return firewallRuleAdminStateIsUp; - } - - public void setFirewallRuleAdminStateIsUp(Boolean firewallRuleAdminStateIsUp) { - this.firewallRuleAdminStateIsUp = firewallRuleAdminStateIsUp; - } - - public String getFirewallRuleDescription() { - return firewallRuleDescription; - } - - public void setFirewallRuleDescription(String firewallRuleDescription) { - this.firewallRuleDescription = firewallRuleDescription; - } - - public String getFirewallRuleName() { - return firewallRuleName; - } - - public void setFirewallRuleName(String firewallRuleName) { - this.firewallRuleName = firewallRuleName; - } - - public String getFirewallRuleTenantID() { - return firewallRuleTenantID; - } - - public void setFirewallRuleTenantID(String firewallRuleTenantID) { - this.firewallRuleTenantID = firewallRuleTenantID; - } - - public String getFirewallRuleUUID() { - return firewallRuleUUID; - } - - public void setFirewallRuleUUID(String firewallRuleUUID) { - this.firewallRuleUUID = firewallRuleUUID; - } - - public NeutronFirewallRule extractFields(List fields) { - NeutronFirewallRule ans = new NeutronFirewallRule(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setFirewallRuleUUID(this.getFirewallRuleUUID()); - } - if (s.equals("tenant_id")) { - ans.setFirewallRuleTenantID(this.getFirewallRuleTenantID()); - } - if (s.equals("name")) { - ans.setFirewallRuleName(this.getFirewallRuleName()); - } - if (s.equals("description")) { - ans.setFirewallRuleDescription(this.getFirewallRuleDescription()); - } - if (s.equals("admin_state_up")) { - ans.setFirewallRuleAdminStateIsUp(firewallRuleAdminStateIsUp); - } - if (s.equals("status")) { - ans.setFirewallRuleStatus(this.getFirewallRuleStatus()); - } - if (s.equals("shared")) { - ans.setFirewallRuleIsShared(firewallRuleIsShared); - } - if (s.equals("firewall_policy_id")) { - ans.setFirewallRulesPolicyID(this.getFirewallRulePolicyID()); - } - if (s.equals("protocol")) { - ans.setFirewallRuleProtocol(this.getFirewallRuleProtocol()); - } - if (s.equals("source_ip_address")) { - ans.setFirewallRuleSrcIpAddr(this.getFirewallRuleSrcIpAddr()); - } - if (s.equals("destination_ip_address")) { - ans.setFirewallRuleDstIpAddr(this.getFirewallRuleDstIpAddr()); - } - if (s.equals("source_port")) { - ans.setFirewallRuleSrcPort(this.getFirewallRuleSrcPort()); - } - if (s.equals("destination_port")) { - ans.setFirewallRuleDstPort(this.getFirewallRuleDstPort()); - } - if (s.equals("position")) { - ans.setFirewallRulePosition(this.getFirewallRulePosition()); - } - if (s.equals("action")) { - ans.setFirewallRuleAction(this.getFirewallRuleAction()); - } - if (s.equals("enabled")) { - ans.setFirewallRuleIsEnabled(firewallRuleIsEnabled); - } - - } - return ans; - } - - @Override - public String toString() { - return "firewallPolicyRules{" + - "firewallRuleUUID='" + firewallRuleUUID + '\'' + - ", firewallRuleTenantID='" + firewallRuleTenantID + '\'' + - ", firewallRuleName='" + firewallRuleName + '\'' + - ", firewallRuleDescription='" + firewallRuleDescription + '\'' + - ", firewallRuleAdminStateIsUp=" + firewallRuleAdminStateIsUp + - ", firewallRuleStatus='" + firewallRuleStatus + '\'' + - ", firewallRuleIsShared=" + firewallRuleIsShared + - ", firewallRulePolicyID=" + firewallRulePolicyID + - ", firewallRuleProtocol='" + firewallRuleProtocol + '\'' + - ", firewallRuleIpVer=" + firewallRuleIpVer + - ", firewallRuleSrcIpAddr='" + firewallRuleSrcIpAddr + '\'' + - ", firewallRuleDstIpAddr='" + firewallRuleDstIpAddr + '\'' + - ", firewallRuleSrcPort=" + firewallRuleSrcPort + - ", firewallRuleDstPort=" + firewallRuleDstPort + - ", firewallRulePosition=" + firewallRulePosition + - ", firewallRuleAction='" + firewallRuleAction + '\'' + - ", firewallRuleIsEnabled=" + firewallRuleIsEnabled + - '}'; - } - - public void initDefaults() { - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java deleted file mode 100644 index 9c8c91b284..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronFloatingIP implements Serializable { - private static final long serialVersionUID = 1L; - - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement (name="id") - String floatingIPUUID; - - @XmlElement (name="floating_network_id") - String floatingNetworkUUID; - - @XmlElement (name="port_id") - String portUUID; - - @XmlElement (name="fixed_ip_address") - String fixedIPAddress; - - @XmlElement (name="floating_ip_address") - String floatingIPAddress; - - @XmlElement (name="tenant_id") - String tenantUUID; - - public NeutronFloatingIP() { - } - - public String getID() { return floatingIPUUID; } - - public String getFloatingIPUUID() { - return floatingIPUUID; - } - - public void setFloatingIPUUID(String floatingIPUUID) { - this.floatingIPUUID = floatingIPUUID; - } - - public String getFloatingNetworkUUID() { - return floatingNetworkUUID; - } - - public void setFloatingNetworkUUID(String floatingNetworkUUID) { - this.floatingNetworkUUID = floatingNetworkUUID; - } - - public String getPortUUID() { - return portUUID; - } - - public void setPortUUID(String portUUID) { - this.portUUID = portUUID; - } - - public String getFixedIPAddress() { - return fixedIPAddress; - } - - public void setFixedIPAddress(String fixedIPAddress) { - this.fixedIPAddress = fixedIPAddress; - } - - public String getFloatingIPAddress() { - return floatingIPAddress; - } - - public void setFloatingIPAddress(String floatingIPAddress) { - this.floatingIPAddress = floatingIPAddress; - } - - public String getTenantUUID() { - return tenantUUID; - } - - public void setTenantUUID(String tenantUUID) { - this.tenantUUID = tenantUUID; - } - - /** - * This method copies selected fields from the object and returns them - * as a new object, suitable for marshaling. - * - * @param fields - * List of attributes to be extracted - * @return an OpenStackFloatingIPs object with only the selected fields - * populated - */ - - public NeutronFloatingIP extractFields(List fields) { - NeutronFloatingIP ans = new NeutronFloatingIP(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setFloatingIPUUID(this.getFloatingIPUUID()); - } - if (s.equals("floating_network_id")) { - ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID()); - } - if (s.equals("port_id")) { - ans.setPortUUID(this.getPortUUID()); - } - if (s.equals("fixed_ip_address")) { - ans.setFixedIPAddress(this.getFixedIPAddress()); - } - if (s.equals("floating_ip_address")) { - ans.setFloatingIPAddress(this.getFloatingIPAddress()); - } - if (s.equals("tenant_id")) { - ans.setTenantUUID(this.getTenantUUID()); - } - } - return ans; - } - - public void initDefaults() { - } -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancer.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancer.java deleted file mode 100644 index 58f0eb4512..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancer.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -/** - * OpenStack Neutron v2.0 Load Balancer as a service - * (LBaaS) bindings. See OpenStack Network API - * v2.0 Reference for description of the fields: - * Implemented fields are as follows: - * - * id uuid-str - * tenant_id uuid-str - * name String - * description String - * status String - * vip_address IP address - * vip_subnet uuid-str - * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf - */ - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronLoadBalancer implements Serializable { - private static final long serialVersionUID = 1L; - - @XmlElement(name="id") - String loadBalancerID; - - @XmlElement (name="tenant_id") - String loadBalancerTenantID; - - @XmlElement (name="name") - String loadBalancerName; - - @XmlElement (name="description") - String loadBalancerDescription; - - @XmlElement (name="status") - String loadBalancerStatus; - - @XmlElement (name="vip_address") - String loadBalancerVipAddress; - - @XmlElement (name="vip_subnet_id") - String loadBalancerVipSubnetID; - - public String getLoadBalancerID() { - return loadBalancerID; - } - - public void setLoadBalancerID(String loadBalancerID) { - this.loadBalancerID = loadBalancerID; - } - - public String getLoadBalancerTenantID() { - return loadBalancerTenantID; - } - - public void setLoadBalancerTenantID(String loadBalancerTenantID) { - this.loadBalancerTenantID = loadBalancerTenantID; - } - - public String getLoadBalancerName() { - return loadBalancerName; - } - - public void setLoadBalancerName(String loadBalancerName) { - this.loadBalancerName = loadBalancerName; - } - - public String getLoadBalancerDescription() { - return loadBalancerDescription; - } - - public void setLoadBalancerDescription(String loadBalancerDescription) { - this.loadBalancerDescription = loadBalancerDescription; - } - - public String getLoadBalancerStatus() { - return loadBalancerStatus; - } - - public void setLoadBalancerStatus(String loadBalancerStatus) { - this.loadBalancerStatus = loadBalancerStatus; - } - - public String getLoadBalancerVipAddress() { - return loadBalancerVipAddress; - } - - public void setLoadBalancerVipAddress(String loadBalancerVipAddress) { - this.loadBalancerVipAddress = loadBalancerVipAddress; - } - - public String getLoadBalancerVipSubnetID() { - return loadBalancerVipSubnetID; - } - - public void setLoadBalancerVipSubnetID(String loadBalancerVipSubnetID) { - this.loadBalancerVipSubnetID = loadBalancerVipSubnetID; - } - - public NeutronLoadBalancer extractFields(List fields) { - NeutronLoadBalancer ans = new NeutronLoadBalancer(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setLoadBalancerID(this.getLoadBalancerID()); - } - if (s.equals("tenant_id")) { - ans.setLoadBalancerTenantID(this.getLoadBalancerTenantID()); - } - if (s.equals("name")) { - ans.setLoadBalancerName(this.getLoadBalancerName()); - } - if(s.equals("description")) { - ans.setLoadBalancerDescription(this.getLoadBalancerDescription()); - } - if (s.equals("vip_address")) { - ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress()); - } - if (s.equals("vip_subnet_id")) { - ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID()); - } - if (s.equals("status")) { - ans.setLoadBalancerStatus(this.getLoadBalancerStatus()); - } - } - return ans; - } - - @Override public String toString() { - return "NeutronLoadBalancer{" + - "loadBalancerID='" + loadBalancerID + '\'' + - ", loadBalancerTenantID='" + loadBalancerTenantID + '\'' + - ", loadBalancerName='" + loadBalancerName + '\'' + - ", loadBalancerDescription='" + loadBalancerDescription + '\'' + - ", loadBalancerStatus='" + loadBalancerStatus + '\'' + - ", loadBalancerVipAddress='" + loadBalancerVipAddress + '\'' + - ", loadBalancerVipSubnetID='" + loadBalancerVipSubnetID + '\'' + - '}'; - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerHealthMonitor.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerHealthMonitor.java deleted file mode 100644 index d23fe113a0..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerHealthMonitor.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -/** - * OpenStack Neutron v2.0 Load Balancer as a service - * (LBaaS) bindings. See OpenStack Network API - * v2.0 Reference for description of the fields: - * Implemented fields are as follows: - * - * - * id uuid-str - * tenant_id uuid-str - * type String - * delay Integer - * timeout Integer - * max_retries Integer - * http_method String - * url_path String - * expected_codes String - * admin_state_up Boolean - * status String - * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf - */ - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronLoadBalancerHealthMonitor implements Serializable { - private static final long serialVersionUID = 1L; - private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancer.class); - - @XmlElement(name="id") - String loadBalancerHealthMonitorID; - - @XmlElement (name="tenant_id") - String loadBalancerHealthMonitorTenantID; - - @XmlElement (name="type") - String loadBalancerHealthMonitorType; - - @XmlElement (name="delay") - Integer loadBalancerHealthMonitorDelay; - - @XmlElement (name="timeout") - Integer loadBalancerHealthMonitorTimeout; - - @XmlElement (name="max_retries") - Integer loadBalancerHealthMonitorMaxRetries; - - @XmlElement (name="http_method") - String loadBalancerHealthMonitorHttpMethod; - - @XmlElement (name="url_path") - String loadBalancerHealthMonitorUrlPath; - - @XmlElement (name="expected_codes") - String loadBalancerHealthMonitorExpectedCodes; - - @XmlElement (defaultValue="true", name="admin_state_up") - Boolean loadBalancerHealthMonitorAdminStateIsUp; - - @XmlElement (name="status") - String loadBalancerHealthMonitorStatus; - - public String getLoadBalancerHealthMonitorID() { - return loadBalancerHealthMonitorID; - } - - public void setLoadBalancerHealthMonitorID(String loadBalancerHealthMonitorID) { - this.loadBalancerHealthMonitorID = loadBalancerHealthMonitorID; - } - - public String getLoadBalancerHealthMonitorTenantID() { - return loadBalancerHealthMonitorTenantID; - } - - public void setLoadBalancerHealthMonitorTenantID(String loadBalancerHealthMonitorTenantID) { - this.loadBalancerHealthMonitorTenantID = loadBalancerHealthMonitorTenantID; - } - - public String getLoadBalancerHealthMonitorType() { - return loadBalancerHealthMonitorType; - } - - public void setLoadBalancerHealthMonitorType(String loadBalancerHealthMonitorType) { - this.loadBalancerHealthMonitorType = loadBalancerHealthMonitorType; - } - - public Integer getLoadBalancerHealthMonitorDelay() { - return loadBalancerHealthMonitorDelay; - } - - public void setLoadBalancerHealthMonitorDelay(Integer loadBalancerHealthMonitorDelay) { - this.loadBalancerHealthMonitorDelay = loadBalancerHealthMonitorDelay; - } - - public Integer getLoadBalancerHealthMonitorTimeout() { - return loadBalancerHealthMonitorTimeout; - } - - public void setLoadBalancerHealthMonitorTimeout(Integer loadBalancerHealthMonitorTimeout) { - this.loadBalancerHealthMonitorTimeout = loadBalancerHealthMonitorTimeout; - } - - public Integer getLoadBalancerHealthMonitorMaxRetries() { - return loadBalancerHealthMonitorMaxRetries; - } - - public void setLoadBalancerHealthMonitorMaxRetries(Integer loadBalancerHealthMonitorMaxRetries) { - this.loadBalancerHealthMonitorMaxRetries = loadBalancerHealthMonitorMaxRetries; - } - - public String getLoadBalancerHealthMonitorHttpMethod() { - return loadBalancerHealthMonitorHttpMethod; - } - - public void setLoadBalancerHealthMonitorHttpMethod(String loadBalancerHealthMonitorHttpMethod) { - this.loadBalancerHealthMonitorHttpMethod = loadBalancerHealthMonitorHttpMethod; - } - - public String getLoadBalancerHealthMonitorUrlPath() { - return loadBalancerHealthMonitorUrlPath; - } - - public void setLoadBalancerHealthMonitorUrlPath(String loadBalancerHealthMonitorUrlPath) { - this.loadBalancerHealthMonitorUrlPath = loadBalancerHealthMonitorUrlPath; - } - - public String getLoadBalancerHealthMonitorExpectedCodes() { - return loadBalancerHealthMonitorExpectedCodes; - } - - public void setLoadBalancerHealthMonitorExpectedCodes(String loadBalancerHealthMonitorExpectedCodes) { - this.loadBalancerHealthMonitorExpectedCodes = loadBalancerHealthMonitorExpectedCodes; - } - - public Boolean getLoadBalancerHealthMonitorAdminStateIsUp() { - return loadBalancerHealthMonitorAdminStateIsUp; - } - - public void setLoadBalancerHealthMonitorAdminStateIsUp(Boolean loadBalancerHealthMonitorAdminStateIsUp) { - this.loadBalancerHealthMonitorAdminStateIsUp = loadBalancerHealthMonitorAdminStateIsUp; - } - - public String getLoadBalancerHealthMonitorStatus() { - return loadBalancerHealthMonitorStatus; - } - - public void setLoadBalancerHealthMonitorStatus(String loadBalancerHealthMonitorStatus) { - this.loadBalancerHealthMonitorStatus = loadBalancerHealthMonitorStatus; - } - - public NeutronLoadBalancerHealthMonitor extractFields(List fields) { - NeutronLoadBalancerHealthMonitor ans = new NeutronLoadBalancerHealthMonitor(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setLoadBalancerHealthMonitorID(this.getLoadBalancerHealthMonitorID()); - } - if (s.equals("tenant_id")) { - ans.setLoadBalancerHealthMonitorTenantID(this.getLoadBalancerHealthMonitorTenantID()); - } - if (s.equals("type")) { - ans.setLoadBalancerHealthMonitorType(this.getLoadBalancerHealthMonitorType()); - } - if (s.equals("delay")) { - ans.setLoadBalancerHealthMonitorDelay(this.getLoadBalancerHealthMonitorDelay()); - } - if (s.equals("timeout")) { - ans.setLoadBalancerHealthMonitorTimeout(this.getLoadBalancerHealthMonitorTimeout()); - } - if (s.equals("max_retries")) { - ans.setLoadBalancerHealthMonitorMaxRetries(this.getLoadBalancerHealthMonitorMaxRetries()); - } - if (s.equals("http_method")) { - ans.setLoadBalancerHealthMonitorHttpMethod(this.getLoadBalancerHealthMonitorHttpMethod()); - } - if(s.equals("url_path")) { - ans.setLoadBalancerHealthMonitorUrlPath(this.getLoadBalancerHealthMonitorUrlPath()); - } - if (s.equals("expected_codes")) { - ans.setLoadBalancerHealthMonitorExpectedCodes(this.getLoadBalancerHealthMonitorExpectedCodes()); - } - if (s.equals("admin_state_up")) { - ans.setLoadBalancerHealthMonitorAdminStateIsUp(loadBalancerHealthMonitorAdminStateIsUp); - } - if (s.equals("status")) { - ans.setLoadBalancerHealthMonitorStatus(this.getLoadBalancerHealthMonitorStatus()); - } - } - return ans; - } - - @Override public String toString() { - return "NeutronLoadBalancerHealthMonitor{" + - "loadBalancerHealthMonitorID='" + loadBalancerHealthMonitorID + '\'' + - ", loadBalancerHealthMonitorTenantID='" + loadBalancerHealthMonitorTenantID + '\'' + - ", loadBalancerHealthMonitorType='" + loadBalancerHealthMonitorType + '\'' + - ", loadBalancerHealthMonitorDelay=" + loadBalancerHealthMonitorDelay + - ", loadBalancerHealthMonitorTimeout=" + loadBalancerHealthMonitorTimeout + - ", loadBalancerHealthMonitorMaxRetries=" + loadBalancerHealthMonitorMaxRetries + - ", loadBalancerHealthMonitorHttpMethod='" + loadBalancerHealthMonitorHttpMethod + '\'' + - ", loadBalancerHealthMonitorUrlPath='" + loadBalancerHealthMonitorUrlPath + '\'' + - ", loadBalancerHealthMonitorExpectedCodes='" + loadBalancerHealthMonitorExpectedCodes + '\'' + - ", loadBalancerHealthMonitorAdminStateIsUp=" + loadBalancerHealthMonitorAdminStateIsUp + - ", loadBalancerHealthMonitorStatus='" + loadBalancerHealthMonitorStatus + '\'' + - '}'; - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerListener.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerListener.java deleted file mode 100644 index 8b4ada3d0f..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerListener.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -/** - * OpenStack Neutron v2.0 Load Balancer as a service - * (LBaaS) bindings. See OpenStack Network API - * v2.0 Reference for description of the fields: - * Implemented fields are as follows: - * - * id uuid-str - * default_pool_id String - * tenant_id uuid-str - * name String - * description String - * shared Bool - * protocol String - * protocol_port String - * load_balancer_id String - * admin_state_up Boolean - * status String - * - * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf - */ - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronLoadBalancerListener implements Serializable { - private static final long serialVersionUID = 1L; - - @XmlElement(name="id") - String loadBalancerListenerID; - - @XmlElement (name="default_pool_id") - String neutronLoadBalancerListenerDefaultPoolID; - - @XmlElement (name="tenant_id") - String loadBalancerListenerTenantID; - - @XmlElement (name="name") - String loadBalancerListenerName; - - @XmlElement (name="description") - String loadBalancerListenerDescription; - - @XmlElement (defaultValue="true", name="admin_state_up") - Boolean loadBalancerListenerAdminStateIsUp; - - @XmlElement (name="status") - String loadBalancerListenerStatus; - - @XmlElement (defaultValue="false", name="shared") - Boolean loadBalancerListenerIsShared; - - @XmlElement (name="protocol") - String neutronLoadBalancerListenerProtocol; - - @XmlElement (name="protocol_port") - String neutronLoadBalancerListenerProtocolPort; - - @XmlElement (name="load_balancer_id") - String neutronLoadBalancerListenerLoadBalancerID; - - - public String getLoadBalancerListenerID() { - return loadBalancerListenerID; - } - - public void setLoadBalancerListenerID(String loadBalancerListenerID) { - this.loadBalancerListenerID = loadBalancerListenerID; - } - - public String getLoadBalancerListenerTenantID() { - return loadBalancerListenerTenantID; - } - - public void setLoadBalancerListenerTenantID(String loadBalancerListenerTenantID) { - this.loadBalancerListenerTenantID = loadBalancerListenerTenantID; - } - - public String getLoadBalancerListenerName() { - return loadBalancerListenerName; - } - - public void setLoadBalancerListenerName(String loadBalancerListenerName) { - this.loadBalancerListenerName = loadBalancerListenerName; - } - - public String getLoadBalancerListenerDescription() { - return loadBalancerListenerDescription; - } - - public void setLoadBalancerListenerDescription(String loadBalancerListenerDescription) { - this.loadBalancerListenerDescription = loadBalancerListenerDescription; - } - - public Boolean getLoadBalancerListenerAdminStateIsUp() { - return loadBalancerListenerAdminStateIsUp; - } - - public void setLoadBalancerListenerAdminStateIsUp(Boolean loadBalancerListenerAdminStateIsUp) { - this.loadBalancerListenerAdminStateIsUp = loadBalancerListenerAdminStateIsUp; - } - - public String getLoadBalancerListenerStatus() { - return loadBalancerListenerStatus; - } - - public void setLoadBalancerListenerStatus(String loadBalancerListenerStatus) { - this.loadBalancerListenerStatus = loadBalancerListenerStatus; - } - - public Boolean getLoadBalancerListenerIsShared() { - return loadBalancerListenerIsShared; - } - - public void setLoadBalancerListenerIsShared(Boolean loadBalancerListenerIsShared) { - this.loadBalancerListenerIsShared = loadBalancerListenerIsShared; - } - - public String getNeutronLoadBalancerListenerProtocol() { - return neutronLoadBalancerListenerProtocol; - } - - public void setNeutronLoadBalancerListenerProtocol(String neutronLoadBalancerListenerProtocol) { - this.neutronLoadBalancerListenerProtocol = neutronLoadBalancerListenerProtocol; - } - - public String getNeutronLoadBalancerListenerProtocolPort() { - return neutronLoadBalancerListenerProtocolPort; - } - - public void setNeutronLoadBalancerListenerProtocolPort(String neutronLoadBalancerListenerProtocolPort) { - this.neutronLoadBalancerListenerProtocolPort = neutronLoadBalancerListenerProtocolPort; - } - - public String getNeutronLoadBalancerListenerDefaultPoolID() { - return neutronLoadBalancerListenerDefaultPoolID; - } - - public void setNeutronLoadBalancerListenerDefaultPoolID(String neutronLoadBalancerListenerDefaultPoolID) { - this.neutronLoadBalancerListenerDefaultPoolID = neutronLoadBalancerListenerDefaultPoolID; - } - - public String getNeutronLoadBalancerListenerLoadBalancerID() { - return neutronLoadBalancerListenerLoadBalancerID; - } - - public void setNeutronLoadBalancerListenerLoadBalancerID(String neutronLoadBalancerListenerLoadBalancerID) { - this.neutronLoadBalancerListenerLoadBalancerID = neutronLoadBalancerListenerLoadBalancerID; - } - - public NeutronLoadBalancerListener extractFields(List fields) { - NeutronLoadBalancerListener ans = new NeutronLoadBalancerListener(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setLoadBalancerListenerID(this.getLoadBalancerListenerID()); - } - if(s.equals("default_pool_id")) { - ans.setNeutronLoadBalancerListenerDefaultPoolID(this.getNeutronLoadBalancerListenerDefaultPoolID()); - } - if (s.equals("tenant_id")) { - ans.setLoadBalancerListenerTenantID(this.getLoadBalancerListenerTenantID()); - } - if (s.equals("name")) { - ans.setLoadBalancerListenerName(this.getLoadBalancerListenerName()); - } - if(s.equals("description")) { - ans.setLoadBalancerListenerDescription(this.getLoadBalancerListenerDescription()); - } - if (s.equals("shared")) { - ans.setLoadBalancerListenerIsShared(loadBalancerListenerIsShared); - } - if (s.equals("protocol")) { - ans.setNeutronLoadBalancerListenerProtocol(this.getNeutronLoadBalancerListenerProtocol()); - } - if (s.equals("protocol_port")) { - ans.setNeutronLoadBalancerListenerProtocolPort(this.getNeutronLoadBalancerListenerProtocolPort()); - } - if (s.equals("load_balancer_id")) { - ans.setNeutronLoadBalancerListenerLoadBalancerID(this.getNeutronLoadBalancerListenerLoadBalancerID()); - } - if (s.equals("admin_state_up")) { - ans.setLoadBalancerListenerAdminStateIsUp(loadBalancerListenerAdminStateIsUp); - } - if (s.equals("status")) { - ans.setLoadBalancerListenerStatus(this.getLoadBalancerListenerStatus()); - } - } - return ans; - } - - @Override public String toString() { - return "NeutronLoadBalancerListener{" + - "loadBalancerListenerID='" + loadBalancerListenerID + '\'' + - ", neutronLoadBalancerListenerDefaultPoolID='" + neutronLoadBalancerListenerDefaultPoolID + '\'' + - ", loadBalancerListenerTenantID='" + loadBalancerListenerTenantID + '\'' + - ", loadBalancerListenerName='" + loadBalancerListenerName + '\'' + - ", loadBalancerListenerDescription='" + loadBalancerListenerDescription + '\'' + - ", loadBalancerListenerAdminStateIsUp=" + loadBalancerListenerAdminStateIsUp + - ", loadBalancerListenerStatus='" + loadBalancerListenerStatus + '\'' + - ", loadBalancerListenerIsShared=" + loadBalancerListenerIsShared + - ", neutronLoadBalancerListenerProtocol='" + neutronLoadBalancerListenerProtocol + '\'' + - ", neutronLoadBalancerListenerProtocolPort='" + neutronLoadBalancerListenerProtocolPort + '\'' + - ", neutronLoadBalancerListenerLoadBalancerID='" + neutronLoadBalancerListenerLoadBalancerID + '\'' + - '}'; - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPool.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPool.java deleted file mode 100644 index 363de412d8..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPool.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -//import javax.xml.bind.annotation.XmlElementWrapper; -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -/** - * OpenStack Neutron v2.0 Load Balancer as a service - * (LBaaS) bindings. See OpenStack Network API - * v2.0 Reference for description of the fields: - * Implemented fields are as follows: - * - * id uuid-str - * tenant_id uuid-str - * name String - * description String - * protocol String - * lb_algorithm String - * healthmonitor_id String - * admin_state_up Bool - * status String - * members List - * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf - */ - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronLoadBalancerPool implements Serializable { - private static final long serialVersionUID = 1L; - - @XmlElement(name="id") - String loadBalancerPoolID; - - @XmlElement (name="tenant_id") - String loadBalancerPoolTenantID; - - @XmlElement (name="name") - String loadBalancerPoolName; - - @XmlElement (name="description") - String loadBalancerPoolDescription; - - @XmlElement (name="protocol") - String loadBalancerPoolProtocol; - - @XmlElement (name="lb_algorithm") - String loadBalancerPoolLbAlgorithm; - - @XmlElement (name="healthmonitor_id") - String neutronLoadBalancerPoolHealthMonitorID; - - @XmlElement (defaultValue="true", name="admin_state_up") - Boolean loadBalancerPoolAdminStateIsUp; - - @XmlElement (name="status") - String loadBalancerPoolStatus; - - @XmlElement(name="members") - List loadBalancerPoolMembers; - - public NeutronLoadBalancerPool() { - } - - public String getLoadBalancerPoolID() { - return loadBalancerPoolID; - } - - public void setLoadBalancerPoolID(String loadBalancerPoolID) { - this.loadBalancerPoolID = loadBalancerPoolID; - } - - public String getLoadBalancerPoolTenantID() { - return loadBalancerPoolTenantID; - } - - public void setLoadBalancerPoolTenantID(String loadBalancerPoolTenantID) { - this.loadBalancerPoolTenantID = loadBalancerPoolTenantID; - } - - public String getLoadBalancerPoolName() { - return loadBalancerPoolName; - } - - public void setLoadBalancerPoolName(String loadBalancerPoolName) { - this.loadBalancerPoolName = loadBalancerPoolName; - } - - public String getLoadBalancerPoolDescription() { - return loadBalancerPoolDescription; - } - - public void setLoadBalancerPoolDescription(String loadBalancerPoolDescription) { - this.loadBalancerPoolDescription = loadBalancerPoolDescription; - } - - public String getLoadBalancerPoolProtocol() { - return loadBalancerPoolProtocol; - } - - public void setLoadBalancerPoolProtocol(String loadBalancerPoolProtocol) { - this.loadBalancerPoolProtocol = loadBalancerPoolProtocol; - } - - public String getLoadBalancerPoolLbAlgorithm() { - return loadBalancerPoolLbAlgorithm; - } - - public void setLoadBalancerPoolLbAlgorithm(String loadBalancerPoolLbAlgorithm) { - this.loadBalancerPoolLbAlgorithm = loadBalancerPoolLbAlgorithm; - } - - public String getNeutronLoadBalancerPoolHealthMonitorID() { - return neutronLoadBalancerPoolHealthMonitorID; - } - - public void setNeutronLoadBalancerPoolHealthMonitorID(String neutronLoadBalancerPoolHealthMonitorID) { - this.neutronLoadBalancerPoolHealthMonitorID = neutronLoadBalancerPoolHealthMonitorID; - } - - public Boolean getLoadBalancerPoolAdminIsStateIsUp() { - return loadBalancerPoolAdminStateIsUp; - } - - public void setLoadBalancerPoolAdminStateIsUp(Boolean loadBalancerPoolAdminStateIsUp) { - this.loadBalancerPoolAdminStateIsUp = loadBalancerPoolAdminStateIsUp; - } - - public String getLoadBalancerPoolStatus() { - return loadBalancerPoolStatus; - } - - public void setLoadBalancerPoolStatus(String loadBalancerPoolStatus) { - this.loadBalancerPoolStatus = loadBalancerPoolStatus; - } - - public List getLoadBalancerPoolMembers() { - /* - * Update the pool_id of the member to that this.loadBalancerPoolID - */ - for (NeutronLoadBalancerPoolMember member: loadBalancerPoolMembers) - member.setPoolID(loadBalancerPoolID); - return loadBalancerPoolMembers; - } - - public void setLoadBalancerPoolMembers(List loadBalancerPoolMembers) { - this.loadBalancerPoolMembers = loadBalancerPoolMembers; - } - - public void addLoadBalancerPoolMember(NeutronLoadBalancerPoolMember loadBalancerPoolMember) { - this.loadBalancerPoolMembers.add(loadBalancerPoolMember); - } - - public void removeLoadBalancerPoolMember(NeutronLoadBalancerPoolMember loadBalancerPoolMember) { - this.loadBalancerPoolMembers.remove(loadBalancerPoolMember); - } - - public NeutronLoadBalancerPool extractFields(List fields) { - NeutronLoadBalancerPool ans = new NeutronLoadBalancerPool(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setLoadBalancerPoolID(this.getLoadBalancerPoolID()); - } - if (s.equals("tenant_id")) { - ans.setLoadBalancerPoolTenantID(this.getLoadBalancerPoolTenantID()); - } - if (s.equals("name")) { - ans.setLoadBalancerPoolName(this.getLoadBalancerPoolName()); - } - if(s.equals("description")) { - ans.setLoadBalancerPoolDescription(this.getLoadBalancerPoolDescription()); - } - if(s.equals("protocol")) { - ans.setLoadBalancerPoolProtocol(this.getLoadBalancerPoolProtocol()); - } - if(s.equals("lb_algorithm")) { - ans.setLoadBalancerPoolLbAlgorithm(this.getLoadBalancerPoolLbAlgorithm()); - } - if(s.equals("healthmonitor_id")) { - ans.setNeutronLoadBalancerPoolHealthMonitorID(this.getNeutronLoadBalancerPoolHealthMonitorID()); - } - if (s.equals("admin_state_up")) { - ans.setLoadBalancerPoolAdminStateIsUp(loadBalancerPoolAdminStateIsUp); - } - if (s.equals("status")) { - ans.setLoadBalancerPoolStatus(this.getLoadBalancerPoolStatus()); - } - if (s.equals("members")) { - ans.setLoadBalancerPoolMembers(getLoadBalancerPoolMembers()); - } - } - return ans; - } -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPoolMember.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPoolMember.java deleted file mode 100644 index 313a951b2f..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPoolMember.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlTransient; -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronLoadBalancerPoolMember implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * TODO: Plumb into LBaaS Pool. Members are nested underneath Pool CRUD. - */ - @XmlElement (name="id") - String poolMemberID; - - @XmlElement (name="tenant_id") - String poolMemberTenantID; - - @XmlElement (name="address") - String poolMemberAddress; - - @XmlElement (name="protocol_port") - Integer poolMemberProtoPort; - - @XmlElement (name="admin_state_up") - Boolean poolMemberAdminStateIsUp; - - @XmlElement (name="weight") - Integer poolMemberWeight; - - @XmlElement (name="subnet_id") - String poolMemberSubnetID; - - @XmlElement (name="status") - String poolMemberStatus; - - String poolID; - - public NeutronLoadBalancerPoolMember() { - } - - @XmlTransient - public String getPoolID() { - return poolID; - } - - public void setPoolID(String poolID) { - this.poolID = poolID; - } - - public String getPoolMemberID() { - return poolMemberID; - } - - public void setPoolMemberID(String poolMemberID) { - this.poolMemberID = poolMemberID; - } - - public String getPoolMemberTenantID() { - return poolMemberTenantID; - } - - public void setPoolMemberTenantID(String poolMemberTenantID) { - this.poolMemberTenantID = poolMemberTenantID; - } - - public String getPoolMemberAddress() { - return poolMemberAddress; - } - - public void setPoolMemberAddress(String poolMemberAddress) { - this.poolMemberAddress = poolMemberAddress; - } - - public Integer getPoolMemberProtoPort() { - return poolMemberProtoPort; - } - - public void setPoolMemberProtoPort(Integer poolMemberProtoPort) { - this.poolMemberProtoPort = poolMemberProtoPort; - } - - public Boolean getPoolMemberAdminStateIsUp() { - return poolMemberAdminStateIsUp; - } - - public void setPoolMemberAdminStateIsUp(Boolean poolMemberAdminStateIsUp) { - this.poolMemberAdminStateIsUp = poolMemberAdminStateIsUp; - } - - public Integer getPoolMemberWeight() { - return poolMemberWeight; - } - - public void setPoolMemberWeight(Integer poolMemberWeight) { - this.poolMemberWeight = poolMemberWeight; - } - - public String getPoolMemberSubnetID() { - return poolMemberSubnetID; - } - - public void setPoolMemberSubnetID(String poolMemberSubnetID) { - this.poolMemberSubnetID = poolMemberSubnetID; - } - - public String getPoolMemberStatus() { - return poolMemberStatus; - } - - public void setPoolMemberStatus(String poolMemberStatus) { - this.poolMemberStatus = poolMemberStatus; - } - - public NeutronLoadBalancerPoolMember extractFields(List fields) { - NeutronLoadBalancerPoolMember ans = new NeutronLoadBalancerPoolMember(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setPoolMemberID(this.getPoolMemberID()); - } - if (s.equals("pool_id")) { - ans.setPoolID(this.getPoolID()); - } - if (s.equals("tenant_id")) { - ans.setPoolMemberTenantID(this.getPoolMemberTenantID()); - } - if (s.equals("address")) { - ans.setPoolMemberAddress(this.getPoolMemberAddress()); - } - if(s.equals("protocol_port")) { - ans.setPoolMemberProtoPort(this.getPoolMemberProtoPort()); - } - if (s.equals("admin_state_up")) { - ans.setPoolMemberAdminStateIsUp(poolMemberAdminStateIsUp); - } - if(s.equals("weight")) { - ans.setPoolMemberWeight(this.getPoolMemberWeight()); - } - if(s.equals("subnet_id")) { - ans.setPoolMemberSubnetID(this.getPoolMemberSubnetID()); - } - if (s.equals("status")) { - ans.setPoolMemberStatus(this.getPoolMemberStatus()); - } - } - return ans; - } - @Override public String toString() { - return "NeutronLoadBalancerPoolMember{" + - "poolMemberID='" + poolMemberID + '\'' + - ", poolID='" + poolID + '\'' + - ", poolMemberTenantID='" + poolMemberTenantID + '\'' + - ", poolMemberAddress='" + poolMemberAddress + '\'' + - ", poolMemberProtoPort=" + poolMemberProtoPort + - ", poolMemberAdminStateIsUp=" + poolMemberAdminStateIsUp + - ", poolMemberWeight=" + poolMemberWeight + - ", poolMemberSubnetID='" + poolMemberSubnetID + '\'' + - ", poolMemberStatus='" + poolMemberStatus + '\'' + - '}'; - } -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java deleted file mode 100644 index 1cbbb36f78..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "network") -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronNetwork implements Serializable, INeutronObject { - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - private static final long serialVersionUID = 1L; - - @XmlElement (name="id") - String networkUUID; // network UUID - - @XmlElement (name="name") - String networkName; // name - - @XmlElement (defaultValue="true", name="admin_state_up") - Boolean adminStateUp; // admin state up (true/false) - - @XmlElement (defaultValue="false", name="shared") - Boolean shared; // shared network or not - - @XmlElement (name="tenant_id") - String tenantID; // tenant for this network - - @XmlElement (defaultValue="false", namespace="router", name="external") - Boolean routerExternal; // network external or not - - @XmlElement (defaultValue="flat", namespace="provider", name="network_type") - String providerNetworkType; // provider network type (flat or vlan) - - @XmlElement (namespace="provider", name="physical_network") - String providerPhysicalNetwork; // provider physical network (name) - - @XmlElement (namespace="provider", name="segmentation_id") - String providerSegmentationID; // provide segmentation ID (vlan ID) - - @XmlElement (name="status") - String status; // status (read-only) - - @XmlElement (name="subnets") - List subnets; // subnets (read-only) - - /* This attribute lists the ports associated with an instance - * which is needed for determining if that instance can be deleted - */ - - List myPorts; - - public NeutronNetwork() { - myPorts = new ArrayList(); - } - - public void initDefaults() { - subnets = new ArrayList(); - if (status == null) { - status = "ACTIVE"; - } - if (adminStateUp == null) { - adminStateUp = true; - } - if (shared == null) { - shared = false; - } - if (routerExternal == null) { - routerExternal = false; - } - if (providerNetworkType == null) { - providerNetworkType = "flat"; - } - } - - public String getID() { return networkUUID; } - - public void setID(String id) { this.networkUUID = id; } - - public String getNetworkUUID() { - return networkUUID; - } - - public void setNetworkUUID(String networkUUID) { - this.networkUUID = networkUUID; - } - - public String getNetworkName() { - return networkName; - } - - public void setNetworkName(String networkName) { - this.networkName = networkName; - } - - public boolean isAdminStateUp() { - return adminStateUp; - } - - public Boolean getAdminStateUp() { return adminStateUp; } - - public void setAdminStateUp(boolean newValue) { - adminStateUp = newValue; - } - - public boolean isShared() { return shared; } - - public Boolean getShared() { return shared; } - - public void setShared(boolean newValue) { - shared = newValue; - } - - public String getTenantID() { - return tenantID; - } - - public void setTenantID(String tenantID) { - this.tenantID = tenantID; - } - - public boolean isRouterExternal() { return routerExternal; } - - public Boolean getRouterExternal() { return routerExternal; } - - public void setRouterExternal(boolean newValue) { - routerExternal = newValue; - } - - public String getProviderNetworkType() { - return providerNetworkType; - } - - public void setProviderNetworkType(String providerNetworkType) { - this.providerNetworkType = providerNetworkType; - } - - public String getProviderPhysicalNetwork() { - return providerPhysicalNetwork; - } - - public void setProviderPhysicalNetwork(String providerPhysicalNetwork) { - this.providerPhysicalNetwork = providerPhysicalNetwork; - } - - public String getProviderSegmentationID() { - return providerSegmentationID; - } - - public void setProviderSegmentationID(String providerSegmentationID) { - this.providerSegmentationID = providerSegmentationID; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public List getSubnets() { - return subnets; - } - - public void setSubnets(List subnets) { - this.subnets = subnets; - } - - public void addSubnet(String uuid) { - subnets.add(uuid); - } - - public void removeSubnet(String uuid) { - subnets.remove(uuid); - } - - public List getPortsOnNetwork() { - return myPorts; - } - - public void addPort(NeutronPort port) { - myPorts.add(port); - } - - public void removePort(NeutronPort port) { - myPorts.remove(port); - } - - /** - * This method copies selected fields from the object and returns them - * as a new object, suitable for marshaling. - * - * @param fields - * List of attributes to be extracted - * @return an OpenStackNetworks object with only the selected fields - * populated - */ - - public NeutronNetwork extractFields(List fields) { - NeutronNetwork ans = new NeutronNetwork(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setNetworkUUID(this.getNetworkUUID()); - } - if (s.equals("name")) { - ans.setNetworkName(this.getNetworkName()); - } - if (s.equals("admin_state_up")) { - ans.setAdminStateUp(adminStateUp); - } - if (s.equals("status")) { - ans.setStatus(this.getStatus()); - } - if (s.equals("subnets")) { - List subnetList = new ArrayList(); - subnetList.addAll(this.getSubnets()); - ans.setSubnets(subnetList); - } - if (s.equals("shared")) { - ans.setShared(shared); - } - if (s.equals("tenant_id")) { - ans.setTenantID(this.getTenantID()); - } - } - return ans; - } - - @Override - public String toString() { - return "NeutronNetwork [networkUUID=" + networkUUID + ", networkName=" + networkName + ", adminStateUp=" - + adminStateUp + ", shared=" + shared + ", tenantID=" + tenantID + ", routerExternal=" + routerExternal - + ", providerNetworkType=" + providerNetworkType + ", providerPhysicalNetwork=" - + providerPhysicalNetwork + ", providerSegmentationID=" + providerSegmentationID + ", status=" + status - + ", subnets=" + subnets + ", myPorts=" + myPorts + "]"; - } -} - diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java deleted file mode 100644 index 3853988353..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronPort implements Serializable, INeutronObject { - private static final long serialVersionUID = 1L; - - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement (name="id") - String portUUID; - - @XmlElement (name="network_id") - String networkUUID; - - @XmlElement (name="name") - String name; - - @XmlElement (defaultValue="true", name="admin_state_up") - Boolean adminStateUp; - - @XmlElement (name="status") - String status; - - @XmlElement (name="mac_address") - String macAddress; - - @XmlElement (name="fixed_ips") - List fixedIPs; - - @XmlElement (name="device_id") - String deviceID; - - @XmlElement (name="device_owner") - String deviceOwner; - - @XmlElement (name="tenant_id") - String tenantID; - - @XmlElement (name="security_groups") - List securityGroups; - - @XmlElement (namespace= "binding", name="host_id") - String bindinghostID; - - @XmlElement (namespace= "binding", name="vnic_type") - String bindingvnicType; - - @XmlElement (namespace= "binding", name="vif_type") - String bindingvifType; - - - /* this attribute stores the floating IP address assigned to - * each fixed IP address - */ - - HashMap floatingIPMap; - - public NeutronPort() { - floatingIPMap = new HashMap(); - } - - public String getID() { return portUUID; } - - public void setID(String id) { this.portUUID = id; } - - public String getPortUUID() { - return portUUID; - } - - public void setPortUUID(String portUUID) { - this.portUUID = portUUID; - } - - public String getNetworkUUID() { - return networkUUID; - } - - public void setNetworkUUID(String networkUUID) { - this.networkUUID = networkUUID; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public boolean isAdminStateUp() { - if (adminStateUp == null) { - return true; - } - return adminStateUp; - } - - public Boolean getAdminStateUp() { return adminStateUp; } - - public void setAdminStateUp(Boolean newValue) { - adminStateUp = newValue; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getMacAddress() { - return macAddress; - } - - public void setMacAddress(String macAddress) { - this.macAddress = macAddress; - } - - public List getFixedIPs() { - return fixedIPs; - } - - public void setFixedIPs(List fixedIPs) { - this.fixedIPs = fixedIPs; - } - - public String getDeviceID() { - return deviceID; - } - - public void setDeviceID(String deviceID) { - this.deviceID = deviceID; - } - - public String getDeviceOwner() { - return deviceOwner; - } - - public void setDeviceOwner(String deviceOwner) { - this.deviceOwner = deviceOwner; - } - - public String getTenantID() { - return tenantID; - } - - public void setTenantID(String tenantID) { - this.tenantID = tenantID; - } - - public List getSecurityGroups() { - return securityGroups; - } - - public void setSecurityGroups(List securityGroups) { - this.securityGroups = securityGroups; - } - - public String getBindinghostID() { - return bindinghostID; - } - - public void setBindinghostID(String bindinghostID) { - this.bindinghostID = bindinghostID; - } - - public String getBindingvnicType() { - return bindingvnicType; - } - - public void setBindingvnicType(String bindingvnicType) { - this.bindingvnicType = bindingvnicType; - } - - public String getBindingvifType() { - return bindingvifType; - } - - public void setBindingvifType(String bindingvifType) { - this.bindingvifType = bindingvifType; - } - - public NeutronFloatingIP getFloatingIP(String key) { - if (!floatingIPMap.containsKey(key)) { - return null; - } - return floatingIPMap.get(key); - } - - public void removeFloatingIP(String key) { - floatingIPMap.remove(key); - } - - public void addFloatingIP(String key, NeutronFloatingIP floatingIP) { - if (!floatingIPMap.containsKey(key)) { - floatingIPMap.put(key, floatingIP); - } - } - - /** - * This method copies selected fields from the object and returns them - * as a new object, suitable for marshaling. - * - * @param fields - * List of attributes to be extracted - * @return an OpenStackPorts object with only the selected fields - * populated - */ - - public NeutronPort extractFields(List fields) { - NeutronPort ans = new NeutronPort(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setPortUUID(this.getPortUUID()); - } - if (s.equals("network_id")) { - ans.setNetworkUUID(this.getNetworkUUID()); - } - if (s.equals("name")) { - ans.setName(this.getName()); - } - if (s.equals("admin_state_up")) { - ans.setAdminStateUp(this.getAdminStateUp()); - } - if (s.equals("status")) { - ans.setStatus(this.getStatus()); - } - if (s.equals("mac_address")) { - ans.setMacAddress(this.getMacAddress()); - } - if (s.equals("fixed_ips")) { - List fixedIPs = new ArrayList(); - fixedIPs.addAll(this.getFixedIPs()); - ans.setFixedIPs(fixedIPs); - } - if (s.equals("device_id")) { - ans.setDeviceID(this.getDeviceID()); - } - if (s.equals("device_owner")) { - ans.setDeviceOwner(this.getDeviceOwner()); - } - if (s.equals("tenant_id")) { - ans.setTenantID(this.getTenantID()); - } - if (s.equals("security_groups")) { - List securityGroups = new ArrayList(); - securityGroups.addAll(this.getSecurityGroups()); - ans.setSecurityGroups(securityGroups); - } - } - return ans; - } - - public void initDefaults() { - adminStateUp = true; - if (status == null) { - status = "ACTIVE"; - } - if (fixedIPs == null) { - fixedIPs = new ArrayList(); - } - } - - /** - * This method checks to see if the port has a floating IPv4 address - * associated with the supplied fixed IPv4 address - * - * @param fixedIP - * fixed IPv4 address in dotted decimal format - * @return a boolean indicating if there is a floating IPv4 address bound - * to the fixed IPv4 address - */ - - public boolean isBoundToFloatingIP(String fixedIP) { - return floatingIPMap.containsKey(fixedIP); - } - - @Override - public String toString() { - return "NeutronPort [portUUID=" + portUUID + ", networkUUID=" + networkUUID + ", name=" + name - + ", adminStateUp=" + adminStateUp + ", status=" + status + ", macAddress=" + macAddress - + ", fixedIPs=" + fixedIPs + ", deviceID=" + deviceID + ", deviceOwner=" + deviceOwner + ", tenantID=" - + tenantID + ", floatingIPMap=" + floatingIPMap + ", securityGroups=" + securityGroups - + ", bindinghostID=" + bindinghostID + ", bindingvnicType=" + bindingvnicType - + ", bindingvnicType=" + bindingvnicType + "]"; - } -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java deleted file mode 100644 index 9d5ee38b50..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronRouter implements Serializable, INeutronObject { - private static final long serialVersionUID = 1L; - - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - @XmlElement (name="id") - String routerUUID; - - @XmlElement (name="name") - String name; - - @XmlElement (defaultValue="true", name="admin_state_up") - Boolean adminStateUp; - - @XmlElement (name="status") - String status; - - @XmlElement (name="tenant_id") - String tenantID; - - @XmlElement (name="external_gateway_info", nillable=true) - NeutronRouter_NetworkReference externalGatewayInfo; - - @XmlElement (name="distributed") - Boolean distributed; - - @XmlElement (name="gw_port_id", nillable=true) - String gatewayPortId; - - @XmlElement (name="routes") - List routes; - - /* Holds a map of OpenStackRouterInterfaces by subnet UUID - * used for internal mapping to DOVE - */ - HashMap interfaces; - - public NeutronRouter() { - interfaces = new HashMap(); - } - - public String getID() { return routerUUID; } - - public void setID(String id) { this.routerUUID = id; } - - public String getRouterUUID() { - return routerUUID; - } - - public void setRouterUUID(String routerUUID) { - this.routerUUID = routerUUID; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public boolean isAdminStateUp() { - if (adminStateUp == null) { - return true; - } - return adminStateUp; - } - - public Boolean getAdminStateUp() { return adminStateUp; } - - public void setAdminStateUp(Boolean newValue) { - adminStateUp = newValue; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getTenantID() { - return tenantID; - } - - public void setTenantID(String tenantID) { - this.tenantID = tenantID; - } - - public NeutronRouter_NetworkReference getExternalGatewayInfo() { - return externalGatewayInfo; - } - - public void setExternalGatewayInfo(NeutronRouter_NetworkReference externalGatewayInfo) { - this.externalGatewayInfo = externalGatewayInfo; - } - - public Boolean getDistributed() { - return distributed; - } - - public void setDistributed(Boolean distributed) { - this.distributed = distributed; - } - - public String getGatewayPortId() { - return gatewayPortId; - } - - public void setGatewayPortId(String gatewayPortId) { - this.gatewayPortId = gatewayPortId; - } - - public List getRoutes() { - return routes; - } - - public void setRoutes(List routes) { - this.routes = routes; - } - - /** - * This method copies selected fields from the object and returns them - * as a new object, suitable for marshaling. - * - * @param fields - * List of attributes to be extracted - * @return an OpenStackRouters object with only the selected fields - * populated - */ - public NeutronRouter extractFields(List fields) { - NeutronRouter ans = new NeutronRouter(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setRouterUUID(this.getRouterUUID()); - } - if (s.equals("name")) { - ans.setName(this.getName()); - } - if (s.equals("admin_state_up")) { - ans.setAdminStateUp(this.getAdminStateUp()); - } - if (s.equals("status")) { - ans.setStatus(this.getStatus()); - } - if (s.equals("tenant_id")) { - ans.setTenantID(this.getTenantID()); - } - if (s.equals("external_gateway_info")) { - ans.setExternalGatewayInfo(this.getExternalGatewayInfo()); - } - if (s.equals("distributed")) { - ans.setDistributed(this.getDistributed()); - } - if (s.equals("gw_port_id")) { - ans.setGatewayPortId(this.getGatewayPortId()); - } - if (s.equals("routes")){ - ans.setRoutes(this.getRoutes()); - } - } - return ans; - } - - public HashMap getInterfaces() { - return interfaces; - } - - public void addInterface(String s, NeutronRouter_Interface i) { - interfaces.put(s, i); - } - - public void removeInterface(String s) { - interfaces.remove(s); - } - - public void initDefaults() { - adminStateUp = true; - } -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_Interface.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_Interface.java deleted file mode 100644 index c7ae4eb172..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_Interface.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -public class NeutronRouter_Interface implements Serializable { - private static final long serialVersionUID = 1L; - - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement (name="subnet_id") - String subnetUUID; - - @XmlElement (name="port_id") - String portUUID; - - @XmlElement (name="id") - String id; - - @XmlElement (name="tenant_id") - String tenantID; - - public NeutronRouter_Interface() { - } - - public NeutronRouter_Interface(String subnetUUID, String portUUID) { - this.subnetUUID = subnetUUID; - this.portUUID = portUUID; - } - - public String getSubnetUUID() { - return subnetUUID; - } - - public void setSubnetUUID(String subnetUUID) { - this.subnetUUID = subnetUUID; - } - - public String getPortUUID() { - return portUUID; - } - - public void setPortUUID(String portUUID) { - this.portUUID = portUUID; - } - - public String getID() { - return id; - } - - public void setID(String id) { - this.id = id; - } - - public void setTenantID(String tenantID) { - this.tenantID = tenantID; - } -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_NetworkReference.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_NetworkReference.java deleted file mode 100644 index 8583d44531..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_NetworkReference.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronRouter_NetworkReference implements Serializable { - private static final long serialVersionUID = 1L; - - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement(name="network_id") - String networkID; - - public NeutronRouter_NetworkReference() { - } - - public String getNetworkID() { - return networkID; - } - - public void setNetworkID(String networkID) { - this.networkID = networkID; - } -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityGroup.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityGroup.java deleted file mode 100644 index ca56c7b050..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityGroup.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * OpenStack Neutron v2.0 Security Group bindings. - * See OpenStack Network API v2.0 Reference for description of - * annotated attributes. The current fields are as follows: - *

- * id uuid-str unique ID for the security group. - * name String name of the security group. - * description String name of the security group. - * tenant_id uuid-str Owner of security rule.. - * security_group_rules List nested RO in the sec group. - */ - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronSecurityGroup implements Serializable { - private static final long serialVersionUID = 1L; - - @XmlElement(name = "id") - String securityGroupUUID; - - @XmlElement(name = "name") - String securityGroupName; - - @XmlElement(name = "description") - String securityGroupDescription; - - @XmlElement(name = "tenant_id") - String securityGroupTenantID; - - @XmlElement(name = "security_group_rules") - List neutronSecurityRule; - - List neutronPorts; - - public NeutronSecurityGroup() { - neutronPorts = new ArrayList (); - List securityRules; - - } - - public String getSecurityGroupUUID() { - return securityGroupUUID; - } - - public void setSecurityGroupUUID(String securityGroupUUID) { - this.securityGroupUUID = securityGroupUUID; - } - - public String getSecurityGroupName() { - return securityGroupName; - } - - public void setSecurityGroupName(String securityGroupName) { - this.securityGroupName = securityGroupName; - } - - public String getSecurityGroupDescription() { - return securityGroupDescription; - } - - public void setSecurityGroupDescription(String securityGroupDescription) { - this.securityGroupDescription = securityGroupDescription; - } - - public String getSecurityGroupTenantID() { - return securityGroupTenantID; - } - - public void setSecurityGroupTenantID(String securityGroupTenantID) { - this.securityGroupTenantID = securityGroupTenantID; - } - - // Rules In Group - public List getSecurityRules() { - return neutronSecurityRule; - } - - public void setSecurityRules(NeutronSecurityRule neutronSecurityRule) { - this.neutronSecurityRule = (List) neutronSecurityRule; - } - - public NeutronSecurityGroup extractFields(List fields) { - NeutronSecurityGroup ans = new NeutronSecurityGroup (); - Iterator i = fields.iterator (); - while (i.hasNext ()) { - String s = i.next (); - if (s.equals ("id")) { - ans.setSecurityGroupUUID (this.getSecurityGroupUUID ()); - } - if (s.equals ("name")) { - ans.setSecurityGroupName (this.getSecurityGroupName ()); - } - if (s.equals ("description")) { - ans.setSecurityGroupDescription (this.getSecurityGroupDescription ()); - } - if (s.equals ("tenant_id")) { - ans.setSecurityGroupTenantID (this.getSecurityGroupTenantID ()); - } - if (s.equals ("security_group_rules")) { - ans.setSecurityRules ((NeutronSecurityRule) this.getSecurityRules ()); - } - } - return ans; - } - - @Override - public String toString() { - return "NeutronSecurityGroup{" + - "securityGroupUUID='" + securityGroupUUID + '\'' + - ", securityGroupName='" + securityGroupName + '\'' + - ", securityGroupDescription='" + securityGroupDescription + '\'' + - ", securityGroupTenantID='" + securityGroupTenantID + '\'' + - ", securityRules=" + neutronSecurityRule + "]"; - } - - public void initDefaults() { - //TODO verify no defaults values are nessecary required. - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityRule.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityRule.java deleted file mode 100644 index 6247691bdd..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityRule.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (C) 2014 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -/** - * See OpenStack Network API v2.0 Reference for description of - * annotated attributes. The current fields are as follows: - *

- * id uuid (String) UUID for the security group rule. - * security_rule_id uuid (String) The security group to associate rule. - * direction String Direction the VM traffic (ingress/egress). - * security_group_id The security group to associate rule with. - * protocol String IP Protocol (icmp, tcp, udp, etc). - * port_range_min Integer Port at start of range - * port_range_max Integer Port at end of range - * ethertype String ethertype in L2 packet (IPv4, IPv6, etc) - * remote_ip_prefix String (IP cidr) CIDR for address range. - * remote_group_id uuid-str Source security group to apply to rule. - * tenant_id uuid-str Owner of security rule. Admin only outside tenant. - */ - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronSecurityRule implements Serializable { - private static final long serialVersionUID = 1L; - - @XmlElement(name = "id") - String securityRuleUUID; - - @XmlElement(name = "direction") - String securityRuleDirection; - - @XmlElement(name = "protocol") - String securityRuleProtocol; - - @XmlElement(name = "port_range_min") - Integer securityRulePortMin; - - @XmlElement(name = " port_range_max") - Integer securityRulePortMax; - - @XmlElement(name = "ethertype") - String securityRuleEthertype; - - @XmlElement(name = "remote_ip_prefix") - String securityRuleRemoteIpPrefix; - - @XmlElement(name = "remote_group_id") - String securityRemoteGroupID; - - @XmlElement(name = "security_group_id") - String securityRuleGroupID; - - @XmlElement(name = "tenant_id") - String securityRuleTenantID; - - public NeutronSecurityRule() { - List securityRules; - } - - public String getSecurityRuleUUID() { - return securityRuleUUID; - } - - public void setSecurityRuleUUID(String securityRuleUUID) { - this.securityRuleUUID = securityRuleUUID; - } - - public String getSecurityRuleDirection() { - return securityRuleDirection; - } - - public void setSecurityRuleDirection(String securityRuleDirection) { - this.securityRuleDirection = securityRuleDirection; - } - - public String getSecurityRuleProtocol() { - return securityRuleProtocol; - } - - public void setSecurityRuleProtocol(String securityRuleProtocol) { - this.securityRuleProtocol = securityRuleProtocol; - } - - public Integer getSecurityRulePortMin() { - return securityRulePortMin; - } - - public void setSecurityRulePortMin(Integer securityRulePortMin) { - this.securityRulePortMin = securityRulePortMin; - } - - public Integer getSecurityRulePortMax() { - return securityRulePortMax; - } - - public void setSecurityRulePortMax(Integer securityRulePortMax) { - this.securityRulePortMax = securityRulePortMax; - } - - public String getSecurityRuleEthertype() { - return securityRuleEthertype; - } - - public void setSecurityRuleEthertype(String securityRuleEthertype) { - this.securityRuleEthertype = securityRuleEthertype; - } - - public String getSecurityRuleRemoteIpPrefix() { - return securityRuleRemoteIpPrefix; - } - - public void setSecurityRuleRemoteIpPrefix(String securityRuleRemoteIpPrefix) { - this.securityRuleRemoteIpPrefix = securityRuleRemoteIpPrefix; - } - - public String getSecurityRemoteGroupID() { - return securityRemoteGroupID; - } - - public void setSecurityRemoteGroupID(String securityRemoteGroupID) { - this.securityRemoteGroupID = securityRemoteGroupID; - } - - public String getSecurityRuleGroupID() { - return securityRuleGroupID; - } - - public void setSecurityRuleGroupID(String securityRuleGroupID) { - this.securityRuleGroupID = securityRuleGroupID; - } - - public String getSecurityRuleTenantID() { - return securityRuleTenantID; - } - - public void setSecurityRuleTenantID(String securityRuleTenantID) { - this.securityRuleTenantID = securityRuleTenantID; - } - - public NeutronSecurityRule extractFields(List fields) { - NeutronSecurityRule ans = new NeutronSecurityRule(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setSecurityRuleUUID(this.getSecurityRuleUUID()); - } - if (s.equals("direction")) { - ans.setSecurityRuleDirection(this.getSecurityRuleDirection()); - } - if (s.equals("protocol")) { - ans.setSecurityRuleProtocol(this.getSecurityRuleProtocol()); - } - if (s.equals("port_range_min")) { - ans.setSecurityRulePortMin(this.getSecurityRulePortMin()); - } - if (s.equals("port_range_max")) { - ans.setSecurityRulePortMax(this.getSecurityRulePortMax()); - } - if (s.equals("ethertype")) { - ans.setSecurityRuleEthertype(this.getSecurityRuleEthertype()); - } - if (s.equals("remote_ip_prefix")) { - ans.setSecurityRuleRemoteIpPrefix(this.getSecurityRuleRemoteIpPrefix()); - } - if (s.equals("remote_group_id")) { - ans.setSecurityRemoteGroupID(this.getSecurityRemoteGroupID()); - } - if (s.equals("security_group_id")) { - ans.setSecurityRuleGroupID(this.getSecurityRuleGroupID()); - } - if (s.equals("tenant_id")) { - ans.setSecurityRuleTenantID(this.getSecurityRuleTenantID()); - } - } - return ans; - } - - @Override - public String toString() { - return "NeutronSecurityRule{" + - "securityRuleUUID='" + securityRuleUUID + '\'' + - ", securityRuleDirection='" + securityRuleDirection + '\'' + - ", securityRuleProtocol='" + securityRuleProtocol + '\'' + - ", securityRulePortMin=" + securityRulePortMin + - ", securityRulePortMax=" + securityRulePortMax + - ", securityRuleEthertype='" + securityRuleEthertype + '\'' + - ", securityRuleRemoteIpPrefix='" + securityRuleRemoteIpPrefix + '\'' + - ", securityRemoteGroupID=" + securityRemoteGroupID + - ", securityRuleGroupID='" + securityRuleGroupID + '\'' + - ", securityRuleTenantID='" + securityRuleTenantID + '\'' + - '}'; - } - - public void initDefaults() { - //TODO verify no defaults values are nessecary required. - } -} \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java deleted file mode 100644 index 2a44d8b88a..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java +++ /dev/null @@ -1,506 +0,0 @@ -/* - * Copyright IBM Corporation and others, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.io.Serializable; -import java.net.InetAddress; -import java.net.Inet6Address; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import org.apache.commons.net.util.SubnetUtils; -import org.apache.commons.net.util.SubnetUtils.SubnetInfo; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) - -public class NeutronSubnet implements Serializable, INeutronObject { - private static final long serialVersionUID = 1L; - - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement (name="id") - String subnetUUID; - - @XmlElement (name="network_id") - String networkUUID; - - @XmlElement (name="name") - String name; - - @XmlElement (defaultValue="4", name="ip_version") - Integer ipVersion; - - @XmlElement (name="cidr") - String cidr; - - @XmlElement (name="gateway_ip") - String gatewayIP; - - @XmlElement (name="dns_nameservers") - List dnsNameservers; - - @XmlElement (name="allocation_pools") - List allocationPools; - - @XmlElement (name="host_routes") - List hostRoutes; - - @XmlElement (defaultValue="true", name="enable_dhcp") - Boolean enableDHCP; - - @XmlElement (name="tenant_id") - String tenantID; - - @XmlElement (name="ipv6_address_mode", nillable=true) - String ipV6AddressMode; - - @XmlElement (name="ipv6_ra_mode", nillable=true) - String ipV6RaMode; - - /* stores the OpenStackPorts associated with an instance - * used to determine if that instance can be deleted. - */ - List myPorts; - - Boolean gatewayIPAssigned; - - public NeutronSubnet() { - myPorts = new ArrayList(); - } - - public String getID() { return subnetUUID; } - - public void setID(String id) { this.subnetUUID = id; } - - public String getSubnetUUID() { - return subnetUUID; - } - - public void setSubnetUUID(String subnetUUID) { - this.subnetUUID = subnetUUID; - } - - public String getNetworkUUID() { - return networkUUID; - } - - public void setNetworkUUID(String networkUUID) { - this.networkUUID = networkUUID; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Integer getIpVersion() { - return ipVersion; - } - - public void setIpVersion(Integer ipVersion) { - this.ipVersion = ipVersion; - } - - public String getCidr() { - return cidr; - } - - public void setCidr(String cidr) { - this.cidr = cidr; - } - - public String getGatewayIP() { - return gatewayIP; - } - - public void setGatewayIP(String gatewayIP) { - this.gatewayIP = gatewayIP; - } - - public List getDnsNameservers() { - return dnsNameservers; - } - - public void setDnsNameservers(List dnsNameservers) { - this.dnsNameservers = dnsNameservers; - } - - public List getAllocationPools() { - return allocationPools; - } - - public void setAllocationPools(List allocationPools) { - this.allocationPools = allocationPools; - } - - public List getHostRoutes() { - return hostRoutes; - } - - public void setHostRoutes(List hostRoutes) { - this.hostRoutes = hostRoutes; - } - - public boolean isEnableDHCP() { - if (enableDHCP == null) { - return true; - } - return enableDHCP; - } - - public Boolean getEnableDHCP() { return enableDHCP; } - - public void setEnableDHCP(Boolean newValue) { - enableDHCP = newValue; - } - - public String getTenantID() { - return tenantID; - } - - public void setTenantID(String tenantID) { - this.tenantID = tenantID; - } - - public String getIpV6AddressMode() { return ipV6AddressMode; } - - public void setIpV6AddressMode(String ipV6AddressMode) { this.ipV6AddressMode = ipV6AddressMode; } - - public String getIpV6RaMode() { return ipV6RaMode; } - - public void setIpV6RaMode(String ipV6RaMode) { this.ipV6RaMode = ipV6RaMode; } - - /** - * This method copies selected fields from the object and returns them - * as a new object, suitable for marshaling. - * - * @param fields - * List of attributes to be extracted - * @return an OpenStackSubnets object with only the selected fields - * populated - */ - - public NeutronSubnet extractFields(List fields) { - NeutronSubnet ans = new NeutronSubnet(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setSubnetUUID(this.getSubnetUUID()); - } - if (s.equals("network_id")) { - ans.setNetworkUUID(this.getNetworkUUID()); - } - if (s.equals("name")) { - ans.setName(this.getName()); - } - if (s.equals("ip_version")) { - ans.setIpVersion(this.getIpVersion()); - } - if (s.equals("cidr")) { - ans.setCidr(this.getCidr()); - } - if (s.equals("gateway_ip")) { - ans.setGatewayIP(this.getGatewayIP()); - } - if (s.equals("dns_nameservers")) { - List nsList = new ArrayList(); - nsList.addAll(this.getDnsNameservers()); - ans.setDnsNameservers(nsList); - } - if (s.equals("allocation_pools")) { - List aPools = new ArrayList(); - aPools.addAll(this.getAllocationPools()); - ans.setAllocationPools(aPools); - } - if (s.equals("host_routes")) { - List hRoutes = new ArrayList(); - hRoutes.addAll(this.getHostRoutes()); - ans.setHostRoutes(hRoutes); - } - if (s.equals("enable_dhcp")) { - ans.setEnableDHCP(this.getEnableDHCP()); - } - if (s.equals("tenant_id")) { - ans.setTenantID(this.getTenantID()); - } - if (s.equals("ipv6_address_mode")) { - ans.setIpV6AddressMode(this.getIpV6AddressMode()); - } - if (s.equals("ipv6_ra_mode")) { - ans.setIpV6RaMode(this.getIpV6RaMode()); - } - } - return ans; - } - - /* test to see if the cidr address used to define this subnet - * is a valid network address (an necessary condition when creating - * a new subnet) - */ - public boolean isValidCIDR() { - // fix for Bug 2290 - need to wrap the existing test as - // IPv4 because SubnetUtils doesn't support IPv6 - if (ipVersion == 4) { - try { - SubnetUtils util = new SubnetUtils(cidr); - SubnetInfo info = util.getInfo(); - if (!info.getNetworkAddress().equals(info.getAddress())) { - return false; - } - } catch (Exception e) { - return false; - } - return true; - } - if (ipVersion == 6) { - // fix for Bug2290 - this is custom code because no classes - // with ODL-friendly licenses have been found - // extract address (in front of /) and length (after /) - String[] parts = cidr.split("/"); - if (parts.length != 2) { - return false; - } - try { - int length = Integer.parseInt(parts[1]); - //TODO?: limit check on length - // convert to byte array - byte[] addrBytes = ((Inet6Address) InetAddress.getByName(parts[0])).getAddress(); - int i; - for (i=length; i<128; i++) { // offset is to ensure proper comparison - if (((((int) addrBytes[i/8]) & 0x000000FF) & (1 << (7-(i%8)))) != 0) { - return(false); - } - } - return(true); - } catch (Exception e) { - return(false); - } - } - return false; - } - - /* test to see if the gateway IP specified overlaps with specified - * allocation pools (an error condition when creating a new subnet - * or assigning a gateway IP) - */ - public boolean gatewayIP_Pool_overlap() { - Iterator i = allocationPools.iterator(); - while (i.hasNext()) { - NeutronSubnet_IPAllocationPool pool = i.next(); - if (pool.contains(gatewayIP)) { - return true; - } - } - return false; - } - - public boolean initDefaults() { - if (enableDHCP == null) { - enableDHCP = true; - } - if (ipVersion == null) { - ipVersion = 4; - } - gatewayIPAssigned = false; - dnsNameservers = new ArrayList(); - if (hostRoutes == null) { - hostRoutes = new ArrayList(); - } - if (allocationPools == null) { - allocationPools = new ArrayList(); - try { - SubnetUtils util = new SubnetUtils(cidr); - SubnetInfo info = util.getInfo(); - if (gatewayIP == null || ("").equals(gatewayIP)) { - gatewayIP = info.getLowAddress(); - } - if (allocationPools.size() < 1) { - NeutronSubnet_IPAllocationPool source = - new NeutronSubnet_IPAllocationPool(info.getLowAddress(), - info.getHighAddress()); - allocationPools = source.splitPool(gatewayIP); - } - } catch (Exception e) { - return false; - } - } - return true; - } - - public List getPortsInSubnet() { - return myPorts; - } - - public void addPort(NeutronPort port) { - myPorts.add(port); - } - - public void removePort(NeutronPort port) { - myPorts.remove(port); - } - - /* this method tests to see if the supplied IPv4 address - * is valid for this subnet or not - */ - public boolean isValidIP(String ipAddress) { - try { - SubnetUtils util = new SubnetUtils(cidr); - SubnetInfo info = util.getInfo(); - return info.isInRange(ipAddress); - } catch (Exception e) { - return false; - } - } - - /* test to see if the supplied IPv4 address is part of one of the - * available allocation pools or not - */ - public boolean isIPInUse(String ipAddress) { - if (ipAddress.equals(gatewayIP) && !gatewayIPAssigned ) { - return false; - } - Iterator i = allocationPools.iterator(); - while (i.hasNext()) { - NeutronSubnet_IPAllocationPool pool = i.next(); - if (pool.contains(ipAddress)) { - return false; - } - } - return true; - } - - /* method to get the lowest available address of the subnet. - * go through all the allocation pools and keep the lowest of their - * low addresses. - */ - public String getLowAddr() { - String ans = null; - Iterator i = allocationPools.iterator(); - while (i.hasNext()) { - NeutronSubnet_IPAllocationPool pool = i.next(); - if (ans == null) { - ans = pool.getPoolStart(); - } - else - if (NeutronSubnet_IPAllocationPool.convert(pool.getPoolStart()) < - NeutronSubnet_IPAllocationPool.convert(ans)) { - ans = pool.getPoolStart(); - } - } - return ans; - } - - /* - * allocate the parameter address. Because this uses an iterator to - * check the instance's list of allocation pools and we want to modify - * pools while the iterator is being used, it is necessary to - * build a new list of allocation pools and replace the list when - * finished (otherwise a split will cause undefined iterator behavior. - */ - public void allocateIP(String ipAddress) { - Iterator i = allocationPools.iterator(); - List newList = new ArrayList(); // we have to modify a separate list - while (i.hasNext()) { - NeutronSubnet_IPAllocationPool pool = i.next(); - /* if the pool contains a single address element and we are allocating it - * then we don't need to copy the pool over. Otherwise, we need to possibly - * split the pool and add both pieces to the new list - */ - if (!(pool.getPoolEnd().equalsIgnoreCase(ipAddress) && - pool.getPoolStart().equalsIgnoreCase(ipAddress))) { - if (pool.contains(ipAddress)) { - List pools = pool.splitPool(ipAddress); - newList.addAll(pools); - } else { - newList.add(pool); - } - } - } - allocationPools = newList; - } - - /* - * release an IP address back to the subnet. Although an iterator - * is used, the list is not modified until the iterator is complete, so - * an extra list is not necessary. - */ - public void releaseIP(String ipAddress) { - NeutronSubnet_IPAllocationPool lPool = null; - NeutronSubnet_IPAllocationPool hPool = null; - Iterator i = allocationPools.iterator(); - long sIP = NeutronSubnet_IPAllocationPool.convert(ipAddress); - //look for lPool where ipAddr - 1 is high address - //look for hPool where ipAddr + 1 is low address - while (i.hasNext()) { - NeutronSubnet_IPAllocationPool pool = i.next(); - long lIP = NeutronSubnet_IPAllocationPool.convert(pool.getPoolStart()); - long hIP = NeutronSubnet_IPAllocationPool.convert(pool.getPoolEnd()); - if (sIP+1 == lIP) { - hPool = pool; - } - if (sIP-1 == hIP) { - lPool = pool; - } - } - //if (lPool == NULL and hPool == NULL) create new pool where low = ip = high - if (lPool == null && hPool == null) { - allocationPools.add(new NeutronSubnet_IPAllocationPool(ipAddress,ipAddress)); - } - //if (lPool == NULL and hPool != NULL) change low address of hPool to ipAddr - if (lPool == null && hPool != null) { - hPool.setPoolStart(ipAddress); - } - //if (lPool != NULL and hPool == NULL) change high address of lPool to ipAddr - if (lPool != null && hPool == null) { - lPool.setPoolEnd(ipAddress); - } - //if (lPool != NULL and hPool != NULL) remove lPool and hPool and create new pool - // where low address = lPool.low address and high address = hPool.high Address - if (lPool != null && hPool != null) { - allocationPools.remove(lPool); - allocationPools.remove(hPool); - allocationPools.add(new NeutronSubnet_IPAllocationPool( - lPool.getPoolStart(), hPool.getPoolEnd())); - } - } - - public void setGatewayIPAllocated() { - gatewayIPAssigned = true; - } - - public void resetGatewayIPAllocated() { - gatewayIPAssigned = false; - } - - public Boolean getGatewayIPAllocated() { - return gatewayIPAssigned; - } - - @Override - public String toString() { - return "NeutronSubnet [subnetUUID=" + subnetUUID + ", networkUUID=" + networkUUID + ", name=" + name - + ", ipVersion=" + ipVersion + ", cidr=" + cidr + ", gatewayIP=" + gatewayIP + ", dnsNameservers=" - + dnsNameservers + ", allocationPools=" + allocationPools + ", hostRoutes=" + hostRoutes - + ", enableDHCP=" + enableDHCP + ", tenantID=" + tenantID + ", myPorts=" + myPorts - + ", gatewayIPAssigned=" + gatewayIPAssigned + ", ipv6AddressMode=" + ipV6AddressMode - + ", ipv6RaMode=" + ipV6RaMode + "]"; - } -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_HostRoute.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_HostRoute.java deleted file mode 100644 index 07744061e6..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_HostRoute.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -public class NeutronSubnet_HostRoute implements Serializable { - private static final long serialVersionUID = 1L; - - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement(name="destination") - String destination; - - @XmlElement(name="nexthop") - String nextHop; - - public NeutronSubnet_HostRoute() { } -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java deleted file mode 100644 index 75da310b2b..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -public class NeutronSubnet_IPAllocationPool implements Serializable { - private static final long serialVersionUID = 1L; - - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement(name="start") - String poolStart; - - @XmlElement(name="end") - String poolEnd; - - public NeutronSubnet_IPAllocationPool() { - } - - public NeutronSubnet_IPAllocationPool(String lowAddress, String highAddress) { - poolStart = lowAddress; - poolEnd = highAddress; - } - - public String getPoolStart() { - return poolStart; - } - - public void setPoolStart(String poolStart) { - this.poolStart = poolStart; - } - - public String getPoolEnd() { - return poolEnd; - } - - public void setPoolEnd(String poolEnd) { - this.poolEnd = poolEnd; - } - - /** - * This method determines if this allocation pool contains the - * input IPv4 address - * - * @param inputString - * IPv4 address in dotted decimal format - * @returns 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); - } - - /** - * This static method converts the supplied IPv4 address to a long - * integer for comparison - * - * @param inputString - * IPv4 address in dotted decimal format - * @returns high-endian representation of the IPv4 address as a long. - * This method will return 0 if the input is null. - */ - - static long convert(String inputString) { - long ans = 0; - if (inputString != null) { - String[] parts = inputString.split("\\."); - for (String part: parts) { - ans <<= 8; - ans |= Integer.parseInt(part); - } - } - return ans; - } - - /** - * This static method converts the supplied high-ending long back - * into a dotted decimal representation of an IPv4 address - * - * @param l - * high-endian representation of the IPv4 address as a long - * @returns IPv4 address in dotted decimal format - */ - static String longtoIP(long l) { - int i; - String[] parts = new String[4]; - for (i=0; i<4; i++) { - parts[3-i] = String.valueOf(l & 255); - l >>= 8; - } - return join(parts,"."); - } - - /* - * helper routine used by longtoIP - */ - public static String join(String r[],String d) - { - if (r.length == 0) { - return ""; - } - StringBuilder sb = new StringBuilder(); - int i; - for(i=0;i splitPool(String ipAddress) { - List ans = new ArrayList(); - long gIP = NeutronSubnet_IPAllocationPool.convert(ipAddress); - long sIP = NeutronSubnet_IPAllocationPool.convert(poolStart); - long eIP = NeutronSubnet_IPAllocationPool.convert(poolEnd); - long i; - NeutronSubnet_IPAllocationPool p = new NeutronSubnet_IPAllocationPool(); - boolean poolStarted = false; - for (i=sIP; i<=eIP; i++) { - if (i == sIP) { - if (i != gIP) { - p.setPoolStart(poolStart); - poolStarted = true; - } else { - //FIX for bug 533 - p.setPoolStart(NeutronSubnet_IPAllocationPool.longtoIP(i+1)); - } - } - if (i == eIP) { - if (i != gIP) { - p.setPoolEnd(poolEnd); - } else { - p.setPoolEnd(NeutronSubnet_IPAllocationPool.longtoIP(i-1)); - } - ans.add(p); - } - if (i != sIP && i != eIP) { - if (i != gIP) { - if (!poolStarted) { - p.setPoolStart(NeutronSubnet_IPAllocationPool.longtoIP(i)); - poolStarted = true; - } - } else { - p.setPoolEnd(NeutronSubnet_IPAllocationPool.longtoIP(i-1)); - poolStarted = false; - ans.add(p); - p = new NeutronSubnet_IPAllocationPool(); - } - } - } - return ans; - } -} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java deleted file mode 100644 index fe5d45b3a6..0000000000 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.networkconfig.neutron; - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -public class Neutron_IPs implements Serializable { - private static final long serialVersionUID = 1L; - - // See OpenStack Network API v2.0 Reference for description of - // annotated attributes - - @XmlElement(name="ip_address") - String ipAddress; - - @XmlElement(name="subnet_id") - String subnetUUID; - - public Neutron_IPs() { } - - public Neutron_IPs(String uuid) { - subnetUUID = uuid; - } - - public String getIpAddress() { - return ipAddress; - } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - - public String getSubnetUUID() { - return subnetUUID; - } - - public void setSubnetUUID(String subnetUUID) { - this.subnetUUID = subnetUUID; - } - - @Override - public String toString() { - return "Neutron_IPs{" + - "ipAddress='" + ipAddress + '\'' + - ", subnetUUID='" + subnetUUID + '\'' + "}"; - } -} diff --git a/pom.xml b/pom.xml index d41b51b214..068be09dcb 100644 --- a/pom.xml +++ b/pom.xml @@ -26,12 +26,6 @@ opendaylight/adsal - - opendaylight/networkconfiguration/neutron - opendaylight/networkconfiguration/neutron/implementation - opendaylight/networkconfiguration/neutron/northbound - opendaylight/networkconfiguration/neutron/features - opendaylight/commons/concepts opendaylight/commons/protocol-framework -- 2.36.6