From 0ac404938f61fa11746e322a7e1c06a948db42c6 Mon Sep 17 00:00:00 2001 From: Anil Vishnoi Date: Fri, 16 Oct 2015 22:54:09 +0530 Subject: [PATCH] Merge branch 'topic/master/neutron-yang-migration' to branch 'master' Squashed commit of the following: commit 89fc149dd21a3fb9fab3833b8a0e4775c38f62ad Merge: 709dd55 7d09c56 Author: Anil Vishnoi Date: Fri Oct 16 20:32:10 2015 +0530 Merge branch 'master' into topic/master/neutron-yang-migration Conflicts: openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/SecurityServicesManager.java Change-Id: Ib0be9f59f9801babb9892d42bf536a924068138c Signed-off-by: Anil Vishnoi commit 709dd55139632d097c2003076bd16fd26164fb03 Author: Aswin Suryanarayanan Date: Sat Oct 17 02:21:07 2015 +0530 Code refactored for security group update. Change-Id: Iaa838588197567e28d5e97ca4cbc526663453491 Signed-off-by: Aswin Suryanarayanan commit eac410a5c3a66fd6f9455efabf6c3b213b813acc Author: Anil Vishnoi Date: Fri Oct 16 14:37:30 2015 +0530 Merge branch 'master' to branch 'topic/master/neutron-yang-migration' Squashed commit of the following: commit 833ea0aba76e3e3317ca6b7e2a0d6fc99a53d9db Merge: 91de317 423e4d8 Author: Flavio Fernandes Date: Thu Oct 15 17:17:06 2015 +0000 Merge "Adding copyright header to ovsdb/southbound UT" commit 91de31748b01a61b80796d121753ac0dff154910 Author: Sam Hague Date: Thu Oct 15 12:08:13 2015 -0400 Add postman collection for NetvirtSfc Change-Id: Ibe16df4c9d789311b185a9f7cb0193b7a81f5aba Signed-off-by: Sam Hague commit 2989548e8b4191e2b050390f565789dddd6702f5 Author: Sam Hague Date: Thu Oct 15 09:50:46 2015 -0400 Remove unused BundleContext from NetvirtSfc Change-Id: I7d9d185710f82546472d733796ebc2cba2e3a671 Signed-off-by: Sam Hague commit 423e4d84a8e2cf602222a9bfbefba9f20b79e382 Author: Rashmi Pujar Date: Thu Oct 15 09:39:33 2015 -0400 Adding copyright header to ovsdb/southbound UT Change-Id: I92d1f02491f04177b97a1ece879da9278220801b Signed-off-by: Rashmi Pujar commit ea352fced510fa638358b43a818adec60bfac0b3 Merge: 249630d f7f42fb Author: Flavio Fernandes Date: Thu Oct 15 11:59:38 2015 +0000 Merge "All TCP & UDP SG Rules : Implementation and Unit tests added." commit 249630df31cdab5087fc44e32d44a4e082a12e40 Merge: 26b0027 26ed356 Author: Flavio Fernandes Date: Thu Oct 15 11:56:48 2015 +0000 Merge "UT for southbound/transactions/md - set 5" commit 26b0027005bbeb06bfe228e9dceecded20ad4724 Merge: cb2fb88 959688e Author: Flavio Fernandes Date: Thu Oct 15 11:51:55 2015 +0000 Merge "Bug 4472 - netvirt: IlligalArgumentException in NAT provider" commit cb2fb8864b794f1a792d2614522ab36c27bd5c4d Merge: 241ccfe e211414 Author: Sam Hague Date: Thu Oct 15 01:37:31 2015 +0000 Merge "cleanup NetvirtSfcIT" commit e211414c068a2f6ba80f1398ca0b38acbc67db42 Author: Sam Hague Date: Wed Oct 14 21:12:16 2015 -0400 cleanup NetvirtSfcIT Change-Id: I1cc224a7ab4f65825feefe6de28fb787ca7e2f1c Signed-off-by: Sam Hague commit 959688edc325bd4adec9e760da771aeedbb2712f Author: Isaku Yamahata Date: Wed Oct 14 15:06:19 2015 -0700 Bug 4472 - netvirt: IlligalArgumentException in NAT provider This patch adds work around code for ipv6 cidr notation is given. Otherwise following exception occurs. > 2015-10-14 13:38:55,125 | ERROR | ntDispatcherImpl | NeutronL3Adapter | 392 - org.opendaylight.ovsdb.openstack.net-virt - 1.2.1.SNAPSHOT | ProgramRouterInterface failed for mac:FA:16:3E:E0:A8:B5 addr:fd14:5ac7:ba3::1/64 node:ovsdb://uuid/8f75c49c-52b9-4303-8633-a80f0361429b/bridge/br-int srcTunId:external destTunId:1083 action:ADD status:Not Implemented: Not Implemented (0) > 2015-10-14 13:38:55,126 | DEBUG | ntDispatcherImpl | ArpResponderService | 393 - org.opendaylight.ovsdb.openstack.net-virt-providers - 1.2.1.SNAPSHOT | ipv6 address case is not implemented yet. dpid 209308480409166 segmentationId 1083 macAddressStr, ipAddress FA:16:3E:E0:A8:B5 action /fd14:5ac7:ba3:0:0:0:0:1 > 2015-10-14 13:38:55,126 | ERROR | ntDispatcherImpl | NeutronL3Adapter | 392 - org.opendaylight.ovsdb.openstack.net-virt - 1.2.1.SNAPSHOT | ProgramStaticArp failed for mac:FA:16:3E:E0:A8:B5 addr:fd14:5ac7:ba3::1 dpid:209308480409166 segOrOfPort:1083 action:ADD status:Not Implemented: Not Implemented (0) > 2015-10-14 13:38:55,126 | ERROR | ntDispatcherImpl | EventDispatcher | 392 - org.opendaylight.ovsdb.openstack.net-virt - 1.2.1.SNAPSHOT | Exception in dispatching event NorthboundEvent [handler=NEUTRON_PORT, action=ADD, port=NeutronPort [portUUID=4b19acf4-d644-4fe7-8643-852c25cbf604, networkUUID=821f7a2b-b991-48b0-a39c-b0ef264bd321, name=, adminStateUp=true, status=ACTIVE, macAddress=FA:16:3E:E0:A8:B5, fixedIPs=[Neutron_IPs{ipAddress='fd14:5ac7:ba3::1', subnetUUID='54a7f233-1fdb-4d40-bd44-275f180e9a64'}], deviceID=738d6a7c-43bd-469d-bfed-6bcc6ffe5dca, deviceOwner=network:router_interface, tenantID=dc27e3a1cff64a1cb85c7f24899c3eee, securityGroups=[], bindinghostID=, bindingvnicType=normal, bindingvnicType=normal], subnet=null, router=null, routerInterface=null, floatingIP=null, network=null, loadBalancer=null, loadBalancerPool=null, loadBalancerPoolMember=null] > java.lang.IllegalArgumentException: Supplied value "fd14:5ac7:ba3::/64" does not match required pattern "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))$" > at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)[64:com.google.guava:18.0.0] > at org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix.(Ipv4Prefix.java:49)[216:org.opendaylight.mdsal.model.ietf-inet-types:2010.9.24.8-SNAPSHOT] > at org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.OutboundNatService.programIpRewriteExclusion(OutboundNatService.java:167)[393:org.opendaylight.ovsdb.openstack.net-virt-providers:1.2.1.SNAPSHOT] > at org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter.programIpRewriteExclusionStage2(NeutronL3Adapter.java:1143)[392:org.opendaylight.ovsdb.openstack.net-virt:1.2.1.SNAPSHOT] > at org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter.programIpRewriteExclusionStage1(NeutronL3Adapter.java:1128)[392:org.opendaylight.ovsdb.openstack.net-virt:1.2.1.SNAPSHOT] > at org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter.programFlowsForNeutronRouterInterface(NeutronL3Adapter.java:807)[392:org.opendaylight.ovsdb.openstack.net-virt:1.2.1.SNAPSHOT] > at org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter.handleNeutronRouterInterfaceEvent(NeutronL3Adapter.java:298)[392:org.opendaylight.ovsdb.openstack.net-virt:1.2.1.SNAPSHOT] > at org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter.handleNeutronPortEvent(NeutronL3Adapter.java:245)[392:org.opendaylight.ovsdb.openstack.net-virt:1.2.1.SNAPSHOT] > at org.opendaylight.ovsdb.openstack.netvirt.PortHandler.doNeutronPortCreated(PortHandler.java:66)[392:org.opendaylight.ovsdb.openstack.net-virt:1.2.1.SNAPSHOT] > at org.opendaylight.ovsdb.openstack.netvirt.PortHandler.processEvent(PortHandler.java:161)[392:org.opendaylight.ovsdb.openstack.net-virt:1.2.1.SNAPSHOT] > at org.opendaylight.ovsdb.openstack.netvirt.impl.EventDispatcherImpl.dispatchEvent(EventDispatcherImpl.java:95)[392:org.opendaylight.ovsdb.openstack.net-virt:1.2.1.SNAPSHOT] > at org.opendaylight.ovsdb.openstack.netvirt.impl.EventDispatcherImpl.access$200(EventDispatcherImpl.java:28)[392:org.opendaylight.ovsdb.openstack.net-virt:1.2.1.SNAPSHOT] > at org.opendaylight.ovsdb.openstack.netvirt.impl.EventDispatcherImpl$1.run(EventDispatcherImpl.java:57)[392:org.opendaylight.ovsdb.openstack.net-virt:1.2.1.SNAPSHOT] > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_60] > at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_60] > at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_60] > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_60] > at java.lang.Thread.run(Thread.java:745)[:1.8.0_60] Change-Id: I1559667adde1c14b5627df3b7212e404998ce897 Signed-off-by: Isaku Yamahata commit 241ccfe97218b053f1ae09a1d7568df551b85551 Author: Maxime Millette-Coulombe Date: Wed Jul 22 11:53:30 2015 -0400 First pass for ovsdb-ui Revamp of the work already done. Adding a draft of a logical topology viewer. The old code is still in this commit because the works done before will be reuse. Change-Id: Ia3a86cb0370cfad2ef3c2a156b412b9e029c3bf9 Signed-off-by: Maxime Millette-Coulombe commit 26ed35648c8fcea96674a1f6e310f9d7930c09c8 Author: Rashmi Pujar Date: Wed Oct 14 15:03:17 2015 -0400 UT for southbound/transactions/md - set 5 11. OvsdbPortRemoveCommand.java 12. TransactionInvokerImpl.java 13. OvsdbPortUpdateCommand.java Change-Id: Icd9ad76e482de5408650916f6bbf5bc73dc297c8 Signed-off-by: Rashmi Pujar commit 5c63f9ab23bd98686a93e7f745689cf95b152a0c Author: Sam Hague Date: Wed Oct 14 13:29:47 2015 -0400 neuter NetvirtSfcIT Change-Id: Iaca49229b1c594a9e2b5659048319880643887ec Signed-off-by: Sam Hague commit 1b7724f1fe1bae26cc0ffe8f86f83f3ea10fd626 Merge: 29eeb86 09a89ea Author: Sam Hague Date: Wed Oct 14 15:32:29 2015 +0000 Merge "add ovsdb-sfc feature to test feature" commit 09a89eaa4496580769faf0564a0b174040682c5d Author: Sam Hague Date: Wed Oct 14 10:49:05 2015 -0400 add ovsdb-sfc feature to test feature Change-Id: I55c2df5791983998f696054b7728b7d1be696e33 Signed-off-by: Sam Hague commit 29eeb865eab297a9d9642d8816dc6ffdbcd42f1f Merge: 378e785 864ac9f Author: Sam Hague Date: Wed Oct 14 13:19:56 2015 +0000 Merge "Add capability on southbound to NetvirtSfc" commit 864ac9f57ab4f369e8237d1e55c3121784e86915 Author: Sam Hague Date: Wed Oct 14 09:02:51 2015 -0400 Add capability on southbound to NetvirtSfc Change-Id: Iffd6b7b27e701fdfa3bf663421ba72945562d0f1 Signed-off-by: Sam Hague commit 378e78556b82bc756069145194c3cf606aa4aba0 Merge: a8c8f4a ff01d7b Author: Sam Hague Date: Wed Oct 14 04:55:31 2015 +0000 Merge "Workaround to fix net-virt-it" commit ff01d7b11f98e0d5cabd5bd77a8f0dfcfe12675a Author: Sam Hague Date: Wed Oct 14 00:23:59 2015 -0400 Workaround to fix net-virt-it Change-Id: I10838b993f60b5e3859780d7d9f7b4c3630e312a Signed-off-by: Sam Hague commit a8c8f4a5010d6a2b565ca411c3541f9698f3ad49 Merge: cfb6abf ffa3c96 Author: Sam Hague Date: Tue Oct 13 13:10:11 2015 +0000 Merge "UT for southbound/transactions/md - set 4" commit cfb6abf8d000ebca1f7585e1cda58cd82e21f329 Author: Anil Vishnoi Date: Tue Oct 13 13:34:24 2015 +0530 Fix issue that was causing integration test failure. In case of controller initiated connection, iid stamping was not happening. Before clustering code merge, iid stamping was done in updateData(), but after clustering code merge, it does not allow to make any changes to the device till owner of the device is selected by EntityOnwershipService, so updateData() was not stamping the iid to swtich. With this fix, once owner of the device is selected, it explictly stamp iid to the switch. NOTE: we should revert following patch before merging this patch https://git.opendaylight.org/gerrit/#/c/28309/1 I ran the integration suit locally and it passes all the tests [main] INFO org.ops4j.pax.exam.spi.reactors.ReactorManager - suite finished Tests run: 22, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 288.094 sec - in org.opendaylight.ovsdb.southbound.it.SouthboundIT Results : Tests run: 22, Failures: 0, Errors: 0, Skipped: 0 Change-Id: I35d6e0a4fa94eef019420e9b9603873d5088a934 Signed-off-by: Anil Vishnoi commit 91c15602a6323fb4dec0dc2605c853689844aec6 Author: Flavio Fernandes Date: Tue Oct 13 11:04:46 2015 +0000 Revert "Temp workaround to debug southbound IT" This reverts commit 149c5bfb602e91f07c2b98f9509d317be8fcaa3c. Change-Id: I78aa7b506f32e37b65cae1bfb24bbb360c5359ad Signed-off-by: Sam Hague Signed-off-by: Anil Vishnoi Signed-off-by: Flavio Fernandes commit 149c5bfb602e91f07c2b98f9509d317be8fcaa3c Author: Sam Hague Date: Mon Oct 12 20:50:25 2015 -0400 Temp workaround to debug southbound IT It is a timing change from the clustering code not taking into account some crazy existing code. This patch has a workaround that works in my local tests. I will merge it temporarily to see if the jenkins builds are good. Will work with Anil and Flavio on a long term solution. Old code: write ovsdb node to config -> -> dcl -> -> connect -> connect -> connectedButCallbacksNotRegistered -> putConnectionInstance -> updateData -> OvsdbNodeUpdateCommand - > ovsdb node - set Open_vSwitch external_ids *** key here is that the putConnectionInstance happened earlier in connect so now the OvsdbNodeUpdateCommand gets a chance to run and write the externalIds to the Open_vSwitch table ... OvsdbMonitorCallback -> OpenVSwitchUpdateCommand - > writes node to operational *** key here is that the iid (nodePath) is found by looking for the externalIds. If found, since it was written earlier, then it is used, if not the backup of using the uuid of the node is used. The IT expects the externalIds value to be there and that is the one with the form ip:port. In the new code: - putConnectionInstance() does not happen until the handleOwnership completes - too late since the updateData is processed before that - updateData doesn't do anything, complains about not finding client since the connectionInstance was not written earlier, therefore the externalIds are not written - OpenVSwitchUpdateCommand ends up using the wrong iid of the form using the uuid since the externalIds were not written. Change-Id: Iafbb8c4fa3dd5708f4c4bd3242e27ec72a4b4c6e Signed-off-by: Sam Hague commit a536890a609e1b28cce86a616c11447b839c1348 Author: Andre Fredette Date: Tue Oct 6 17:33:15 2015 -0400 Bug 4144 - Periodic ARP resolver should use unicast MAC destination address whenever possible; instead of broadcast Modified ArpResolver and GatewayMacResolverService to use the unicast DA when known. The code treats the DA as known for a new ARP request if one of the last N=2 ARP request was answered. Change-Id: I2bd7791b74d41e2838edf59d6edc510b63f3c40b Signed-off-by: Andre Fredette commit 1c4bfda9a0f94a2a97c58a918f945f4e1e3d4688 Author: Vishal Thapar Date: Mon Oct 12 14:22:57 2015 +0530 hwvtep: version bump to 1.2.1 Update hwvtep poms as per this: https://git.opendaylight.org/gerrit/#/c/25574/ Change-Id: I651a4e475e9bf243497ce07386e7418141f2fc3c Signed-off-by: Vishal Thapar commit 685f586c67dc369259fc53a001f3d8297c6d8351 Author: Sam Hague Date: Fri Oct 9 16:22:56 2015 -0400 Add setting controller for sfc it This patch adds setting the controller so that flows can be pushed to the switches. Use the following to initate the tests: start an ovsdb node and set it to be in passive mode: sudo ovs-vsctl set-manager ptcp:6640 cd .../net-virt-sfc/it mvn -Dit.test=NetvirtSfcIT#testDoIt verify -Pintegrationtest -Dovsdbserver.ipaddress=192.168.120.31 The above will connect to the node and set's it controller to ODL. Change-Id: Ibf307b668535e47fe80ba0a8b7403e53d7a40ccb Signed-off-by: Sam Hague commit ffa3c96aab514cfaba4e0eb543fe6956d3dfdb13 Author: Rashmi Pujar Date: Fri Oct 9 12:37:06 2015 -0400 UT for southbound/transactions/md - set 4 8. OvsdbManagersUpdateCommand.java 9. OvsdbNodeRemoveCommand.java 10. OvsdbOperationalCommandAggregator.java Change-Id: I4597340cb871fb6b8558f2632ad71423a3cb8176 Signed-off-by: Rashmi Pujar commit f7f42fbacd178a843009a07bb21816afa83707b3 Author: sangeeta.maurya Date: Fri Oct 9 04:58:00 2015 +0545 All TCP & UDP SG Rules : Implementation and Unit tests added. Change-Id: I4a00740fed78ab416fe22214fa7542ae7036f6fc Signed-off-by: sangeeta.maurya Change-Id: I95183dca8f6a8f628c5937e94ae7a098c536d14f Signed-off-by: Anil Vishnoi commit 6380f7393d6974de911a1ee31589fae5aa6b9395 Author: Aswin Suryanarayanan Date: Fri Oct 9 00:54:24 2015 +0530 Support added for modifying a security group associated with a port. Change-Id: I7bc5d4d790676eea380803af8af7591a19e9e00a Signed-off-by: Aswin Suryanarayanan commit d4b6c92bb6e10d84783d5ca1037018ec1c0be12f Author: Flavio Fernandes Date: Fri Oct 9 16:42:53 2015 -0400 Rev up on neutron mdsal Change-Id: I3a5d579455a8dcc6c5f67f420a879d78b7160be5 Signed-off-by: Flavio Fernandes commit 71ca5bff6921d7e1bc8e0ae70df94f34677d4f65 Merge: b172da3 5c20432 Author: Flavio Fernandes Date: Fri Oct 9 16:15:40 2015 -0400 Merge branch 'master' into topic/master/neutron-yang-migration.wip Change-Id: I80eaa18b7e09acda944310fe2d6fd8bf7864aae0 Signed-off-by: Flavio Fernandes commit b172da376fc5090347f1592786fcac62bb6c1879 Merge: 203fe0e 0cbdadc Author: Anil Vishnoi Date: Thu Oct 8 20:17:59 2015 +0530 Merge branch 'master' into topic/master/neutron-yang-migration Conflicts: openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclServiceTest.java Change-Id: I170b630be63898fb2386377a65e297334ea70119 Signed-off-by: Anil Vishnoi commit 203fe0e97e86753f200fbbba3217e1e24330392b Merge: 74b4518 f6b2a1e Author: Anil Vishnoi Date: Wed Oct 7 00:57:16 2015 +0530 Merge branch 'master' into topic/master/neutron-yang-migration Change-Id: I496a2b2aade88bc318763a77d4e878e5e11e97f8 Signed-off-by: Anil Vishnoi commit 74b45187dc5f4c1982ae2a9554434c1546604b82 Merge: d2853aa 83cfd5b Author: Anil Vishnoi Date: Fri Oct 2 19:59:13 2015 +0530 Merge branch 'master' into topic/master/neutron-yang-migration Conflicts: openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/ConfigActivator.java Change-Id: Ic7d248e43b7f41fa7a17b8a2c371647e5c54e302 Signed-off-by: Anil Vishnoi commit d2853aa6b7ef1aea8b93a6ed5ccbc81c1df2dc13 Merge: bdbce26 7848a77 Author: Flavio Fernandes Date: Thu Oct 1 14:44:12 2015 -0400 Merge branch 'master' into topic/master/neutron-yang-migration Change-Id: I9c76cf1adf765b351c45fe93260ca89f596383c1 Signed-off-by: Flavio Fernandes commit bdbce26b1905fe7d349cc65966046253e38aceb9 Merge: 0ecfc12 0179232 Author: Anil Vishnoi Date: Thu Oct 1 03:48:35 2015 +0530 Merge branch 'master' into topic/master/neutron-yang-migration Conflicts: integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/OvsdbTestBase.java northbound/src/test/java/org/opendaylight/ovsdb/northbound/NodeResourceTest.java northbound/src/test/java/org/opendaylight/ovsdb/northbound/OvsdbNorthboundV3Test.java Change-Id: Ie64d7e8d21250859b583a5f6b1b5b112a4b70c84 Signed-off-by: Anil Vishnoi commit 0ecfc1294aa2e1047162215cb9d1bb38d0bc70fb Author: Anil Vishnoi Date: Sat Sep 26 04:50:05 2015 +0530 Fix minor changese in NeutronSecurityRule attributes values Change-Id: Ib2fb0b195dd9e671627acfcd8741246c035fc237 Signed-off-by: Anil Vishnoi commit 98290241988633a61aa36bd0de6756c2f27f8817 Merge: 387c461 708c8c3 Author: Anil Vishnoi Date: Fri Sep 25 08:13:48 2015 +0530 Merge branch 'master' into topic/master/neutron-yang-migration Change-Id: I4d2d1cda0138e4647580b790ce9131c077e09f81 Signed-off-by: Anil Vishnoi commit 387c4618bf4d52acf2cfa5e3ea1772975c6541ac Merge: 8d6fd60 b398044 Author: Anil Vishnoi Date: Thu Sep 24 02:39:11 2015 +0530 Merge branch 'master' into topic/master/neutron-yang-migration Conflicts: integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/ConfigurationBundles.java ovsdb-plugin-compatibility-layer/src/test/java/org/opendaylight/ovsdb/compatibility/plugin/impl/ConnectionServiceImplTest.java plugin-shell/src/test/java/org/opendaylight/ovsdb/plugin/shell/PrintCacheTest.java plugin/src/test/java/org/opendaylight/ovsdb/plugin/impl/ConnectionServiceImplTest.java Change-Id: Ic5c81688c9cf8cf7fccdbe8c90eb90d8cbd66c94 Signed-off-by: Anil Vishnoi commit 8d6fd60eec27d9373fb8687b1418436f1e94eb9f Merge: fed891b 5bc4327 Author: Anil Vishnoi Date: Fri Sep 18 22:16:41 2015 +0530 Merge branch 'master' into topic/master/neutron-yang-migration Signed-off-by: Anil Vishnoi commit fed891b235315b840c70bced882c7972d1bf49f7 Merge: 985d450 b388ea4 Author: Flavio Fernandes Date: Thu Sep 17 14:13:28 2015 +0000 Merge "Misc Fix: Handle neutron port that is not associated with a tenant id" into topic/master/neutron-yang-migration commit 985d45084a55be99873992d75400d52210d81de0 Author: Flavio Fernandes Date: Thu Sep 17 01:13:45 2015 -0400 SecGroup: Handle cases when security group has empty rules Change-Id: I54ef43f6a4afd9fc571c8dcf9bf843007452c968 Signed-off-by: Flavio Fernandes commit b388ea424d6a072bdec66cc792598415744e06d0 Author: Flavio Fernandes Date: Thu Sep 17 01:01:56 2015 -0400 Misc Fix: Handle neutron port that is not associated with a tenant id (e.g. external gw port) Change-Id: I2e3496303d78767b691d9129bc14c86572ce8acf Signed-off-by: Flavio Fernandes commit 99081a0ab8dbed12ec76c4230256a5f918989cdc Author: Stephen Kitt Date: Wed Sep 16 11:14:03 2015 +0200 Document how to use Docker Compose Fig has been obsoleted by Docker Compose. Some distributions have now replaced Fig entirely (e.g. Fedora 22); this patch documents Docker Compose as an alternative to Fig. Change-Id: Ia33bb8633e7c2f039857b98ba96e9b8b343d0394 Signed-off-by: Stephen Kitt commit 9bb0f33598e40c6a5829b8be56597f90b534162b Author: Flavio Fernandes Date: Wed Sep 16 02:19:35 2015 -0400 A few cleanups * use plain String concatenation instead of StringBuilder where appropriate * simplify single-use return variables * <> operator * avoid calling new String() Change-Id: I56e99426daeda620a37059417588e5ee4fb99c76 Also-By: Stephen Kitt Signed-off-by: Flavio Fernandes commit a2fdb4a16358da8c2bc565c3b84589290f5de9d8 Author: Anil Vishnoi Date: Tue Sep 15 22:58:34 2015 +0000 Revert "Use single-argument form of firstKeyOf()" This reverts commit e19e4e3f10f65054aba16a94c082180f24b9beb6. This is breaking the net-virt code. Bridges are not getting created when OVSDB server connects to the controller. Probably happening because of single argument firstKeyOf() method. Change-Id: I76ab5f86f7329f741e30fd21eaed436391f793b8 Signed-off-by: Anil Vishnoi commit 64d86b6ad9b7fd54eaf708cb7654177fea344ef4 Author: Anil Vishnoi Date: Wed Sep 16 01:59:24 2015 +0530 Added Security Group and Security Rule data change listeners Signed-off-by: Anil Vishnoi commit 218b94228d407a5cc8d9c52550eabc2ef96e0a29 Author: Anil Vishnoi Date: Wed Sep 16 01:23:46 2015 +0530 Fixed the instanceof checks Signed-off-by: Anil Vishnoi commit 4167a9762eb08930c86209028a21c618f167bb29 Merge: 1188baa b085ce8 Author: Anil Vishnoi Date: Tue Sep 15 21:43:34 2015 +0530 Merge branch 'master' into topic/master/neutron-yang-migration Signed-off-by: Anil Vishnoi commit 1188baa0e84249e202aab52d82dbb435552801aa Author: Anil Vishnoi Date: Tue Sep 15 04:41:56 2015 +0530 Fixed classcast exceptions while processing the events Signed-off-by: Anil Vishnoi commit 79e5a3a8271e4021cb79d6a83177866bd1acc771 Author: Anil Vishnoi Date: Tue Sep 15 01:17:25 2015 +0530 Fix single feature test failures Signed-off-by: Anil Vishnoi commit d1d6e81d0cf0dc21aa64c8e94ab993622c8f574d Author: Anil Vishnoi Date: Mon Sep 14 17:52:24 2015 +0530 Fixed local lbaas code to accomodate the model changes done in neutron yang models Signed-off-by: Anil Vishnoi commit 1393eb861d1011c2285e065e28dc971dc52eae76 Author: Anil Vishnoi Date: Sat Sep 12 04:01:33 2015 +0530 Added dummy provider as a dependency Signed-off-by: Anil Vishnoi commit 09354754ab1fdf042327667f467f88483f24ab38 Merge: 272a6c1 53770e6 Author: Anil Vishnoi Date: Fri Sep 11 17:01:33 2015 +0530 Merge branch 'master' into topic/master/neutron-yang-migration Conflicts: openstack/net-virt/pom.xml Signed-off-by: Anil Vishnoi commit 272a6c15978aabae127a112f18f27d537828e931 Author: Flavio Fernandes Date: Wed Sep 2 18:11:28 2015 -0400 Add NeutronLoadBalancerPoolMemberChangeListener Plus other minor fixes. Patch set 2: resolve fixmes. Change-Id: I75e6106f1cf5bb72370983bebe9568704dcef36a Signed-off-by: Flavio Fernandes commit 5c815ff07f95721790a1dab87210bd19b82f3a15 Merge: 4029f04 55ff806 Author: Anil Vishnoi Date: Wed Sep 2 20:24:08 2015 +0000 Merge "Add NeutronLoadBalancerPoolChangeListener" into topic/master/neutron-yang-migration commit 55ff80613eb153260007d3d2006cbe6354819db6 Author: Flavio Fernandes Date: Wed Sep 2 16:09:49 2015 -0400 Add NeutronLoadBalancerPoolChangeListener Change-Id: Icb570f780c3f67e3ee67dc3366fc059e981ff176 Signed-off-by: Flavio Fernandes commit 4029f04004d7db4e1f4562f26b98b3966c1092db Author: Flavio Fernandes Date: Wed Sep 2 11:37:25 2015 -0400 Cosmetics: Fix Copyright (try 2) Signed-off-by: Flavio Fernandes commit d8169714e9fe8880f3a10c680851ff500e4b1696 Author: Anil Vishnoi Date: Mon Aug 31 04:08:06 2015 +0530 Fixed unit tests Signed-off-by: Anil Vishnoi commit 6f4f4005cf28367b5d2e10d50246189abaa8f600 Author: Anil Vishnoi Date: Mon Aug 31 03:20:03 2015 +0530 Implemented INeutronFloatingIPAware notification provider. This implementation subscribe for data change notification from /neutorn/floatingips/floatingip path and call the *iaware methods according to the changes (create, update, delete) it receives from data store. Signed-off-by: Anil Vishnoi commit 60445afc56d355a593223221d2182a6f3c53a307 Author: Anil Vishnoi Date: Mon Aug 31 02:31:20 2015 +0530 Implemented INeutronRouterAware notification provider. This implementation subscribe for data change notification from /neutorn/routers/router path and call the *iaware methods according to the changes (create, update, delete) it receives from data store. Signed-off-by: Anil Vishnoi commit fda2cd8556790bacff1e55efc1276f899cdb8b9c Author: Anil Vishnoi Date: Mon Aug 31 02:06:13 2015 +0530 Implemented INeutronPortAware notification provider. This implementation subscribe for data change notification from /neutorn/ports/port path and call the *iaware methods according to the changes (create, update, delete) it receives from data store. Signed-off-by: Anil Vishnoi commit 8a67f0db43b6c07d2560916b21cfb9c46f57bf7f Author: Anil Vishnoi Date: Mon Aug 31 01:32:01 2015 +0530 Implemented INeutronSubnetAware notification provider. This implementation subscribe for data change notification from /neutorn/subnets/subnet path and call the *iaware methods according to the changes (create, update, delete) it receives from data store. Signed-off-by: Anil Vishnoi commit cdcc657f2e684c8595f7ff76553c3ea3255ba395 Author: Anil Vishnoi Date: Fri Aug 28 23:49:14 2015 +0530 Implement Neutron Network data change listener This patch listens on the /Neutron/Networks/Network path of Neutron network yang model and convert it to NeutronNetwork pojo (existing pojo's that's in use by net-virt) and call the respective method of implementor of INeutronNetworkAware interface Signed-off-by: Anil Vishnoi commit fb7c9891641b1b4822a8dbade472da55779d1300 Author: Anil Vishnoi Date: Sat Aug 29 03:10:44 2015 +0530 Add CRUD interface implementation to ovsdb net-virt. This code is borrowed from the neutron northbound project. I cleaned up few of the CRUD implementation file that is not required for the net-virt. Few of the existing CRUD interface implementation is still based on the ConcurrentHashMap, which we need to migrate to the data store based implementation. This patch hooks these services locally so that only ovsdb net-virt can consume these services Signed-off-by: Anil Vishnoi commit a2c8738b0b703eaa6c04f6f49694e1fe035216ad Author: Anil Vishnoi Date: Fri Aug 28 20:35:46 2015 +0530 Code refactoring: moved CRUD interface and IAware interface to their own packages Signed-off-by: Anil Vishnoi commit 76d01ae3060835cbcd9bd469058033e7bcd5dc48 Merge: cb5f2d9 ff7ddc7 Author: Anil Vishnoi Date: Sat Aug 29 03:39:18 2015 +0530 Merge branch 'master' into topic/master/neutron-yang-migration Signed-off-by: Anil Vishnoi commit cb5f2d9d3ebc9952030aecd83e7a71c770fe41ea Author: Anil Vishnoi Date: Thu Aug 27 17:51:23 2015 +0530 Neutron-Yang-Migration: Intial code for translator layer Signed-off-by: Anil Vishnoi Change-Id: Id18f4fc26f018673f08ef10ddd86850922b7265b Signed-off-by: Anil Vishnoi --- features/ovsdb/pom.xml | 5 + features/ovsdb/src/main/features/features.xml | 1 + .../ovsdb/lib/jsonrpc/JsonRpcDecoderTest.java | 2 +- .../ovsdb/lib/notation/VersionTest.java | 2 +- .../ovsdbclient/TestBridge.java | 2 +- .../VersionIncompatibleBridge.java | 2 +- .../schema/hardwarevtep/HardwareVTEPIT.java | 2 +- .../schema/openvswitch/OpenVSwitchIT.java | 2 +- openstack/net-virt-providers/pom.xml | 5 - .../providers/openflow13/OF13Provider.java | 8 +- .../openflow13/services/EgressAclService.java | 6 +- .../services/IngressAclService.java | 6 +- .../openflow13/OF13ProviderTest.java | 2 +- .../services/EgressAclServiceTest.java | 7 +- .../services/IngressAclServiceTest.java | 6 +- openstack/net-virt/pom.xml | 17 +- .../openstack/netvirt/ConfigActivator.java | 67 ++- .../ovsdb/openstack/netvirt/FWaasHandler.java | 14 +- .../openstack/netvirt/FloatingIPHandler.java | 4 +- .../ovsdb/openstack/netvirt/LBaaSHandler.java | 20 +- .../openstack/netvirt/LBaaSPoolHandler.java | 18 +- .../netvirt/LBaaSPoolMemberHandler.java | 20 +- .../openstack/netvirt/NetworkHandler.java | 6 +- .../openstack/netvirt/NeutronCacheUtils.java | 21 +- .../openstack/netvirt/NorthboundEvent.java | 18 +- .../ovsdb/openstack/netvirt/PortHandler.java | 4 +- .../netvirt/PortSecurityHandler.java | 8 +- .../openstack/netvirt/RouterHandler.java | 6 +- .../openstack/netvirt/SouthboundHandler.java | 2 +- .../openstack/netvirt/SubnetHandler.java | 4 +- .../api/BridgeConfigurationManager.java | 12 +- .../netvirt/api/ConfigurationService.java | 21 +- .../netvirt/api/EgressAclProvider.java | 4 +- .../netvirt/api/GatewayMacResolver.java | 6 +- .../netvirt/api/IngressAclProvider.java | 4 +- .../netvirt/api/NetworkingProvider.java | 20 +- .../netvirt/api/SecurityServicesManager.java | 17 +- .../netvirt/api/TenantNetworkManager.java | 10 +- .../impl/BridgeConfigurationManagerImpl.java | 2 +- .../openstack/netvirt/impl/MdsalUtils.java | 4 +- .../netvirt/impl/NeutronL3Adapter.java | 77 ++- .../impl/OvsdbInventoryServiceImpl.java | 22 + .../netvirt/impl/SecurityServicesImpl.java | 121 ++++- .../netvirt/impl/SouthboundImpl.java | 4 +- .../impl/TenantNetworkManagerImpl.java | 10 +- .../netvirt/translator/INeutronObject.java | 19 + .../netvirt/translator/NeutronFirewall.java | 187 +++++++ .../translator/NeutronFirewallPolicy.java | 174 +++++++ .../translator/NeutronFirewallRule.java | 317 ++++++++++++ .../netvirt/translator/NeutronFloatingIP.java | 189 +++++++ .../translator/NeutronLoadBalancer.java | 184 +++++++ .../NeutronLoadBalancerHealthMonitor.java | 231 +++++++++ .../NeutronLoadBalancerListener.java | 213 ++++++++ .../translator/NeutronLoadBalancerPool.java | 246 +++++++++ .../NeutronLoadBalancerPoolMember.java | 176 +++++++ ...eutronLoadBalancer_SessionPersistence.java | 56 ++ .../netvirt/translator/NeutronNetwork.java | 291 +++++++++++ .../translator/NeutronNetwork_Segment.java | 74 +++ .../netvirt/translator/NeutronPort.java | 314 +++++++++++ .../NeutronPort_AllowedAddressPairs.java | 52 ++ .../NeutronPort_ExtraDHCPOption.java | 45 ++ .../translator/NeutronPort_VIFDetail.java | 44 ++ .../netvirt/translator/NeutronRouter.java | 228 ++++++++ .../translator/NeutronRouter_Interface.java | 82 +++ .../NeutronRouter_NetworkReference.java | 72 +++ .../translator/NeutronSecurityGroup.java | 147 ++++++ .../translator/NeutronSecurityRule.java | 223 ++++++++ .../netvirt/translator/NeutronSubnet.java | 489 ++++++++++++++++++ .../NeutronSubnetIPAllocationPool.java | 311 +++++++++++ .../translator/NeutronSubnet_HostRoute.java | 44 ++ .../netvirt/translator/Neutron_ID.java | 48 ++ .../netvirt/translator/Neutron_IPs.java | 61 +++ .../translator/crud/INeutronFirewallCRUD.java | 96 ++++ .../crud/INeutronFirewallPolicyCRUD.java | 97 ++++ .../crud/INeutronFirewallRuleCRUD.java | 97 ++++ .../crud/INeutronFloatingIPCRUD.java | 85 +++ .../crud/INeutronLoadBalancerCRUD.java | 97 ++++ ...INeutronLoadBalancerHealthMonitorCRUD.java | 97 ++++ .../INeutronLoadBalancerListenerCRUD.java | 97 ++++ .../crud/INeutronLoadBalancerPoolCRUD.java | 97 ++++ .../INeutronLoadBalancerPoolMemberCRUD.java | 93 ++++ .../translator/crud/INeutronNetworkCRUD.java | 97 ++++ .../translator/crud/INeutronPortCRUD.java | 111 ++++ .../translator/crud/INeutronRouterCRUD.java | 95 ++++ .../crud/INeutronSecurityGroupCRUD.java | 88 ++++ .../crud/INeutronSecurityRuleCRUD.java | 89 ++++ .../translator/crud/INeutronSubnetCRUD.java | 99 ++++ .../crud/NeutronCRUDInterfaces.java | 188 +++++++ .../crud/impl/AbstractNeutronInterface.java | 170 ++++++ .../crud/impl/NeutronFirewallInterface.java | 97 ++++ .../impl/NeutronFirewallPolicyInterface.java | 102 ++++ .../impl/NeutronFirewallRuleInterface.java | 98 ++++ .../crud/impl/NeutronFloatingIPInterface.java | 184 +++++++ ...ronLoadBalancerHealthMonitorInterface.java | 100 ++++ .../impl/NeutronLoadBalancerInterface.java | 162 ++++++ .../NeutronLoadBalancerListenerInterface.java | 101 ++++ .../NeutronLoadBalancerPoolInterface.java | 195 +++++++ ...eutronLoadBalancerPoolMemberInterface.java | 100 ++++ .../crud/impl/NeutronNetworkInterface.java | 279 ++++++++++ .../crud/impl/NeutronPortInterface.java | 327 ++++++++++++ .../crud/impl/NeutronRouterInterface.java | 264 ++++++++++ .../impl/NeutronSecurityGroupInterface.java | 193 +++++++ .../impl/NeutronSecurityRuleInterface.java | 284 ++++++++++ .../crud/impl/NeutronSubnetInterface.java | 297 +++++++++++ .../iaware/INeutronFirewallAware.java | 82 +++ .../iaware/INeutronFirewallPolicyAware.java | 82 +++ .../iaware/INeutronFirewallRuleAware.java | 82 +++ .../iaware/INeutronFloatingIPAware.java | 82 +++ .../iaware/INeutronLoadBalancerAware.java | 83 +++ ...NeutronLoadBalancerHealthMonitorAware.java | 83 +++ .../INeutronLoadBalancerListenerAware.java | 83 +++ .../iaware/INeutronLoadBalancerPoolAware.java | 83 +++ .../INeutronLoadBalancerPoolMemberAware.java | 78 +++ .../iaware/INeutronNetworkAware.java | 82 +++ .../translator/iaware/INeutronPortAware.java | 82 +++ .../iaware/INeutronRouterAware.java | 134 +++++ .../iaware/INeutronSecurityGroupAware.java | 74 +++ .../iaware/INeutronSecurityRuleAware.java | 74 +++ .../iaware/INeutronSubnetAware.java | 83 +++ .../impl/NeutronFloatingIPChangeListener.java | 132 +++++ .../iaware/impl/NeutronIAwareUtil.java | 45 ++ ...NeutronLoadBalancerPoolChangeListener.java | 183 +++++++ ...nLoadBalancerPoolMemberChangeListener.java | 143 +++++ .../impl/NeutronNetworkChangeListener.java | 168 ++++++ .../impl/NeutronPortChangeListener.java | 222 ++++++++ .../impl/NeutronRouterChangeListener.java | 169 ++++++ ...eutronSecurityGroupDataChangeListener.java | 150 ++++++ ...NeutronSecurityRuleDataChangeListener.java | 183 +++++++ .../impl/NeutronSubnetChangeListener.java | 194 +++++++ .../openstack/netvirt/FWaasHandlerTest.java | 6 +- .../netvirt/FloatingIPHandlerTest.java | 2 +- .../openstack/netvirt/LBaaSHandlerTest.java | 16 +- .../netvirt/LBaaSPoolHandlerTest.java | 16 +- .../netvirt/LBaaSPoolMemberHandlerTest.java | 16 +- .../openstack/netvirt/NetworkHandlerTest.java | 4 +- .../netvirt/NeutronCacheUtilsTest.java | 14 +- .../openstack/netvirt/PortHandlerTest.java | 2 +- .../netvirt/PortSecurityHandlerTest.java | 4 +- .../openstack/netvirt/RouterHandlerTest.java | 4 +- .../netvirt/SouthboundHandlerTest.java | 2 +- .../openstack/netvirt/SubnetHandlerTest.java | 2 +- .../BridgeConfigurationManagerImplTest.java | 2 +- .../netvirt/impl/NeutronL3AdapterTest.java | 20 +- .../impl/SecurityServicesImplTest.java | 6 +- .../impl/TenantNetworkManagerImplTest.java | 8 +- .../impl/VlanConfigurationCacheImplTest.java | 2 +- .../impl/OvsSfcProviderModule.java | 2 +- .../schema/hardwarevtep/HardwareVTEPTest.java | 2 +- .../schema/openvswitch/OpenVSwitchTest.java | 2 +- .../utils/config/ConfigPropertiesTest.java | 2 +- .../ovsdb/utils/mdsal/node/NodeUtilsTest.java | 2 +- .../utils/mdsal/openflow/MatchUtilsTest.java | 2 +- .../servicehelper/ServiceHelperTest.java | 2 +- 153 files changed, 12476 insertions(+), 234 deletions(-) create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/INeutronObject.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFirewall.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFirewallPolicy.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFirewallRule.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFloatingIP.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancer.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerHealthMonitor.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerListener.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerPool.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerPoolMember.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancer_SessionPersistence.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronNetwork.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronNetwork_Segment.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort_AllowedAddressPairs.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort_ExtraDHCPOption.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort_VIFDetail.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronRouter.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronRouter_Interface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronRouter_NetworkReference.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSecurityGroup.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSecurityRule.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSubnet.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSubnetIPAllocationPool.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSubnet_HostRoute.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/Neutron_ID.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/Neutron_IPs.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFirewallCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFirewallPolicyCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFirewallRuleCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFloatingIPCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerHealthMonitorCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerListenerCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerPoolCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerPoolMemberCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronNetworkCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronPortCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronRouterCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronSecurityGroupCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronSecurityRuleCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronSubnetCRUD.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/NeutronCRUDInterfaces.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/AbstractNeutronInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFirewallInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFirewallPolicyInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFirewallRuleInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFloatingIPInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerHealthMonitorInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerListenerInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerPoolInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerPoolMemberInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronNetworkInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronPortInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronRouterInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronSecurityGroupInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronSecurityRuleInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronSubnetInterface.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFirewallAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFirewallPolicyAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFirewallRuleAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFloatingIPAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerHealthMonitorAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerListenerAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerPoolAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerPoolMemberAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronNetworkAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronPortAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronRouterAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronSecurityGroupAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronSecurityRuleAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronSubnetAware.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronFloatingIPChangeListener.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronIAwareUtil.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronLoadBalancerPoolChangeListener.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronLoadBalancerPoolMemberChangeListener.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronNetworkChangeListener.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronPortChangeListener.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronRouterChangeListener.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronSecurityGroupDataChangeListener.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronSecurityRuleDataChangeListener.java create mode 100644 openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronSubnetChangeListener.java diff --git a/features/ovsdb/pom.xml b/features/ovsdb/pom.xml index 8f60aa5f7..94cf2abe8 100644 --- a/features/ovsdb/pom.xml +++ b/features/ovsdb/pom.xml @@ -226,6 +226,11 @@ and is available at http://www.eclipse.org/legal/epl-v10.html ${networkconfig.neutron.version} features xml + + + org.opendaylight.neutron + dummyprovider + ${networkconfig.neutron.version} org.opendaylight.openflowplugin diff --git a/features/ovsdb/src/main/features/features.xml b/features/ovsdb/src/main/features/features.xml index 45824945a..1abdab4e6 100644 --- a/features/ovsdb/src/main/features/features.xml +++ b/features/ovsdb/src/main/features/features.xml @@ -38,6 +38,7 @@ mvn:org.opendaylight.ovsdb/utils.servicehelper/${ovsdb.utils.servicehelper.version} mvn:org.opendaylight.ovsdb/openstack.net-virt/${openstack.netvirt.version} mvn:org.opendaylight.ovsdb/openstack.net-virt-providers/${openstack.netvirt.providers.version} + mvn:org.opendaylight.neutron/dummyprovider/${networkconfig.neutron.version} mvn:org.opendaylight.ovsdb/openstack.net-virt/${project.version}/xml/config mvn:org.opendaylight.ovsdb/openstack.net-virt-providers/${project.version}/xml/config diff --git a/library/impl/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcDecoderTest.java b/library/impl/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcDecoderTest.java index a061d66bd..389e33f1f 100644 --- a/library/impl/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcDecoderTest.java +++ b/library/impl/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcDecoderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Red Hat, Inc. + * Copyright (C) 2014 Red Hat, 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, diff --git a/library/impl/src/test/java/org/opendaylight/ovsdb/lib/notation/VersionTest.java b/library/impl/src/test/java/org/opendaylight/ovsdb/lib/notation/VersionTest.java index e0560f8c9..6eb903358 100755 --- a/library/impl/src/test/java/org/opendaylight/ovsdb/lib/notation/VersionTest.java +++ b/library/impl/src/test/java/org/opendaylight/ovsdb/lib/notation/VersionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Red Hat, Inc. + * Copyright (C) 2014 Red Hat, 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, diff --git a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/TestBridge.java b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/TestBridge.java index 2ccae3f17..9c0645ed2 100644 --- a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/TestBridge.java +++ b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/TestBridge.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Red Hat, Inc. + * Copyright (C) 2014 Red Hat, 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, diff --git a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/VersionIncompatibleBridge.java b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/VersionIncompatibleBridge.java index 4fdc93a1c..8496f3fa0 100644 --- a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/VersionIncompatibleBridge.java +++ b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/VersionIncompatibleBridge.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Red Hat, Inc. + * Copyright (C) 2014 Red Hat, 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, diff --git a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/hardwarevtep/HardwareVTEPIT.java b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/hardwarevtep/HardwareVTEPIT.java index 1768f6088..1d07fa28d 100644 --- a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/hardwarevtep/HardwareVTEPIT.java +++ b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/hardwarevtep/HardwareVTEPIT.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Red Hat, Inc. + * Copyright (C) 2014 Red Hat, 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, diff --git a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/openvswitch/OpenVSwitchIT.java b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/openvswitch/OpenVSwitchIT.java index d31ec69c7..8d12cd163 100644 --- a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/openvswitch/OpenVSwitchIT.java +++ b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/openvswitch/OpenVSwitchIT.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Red Hat, Inc. + * Copyright (C) 2014 Red Hat, 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, diff --git a/openstack/net-virt-providers/pom.xml b/openstack/net-virt-providers/pom.xml index ceb03c033..780944ff5 100644 --- a/openstack/net-virt-providers/pom.xml +++ b/openstack/net-virt-providers/pom.xml @@ -103,11 +103,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.controller.model model-inventory - - org.opendaylight.neutron - neutron-spi - ${networkconfig.neutron.version} - org.opendaylight.openflowplugin.model model-flow-base diff --git a/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/OF13Provider.java b/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/OF13Provider.java index f2d687f10..c354d2dce 100644 --- a/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/OF13Provider.java +++ b/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/OF13Provider.java @@ -19,10 +19,10 @@ import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; -import org.opendaylight.neutron.spi.NeutronNetwork; -import org.opendaylight.neutron.spi.NeutronPort; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; import org.opendaylight.ovsdb.openstack.netvirt.MdsalHelper; import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler; import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager; diff --git a/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclService.java b/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclService.java index a95eb32d9..7faf6b048 100644 --- a/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclService.java +++ b/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclService.java @@ -11,9 +11,9 @@ package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services; import java.math.BigInteger; import java.util.List; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; -import org.opendaylight.neutron.spi.NeutronSecurityRule; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; import org.opendaylight.ovsdb.openstack.netvirt.api.Constants; import org.opendaylight.ovsdb.openstack.netvirt.api.EgressAclProvider; import org.opendaylight.ovsdb.openstack.netvirt.api.SecurityServicesManager; diff --git a/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/IngressAclService.java b/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/IngressAclService.java index 75a24467a..e8fa6b14c 100644 --- a/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/IngressAclService.java +++ b/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/IngressAclService.java @@ -11,9 +11,9 @@ package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services; import java.math.BigInteger; import java.util.List; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; -import org.opendaylight.neutron.spi.NeutronSecurityRule; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; import org.opendaylight.ovsdb.openstack.netvirt.api.Constants; import org.opendaylight.ovsdb.openstack.netvirt.api.IngressAclProvider; import org.opendaylight.ovsdb.openstack.netvirt.api.SecurityServicesManager; diff --git a/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/OF13ProviderTest.java b/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/OF13ProviderTest.java index 4dff41cf6..a4ce294d9 100644 --- a/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/OF13ProviderTest.java +++ b/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/OF13ProviderTest.java @@ -34,7 +34,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.opendaylight.neutron.spi.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; import org.opendaylight.ovsdb.openstack.netvirt.MdsalHelper; import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler; import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager; diff --git a/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclServiceTest.java b/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclServiceTest.java index f5498e897..e72b4ce68 100644 --- a/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclServiceTest.java +++ b/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/EgressAclServiceTest.java @@ -31,9 +31,10 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; -import org.opendaylight.neutron.spi.NeutronSecurityRule; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.api.Constants; import org.opendaylight.ovsdb.openstack.netvirt.api.SecurityServicesManager; import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.PipelineOrchestrator; import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service; diff --git a/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/IngressAclServiceTest.java b/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/IngressAclServiceTest.java index c4e19b8d3..51734e827 100644 --- a/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/IngressAclServiceTest.java +++ b/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/IngressAclServiceTest.java @@ -37,9 +37,9 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; -import org.opendaylight.neutron.spi.NeutronSecurityRule; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; import org.opendaylight.ovsdb.openstack.netvirt.api.Constants; import org.opendaylight.ovsdb.openstack.netvirt.api.SecurityServicesManager; import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.PipelineOrchestrator; diff --git a/openstack/net-virt/pom.xml b/openstack/net-virt/pom.xml index 3fa44351f..3b5584c3e 100644 --- a/openstack/net-virt/pom.xml +++ b/openstack/net-virt/pom.xml @@ -45,7 +45,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html - 0.6.0-SNAPSHOT + 0.6.0-SNAPSHOT 1.2.1-SNAPSHOT 1.2.1-SNAPSHOT 1.5.2 @@ -100,16 +100,16 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.controller sal-common-api - - org.opendaylight.neutron - neutron-spi - ${networkconfig.neutron.version} - org.opendaylight.ovsdb southbound-api 1.2.1-SNAPSHOT + + org.opendaylight.neutron + model + ${neutron.model.version} + org.opendaylight.ovsdb utils.config @@ -148,6 +148,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.mdsal.model ietf-yang-types + + commons-net + commons-net + org.slf4j slf4j-api @@ -215,6 +219,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html utils.config;type=!pom;inline=false true + org.opendaylight.ovsdb.openstack.netvirt.translator, org.opendaylight.ovsdb.openstack.netvirt.api, org.opendaylight.ovsdb.openstack.netvirt diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/ConfigActivator.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/ConfigActivator.java index a3acb01dd..e37b853b8 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/ConfigActivator.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/ConfigActivator.java @@ -16,7 +16,40 @@ import java.util.List; import org.apache.commons.lang3.tuple.Pair; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; -import org.opendaylight.neutron.spi.*; +import org.opendaylight.ovsdb.openstack.netvirt.translator.*; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerPoolCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronFirewallInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronFirewallPolicyInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronFirewallRuleInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronFloatingIPInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronLoadBalancerHealthMonitorInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronLoadBalancerInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronLoadBalancerListenerInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronLoadBalancerPoolInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronLoadBalancerPoolMemberInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronNetworkInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronPortInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronRouterInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronSecurityGroupInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronSecurityRuleInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.impl.NeutronSubnetInterface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronFirewallAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronFirewallPolicyAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronFirewallRuleAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronFloatingIPAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronLoadBalancerAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronLoadBalancerPoolAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronLoadBalancerPoolMemberAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronNetworkAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronPortAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronRouterAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronSecurityGroupAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronSecurityRuleAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronSubnetAware; import org.opendaylight.ovsdb.openstack.netvirt.api.*; import org.opendaylight.ovsdb.openstack.netvirt.impl.*; import org.osgi.framework.BundleActivator; @@ -29,6 +62,7 @@ import org.slf4j.LoggerFactory; public class ConfigActivator implements BundleActivator { private static final Logger LOG = LoggerFactory.getLogger(ConfigActivator.class); + private List> translatorCRUDRegistrations = new ArrayList>(); private List> servicesAndRegistrations = new ArrayList<>(); private ProviderContext providerContext; @@ -39,6 +73,7 @@ public class ConfigActivator implements BundleActivator { @Override public void start(BundleContext context) throws Exception { LOG.info("ConfigActivator start:"); + registerCRUDServiceProviders(context, this.providerContext); ConfigurationServiceImpl configurationService = new ConfigurationServiceImpl(); registerService(context, new String[] {ConfigurationService.class.getName()}, @@ -168,11 +203,33 @@ public class ConfigActivator implements BundleActivator { trackService(context, RoutingProvider.class, neutronL3Adapter); trackService(context, L3ForwardingProvider.class, neutronL3Adapter); trackService(context, GatewayMacResolver.class, neutronL3Adapter); + trackService(context, IngressAclProvider.class, securityServices); + trackService(context, EgressAclProvider.class, securityServices); // We no longer need to track the services, avoid keeping references around servicesAndRegistrations.clear(); } + private void registerCRUDServiceProviders(BundleContext context, + ProviderContext providerContext) { + LOG.debug("Registering CRUD service providers"); + NeutronRouterInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronPortInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronSubnetInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronNetworkInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronSecurityGroupInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronSecurityRuleInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronFirewallInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronFirewallPolicyInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronFirewallRuleInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronLoadBalancerInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronLoadBalancerPoolInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronLoadBalancerListenerInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronLoadBalancerHealthMonitorInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronLoadBalancerPoolMemberInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + NeutronFloatingIPInterface.registerNewInterface(context, providerContext, translatorCRUDRegistrations); + } + private void trackService(BundleContext context, final Class clazz, final ConfigInterface... dependents) { @SuppressWarnings("unchecked") ServiceTracker tracker = new ServiceTracker(context, clazz, null) { @@ -206,9 +263,15 @@ public class ConfigActivator implements BundleActivator { @Override public void stop(BundleContext context) throws Exception { - LOG.info("ConfigActivator stop"); + LOG.info("Stop Translator CRUD service provides"); // ServiceTrackers and services are already released when bundle stops, // so we don't need to close the trackers or unregister the services + for (ServiceRegistration registration : translatorCRUDRegistrations) { + if (registration != null) { + registration.unregister(); + } + } + } private ServiceRegistration registerService(BundleContext bundleContext, String[] interfaces, diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/FWaasHandler.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/FWaasHandler.java index 7a3bf8a70..0b7881f31 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/FWaasHandler.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/FWaasHandler.java @@ -10,12 +10,12 @@ package org.opendaylight.ovsdb.openstack.netvirt; import java.net.HttpURLConnection; -import org.opendaylight.neutron.spi.INeutronFirewallAware; -import org.opendaylight.neutron.spi.INeutronFirewallPolicyAware; -import org.opendaylight.neutron.spi.INeutronFirewallRuleAware; -import org.opendaylight.neutron.spi.NeutronFirewall; -import org.opendaylight.neutron.spi.NeutronFirewallPolicy; -import org.opendaylight.neutron.spi.NeutronFirewallRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewall; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewallPolicy; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewallRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronFirewallAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronFirewallPolicyAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronFirewallRuleAware; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper; import org.osgi.framework.ServiceReference; @@ -170,7 +170,7 @@ public class FWaasHandler extends AbstractHandler /** * Process the event. * - * @param abstractEvent@see org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher + * @param abstractEvent new FWaas Event@see org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher */ @Override public void processEvent(AbstractEvent abstractEvent) { diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/FloatingIPHandler.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/FloatingIPHandler.java index 679c1bb8c..30e28ea43 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/FloatingIPHandler.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/FloatingIPHandler.java @@ -10,8 +10,8 @@ package org.opendaylight.ovsdb.openstack.netvirt; import java.net.HttpURLConnection; -import org.opendaylight.neutron.spi.INeutronFloatingIPAware; -import org.opendaylight.neutron.spi.NeutronFloatingIP; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFloatingIP; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronFloatingIPAware; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter; diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSHandler.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSHandler.java index 8bff814fb..e305fd340 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSHandler.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSHandler.java @@ -12,15 +12,15 @@ import java.net.HttpURLConnection; import java.util.List; import java.util.Map; -import org.opendaylight.neutron.spi.INeutronLoadBalancerAware; -import org.opendaylight.neutron.spi.INeutronLoadBalancerCRUD; -import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolCRUD; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.INeutronSubnetCRUD; -import org.opendaylight.neutron.spi.NeutronLoadBalancer; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPool; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerPoolCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronLoadBalancerAware; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.api.LoadBalancerConfiguration; @@ -166,6 +166,8 @@ public class LBaaSHandler extends AbstractHandler /** * Useful utility for extracting the loadbalancer instance * configuration from the neutron LB cache + * @param neutronLB neutron load balancer object + * @return returns load balancer configuration */ public LoadBalancerConfiguration extractLBConfiguration(NeutronLoadBalancer neutronLB) { String loadBalancerName = neutronLB.getLoadBalancerName(); diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolHandler.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolHandler.java index c0a3ab4c9..93b4ce626 100755 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolHandler.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolHandler.java @@ -12,14 +12,14 @@ import java.net.HttpURLConnection; import java.util.List; import java.util.Map; -import org.opendaylight.neutron.spi.INeutronLoadBalancerCRUD; -import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolAware; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.INeutronSubnetCRUD; -import org.opendaylight.neutron.spi.NeutronLoadBalancer; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPool; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronLoadBalancerPoolAware; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.api.LoadBalancerConfiguration; @@ -194,6 +194,8 @@ public class LBaaSPoolHandler extends AbstractHandler /** * Useful utility for extracting the loadbalancer instance. With * each LB pool, we allow multiple VIP and LB to be instantiated. + * @param neutronLBPool Neutron load balancer pool object + * @return list of loadbalancer configuration of pool members */ public List extractLBConfiguration(NeutronLoadBalancerPool neutronLBPool) { String poolProtocol = neutronLBPool.getLoadBalancerPoolProtocol(); diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolMemberHandler.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolMemberHandler.java index d8834f5db..9ff36f2b0 100755 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolMemberHandler.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolMemberHandler.java @@ -12,15 +12,15 @@ import java.net.HttpURLConnection; import java.util.List; import java.util.Map; -import org.opendaylight.neutron.spi.INeutronLoadBalancerCRUD; -import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolCRUD; -import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolMemberAware; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.INeutronSubnetCRUD; -import org.opendaylight.neutron.spi.NeutronLoadBalancer; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPool; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerPoolCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronLoadBalancerPoolMemberAware; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.api.LoadBalancerConfiguration; @@ -191,6 +191,8 @@ public class LBaaSPoolMemberHandler extends AbstractHandler /** * Useful utility for extracting the loadbalancer instance * configuration from the neutron LB cache based on member info + * @param neutronLBPoolMember Neutron LB pool member object + * @return load balancer configuration of the pool member */ public LoadBalancerConfiguration extractLBConfiguration(NeutronLoadBalancerPoolMember neutronLBPoolMember) { String memberID = neutronLBPoolMember.getID(); diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NetworkHandler.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NetworkHandler.java index 705c15e33..cbd4d8016 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NetworkHandler.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NetworkHandler.java @@ -11,9 +11,9 @@ package org.opendaylight.ovsdb.openstack.netvirt; import java.net.HttpURLConnection; import java.util.List; -import org.opendaylight.neutron.spi.INeutronNetworkAware; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronNetworkAware; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NeutronCacheUtils.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NeutronCacheUtils.java index c52c28125..f6c234255 100755 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NeutronCacheUtils.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NeutronCacheUtils.java @@ -8,13 +8,13 @@ package org.opendaylight.ovsdb.openstack.netvirt; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.INeutronSubnetCRUD; -import org.opendaylight.neutron.spi.NeutronNetwork; -import org.opendaylight.neutron.spi.NeutronPort; -import org.opendaylight.neutron.spi.NeutronSubnet; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; import java.util.AbstractMap; import java.util.Iterator; @@ -25,6 +25,9 @@ public class NeutronCacheUtils { /** * Look up in the NeutronPortsCRUD cache and return the MAC address for a corresponding IP address + * @param neutronPortsCache Reference to port cache to get existing port related data. This interface + * basically read data from the md-sal data store. + * @param subnetID subnet to which given port is attached * @param ipAddr IP address of a member or VM * @return MAC address registered with that IP address */ @@ -58,6 +61,10 @@ public class NeutronCacheUtils { /** * Look up in the NeutronNetworkCRUD cache and NeutronSubnetCRUD cache for * extracting the provider segmentation_type and segmentation_id + * @param neutronNetworkCache Reference to neutron network cache to get existing network related data. + * This interface basically read data from the md-sal data store. + * @param neutronSubnetCache Reference to neutron subnet cache to get existing subnet related data. + * This interface basically read data from the md-sal data store. * @param subnetID Subnet UUID * @return {Type: ID} pair for that subnet ID */ diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NorthboundEvent.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NorthboundEvent.java index ae4609ae9..209e292b0 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NorthboundEvent.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NorthboundEvent.java @@ -8,15 +8,15 @@ package org.opendaylight.ovsdb.openstack.netvirt; -import org.opendaylight.neutron.spi.NeutronFloatingIP; -import org.opendaylight.neutron.spi.NeutronLoadBalancer; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPool; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPoolMember; -import org.opendaylight.neutron.spi.NeutronNetwork; -import org.opendaylight.neutron.spi.NeutronPort; -import org.opendaylight.neutron.spi.NeutronRouter; -import org.opendaylight.neutron.spi.NeutronRouter_Interface; -import org.opendaylight.neutron.spi.NeutronSubnet; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFloatingIP; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter_Interface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; public class NorthboundEvent extends AbstractEvent { diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/PortHandler.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/PortHandler.java index a59927ea8..e374404ae 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/PortHandler.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/PortHandler.java @@ -11,8 +11,8 @@ package org.opendaylight.ovsdb.openstack.netvirt; import java.net.HttpURLConnection; import java.util.List; -import org.opendaylight.neutron.spi.INeutronPortAware; -import org.opendaylight.neutron.spi.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronPortAware; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.Constants; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/PortSecurityHandler.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/PortSecurityHandler.java index 76a6b9d35..e6568000a 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/PortSecurityHandler.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/PortSecurityHandler.java @@ -10,10 +10,10 @@ package org.opendaylight.ovsdb.openstack.netvirt; import java.net.HttpURLConnection; -import org.opendaylight.neutron.spi.INeutronSecurityGroupAware; -import org.opendaylight.neutron.spi.INeutronSecurityRuleAware; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; -import org.opendaylight.neutron.spi.NeutronSecurityRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronSecurityGroupAware; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronSecurityRuleAware; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper; import org.osgi.framework.ServiceReference; diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/RouterHandler.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/RouterHandler.java index 7c914f8c3..95b77606a 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/RouterHandler.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/RouterHandler.java @@ -10,9 +10,9 @@ package org.opendaylight.ovsdb.openstack.netvirt; import java.net.HttpURLConnection; -import org.opendaylight.neutron.spi.INeutronRouterAware; -import org.opendaylight.neutron.spi.NeutronRouter; -import org.opendaylight.neutron.spi.NeutronRouter_Interface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter_Interface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronRouterAware; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter; diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/SouthboundHandler.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/SouthboundHandler.java index e16ebbc19..ee5a2d6a6 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/SouthboundHandler.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/SouthboundHandler.java @@ -10,7 +10,7 @@ package org.opendaylight.ovsdb.openstack.netvirt; import java.util.List; -import org.opendaylight.neutron.spi.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; import org.opendaylight.ovsdb.openstack.netvirt.api.*; import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter; import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper; diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/SubnetHandler.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/SubnetHandler.java index 3e3a714db..c74d11d12 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/SubnetHandler.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/SubnetHandler.java @@ -10,8 +10,8 @@ package org.opendaylight.ovsdb.openstack.netvirt; import java.net.HttpURLConnection; -import org.opendaylight.neutron.spi.INeutronSubnetAware; -import org.opendaylight.neutron.spi.NeutronSubnet; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronSubnetAware; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter; diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/BridgeConfigurationManager.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/BridgeConfigurationManager.java index 45d3018ba..d58075cad 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/BridgeConfigurationManager.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/BridgeConfigurationManager.java @@ -8,7 +8,7 @@ package org.opendaylight.ovsdb.openstack.netvirt.api; -import org.opendaylight.neutron.spi.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import java.util.List; @@ -74,7 +74,7 @@ public interface BridgeConfigurationManager { * For OpenFlow 1.3 the Integration Bridge is required and must have a physical device connected. * @param bridgeNode the {@link Node} that represents bridge * @param ovsdbNode the {@link Node} where the bridge is configured - * @param network the {@link org.opendaylight.neutron.spi.NeutronNetwork} + * @param network the {@link org.opendaylight.ovsdb.openstack.netvirt.translator} * @return True or False */ boolean isNodeVlanReady(Node bridgeNode, Node ovsdbNode, NeutronNetwork network); @@ -92,7 +92,7 @@ public interface BridgeConfigurationManager { * Returns true if the bridges required for the provider network type are created * If the bridges are not created, this method will attempt to create them * @param node the {@link Node} to query - * @param network the {@link org.opendaylight.neutron.spi.NeutronNetwork} + * @param network the {@link org.opendaylight.ovsdb.openstack.netvirt.translator} * @return True or False */ boolean createLocalNetwork(Node node, NeutronNetwork network); @@ -105,9 +105,9 @@ public interface BridgeConfigurationManager { /** * Returns the physical interface mapped to the given neutron physical network. - * @param node - * @param physicalNetwork - * @return + * @param node the {@link Node} to query + * @param physicalNetwork neutron physical network + * @return name of the physical interface */ String getPhysicalInterfaceName(Node node, String physicalNetwork); diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/ConfigurationService.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/ConfigurationService.java index b1beb9442..a41eb1020 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/ConfigurationService.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/ConfigurationService.java @@ -22,52 +22,57 @@ import org.apache.commons.lang3.tuple.Pair; public interface ConfigurationService { /** - * Returns the name configured name of the Integration Bridge + * @return the name configured name of the Integration Bridge */ String getIntegrationBridgeName(); /** * Configures the name of the Integration Bridge + * @param integrationBridgeName name of integration bridge */ void setIntegrationBridgeName(String integrationBridgeName); /** - * Returns the name configured name of the Network Bridge + * @return the name configured name of the Network Bridge */ String getNetworkBridgeName(); /** * Configures the name of the Network Bridge + * @param networkBridgeName Name of the network bridge */ void setNetworkBridgeName(String networkBridgeName); /** - * Returns the name configured name of the ExternalBridge + * @return the name configured name of the ExternalBridge */ String getExternalBridgeName(); /** * Configures the name of the External Bridge + * @param externalBridgeName Name of external bridge */ void setExternalBridgeName(String externalBridgeName); /** - * Returns the key used to access the Tunnel Endpoint configuration from Open vSwitch + * @return the key used to access the Tunnel Endpoint configuration from Open vSwitch */ String getTunnelEndpointKey(); /** * Sets the key used to access the Tunnel Endpoint configuration from Open vSwitch + * @param tunnelEndpointKey key of tunnel end point */ void setTunnelEndpointKey(String tunnelEndpointKey); /** - * Returns a Map of patch port names where the key is a tuple of source bridge and destination bridge + * @return a Map of patch port names where the key is a tuple of source bridge and destination bridge */ Map, String> getPatchPortNames(); /** * Sets the Map of source/destination bridges to patch port name + * @param patchPortNames Map of source/destination bridges to patch port name */ void setPatchPortNames(Map, String> patchPortNames); @@ -80,22 +85,24 @@ public interface ConfigurationService { String getPatchPortName(Pair portTuple); /** - * Returns the key used to access the Tunnel Endpoint configuration from Open vSwitch + * @return the key used to access the Tunnel Endpoint configuration from Open vSwitch */ String getProviderMappingsKey(); /** * Sets the key used to access the Tunnel Endpoint configuration from Open vSwitch + * @param providerMappingsKey provide mapping key */ void setProviderMappingsKey(String providerMappingsKey); /** - * Gets the default provider mapping + * @return Gets the default provider mapping */ String getDefaultProviderMapping(); /** * Sets the default provider mapping + * @param providerMapping provider mapping */ void setDefaultProviderMapping(String providerMapping); diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/EgressAclProvider.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/EgressAclProvider.java index a9d66426b..7438ce28c 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/EgressAclProvider.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/EgressAclProvider.java @@ -10,8 +10,8 @@ package org.opendaylight.ovsdb.openstack.netvirt.api; import java.util.List; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; /** * This interface allows egress Port Security flows to be written to devices. diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/GatewayMacResolver.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/GatewayMacResolver.java index 4fb38991f..a96d78b4b 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/GatewayMacResolver.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/GatewayMacResolver.java @@ -31,15 +31,17 @@ public interface GatewayMacResolver { * periodicRefresh flag. * @param externalNetworkBridgeDpid This bridge will be used for sending ARP request * @param gatewayIp ARP request will be send for this ip address + * @param sourceIpAddress Source IP address for the ARP request (localhost) + * @param sourceMacAddress Source MAC address for the ARP request (localhost) * @param periodicRefresh Do you want to periodically refresh the gateway mac? - * @return + * @return ListenableFuture that contains the mac address of gateway ip. */ public ListenableFuture resolveMacAddress( final Long externalNetworkBridgeDpid, final Ipv4Address gatewayIp, final Ipv4Address sourceIpAddress, final MacAddress sourceMacAddress, final Boolean periodicRefresh); /** * Method will stop the periodic refresh of the given gateway ip address. - * @param gatewayIp + * @param gatewayIp Gateway IP Address */ public void stopPeriodicRefresh(final Ipv4Address gatewayIp); } diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/IngressAclProvider.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/IngressAclProvider.java index 81fe7f653..5810f95d3 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/IngressAclProvider.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/IngressAclProvider.java @@ -10,8 +10,8 @@ package org.opendaylight.ovsdb.openstack.netvirt.api; import java.util.List; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; /** * This interface allows ingress Port Security flows to be written to devices. diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/NetworkingProvider.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/NetworkingProvider.java index 953a0b17f..791e07aea 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/NetworkingProvider.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/NetworkingProvider.java @@ -8,7 +8,7 @@ package org.opendaylight.ovsdb.openstack.netvirt.api; -import org.opendaylight.neutron.spi.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.osgi.framework.ServiceReference; @@ -19,27 +19,37 @@ import org.osgi.framework.ServiceReference; public interface NetworkingProvider { /** - * Returns the name of the NetworkingProvider + * @return the name of the NetworkingProvider */ String getName(); /** - * Return true if the provider supports Network Service Instances + * @return true if the provider supports Network Service Instances */ boolean supportsServices(); /** - * Return true if the provider supports per-tenant or "static" tunneling + * @return true if the provider supports per-tenant or "static" tunneling */ boolean hasPerTenantTunneling(); /** * Handle Interface Update Callback Method + * @param network Neutron Network attached to the interface + * @param source Source node where interface is attached + * @param intf Termination point attached to the node + * @return true if interface update handled successfully */ boolean handleInterfaceUpdate(NeutronNetwork network, Node source, OvsdbTerminationPointAugmentation intf); /** * Handle Interface Delete Callback Method + * @param tunnelType Type of the tunnel (e.g. vxlan) + * @param network Neutron Network associated with the removed interface + * @param source Source node where interface was attached + * @param intf Termination point associated to the deleted interface + * @param isLastInstanceOnNode is last interface attached to the node ? + * @return true if interface delete handled successfully */ boolean handleInterfaceDelete(String tunnelType, NeutronNetwork network, Node source, OvsdbTerminationPointAugmentation intf, boolean isLastInstanceOnNode); @@ -49,11 +59,13 @@ public interface NetworkingProvider { * This method provides a set of common functionalities to initialize the Flow rules of an OVSDB node * that are Openflow Version specific. Hence we have this method in addition to the following * Openflow Node specific initialization method. + * @param node Node on which flow rules are going to be installed */ void initializeFlowRules(Node node); /** * Initialize the Flow rules for a given OpenFlow node + * @param openflowNode Node on which flow rules are going to be installed */ void initializeOFFlowRules(Node openflowNode); } diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/SecurityServicesManager.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/SecurityServicesManager.java index 1bb10552c..997b76682 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/SecurityServicesManager.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/SecurityServicesManager.java @@ -8,14 +8,14 @@ package org.opendaylight.ovsdb.openstack.netvirt.api; -import java.util.List; - -import org.opendaylight.neutron.spi.NeutronPort; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import java.util.List; + /** * Open vSwitch isolates Tenant Networks using VLANs on the Integration Bridge. * This class manages the provisioning of these VLANs @@ -89,4 +89,11 @@ public interface SecurityServicesManager { */ List getVmListForSecurityGroup(List srcAddressList, String securityGroupUuid); + /** + * Add or remove the security groups rules from the port. + * @param port the neutron port. + * @param securityGroup the security group associated with the port. + * @param write whether to add/delete flow. + */ + void syncSecurityGroup(NeutronPort port, List securityGroup, boolean write); } diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/TenantNetworkManager.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/TenantNetworkManager.java index 482a6077b..ff6200a13 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/TenantNetworkManager.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/TenantNetworkManager.java @@ -8,8 +8,8 @@ package org.opendaylight.ovsdb.openstack.netvirt.api; -import org.opendaylight.neutron.spi.NeutronNetwork; -import org.opendaylight.neutron.spi.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; @@ -55,16 +55,22 @@ public interface TenantNetworkManager { /** * Get the Neutron Network ID for a given Segmentation ID + * @param segmentationId segmentation id of the neutron network + * @return Neutron network id associated with the given segmentation id */ String getNetworkId(String segmentationId); /** * Network Created Callback + * @param node target node + * @param networkId Id of neutron network + * @return vlan assigned to the network */ int networkCreated(Node node, String networkId); /** * Network Deleted Callback + * @param id Id of the neutron network */ void networkDeleted(String id); NeutronNetwork getTenantNetwork(OvsdbTerminationPointAugmentation terminationPointAugmentation); diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImpl.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImpl.java index f03a88f08..e58021f93 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImpl.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImpl.java @@ -8,7 +8,7 @@ package org.opendaylight.ovsdb.openstack.netvirt.impl; -import org.opendaylight.neutron.spi.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; import org.opendaylight.ovsdb.openstack.netvirt.ConfigInterface; import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler; import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager; diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/MdsalUtils.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/MdsalUtils.java index 9420bbf6a..b01dc1fc5 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/MdsalUtils.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/MdsalUtils.java @@ -61,7 +61,7 @@ public class MdsalUtils { * * @param logicalDatastoreType {@link LogicalDatastoreType} which should be modified * @param path {@link InstanceIdentifier} for path to read - * @param the data object type + * @param data object of type D * @return the result of the request */ public boolean merge( @@ -84,7 +84,7 @@ public class MdsalUtils { * * @param logicalDatastoreType {@link LogicalDatastoreType} which should be modified * @param path {@link InstanceIdentifier} for path to read - * @param the data object type + * @param data object of type D * @return the result of the request */ public boolean put( diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3Adapter.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3Adapter.java index b381f87d5..ad447f22a 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3Adapter.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3Adapter.java @@ -10,16 +10,17 @@ package org.opendaylight.ovsdb.openstack.netvirt.impl; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.INeutronSubnetCRUD; -import org.opendaylight.neutron.spi.NeutronFloatingIP; -import org.opendaylight.neutron.spi.NeutronNetwork; -import org.opendaylight.neutron.spi.NeutronPort; -import org.opendaylight.neutron.spi.NeutronRouter; -import org.opendaylight.neutron.spi.NeutronRouter_Interface; -import org.opendaylight.neutron.spi.NeutronSubnet; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFloatingIP; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter_Interface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; import org.opendaylight.ovsdb.openstack.netvirt.ConfigInterface; import org.opendaylight.ovsdb.openstack.netvirt.api.*; import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper; @@ -43,6 +44,7 @@ import java.net.UnknownHostException; import java.util.HashMap; import java.util.HashSet; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -70,6 +72,7 @@ public class NeutronL3Adapter implements ConfigInterface { private volatile ArpProvider arpProvider; private volatile RoutingProvider routingProvider; private volatile GatewayMacResolver gatewayMacResolver; + private volatile SecurityServicesManager securityServicesManager; private class FloatIpData { // br-int of node where floating ip is associated with tenant port @@ -197,6 +200,8 @@ public class NeutronL3Adapter implements ConfigInterface { */ public void handleNeutronPortEvent(final NeutronPort neutronPort, Action action) { LOG.debug("Neutron port {} event : {}", action, neutronPort.toString()); + + this.processSecurityGroupUpdate(neutronPort); if (!this.enabled) { return; } @@ -326,7 +331,7 @@ public class NeutronL3Adapter implements ConfigInterface { * way around) on OpenFlow Table 100. * * @param actionIn the {@link org.opendaylight.ovsdb.openstack.netvirt.api.Action} action to be handled. - * @param neutronFloatingIP An {@link org.opendaylight.neutron.spi.NeutronFloatingIP} instance of NeutronFloatingIP object. + * @param neutronFloatingIP An {@link org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFloatingIP} instance of NeutronFloatingIP object. */ public void handleNeutronFloatingIPEvent(final NeutronFloatingIP neutronFloatingIP, Action actionIn) { @@ -529,7 +534,7 @@ public class NeutronL3Adapter implements ConfigInterface { * Process the event. * * @param action the {@link org.opendaylight.ovsdb.openstack.netvirt.api.Action} action to be handled. - * @param neutronNetwork An {@link org.opendaylight.neutron.spi.NeutronNetwork} instance of NeutronFloatingIP object. + * @param neutronNetwork An {@link org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork} instance of NeutronFloatingIP object. */ public void handleNeutronNetworkEvent(final NeutronNetwork neutronNetwork, Action action) { LOG.debug("neutronNetwork {}: network: {}", action, neutronNetwork); @@ -544,7 +549,7 @@ public class NeutronL3Adapter implements ConfigInterface { * @param bridgeNode An instance of Node object. * @param intf An {@link org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105 * .OvsdbTerminationPointAugmentation} instance of OvsdbTerminationPointAugmentation object. - * @param neutronNetwork An {@link org.opendaylight.neutron.spi.NeutronNetwork} instance of NeutronNetwork + * @param neutronNetwork An {@link org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork} instance of NeutronNetwork * object. * @param action the {@link org.opendaylight.ovsdb.openstack.netvirt.api.Action} action to be handled. */ @@ -657,6 +662,50 @@ public class NeutronL3Adapter implements ConfigInterface { } } + private void processSecurityGroupUpdate(NeutronPort neutronPort) { + LOG.trace("processSecurityGroupUpdate:" + neutronPort); + /** + * Get updated data and original data for the the changed. Identify the security groups that got + * added and removed and call the appropriate providers for updating the flows. + */ + try { + NeutronPort originalPort = neutronPort.getOriginalPort(); + if (null == originalPort) { + LOG.debug("processSecurityGroupUpdate: originalport is empty"); + return; + } + List addedGroup = getsecurityGroupChanged(neutronPort, + neutronPort.getOriginalPort()); + List deletedGroup = getsecurityGroupChanged(neutronPort.getOriginalPort(), + neutronPort); + + if (null != addedGroup && !addedGroup.isEmpty()) { + securityServicesManager.syncSecurityGroup(neutronPort,addedGroup,true); + } + if (null != deletedGroup && !deletedGroup.isEmpty()) { + securityServicesManager.syncSecurityGroup(neutronPort,deletedGroup,false); + } + + } catch (Exception e) { + LOG.error("Exception in processSecurityGroupUpdate", e); + } + } + + private List getsecurityGroupChanged(NeutronPort port1, NeutronPort port2) { + LOG.trace("getsecurityGroupChanged:" + "Port1:" + port1 + "Port2" + port2); + ArrayList list1 = new ArrayList(port1.getSecurityGroups()); + ArrayList list2 = new ArrayList(port2.getSecurityGroups()); + for (Iterator iterator = list1.iterator(); iterator.hasNext();) { + NeutronSecurityGroup securityGroup1 = iterator.next(); + for (NeutronSecurityGroup securityGroup2 :list2) { + if (securityGroup1.getID().equals(securityGroup2.getID())) { + iterator.remove(); + } + } + } + return list1; + } + private void programL3ForwardingStage1(Node node, Long dpid, String providerSegmentationId, String macAddress, String ipStr, Action actionForNode) { @@ -1370,6 +1419,8 @@ public class NeutronL3Adapter implements ConfigInterface { (Southbound) ServiceHelper.getGlobalInstance(Southbound.class, this); gatewayMacResolver = (GatewayMacResolver) ServiceHelper.getGlobalInstance(GatewayMacResolver.class, this); + securityServicesManager = + (SecurityServicesManager) ServiceHelper.getGlobalInstance(SecurityServicesManager.class, this); initL3AdapterMembers(); } diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/OvsdbInventoryServiceImpl.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/OvsdbInventoryServiceImpl.java index ea6bc98e8..60388974f 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/OvsdbInventoryServiceImpl.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/OvsdbInventoryServiceImpl.java @@ -8,7 +8,9 @@ package org.opendaylight.ovsdb.openstack.netvirt.impl; import com.google.common.collect.Sets; + import java.util.Set; + import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; @@ -16,6 +18,13 @@ import org.opendaylight.ovsdb.openstack.netvirt.ConfigInterface; import org.opendaylight.ovsdb.openstack.netvirt.api.Constants; import org.opendaylight.ovsdb.openstack.netvirt.api.OvsdbInventoryService; import org.opendaylight.ovsdb.openstack.netvirt.api.OvsdbInventoryListener; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.impl.NeutronFloatingIPChangeListener; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.impl.NeutronNetworkChangeListener; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.impl.NeutronPortChangeListener; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.impl.NeutronRouterChangeListener; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.impl.NeutronSubnetChangeListener; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.impl.NeutronLoadBalancerPoolChangeListener; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.impl.NeutronLoadBalancerPoolMemberChangeListener; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId; @@ -61,6 +70,7 @@ public class OvsdbInventoryServiceImpl implements ConfigInterface, OvsdbInventor @Override public void providersReady() { ovsdbDataChangeListener.start(); + initializeNeutronModelsDataChangeListeners(dataBroker); initializeNetvirtTopology(); } @@ -84,4 +94,16 @@ public class OvsdbInventoryServiceImpl implements ConfigInterface, OvsdbInventor LOG.error("Error initializing netvirt topology"); } } + + private void initializeNeutronModelsDataChangeListeners( + DataBroker db) { + new NeutronNetworkChangeListener(db); + new NeutronSubnetChangeListener(db); + new NeutronPortChangeListener(db); + new NeutronRouterChangeListener(db); + new NeutronFloatingIPChangeListener(db); + new NeutronLoadBalancerPoolChangeListener(db); + new NeutronLoadBalancerPoolMemberChangeListener(db); + } + } diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImpl.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImpl.java index 1284419ff..277c5a268 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImpl.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImpl.java @@ -8,33 +8,42 @@ package org.opendaylight.ovsdb.openstack.netvirt.impl; -import java.util.ArrayList; -import java.util.List; - -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.INeutronSubnetCRUD; -import org.opendaylight.neutron.spi.NeutronPort; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; -import org.opendaylight.neutron.spi.NeutronSubnet; -import org.opendaylight.neutron.spi.Neutron_IPs; import org.opendaylight.ovsdb.openstack.netvirt.ConfigInterface; +import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService; import org.opendaylight.ovsdb.openstack.netvirt.api.Constants; +import org.opendaylight.ovsdb.openstack.netvirt.api.EgressAclProvider; +import org.opendaylight.ovsdb.openstack.netvirt.api.IngressAclProvider; import org.opendaylight.ovsdb.openstack.netvirt.api.SecurityServicesManager; import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; - import org.osgi.framework.ServiceReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.ArrayList; +import java.util.List; + public class SecurityServicesImpl implements ConfigInterface, SecurityServicesManager { private static final Logger LOG = LoggerFactory.getLogger(TenantNetworkManagerImpl.class); private volatile INeutronPortCRUD neutronPortCache; private volatile INeutronSubnetCRUD neutronSubnetCache; private volatile Southbound southbound; + private volatile INeutronNetworkCRUD neutronNetworkCache; + private volatile ConfigurationService configurationService; + private volatile IngressAclProvider ingressAclProvider; + private volatile EgressAclProvider egressAclProvider; + private volatile SecurityServicesManager securityServicesManager; @Override public boolean isPortSecurityReady(OvsdbTerminationPointAugmentation terminationPointAugmentation) { @@ -325,10 +334,98 @@ public class SecurityServicesImpl implements ConfigInterface, SecurityServicesMa } + @Override + public void syncSecurityGroup(NeutronPort port, List securityGroupList, boolean write) { + LOG.trace("syncSecurityGroup:" + securityGroupList + " Write:" + Boolean.valueOf(write)); + if (null != port && null != port.getSecurityGroups()) { + Node node = getNode(port); + NeutronNetwork neutronNetwork = neutronNetworkCache.getNetwork(port.getNetworkUUID()); + String segmentationId = neutronNetwork.getProviderSegmentationID(); + OvsdbTerminationPointAugmentation intf = getInterface(node, port); + long localPort = southbound.getOFPort(intf); + String attachedMac = southbound.getInterfaceExternalIdsValue(intf, Constants.EXTERNAL_ID_VM_MAC); + if (attachedMac == null) { + LOG.debug("programVlanRules: No AttachedMac seen in {}", intf); + return; + } + long dpid = getDpidOfIntegrationBridge(node); + List srcAddressList = securityServicesManager.getIpAddressList(node, intf); + for (NeutronSecurityGroup securityGroupInPort:securityGroupList) { + ingressAclProvider.programPortSecurityAcl(dpid, segmentationId, attachedMac, localPort, + securityGroupInPort, srcAddressList, write); + egressAclProvider.programPortSecurityAcl(dpid, segmentationId, attachedMac, localPort, + securityGroupInPort, srcAddressList, write); + } + } + } + + private long getDpidOfIntegrationBridge(Node node) { + LOG.trace("getDpidOfIntegrationBridge:" + node); + long dpid = 0L; + if (southbound.getBridgeName(node).equals(configurationService.getIntegrationBridgeName())) { + dpid = getDpid(node); + } + return dpid; + } + + private long getDpid(Node node) { + LOG.trace("getDpid" + node); + long dpid = southbound.getDataPathId(node); + if (dpid == 0) { + LOG.warn("getDpid: dpid not found: {}", node); + } + return dpid; + } + + private Node getNode(NeutronPort port) { + LOG.trace("getNode:Port" + port); + List toplogyNodes = southbound.readOvsdbTopologyNodes(); + + for (Node topologyNode : toplogyNodes) { + try { + Node node = southbound.getBridgeNode(topologyNode,Constants.INTEGRATION_BRIDGE); + List ovsdbPorts = southbound.getTerminationPointsOfBridge(node); + for (OvsdbTerminationPointAugmentation ovsdbPort : ovsdbPorts) { + String uuid = southbound.getInterfaceExternalIdsValue(ovsdbPort, + Constants.EXTERNAL_ID_INTERFACE_ID); + if (null != uuid && uuid.equals(port.getID())) { + return node; + } + } + } catch (Exception e) { + LOG.error("Exception during handlingNeutron network delete", e); + } + } + return null; + } + + private OvsdbTerminationPointAugmentation getInterface(Node node, NeutronPort port) { + LOG.trace("getInterface:Node:" + node + " Port:" + port); + try { + List ovsdbPorts = southbound.getTerminationPointsOfBridge(node); + for (OvsdbTerminationPointAugmentation ovsdbPort : ovsdbPorts) { + String uuid = southbound.getInterfaceExternalIdsValue(ovsdbPort, + Constants.EXTERNAL_ID_INTERFACE_ID); + if (null != uuid && uuid.equals(port.getID())) { + return ovsdbPort; + } + } + } catch (Exception e) { + LOG.error("Exception during handlingNeutron network delete", e); + } + return null; + } + @Override public void setDependencies(ServiceReference serviceReference) { southbound = (Southbound) ServiceHelper.getGlobalInstance(Southbound.class, this); + neutronNetworkCache = + (INeutronNetworkCRUD) ServiceHelper.getGlobalInstance(INeutronNetworkCRUD.class, this); + configurationService = + (ConfigurationService) ServiceHelper.getGlobalInstance(ConfigurationService.class, this); + securityServicesManager = + (SecurityServicesManager) ServiceHelper.getGlobalInstance(SecurityServicesManager.class, this); } @Override @@ -337,6 +434,10 @@ public class SecurityServicesImpl implements ConfigInterface, SecurityServicesMa neutronPortCache = (INeutronPortCRUD)impl; } else if (impl instanceof INeutronSubnetCRUD) { neutronSubnetCache = (INeutronSubnetCRUD) impl; + } else if (impl instanceof IngressAclProvider) { + ingressAclProvider = (IngressAclProvider) impl; + } else if (impl instanceof EgressAclProvider) { + egressAclProvider = (EgressAclProvider) impl; } } } diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SouthboundImpl.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SouthboundImpl.java index 4200448a6..6b84f9f7f 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SouthboundImpl.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SouthboundImpl.java @@ -411,8 +411,8 @@ public class SouthboundImpl implements Southbound { /** * Method read ports from bridge node. Method will check if the provided node * has the ports details, if not, it will read from Operational data store. - * @param node - * @return + * @param node Target bridge to getch termination points from. + * @return List of termination points on the given bridge */ public List getTerminationPointsOfBridge(Node node) { List tpAugmentations = extractTerminationPointAugmentations(node); diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/TenantNetworkManagerImpl.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/TenantNetworkManagerImpl.java index 53ba42d27..6cb1f144f 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/TenantNetworkManagerImpl.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/TenantNetworkManagerImpl.java @@ -9,11 +9,13 @@ package org.opendaylight.ovsdb.openstack.netvirt.impl; import com.google.common.base.Preconditions; + import java.util.List; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.NeutronNetwork; -import org.opendaylight.neutron.spi.NeutronPort; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; import org.opendaylight.ovsdb.openstack.netvirt.ConfigInterface; import org.opendaylight.ovsdb.openstack.netvirt.api.Constants; import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound; diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/INeutronObject.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/INeutronObject.java new file mode 100644 index 000000000..4e3076c8b --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/INeutronObject.java @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator; + +/** + * This class contains behaviour common to Neutron configuration objects + */ +public interface INeutronObject { + + String getID(); + + void setID(String id); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFirewall.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFirewall.java new file mode 100644 index 000000000..935fadb28 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFirewall.java @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator; + +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, INeutronObject { + 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 getID() { + return firewallUUID; + } + + public void setID(String id) { + firewallUUID = id; + } + + // @deprecated use getID() + public String getFirewallUUID() { + return firewallUUID; + } + + // @deprecated use setID() + 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.setID(this.getID()); + } + 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/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFirewallPolicy.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFirewallPolicy.java new file mode 100644 index 000000000..ad9da39bb --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFirewallPolicy.java @@ -0,0 +1,174 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator; + +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, INeutronObject { + 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") + Boolean firewallPolicyIsAudited; + + public Boolean getFirewallPolicyIsAudited() { + return firewallPolicyIsAudited; + } + + public void setFirewallPolicyIsAudited(Boolean 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 getID() { + return firewallPolicyUUID; + } + + public void setID(String id) { + firewallPolicyUUID = id; + } + + // @deprecated use getID() + public String getFirewallPolicyUUID() { + return firewallPolicyUUID; + } + + // @deprecated use setID() + 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.setID(this.getID()); + } + 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 + '\'' + + '}'; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFirewallRule.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFirewallRule.java new file mode 100644 index 000000000..9bc4c52b9 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFirewallRule.java @@ -0,0 +1,317 @@ +/* + * Copyright (C) 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator; + +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, INeutronObject { + 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(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 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 getID() { + return firewallRuleUUID; + } + + public void setID(String id) { + firewallRuleUUID = id; + } + + // @deprecated use getID() + public String getFirewallRuleUUID() { + return firewallRuleUUID; + } + + // @deprecated use setID() + public void setFireWallRuleID(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.setID(this.getID()); + } + 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("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 + '\'' + + ", 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() { + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFloatingIP.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFloatingIP.java new file mode 100644 index 000000000..89bde7004 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronFloatingIP.java @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +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, INeutronObject { + 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; + + @XmlElement (name="router_id") + String routerUUID; + + @XmlElement (name="status") + String status; + + public NeutronFloatingIP() { + } + + public String getID() { + return floatingIPUUID; + } + + public void setID(String id) { + floatingIPUUID = id; + } + + // @deprecated use getID() + public String getFloatingIPUUID() { + return floatingIPUUID; + } + + // @deprecated use setID() + 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 String getRouterUUID() { + return routerUUID; + } + + 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; + } + + public void setRouterUUID(String routerUUID) { + this.routerUUID = routerUUID; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + /** + * 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.setID(this.getID()); + } + 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()); + } + if (s.equals("router_id")) { + ans.setRouterUUID(this.getRouterUUID()); + } + if (s.equals("status")) { + ans.setStatus(this.getStatus()); + } + } + return ans; + } + + @Override + public String toString() { + return "NeutronFloatingIP{" + + "fipUUID='" + floatingIPUUID + '\'' + + ", fipFloatingNetworkId='" + floatingNetworkUUID + '\'' + + ", fipPortUUID='" + portUUID + '\'' + + ", fipFixedIPAddress='" + fixedIPAddress + '\'' + + ", fipFloatingIPAddress=" + floatingIPAddress + + ", fipTenantId='" + tenantUUID + '\'' + + ", fipRouterId='" + routerUUID + '\'' + + ", fipStatus='" + status + '\'' + + '}'; + } + + public void initDefaults() { + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancer.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancer.java new file mode 100644 index 000000000..cf9572291 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancer.java @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator; + +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, INeutronObject { + 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 = "admin_state_up") + Boolean loadBalancerAdminStateUp; + + @XmlElement (name = "vip_address") + String loadBalancerVipAddress; + + @XmlElement (name = "vip_subnet_id") + String loadBalancerVipSubnetID; + + public String getID() { + return loadBalancerID; + } + + public void setID(String id) { + loadBalancerID = id; + } + + // @deprecated use getID() + public String getLoadBalancerID() { + return loadBalancerID; + } + + // @deprecated use setID() + 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 Boolean getLoadBalancerAdminStateUp() { + return loadBalancerAdminStateUp; + } + + public void setLoadBalancerAdminStateUp(Boolean loadBalancerAdminStateUp) { + this.loadBalancerAdminStateUp = loadBalancerAdminStateUp; + } + + 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.setID(this.getID()); + } + 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()); + } + if (s.equals("admin_state_up")) { + ans.setLoadBalancerAdminStateUp(this.getLoadBalancerAdminStateUp()); + } + } + return ans; + } + + @Override public String toString() { + return "NeutronLoadBalancer{" + + "loadBalancerID='" + loadBalancerID + '\'' + + ", loadBalancerTenantID='" + loadBalancerTenantID + '\'' + + ", loadBalancerName='" + loadBalancerName + '\'' + + ", loadBalancerDescription='" + loadBalancerDescription + '\'' + + ", loadBalancerStatus='" + loadBalancerStatus + '\'' + + ", loadBalancerAdminStateUp='" + loadBalancerAdminStateUp + '\'' + + ", loadBalancerVipAddress='" + loadBalancerVipAddress + '\'' + + ", loadBalancerVipSubnetID='" + loadBalancerVipSubnetID + '\'' + + '}'; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerHealthMonitor.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerHealthMonitor.java new file mode 100644 index 000000000..430cef838 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerHealthMonitor.java @@ -0,0 +1,231 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator; + +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, INeutronObject { + private static final long serialVersionUID = 1L; + + @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 = "pools") + List loadBalancerHealthMonitorPools; + + public String getID() { + return loadBalancerHealthMonitorID; + } + + public void setID(String id) { + loadBalancerHealthMonitorID = id; + } + + // @deprecated use getID() + public String getLoadBalancerHealthMonitorID() { + return loadBalancerHealthMonitorID; + } + + // @deprecated use setID() + 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 List getLoadBalancerHealthMonitorPools() { + return loadBalancerHealthMonitorPools; + } + + public void setLoadBalancerHealthMonitorPools(List loadBalancerHealthMonitorPools) { + this.loadBalancerHealthMonitorPools = loadBalancerHealthMonitorPools; + } + + 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.setID(this.getID()); + } + 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); + } + } + 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 + + '}'; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerListener.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerListener.java new file mode 100644 index 000000000..48d19b5e2 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerListener.java @@ -0,0 +1,213 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator; + +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, INeutronObject { + private static final long serialVersionUID = 1L; + + @XmlElement(name = "id") + String loadBalancerListenerID; + + @XmlElement (name = "default_pool_id") + String neutronLoadBalancerListenerDefaultPoolID; + + @XmlElement (name = "connection_limit") + Integer neutronLoadBalancerListenerConnectionLimit; + + @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 = "protocol") + String neutronLoadBalancerListenerProtocol; + + @XmlElement (name = "protocol_port") + String neutronLoadBalancerListenerProtocolPort; + + @XmlElement (name = "load_balancers") + List neutronLoadBalancerListenerLoadBalancerIDs; + + public String getID() { + return loadBalancerListenerID; + } + + public void setID(String id) { + loadBalancerListenerID = id; + } + + // @deprecated use getID() + public String getLoadBalancerListenerID() { + return loadBalancerListenerID; + } + + // @deprecated use setID() + 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 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 Integer getNeutronLoadBalancerListenerConnectionLimit() { + return neutronLoadBalancerListenerConnectionLimit; + } + + public void setNeutronLoadBalancerListenerConnectionLimit(Integer neutronLoadBalancerListenerConnectionLimit) { + this.neutronLoadBalancerListenerConnectionLimit = neutronLoadBalancerListenerConnectionLimit; + } + + public List getNeutronLoadBalancerListenerLoadBalancerIDs() { + return neutronLoadBalancerListenerLoadBalancerIDs; + } + + public void setNeutronLoadBalancerListenerLoadBalancerIDs(List neutronLoadBalancerListenerLoadBalancerIDs) { + this.neutronLoadBalancerListenerLoadBalancerIDs = neutronLoadBalancerListenerLoadBalancerIDs; + } + + 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.setID(this.getID()); + } + 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("protocol")) { + ans.setNeutronLoadBalancerListenerProtocol(this.getNeutronLoadBalancerListenerProtocol()); + } + if (s.equals("protocol_port")) { + ans.setNeutronLoadBalancerListenerProtocolPort(this.getNeutronLoadBalancerListenerProtocolPort()); + } + if (s.equals("admin_state_up")) { + ans.setLoadBalancerListenerAdminStateIsUp(loadBalancerListenerAdminStateIsUp); + } + } + return ans; + } + + @Override public String toString() { + return "NeutronLoadBalancerListener{" + + "loadBalancerListenerID='" + loadBalancerListenerID + '\'' + + ", neutronLoadBalancerListenerDefaultPoolID='" + neutronLoadBalancerListenerDefaultPoolID + '\'' + + ", neutronLoadBalancerListenerConnectionLimit='" + neutronLoadBalancerListenerConnectionLimit + '\'' + + ", loadBalancerListenerTenantID='" + loadBalancerListenerTenantID + '\'' + + ", loadBalancerListenerName='" + loadBalancerListenerName + '\'' + + ", loadBalancerListenerDescription='" + loadBalancerListenerDescription + '\'' + + ", loadBalancerListenerAdminStateIsUp=" + loadBalancerListenerAdminStateIsUp + + ", neutronLoadBalancerListenerProtocol='" + neutronLoadBalancerListenerProtocol + '\'' + + ", neutronLoadBalancerListenerProtocolPort='" + neutronLoadBalancerListenerProtocolPort + '\'' + + '}'; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerPool.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerPool.java new file mode 100644 index 000000000..890dd3879 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerPool.java @@ -0,0 +1,246 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator; + +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 + * protocol String + * lb_algorithm String + * healthmonitor_id String + * admin_state_up Bool + * status String + * members List <NeutronLoadBalancerPoolMember> + * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf + */ + +@XmlRootElement +@XmlAccessorType(XmlAccessType.NONE) + +public class NeutronLoadBalancerPool implements Serializable, INeutronObject { + 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 = "listeners") + List loadBalancerPoolListeners; + + @XmlElement(name = "session_persistence") + NeutronLoadBalancer_SessionPersistence loadBalancerPoolSessionPersistence; + + @XmlElement(name = "members") + List loadBalancerPoolMembers; + + public NeutronLoadBalancerPool() { + } + + public String getID() { + return loadBalancerPoolID; + } + + public void setID(String id) { + loadBalancerPoolID = id; + } + + // @deprecated use getID() + public String getLoadBalancerPoolID() { + return loadBalancerPoolID; + } + + // @deprecated use setID() + 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 NeutronLoadBalancer_SessionPersistence getLoadBalancerPoolSessionPersistence() { + return loadBalancerPoolSessionPersistence; + } + + public void setLoadBalancerSessionPersistence(NeutronLoadBalancer_SessionPersistence loadBalancerPoolSessionPersistence) { + this.loadBalancerPoolSessionPersistence = loadBalancerPoolSessionPersistence; + } + + public List getLoadBalancerPoolListeners() { + return loadBalancerPoolListeners; + } + + public void setLoadBalancerPoolListeners(List loadBalancerPoolListeners) { + this.loadBalancerPoolListeners = loadBalancerPoolListeners; + } + + public List getLoadBalancerPoolMembers() { + /* + * Update the pool_id of the member to that this.loadBalancerPoolID + */ + if (loadBalancerPoolMembers != null) { + for (NeutronLoadBalancerPoolMember member: loadBalancerPoolMembers) { + member.setPoolID(loadBalancerPoolID); + } + return loadBalancerPoolMembers; + } + return loadBalancerPoolMembers; + } + + 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.setID(this.getID()); + } + 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("members")) { + ans.setLoadBalancerPoolMembers(getLoadBalancerPoolMembers()); + } + } + return ans; + } + + @Override + public String toString() { + return "NeutronLoadBalancerPool{" + + "id='" + loadBalancerPoolID + '\'' + + ", tenantID='" + loadBalancerPoolTenantID + '\'' + + ", name='" + loadBalancerPoolName + '\'' + + ", description='" + loadBalancerPoolDescription + '\'' + + ", protocol=" + loadBalancerPoolProtocol +'\''+ + ", lbAlgorithm='" + loadBalancerPoolLbAlgorithm + '\'' + + ", healthmonitorID=" + neutronLoadBalancerPoolHealthMonitorID + + ", adminStateUp=" + loadBalancerPoolAdminStateIsUp + +// todo: add loadBalancerPoolMembers as joined string + '}'; + } + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerPoolMember.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerPoolMember.java new file mode 100644 index 000000000..274aa6c36 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancerPoolMember.java @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator; + +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, INeutronObject { + + 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; + + String poolID; + + public NeutronLoadBalancerPoolMember() { + } + + @XmlTransient + public String getPoolID() { + return poolID; + } + + public void setPoolID(String poolID) { + this.poolID = poolID; + } + + public String getID() { + return poolMemberID; + } + + public void setID(String id) { + poolMemberID = id; + } + + // @deprecated use getID() + public String getPoolMemberID() { + return poolMemberID; + } + + // @deprecated use setID() + 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 NeutronLoadBalancerPoolMember extractFields(List fields) { + NeutronLoadBalancerPoolMember ans = new NeutronLoadBalancerPoolMember(); + Iterator i = fields.iterator(); + while (i.hasNext()) { + String s = i.next(); + if (s.equals("id")) { + ans.setID(this.getID()); + } + 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()); + } + } + return ans; + } + @Override public String toString() { + return "NeutronLoadBalancerPoolMember{" + + "poolMemberID='" + poolMemberID + '\'' + + ", poolID='" + poolID + '\'' + + ", poolMemberTenantID='" + poolMemberTenantID + '\'' + + ", poolMemberAddress='" + poolMemberAddress + '\'' + + ", poolMemberProtoPort=" + poolMemberProtoPort + + ", poolMemberAdminStateIsUp=" + poolMemberAdminStateIsUp + + ", poolMemberWeight=" + poolMemberWeight + + ", poolMemberSubnetID='" + poolMemberSubnetID + '\'' + + '}'; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancer_SessionPersistence.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancer_SessionPersistence.java new file mode 100644 index 000000000..7d3d63c96 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronLoadBalancer_SessionPersistence.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +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 NeutronLoadBalancer_SessionPersistence implements Serializable { + private static final long serialVersionUID = 1L; + + // See OpenStack Network API v2.0 Reference for description of + // annotated attributes + + @XmlElement(name = "cookie_name") + String cookieName; + + @XmlElement(name = "type") + String type; + + public NeutronLoadBalancer_SessionPersistence() { + } + + public NeutronLoadBalancer_SessionPersistence(String cookieName, String type) { + this.cookieName = cookieName; + this.type = type; + } + + public String getCookieName() { + return cookieName; + } + + public void setCookieName(String cookieName) { + this.cookieName = cookieName; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} + diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronNetwork.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronNetwork.java new file mode 100644 index 000000000..b6396dc6e --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronNetwork.java @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +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; + + @XmlElement (name = "name") + String networkName; + + @XmlElement (defaultValue = "true", name = "admin_state_up") + Boolean adminStateUp; + + @XmlElement (defaultValue = "false", name = "shared") + Boolean shared; + + @XmlElement (name = "tenant_id") + String tenantID; + + // @XmlElement (defaultValue = "false", name = "router:external") + @XmlElement (defaultValue="false", namespace="router", name="external") + Boolean routerExternal; + + // @XmlElement (defaultValue = "flat", name = "provider:network_type") + @XmlElement (namespace="provider", name="network_type") + String providerNetworkType; + + // @XmlElement (name = "provider:physical_network") + @XmlElement (namespace="provider", name="physical_network") + String providerPhysicalNetwork; + + // @XmlElement (name = "provider:segmentation_id") + @XmlElement (namespace="provider", name="segmentation_id") + String providerSegmentationID; + + @XmlElement (name = "status") + String status; + + @XmlElement (name = "subnets") + List subnets; + + @XmlElement (name="segments") + List segments; + + @XmlElement (name="vlan_transparent") + Boolean vlanTransparent; + + @XmlElement (name="mtu") + Integer mtu; + + /* This attribute lists the ports associated with an instance + * which is needed for determining if that instance can be deleted + */ + + public NeutronNetwork() { + } + + 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 void setSegments(List segments) { + this.segments = segments; + } + + public List getSegments() { + return segments; + } + + public Boolean getVlanTransparent() { + return vlanTransparent; + } + + public void setVlanTransparent(Boolean input) { + this.vlanTransparent = input; + } + + public Integer getMtu() { + return mtu; + } + + public void setMtu(Integer input) { + mtu = input; + } + + /** + * 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()); + } + if (s.equals("external")) { + ans.setRouterExternal(this.getRouterExternal()); + } + if (s.equals("segmentation_id")) { + ans.setProviderSegmentationID(this.getProviderSegmentationID()); + } + if (s.equals("physical_network")) { + ans.setProviderPhysicalNetwork(this.getProviderPhysicalNetwork()); + } + if (s.equals("network_type")) { + ans.setProviderNetworkType(this.getProviderNetworkType()); + } + } + 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 + ", segments = " + segments + "]"; + } +} + diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronNetwork_Segment.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronNetwork_Segment.java new file mode 100644 index 000000000..2246f89fa --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronNetwork_Segment.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +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(name = "network") +@XmlAccessorType(XmlAccessType.NONE) + +public class NeutronNetwork_Segment implements Serializable { + // See OpenStack Network API v2.0 Reference for description of + // annotated attributes + + private static final long serialVersionUID = 1L; + + // @XmlElement (defaultValue="flat", name="provider:network_type") + @XmlElement (defaultValue="flat", namespace="provider", name="network_type") + String providerNetworkType; + + // @XmlElement (name="provider:physical_network") + @XmlElement (namespace="provider", name="physical_network") + String providerPhysicalNetwork; + + // @XmlElement (name="provider:segmentation_id") + @XmlElement (namespace="provider", name="segmentation_id") + String providerSegmentationID; + + public NeutronNetwork_Segment() { + } + + 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; + } + + @Override + public String toString() { + return "NeutronNetwork_Segment [ " + + ", providerNetworkType=" + providerNetworkType + + ", providerPhysicalNetwork=" + providerPhysicalNetwork + + ", providerSegmentationID=" + providerSegmentationID + "]"; + } +} + diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort.java new file mode 100644 index 000000000..2608cd47d --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort.java @@ -0,0 +1,314 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + + +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 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 (name = "allowed_address_pairs") + List allowedAddressPairs; + + //@XmlElement (name = "binding:host_id") + @XmlElement (namespace = "binding", name = "host_id") + String bindinghostID; + + //@XmlElement (name = "binding:vnic_type") + @XmlElement (namespace = "binding", name = "vnic_type") + String bindingvnicType; + + //@XmlElement (name = "binding:vif_type") + @XmlElement (namespace = "binding", name = "vif_type") + String bindingvifType; + + //@XmlElement (name = "binding:vif_details") + @XmlElement (namespace = "binding", name = "vif_details") + List vifDetails; + + @XmlElement (name = "extra_dhcp_opts") + List extraDHCPOptions; + + NeutronPort originalPort; + + public NeutronPort() { + } + + 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 List getAllowedAddressPairs() { + return allowedAddressPairs; + } + + public void setAllowedAddressPairs(List allowedAddressPairs) { + this.allowedAddressPairs = allowedAddressPairs; + } + + public List getExtraDHCPOptions() { + return extraDHCPOptions; + } + + public void setExtraDHCPOptions(List extraDHCPOptions) { + this.extraDHCPOptions = extraDHCPOptions; + } + + public List getVIFDetail() { + return vifDetails; + } + + public void setVIFDetail(List vifDetails) { + this.vifDetails = vifDetails; + } + + 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 NeutronPort getOriginalPort() { + return originalPort; + } + + + public void setOriginalPort(NeutronPort originalPort) { + this.originalPort = originalPort; + } + + /** + * 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(); + for (String field: fields) { + if ("id".equals(field)) { + ans.setPortUUID(this.getPortUUID()); + } + if ("network_id".equals(field)) { + ans.setNetworkUUID(this.getNetworkUUID()); + } + if ("name".equals(field)) { + ans.setName(this.getName()); + } + if ("admin_state_up".equals(field)) { + ans.setAdminStateUp(this.getAdminStateUp()); + } + if ("status".equals(field)) { + ans.setStatus(this.getStatus()); + } + if ("mac_address".equals(field)) { + ans.setMacAddress(this.getMacAddress()); + } + if ("fixed_ips".equals(field)) { + ans.setFixedIPs(new ArrayList(this.getFixedIPs())); + } + if ("device_id".equals(field)) { + ans.setDeviceID(this.getDeviceID()); + } + if ("device_owner".equals(field)) { + ans.setDeviceOwner(this.getDeviceOwner()); + } + if ("tenant_id".equals(field)) { + ans.setTenantID(this.getTenantID()); + } + if ("security_groups".equals(field)) { + ans.setSecurityGroups(new ArrayList(this.getSecurityGroups())); + } + } + return ans; + } + + public void initDefaults() { + adminStateUp = true; + if (status == null) { + status = "ACTIVE"; + } + if (fixedIPs == null) { + fixedIPs = new ArrayList(); + } + } + + @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 + ", securityGroups=" + securityGroups + + ", bindinghostID=" + bindinghostID + ", bindingvnicType=" + bindingvnicType + + ", bindingvnicType=" + bindingvnicType + "]"; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort_AllowedAddressPairs.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort_AllowedAddressPairs.java new file mode 100644 index 000000000..65448d09c --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort_AllowedAddressPairs.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +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 NeutronPort_AllowedAddressPairs implements Serializable { + private static final long serialVersionUID = 1L; + + @XmlElement (name = "port_id") + String portID; + + @XmlElement (name = "mac_address") + String macAddress; + + @XmlElement (name = "ip_address") + String ipAddress; + + public NeutronPort_AllowedAddressPairs() { + } + + public NeutronPort_AllowedAddressPairs(String portID, String macAddress, String ipAddress) { + this.portID = portID; + this.macAddress = macAddress; + this.ipAddress = ipAddress; + } + + public String getPortID() { return(portID); } + + public void setPortID(String portID) { this.portID = portID; } + + public String getMacAddress() { return(macAddress); } + + public void setMacAddress(String macAddress) { this.macAddress = macAddress; } + + public String getIpAddress() { return(ipAddress); } + + public void setIpAddress(String ipAddress) { this.ipAddress = ipAddress; } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort_ExtraDHCPOption.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort_ExtraDHCPOption.java new file mode 100644 index 000000000..554fac1ff --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort_ExtraDHCPOption.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +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 NeutronPort_ExtraDHCPOption implements Serializable { + private static final long serialVersionUID = 1L; + + @XmlElement (name = "opt_value") + String value; + + @XmlElement (name = "opt_name") + String name; + + public NeutronPort_ExtraDHCPOption() { + } + + public NeutronPort_ExtraDHCPOption(String value, String name) { + this.value = value; + this.name = name; + } + + public String getValue() { return(value); } + + public void setValue(String value) { this.value = value; } + + public String getName() { return(name); } + + public void setName(String name) { this.name = name; } + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort_VIFDetail.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort_VIFDetail.java new file mode 100644 index 000000000..c485259b3 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronPort_VIFDetail.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +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 NeutronPort_VIFDetail implements Serializable { + private static final long serialVersionUID = 1L; + + @XmlElement (name = "port_filter") + Boolean portFilter; + + @XmlElement (name = "ovs_hybrid_plug") + Boolean ovsHybridPlug; + + public NeutronPort_VIFDetail() { + } + + public NeutronPort_VIFDetail(Boolean portFilter, Boolean ovsHybridPlug) { + this.portFilter = portFilter; + this.ovsHybridPlug = ovsHybridPlug; + } + + public Boolean getPortFilter() { return(portFilter); } + + public void setPortFilter(Boolean portFilter) { this.portFilter = portFilter; } + + public Boolean getOvsHybridPlug() { return(ovsHybridPlug); } + + public void setOvsHybridPlug(Boolean ovsHybridPlug) { this.ovsHybridPlug = ovsHybridPlug; } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronRouter.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronRouter.java new file mode 100644 index 000000000..cc64cd055 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronRouter.java @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +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 + */ + Map 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 void setInterfaces(Map input) { + interfaces = input; + } + + public Map 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; + } + + @Override + public String toString() { + return "NeutronRouter [" + + "id=" + routerUUID + + ", name=" + name + + ", adminStateUp=" + adminStateUp + + ", status=" + status + + ", tenantID=" + tenantID + + ", external_gateway_info=" + externalGatewayInfo + + ", distributed=" + distributed + + ", gw_port_id=" + gatewayPortId + + ", routes=" + routes + + ", interfaces=" + interfaces + + "]"; + } + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronRouter_Interface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronRouter_Interface.java new file mode 100644 index 000000000..974953361 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronRouter_Interface.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +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; + } + + @Override + public String toString() { + return "NeutronRouterInterface [" + + "subnetUUID=" + subnetUUID + + ", portUUID=" + portUUID + + ", id=" + id + + ", tenantID=" + tenantID + "]"; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronRouter_NetworkReference.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronRouter_NetworkReference.java new file mode 100644 index 000000000..ddc221794 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronRouter_NetworkReference.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +import java.io.Serializable; + +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_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; + + @XmlElement(name = "enable_snat") + Boolean enableSNAT; + + @XmlElement(name = "external_fixed_ips") + List externalFixedIPs; + + public NeutronRouter_NetworkReference() { + } + + public String getNetworkID() { + return networkID; + } + + public void setNetworkID(String networkID) { + this.networkID = networkID; + } + + public Boolean getEnableSNAT() { + return enableSNAT; + } + + public void setEnableSNAT(Boolean enableSNAT) { + this.enableSNAT = enableSNAT; + } + + public List getExternalFixedIPs() { + return externalFixedIPs; + } + + public void setExternalFixedIPs(List externalFixedIPs) { + this.externalFixedIPs = externalFixedIPs; + } + + @Override + public String toString() { + return "NeutronRouterNetworkReference [networkID=" + networkID + + " enableSNAT=" + enableSNAT + + " externalFixedIPs=" + externalFixedIPs + "]"; + } + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSecurityGroup.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSecurityGroup.java new file mode 100644 index 000000000..9a5daedf6 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSecurityGroup.java @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator; + +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; + +/** + * 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<NeutronSecurityRule> nested RO in the sec group. + */ + +@XmlRootElement +@XmlAccessorType(XmlAccessType.NONE) + +public class NeutronSecurityGroup implements Serializable, INeutronObject { + 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; + + public NeutronSecurityGroup() { + neutronSecurityRule = new ArrayList(); + + } + + public String getID() { + return securityGroupUUID; + } + + public void setID(String id) { + securityGroupUUID = id; + } + + // @deprecated use getID() + public String getSecurityGroupUUID() { + return securityGroupUUID; + } + + // @deprecated use setID() + 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(List neutronSecurityRule) { + this.neutronSecurityRule = 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.setID (this.getID ()); + } + 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 (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. + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSecurityRule.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSecurityRule.java new file mode 100644 index 000000000..bd6ddd566 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSecurityRule.java @@ -0,0 +1,223 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator; + +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, INeutronObject { + 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() { + } + + public String getID() { + return securityRuleUUID; + } + + public void setID(String id) { + securityRuleUUID = id; + } + + // @deprecated use getID() + public String getSecurityRuleUUID() { + return securityRuleUUID; + } + + // @deprecated use setID() + 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.setID(this.getID()); + } + 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. + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSubnet.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSubnet.java new file mode 100644 index 000000000..9d32fc3e7 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSubnet.java @@ -0,0 +1,489 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +import java.io.Serializable; +import java.math.BigInteger; +import java.net.InetAddress; +import java.net.Inet6Address; +import java.net.UnknownHostException; +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; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.NeutronCRUDInterfaces; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@XmlRootElement +@XmlAccessorType(XmlAccessType.NONE) + +public class NeutronSubnet implements Serializable, INeutronObject { + private static final Logger LOGGER = LoggerFactory + .getLogger(NeutronCRUDInterfaces.class); + + private static final long serialVersionUID = 1L; + private static final int IPV4_VERSION = 4; + private static final int IPV6_VERSION = 6; + private static final int IPV6_LENGTH = 128; + private static final int IPV6_LENGTH_BYTES = 8; + private static final long IPV6_LSB_MASK = 0x000000FF; + private static final int IPV6_BYTE_OFFSET = 7; + + // 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. + * + * @deprecated, will be removed in Boron + */ + + List myPorts; + + public NeutronSubnet() { + myPorts = new ArrayList(); + } + + // @deprecated - will be removed in Boron + public void setPorts(List arg) { + myPorts = arg; + } + + 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; + } + + // @deprecated - will be removed in Boron + public List getPortsInSubnet() { + return myPorts; + } + + // @deprecated - will be removed in Boron + public List getPortsInSubnet(String ignore) { + List answer = new ArrayList(); + for (NeutronPort port : myPorts) { + if (!port.getDeviceOwner().equalsIgnoreCase(ignore)) { + answer.add(port); + } + } + return answer; + } + + /* 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 == IPV4_VERSION) { + try { + SubnetUtils util = new SubnetUtils(cidr); + SubnetInfo info = util.getInfo(); + if (!info.getNetworkAddress().equals(info.getAddress())) { + return false; + } + } catch (IllegalArgumentException e) { + LOGGER.warn("Failure in isValidCIDR()", e); + return false; + } + return true; + } + if (ipVersion == IPV6_VERSION) { + // 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 < IPV6_LENGTH; i++) { + if (((((int) addrBytes[i/IPV6_LENGTH_BYTES]) & IPV6_LSB_MASK) & (1 << (IPV6_BYTE_OFFSET-(i%IPV6_LENGTH_BYTES)))) != 0) { + return(false); + } + } + return(true); + } catch (UnknownHostException e) { + LOGGER.warn("Failure in isValidCIDR()", 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()) { + NeutronSubnetIPAllocationPool pool = i.next(); + if (ipVersion == IPV4_VERSION && pool.contains(gatewayIP)) { + return true; + } + if (ipVersion == IPV6_VERSION && pool.containsV6(gatewayIP)) { + return true; + } + } + return false; + } + + public boolean initDefaults() { + if (enableDHCP == null) { + enableDHCP = true; + } + if (ipVersion == null) { + ipVersion = IPV4_VERSION; + } + dnsNameservers = new ArrayList(); + if (hostRoutes == null) { + hostRoutes = new ArrayList(); + } + if (allocationPools == null) { + allocationPools = new ArrayList(); + if (ipVersion == IPV4_VERSION) { + try { + SubnetUtils util = new SubnetUtils(cidr); + SubnetInfo info = util.getInfo(); + if (gatewayIP == null || ("").equals(gatewayIP)) { + gatewayIP = info.getLowAddress(); + } + if (allocationPools.size() < 1) { + NeutronSubnetIPAllocationPool source = + new NeutronSubnetIPAllocationPool(info.getLowAddress(), + info.getHighAddress()); + allocationPools = source.splitPool(gatewayIP); + } + } catch (IllegalArgumentException e) { + LOGGER.warn("Failure in initDefault()", e); + return false; + } + } + if (ipVersion == IPV6_VERSION) { + String[] parts = cidr.split("/"); + if (parts.length != 2) { + return false; + } + try { + int length = Integer.parseInt(parts[1]); + BigInteger lowAddress_bi = NeutronSubnetIPAllocationPool.convertV6(parts[0]); + String lowAddress = NeutronSubnetIPAllocationPool.bigIntegerToIP(lowAddress_bi.add(BigInteger.ONE)); + BigInteger mask = BigInteger.ONE.shiftLeft(length).subtract(BigInteger.ONE); + String highAddress = NeutronSubnetIPAllocationPool.bigIntegerToIP(lowAddress_bi.add(mask).subtract(BigInteger.ONE)); + if (gatewayIP == null || ("").equals(gatewayIP)) { + gatewayIP = lowAddress; + } + if (allocationPools.size() < 1) { + NeutronSubnetIPAllocationPool source = + new NeutronSubnetIPAllocationPool(lowAddress, + highAddress); + allocationPools = source.splitPoolV6(gatewayIP); + } + } catch (Exception e) { + LOGGER.warn("Failure in initDefault()", e); + return false; + } + } + } + return true; + } + + /* this method tests to see if the supplied IPv4 address + * is valid for this subnet or not + */ + public boolean isValidIP(String ipAddress) { + if (ipVersion == IPV4_VERSION) { + try { + SubnetUtils util = new SubnetUtils(cidr); + SubnetInfo info = util.getInfo(); + return info.isInRange(ipAddress); + } catch (IllegalArgumentException e) { + LOGGER.warn("Failure in isValidIP()", e); + return false; + } + } + + if (ipVersion == IPV6_VERSION) { + String[] parts = cidr.split("/"); + try { + int length = Integer.parseInt(parts[1]); + byte[] cidrBytes = ((Inet6Address) InetAddress.getByName(parts[0])).getAddress(); + byte[] ipBytes = ((Inet6Address) InetAddress.getByName(ipAddress)).getAddress(); + int i; + for (i = 0; i < length; i++) { + if (((((int) cidrBytes[i/IPV6_LENGTH_BYTES]) & IPV6_LSB_MASK) & (1 << (IPV6_BYTE_OFFSET-(i%IPV6_LENGTH_BYTES)))) != + ((((int) ipBytes[i/IPV6_LENGTH_BYTES]) & IPV6_LSB_MASK) & (1 << (IPV6_BYTE_OFFSET-(i%IPV6_LENGTH_BYTES))))) { + return(false); + } + } + return(true); + } catch (UnknownHostException e) { + LOGGER.warn("Failure in isValidIP()", e); + return(false); + } + } + return false; + } + + /* 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()) { + NeutronSubnetIPAllocationPool pool = i.next(); + if (ans == null) { + ans = pool.getPoolStart(); + } + else { + if (ipVersion == IPV4_VERSION && + NeutronSubnetIPAllocationPool.convert(pool.getPoolStart()) < + NeutronSubnetIPAllocationPool.convert(ans)) { + ans = pool.getPoolStart(); + } + if (ipVersion == IPV6_VERSION && + NeutronSubnetIPAllocationPool.convertV6(pool.getPoolStart()).compareTo(NeutronSubnetIPAllocationPool.convertV6(ans)) < 0) { + ans = pool.getPoolStart(); + } + } + } + return ans; + } + + @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 + + ", ipv6AddressMode=" + ipV6AddressMode + + ", ipv6RaMode=" + ipV6RaMode + "]"; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSubnetIPAllocationPool.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSubnetIPAllocationPool.java new file mode 100644 index 000000000..38f31c74b --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSubnetIPAllocationPool.java @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +import java.io.Serializable; +import java.math.BigInteger; +import java.net.InetAddress; +import java.net.Inet6Address; +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; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@XmlRootElement +@XmlAccessorType(XmlAccessType.NONE) +public class NeutronSubnetIPAllocationPool implements Serializable { + private static final Logger LOGGER = LoggerFactory + .getLogger(NeutronSubnetIPAllocationPool.class); + + private static final long serialVersionUID = 1L; + + private static final int BYTE_LENGTH = 8; + private static final int IPV4_DOTTED_QUADS = 4; + private static final int IPV4_DOTTED_QUAD_OFFSET = 3; + private static final int IPV4_DOTTED_QUAD_MASK = 255; + + // See OpenStack Network API v2.0 Reference for description of + // annotated attributes + + @XmlElement(name = "start") + String poolStart; + + @XmlElement(name = "end") + String poolEnd; + + public NeutronSubnetIPAllocationPool() { + } + + public NeutronSubnetIPAllocationPool(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 + * @return a boolean on whether the pool contains the address or not + */ + + public boolean contains(String inputString) { + long inputIP = convert(inputString); + long startIP = convert(poolStart); + long endIP = convert(poolEnd); + return (inputIP >= startIP && inputIP <= endIP); + } + + /** + * This static method converts the supplied IPv4 address to a long + * integer for comparison + * + * @param inputString + * IPv4 address in dotted decimal format + * @return 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 <<= BYTE_LENGTH; + ans |= Integer.parseInt(part); + } + } + return ans; + } + + /** + * This method determines if this allocation pool contains the + * input IPv4 address + * + * @param inputString + * IPv4 address in dotted decimal format + * @return a boolean on whether the pool contains the address or not + */ + + public boolean containsV6(String inputString) { + BigInteger inputIP = convertV6(inputString); + BigInteger startIP = convertV6(poolStart); + BigInteger endIP = convertV6(poolEnd); + return (inputIP.compareTo(startIP) >= 0 && inputIP.compareTo(endIP) <= 0); + } + + /** + * This static method converts the supplied IPv4 address to a long + * integer for comparison + * + * @param inputString + * IPv6 address in dotted decimal format + * @return high-endian representation of the IPv4 address as a BigInteger. + * This method will return 0 if the input is null. + */ + + static BigInteger convertV6(String inputString) { + if (inputString == null) { + return BigInteger.ZERO; + } + try { + return new BigInteger(((Inet6Address) InetAddress.getByName(inputString)).getAddress()); + } catch (Exception e) { + LOGGER.error("convertV6 error", e); + return BigInteger.ZERO; + } + } + + /** + * 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 + * @return IPv4 address in dotted decimal format + */ + static String longToIP(long input) { + int part; + long ipLong = input; + String[] parts = new String[IPV4_DOTTED_QUADS]; + for (part = 0; part < IPV4_DOTTED_QUADS; part++) { + parts[IPV4_DOTTED_QUAD_OFFSET-part] = String.valueOf(ipLong & IPV4_DOTTED_QUAD_MASK); + ipLong >>= BYTE_LENGTH; + } + return join(parts,"."); + } + + /** + * 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 + * @return IPv4 address in dotted decimal format + */ + static String bigIntegerToIP(BigInteger b) { + try { + return Inet6Address.getByAddress(b.toByteArray()).getHostAddress(); + } catch (Exception e) { + LOGGER.error("bigIntegerToIP", e); + return "ERROR"; + } + } + + /* + * helper routine used by longToIP + */ + public static String join(String r[],String separator) + { + if (r.length == 0) { + return ""; + } + StringBuilder sb = new StringBuilder(); + int i; + for(i = 0;i < r.length - 1;i++) { + sb.append(r[i]); + sb.append(separator); + } + return sb.toString() + r[i]; + } + + /* + * This method splits the current instance by removing the supplied + * parameter. + * + * If the parameter is either the low or high address, + * then that member is adjusted and a list containing just this instance + * is returned. + * + * If the parameter is in the middle of the pool, then + * create two new instances, one ranging from low to parameter-1 + * the other ranging from parameter+1 to high + */ + public List splitPool(String ipAddress) { + List ans = new ArrayList(); + long gIP = NeutronSubnetIPAllocationPool.convert(ipAddress); + long sIP = NeutronSubnetIPAllocationPool.convert(poolStart); + long eIP = NeutronSubnetIPAllocationPool.convert(poolEnd); + long i; + NeutronSubnetIPAllocationPool p = new NeutronSubnetIPAllocationPool(); + 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(NeutronSubnetIPAllocationPool.longToIP(i+1)); + } + } + if (i == eIP) { + if (i != gIP) { + p.setPoolEnd(poolEnd); + } else { + p.setPoolEnd(NeutronSubnetIPAllocationPool.longToIP(i-1)); + } + ans.add(p); + } + if (i != sIP && i != eIP) { + if (i != gIP) { + if (!poolStarted) { + p.setPoolStart(NeutronSubnetIPAllocationPool.longToIP(i)); + poolStarted = true; + } + } else { + p.setPoolEnd(NeutronSubnetIPAllocationPool.longToIP(i-1)); + poolStarted = false; + ans.add(p); + p = new NeutronSubnetIPAllocationPool(); + // Fix for 2120 + p.setPoolStart(NeutronSubnetIPAllocationPool.longToIP(i+1)); + poolStarted = true; + } + } + } + return ans; + } + + @Override + public String toString() { + return "NeutronSubnetIPAllocationPool [" + + "start=" + poolStart + + ", end=" + poolEnd + "]"; + } + + /* + * This method splits the current instance by removing the supplied + * parameter. + * + * If the parameter is either the low or high address, + * then that member is adjusted and a list containing just this instance + * is returned. + new * + * If the parameter is in the middle of the pool, then + * create two new instances, one ranging from low to parameter-1 + * the other ranging from parameter+1 to high + * If the pool is a single address, return null + */ + public List splitPoolV6(String ipAddress) { + List ans = new ArrayList(); + BigInteger gIP = NeutronSubnetIPAllocationPool.convertV6(ipAddress); + BigInteger sIP = NeutronSubnetIPAllocationPool.convertV6(poolStart); + BigInteger eIP = NeutronSubnetIPAllocationPool.convertV6(poolEnd); + if (gIP.compareTo(sIP) == 0 && gIP.compareTo(eIP) < 0) { + NeutronSubnetIPAllocationPool p = new NeutronSubnetIPAllocationPool(); + p.setPoolStart(NeutronSubnetIPAllocationPool.bigIntegerToIP(sIP.add(BigInteger.ONE))); + p.setPoolEnd(poolEnd); + ans.add(p); + return(ans); + } + if (gIP.compareTo(eIP) == 0 && gIP.compareTo(sIP) > 0) { + NeutronSubnetIPAllocationPool p = new NeutronSubnetIPAllocationPool(); + p.setPoolStart(poolStart); + p.setPoolEnd(NeutronSubnetIPAllocationPool.bigIntegerToIP(eIP.subtract(BigInteger.ONE))); + ans.add(p); + return(ans); + } + if (gIP.compareTo(eIP) < 0 && gIP.compareTo(sIP) > 0) { + NeutronSubnetIPAllocationPool p = new NeutronSubnetIPAllocationPool(); + p.setPoolStart(poolStart); + p.setPoolEnd(NeutronSubnetIPAllocationPool.bigIntegerToIP(gIP.subtract(BigInteger.ONE))); + ans.add(p); + NeutronSubnetIPAllocationPool p2 = new NeutronSubnetIPAllocationPool(); + p2.setPoolStart(NeutronSubnetIPAllocationPool.bigIntegerToIP(gIP.add(BigInteger.ONE))); + p2.setPoolEnd(poolEnd); + ans.add(p2); + return ans; + } + return null; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSubnet_HostRoute.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSubnet_HostRoute.java new file mode 100644 index 000000000..49743fe98 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/NeutronSubnet_HostRoute.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +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; + + /** + * HostRoute constructor + */ + public NeutronSubnet_HostRoute() { } + + @Override + public String toString() { + return "NeutronSubnetHostRoute [" + + "destination=" + destination + + ", nextHop=" + nextHop + "]"; + } + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/Neutron_ID.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/Neutron_ID.java new file mode 100644 index 000000000..acdae1273 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/Neutron_ID.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +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_ID implements Serializable { + private static final long serialVersionUID = 1L; + + // See OpenStack Network API v2.0 Reference for description of + // annotated attributes + + @XmlElement(name = "id") + String uuid; + + public Neutron_ID() { } + + public Neutron_ID(String uuid) { + this.uuid = uuid; + } + + public String getID() { + return uuid; + } + + public void setID(String uuid) { + this.uuid = uuid; + } + + @Override + public String toString() { + return "Neutron_ID{" + "id='" + uuid + '\'' + "}"; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/Neutron_IPs.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/Neutron_IPs.java new file mode 100644 index 000000000..41b8981e7 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/Neutron_IPs.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator; + +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/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFirewallCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFirewallCRUD.java new file mode 100644 index 000000000..51b4021a9 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFirewallCRUD.java @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewall; + +/** + * This interface defines the methods for CRUD of NB OpenStack Firewall objects + */ + +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 + */ + + 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.ovsdb.openstack.netvirt.translator.NeutronFirewall} + * OpenStackFirewall class + */ + + NeutronFirewall getNeutronFirewall(String uuid); + + /** + * Applications call this interface method to return all Firewall objects + * + * @return List of OpenStackNetworks objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean neutronFirewallInUse(String uuid); + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFirewallPolicyCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFirewallPolicyCRUD.java new file mode 100644 index 000000000..6993dfbd1 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFirewallPolicyCRUD.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewallPolicy; + +/** + * This interface defines the methods for CRUD of NB OpenStack Firewall Policy objects + * + */ + +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 + */ + + 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 + */ + + NeutronFirewallPolicy getNeutronFirewallPolicy(String uuid); + + /** + * Applications call this interface method to return all Firewall Policy objects + * + * @return List of OpenStack Firewall Policy objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean neutronFirewallPolicyInUse(String uuid); + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFirewallRuleCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFirewallRuleCRUD.java new file mode 100644 index 000000000..e3cce62df --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFirewallRuleCRUD.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewallRule; + +/** + * This interface defines the methods for CRUD of NB OpenStack Firewall Rule objects + * + */ + +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 + */ + + 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 + */ + + NeutronFirewallRule getNeutronFirewallRule(String uuid); + + /** + * Applications call this interface method to return all Firewall Rule objects + * + * @return List of OpenStackNetworks objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean neutronFirewallRuleInUse(String uuid); + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFloatingIPCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFloatingIPCRUD.java new file mode 100644 index 000000000..73ee3c4ad --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronFloatingIPCRUD.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFloatingIP; + +/** + * This interface defines the methods for CRUD of NB FloatingIP objects + * + */ + +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 + */ + + 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.ovsdb.openstack.netvirt.translator.NeutronFloatingIP} + * OpenStack FloatingIP class + */ + + NeutronFloatingIP getFloatingIP(String uuid); + + /** + * Applications call this interface method to return all FloatingIP objects + * + * @return a Set of OpenStackFloatingIPs objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean updateFloatingIP(String uuid, NeutronFloatingIP delta); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerCRUD.java new file mode 100644 index 000000000..7fc23c114 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerCRUD.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer; + +/** + * This interface defines the methods for CRUD of NB OpenStack LoadBalancer objects + * + */ + +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 + */ + + 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 + */ + + NeutronLoadBalancer getNeutronLoadBalancer(String uuid); + + /** + * Applications call this interface method to return all LoadBalancer objects + * + * @return List of OpenStackNetworks objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean neutronLoadBalancerInUse(String uuid); + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerHealthMonitorCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerHealthMonitorCRUD.java new file mode 100644 index 000000000..98f781fde --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerHealthMonitorCRUD.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerHealthMonitor; + +/** + * This interface defines the methods for CRUD of NB OpenStack LoadBalancerHealthMonitor objects + * + */ + +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 + */ + + 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 + */ + + NeutronLoadBalancerHealthMonitor getNeutronLoadBalancerHealthMonitor(String uuid); + + /** + * Applications call this interface method to return all LoadBalancerHealthMonitor objects + * + * @return List of OpenStackNetworks objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean neutronLoadBalancerHealthMonitorInUse(String uuid); + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerListenerCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerListenerCRUD.java new file mode 100644 index 000000000..b77136873 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerListenerCRUD.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerListener; + +/** + * This interface defines the methods for CRUD of NB OpenStack LoadBalancerListener objects + * + */ + +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 + */ + + 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 + */ + + NeutronLoadBalancerListener getNeutronLoadBalancerListener(String uuid); + + /** + * Applications call this interface method to return all LoadBalancerListener objects + * + * @return List of OpenStackNetworks objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean neutronLoadBalancerListenerInUse(String uuid); + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerPoolCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerPoolCRUD.java new file mode 100644 index 000000000..93185b30e --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerPoolCRUD.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool; + +/** + * This interface defines the methods for CRUD of NB OpenStack LoadBalancerPool objects + * + */ + +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 + */ + + 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 + */ + + NeutronLoadBalancerPool getNeutronLoadBalancerPool(String uuid); + + /** + * Applications call this interface method to return all LoadBalancerPool objects + * + * @return List of OpenStackNetworks objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean neutronLoadBalancerPoolInUse(String uuid); + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerPoolMemberCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerPoolMemberCRUD.java new file mode 100644 index 000000000..a0b47f271 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronLoadBalancerPoolMemberCRUD.java @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember; + +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 + */ + + 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.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember} + * OpenStackNeutronLoadBalancerPoolMember class + */ + + NeutronLoadBalancerPoolMember getNeutronLoadBalancerPoolMember(String uuid); + + /** + * Applications call this interface method to return all NeutronLoadBalancerPoolMember objects + * + * @return List of OpenStackNetworks objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean neutronLoadBalancerPoolMemberInUse(String uuid); + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronNetworkCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronNetworkCRUD.java new file mode 100644 index 000000000..87146669a --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronNetworkCRUD.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; + +/** + * This interface defines the methods for CRUD of NB network objects + * + */ + +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 + */ + + 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.ovsdb.openstack.netvirt.translator.NeutronNetwork} + * OpenStack Network class + */ + + NeutronNetwork getNetwork(String uuid); + + /** + * Applications call this interface method to return all Network objects + * + * @return List of OpenStackNetworks objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean networkInUse(String netUUID); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronPortCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronPortCRUD.java new file mode 100644 index 000000000..f7d5271c4 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronPortCRUD.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; + +/** + * This interface defines the methods for CRUD of NB Port objects + * + */ + +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 + */ + + 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.ovsdb.openstack.netvirt.translator.NeutronPort} + * OpenStack Port class + */ + + NeutronPort getPort(String uuid); + + /** + * Applications call this interface method to return all Port objects + * + * @return List of OpenStackPorts objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + * + * @deprecated - will be removed in Boron + */ + + 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 + * + * @deprecated - will be removed in Boron + */ + + NeutronPort getGatewayPort(String subnetUUID); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronRouterCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronRouterCRUD.java new file mode 100644 index 000000000..c2fcc3ce7 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronRouterCRUD.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter; + +/** + * This interface defines the methods for CRUD of NB Router objects + * + */ + +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 + */ + + 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.ovsdb.openstack.netvirt.translator.NeutronRouter} + * OpenStack Router class + */ + + NeutronRouter getRouter(String uuid); + + /** + * Applications call this interface method to return all Router objects + * + * @return List of OpenStackRouters objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean updateRouter(String uuid, NeutronRouter delta); + + /** + * Applications call this interface method to check if a router is in use + * + * @param routerUUID + * identifier of the Router object + * @return boolean on whether the router is in use or not + */ + + boolean routerInUse(String routerUUID); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronSecurityGroupCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronSecurityGroupCRUD.java new file mode 100644 index 000000000..0fa139e81 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronSecurityGroupCRUD.java @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; + +/** + * This interface defines the methods for CRUD of NB OpenStack Security Group objects + */ + +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 + */ + + 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.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup} + * OpenStack Security Group class + */ + + NeutronSecurityGroup getNeutronSecurityGroup(String uuid); + + /** + * Applications call this interface method to return all Security Group objects + * + * @return List of OpenStackSecurity Groups objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean neutronSecurityGroupInUse(String uuid); + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronSecurityRuleCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronSecurityRuleCRUD.java new file mode 100644 index 000000000..42fbadc08 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronSecurityRuleCRUD.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityRule; + +/** + * This interface defines the methods for CRUD of NB OpenStack Security Rule objects + */ + +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 + */ + + 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.ovsdb.openstack.netvirt.translator.NeutronSecurityRule} + * OpenStackSecurity Rule class + */ + + NeutronSecurityRule getNeutronSecurityRule(String uuid); + + /** + * Applications call this interface method to return all Security Rule objects + * + * @return List of OpenStack SecurityRules objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + */ + + boolean neutronSecurityRuleInUse(String uuid); + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronSubnetCRUD.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronSubnetCRUD.java new file mode 100644 index 000000000..b96646aa1 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/INeutronSubnetCRUD.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.crud; + +import java.util.List; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet; + +/** + * This interface defines the methods for CRUD of NB Subnet objects + * + */ + +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 + */ + + 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.ovsdb.openstack.netvirt.translator.NeutronSubnet} + * OpenStack Subnet class + */ + + NeutronSubnet getSubnet(String uuid); + + /** + * Applications call this interface method to return all Subnet objects + * + * @return List of OpenStackSubnets objects + */ + + 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 + */ + + 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 + */ + + 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 + */ + + 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 + * + * @deprecated - will be removed in Boron + */ + + boolean subnetInUse(String subnetUUID); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/NeutronCRUDInterfaces.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/NeutronCRUDInterfaces.java new file mode 100644 index 000000000..4f61e515f --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/NeutronCRUDInterfaces.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.crud; + +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); + + private INeutronNetworkCRUD networkInterface; + private INeutronSubnetCRUD subnetInterface; + private INeutronPortCRUD portInterface; + private INeutronRouterCRUD routerInterface; + private INeutronFloatingIPCRUD fipInterface; + private INeutronSecurityGroupCRUD sgInterface; + private INeutronSecurityRuleCRUD srInterface; + private INeutronFirewallCRUD fwInterface; + private INeutronFirewallPolicyCRUD fwpInterface; + private INeutronFirewallRuleCRUD fwrInterface; + private INeutronLoadBalancerCRUD lbInterface; + private INeutronLoadBalancerPoolCRUD lbpInterface; + private INeutronLoadBalancerListenerCRUD lblInterface; + private INeutronLoadBalancerHealthMonitorCRUD lbhmInterface; + private INeutronLoadBalancerPoolMemberCRUD lbpmInterface; + public NeutronCRUDInterfaces() { + } + + public INeutronNetworkCRUD getNetworkInterface() { + return networkInterface; + } + + public INeutronSubnetCRUD getSubnetInterface() { + return subnetInterface; + } + + public INeutronPortCRUD getPortInterface() { + return portInterface; + } + + public INeutronRouterCRUD getRouterInterface() { + return routerInterface; + } + + public INeutronFloatingIPCRUD getFloatingIPInterface() { + return fipInterface; + } + + public INeutronSecurityGroupCRUD getSecurityGroupInterface() { + return sgInterface; + } + + public INeutronSecurityRuleCRUD getSecurityRuleInterface() { + return srInterface; + } + + public INeutronFirewallCRUD getFirewallInterface() { + return fwInterface; + } + + public INeutronFirewallPolicyCRUD getFirewallPolicyInterface() { + return fwpInterface; + } + + public INeutronFirewallRuleCRUD getFirewallRuleInterface() { + return fwrInterface; + } + + public INeutronLoadBalancerCRUD getLoadBalancerInterface() { + return lbInterface; + } + + public INeutronLoadBalancerPoolCRUD getLoadBalancerPoolInterface() { + return lbpInterface; + } + + public INeutronLoadBalancerListenerCRUD getLoadBalancerListenerInterface() { + return lblInterface; + } + + public INeutronLoadBalancerHealthMonitorCRUD getLoadBalancerHealthMonitorInterface() { + return lbhmInterface; + } + + public INeutronLoadBalancerPoolMemberCRUD getLoadBalancerPoolMemberInterface() { + return lbpmInterface; + } + + public NeutronCRUDInterfaces fetchINeutronNetworkCRUD(Object obj) { + networkInterface = (INeutronNetworkCRUD) getInstances(INeutronNetworkCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronSubnetCRUD(Object obj) { + subnetInterface = (INeutronSubnetCRUD) getInstances(INeutronSubnetCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronPortCRUD(Object obj) { + portInterface = (INeutronPortCRUD) getInstances(INeutronPortCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronRouterCRUD(Object obj) { + routerInterface = (INeutronRouterCRUD) getInstances(INeutronRouterCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronFloatingIPCRUD(Object obj) { + fipInterface = (INeutronFloatingIPCRUD) getInstances(INeutronFloatingIPCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronSecurityGroupCRUD(Object obj) { + sgInterface = (INeutronSecurityGroupCRUD) getInstances(INeutronSecurityGroupCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronSecurityRuleCRUD(Object obj) { + srInterface = (INeutronSecurityRuleCRUD) getInstances(INeutronSecurityRuleCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronFirewallCRUD(Object obj) { + fwInterface = (INeutronFirewallCRUD) getInstances(INeutronFirewallCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronFirewallPolicyCRUD(Object obj) { + fwpInterface = (INeutronFirewallPolicyCRUD) getInstances(INeutronFirewallPolicyCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronFirewallRuleCRUD(Object obj) { + fwrInterface = (INeutronFirewallRuleCRUD) getInstances(INeutronFirewallRuleCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronLoadBalancerCRUD(Object obj) { + lbInterface = (INeutronLoadBalancerCRUD) getInstances(INeutronLoadBalancerCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronLoadBalancerPoolCRUD(Object obj) { + lbpInterface = (INeutronLoadBalancerPoolCRUD) getInstances(INeutronLoadBalancerPoolCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronLoadBalancerListenerCRUD(Object obj) { + lblInterface = (INeutronLoadBalancerListenerCRUD) getInstances(INeutronLoadBalancerListenerCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronLoadBalancerHealthMonitorCRUD(Object obj) { + lbhmInterface = (INeutronLoadBalancerHealthMonitorCRUD) getInstances(INeutronLoadBalancerHealthMonitorCRUD.class, obj); + return this; + } + + public NeutronCRUDInterfaces fetchINeutronLoadBalancerPoolMemberCRUD(Object obj) { + lbpmInterface = (INeutronLoadBalancerPoolMemberCRUD) getInstances(INeutronLoadBalancerPoolMemberCRUD.class, obj); + return this; + } + + public 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("Error in getInstances", e); + } + return null; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/AbstractNeutronInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/AbstractNeutronInterface.java new file mode 100644 index 000000000..178a228f7 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/AbstractNeutronInterface.java @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2015 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.lang.reflect.Method; +import java.util.concurrent.ExecutionException; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; +import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; +import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.INeutronObject; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Optional; +import com.google.common.base.Preconditions; +import com.google.common.util.concurrent.CheckedFuture; + + +public abstract class AbstractNeutronInterface implements AutoCloseable { + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractNeutronInterface.class); + private static final int DEDASHED_UUID_LENGTH = 32; + private static final int DEDASHED_UUID_START = 0; + private static final int DEDASHED_UUID_DIV1 = 8; + private static final int DEDASHED_UUID_DIV2 = 12; + private static final int DEDASHED_UUID_DIV3 = 16; + private static final int DEDASHED_UUID_DIV4 = 20; + + private DataBroker db; + + AbstractNeutronInterface(ProviderContext providerContext) { + this.db = providerContext.getSALService(DataBroker.class); + } + + public DataBroker getDataBroker() { + return db; + } + + protected abstract InstanceIdentifier createInstanceIdentifier(T item); + + protected abstract T toMd(S neutronObject); + + protected abstract T toMd(String uuid); + + protected T readMd(InstanceIdentifier path) { + T result = null; + final ReadOnlyTransaction transaction = getDataBroker().newReadOnlyTransaction(); + CheckedFuture, ReadFailedException> future = transaction.read(LogicalDatastoreType.CONFIGURATION, path); + if (future != null) { + Optional optional; + try { + optional = future.checkedGet(); + if (optional.isPresent()) { + result = optional.get(); + } + } catch (ReadFailedException e) { + LOGGER.warn("Failed to read {}", path, e); + } + } + transaction.close(); + return result; + } + + protected boolean addMd(S neutronObject) { + // TODO think about adding existence logic + return updateMd(neutronObject); + } + + protected boolean updateMd(S neutronObject) { + WriteTransaction transaction = getDataBroker().newWriteOnlyTransaction(); + T item = toMd(neutronObject); + InstanceIdentifier iid = createInstanceIdentifier(item); + transaction.put(LogicalDatastoreType.CONFIGURATION, iid, item,true); + CheckedFuture future = transaction.submit(); + try { + future.get(); + } catch (InterruptedException | ExecutionException e) { + LOGGER.warn("Transation failed ",e); + return false; + } + return true; + } + + protected boolean removeMd(T item) { + WriteTransaction transaction = getDataBroker().newWriteOnlyTransaction(); + InstanceIdentifier iid = createInstanceIdentifier(item); + transaction.delete(LogicalDatastoreType.CONFIGURATION, iid); + CheckedFuture future = transaction.submit(); + try { + future.get(); + } catch (InterruptedException | ExecutionException e) { + LOGGER.warn("Transation failed ",e); + return false; + } + return true; + } + + protected Uuid toUuid(String uuid) { + Preconditions.checkNotNull(uuid); + Uuid result; + try { + result = new Uuid(uuid); + } catch(IllegalArgumentException e) { + // OK... someone didn't follow RFC 4122... lets try this the hard way + String dedashed = uuid.replace("-", ""); + if(dedashed.length() == DEDASHED_UUID_LENGTH) { + String redashed = dedashed.substring(DEDASHED_UUID_START, DEDASHED_UUID_DIV1) + + "-" + + dedashed.substring(DEDASHED_UUID_DIV1, DEDASHED_UUID_DIV2) + + "-" + + dedashed.substring(DEDASHED_UUID_DIV2, DEDASHED_UUID_DIV3) + + "-" + + dedashed.substring(DEDASHED_UUID_DIV3, DEDASHED_UUID_DIV4) + + "-" + + dedashed.substring(DEDASHED_UUID_DIV4, DEDASHED_UUID_LENGTH); + result = new Uuid(redashed); + } else { + throw e; + } + } + return result; + } + + // this method uses reflection to update an object from it's delta. + + protected 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) { + LOGGER.error("Error in overwrite", e); + return false; + } + } + } + return true; + } + + @Override + public void close() throws Exception { + // TODO Auto-generated method stub + + } + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFirewallInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFirewallInterface.java new file mode 100644 index 000000000..485eb8be0 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFirewallInterface.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2014, 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.List; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.INeutronObject; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewall; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronFirewallCRUD; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +public class NeutronFirewallInterface extends AbstractNeutronInterface implements INeutronFirewallCRUD { + + NeutronFirewallInterface(ProviderContext providerContext) { + super(providerContext); + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronFirewallInterface neutronFirewallInterface = new NeutronFirewallInterface(providerContext); + ServiceRegistration neutronFirewallInterfaceRegistration = context.registerService(INeutronFirewallCRUD.class, neutronFirewallInterface, null); + if(neutronFirewallInterfaceRegistration != null) { + registrations.add(neutronFirewallInterfaceRegistration); + } + } + + @Override + public boolean neutronFirewallExists(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + public NeutronFirewall getNeutronFirewall(String uuid) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllNeutronFirewalls() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean addNeutronFirewall(NeutronFirewall input) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean removeNeutronFirewall(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean updateNeutronFirewall(String uuid, NeutronFirewall delta) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean neutronFirewallInUse(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + protected InstanceIdentifier createInstanceIdentifier(DataObject item) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected DataObject toMd(INeutronObject neutronObject) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected DataObject toMd(String uuid) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFirewallPolicyInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFirewallPolicyInterface.java new file mode 100644 index 000000000..514a1dc14 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFirewallPolicyInterface.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2014, 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.List; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.INeutronObject; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewallPolicy; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronFirewallPolicyCRUD; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + */ + +public class NeutronFirewallPolicyInterface extends AbstractNeutronInterface implements INeutronFirewallPolicyCRUD { + + NeutronFirewallPolicyInterface(ProviderContext providerContext) { + super(providerContext); + } + + @Override + public boolean neutronFirewallPolicyExists(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + public NeutronFirewallPolicy getNeutronFirewallPolicy(String uuid) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllNeutronFirewallPolicies() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean addNeutronFirewallPolicy(NeutronFirewallPolicy input) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean removeNeutronFirewallPolicy(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean updateNeutronFirewallPolicy(String uuid, + NeutronFirewallPolicy delta) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean neutronFirewallPolicyInUse(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + protected InstanceIdentifier createInstanceIdentifier(DataObject item) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected DataObject toMd(INeutronObject neutronObject) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected DataObject toMd(String uuid) { + // TODO Auto-generated method stub + return null; + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronFirewallPolicyInterface neutronFirewallPolicyInterface = new NeutronFirewallPolicyInterface(providerContext); + ServiceRegistration neutronFirewallPolicyInterfaceRegistration = context.registerService(INeutronFirewallPolicyCRUD.class, neutronFirewallPolicyInterface, null); + if(neutronFirewallPolicyInterfaceRegistration != null) { + registrations.add(neutronFirewallPolicyInterfaceRegistration); + } + } + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFirewallRuleInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFirewallRuleInterface.java new file mode 100644 index 000000000..f056d1870 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFirewallRuleInterface.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2014, 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.List; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.INeutronObject; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewallRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronFirewallRuleCRUD; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +public class NeutronFirewallRuleInterface extends AbstractNeutronInterface implements INeutronFirewallRuleCRUD { + + NeutronFirewallRuleInterface(ProviderContext providerContext) { + super(providerContext); + } + + @Override + public boolean neutronFirewallRuleExists(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + public NeutronFirewallRule getNeutronFirewallRule(String uuid) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllNeutronFirewallRules() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean addNeutronFirewallRule(NeutronFirewallRule input) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean removeNeutronFirewallRule(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean updateNeutronFirewallRule(String uuid, + NeutronFirewallRule delta) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean neutronFirewallRuleInUse(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + protected InstanceIdentifier createInstanceIdentifier(DataObject item) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected DataObject toMd(INeutronObject neutronObject) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected DataObject toMd(String uuid) { + // TODO Auto-generated method stub + return null; + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronFirewallRuleInterface neutronFirewallRuleInterface = new NeutronFirewallRuleInterface(providerContext); + ServiceRegistration neutronFirewallRuleInterfaceRegistration = context.registerService(INeutronFirewallRuleCRUD.class, neutronFirewallRuleInterface, null); + if(neutronFirewallRuleInterfaceRegistration != null) { + registrations.add(neutronFirewallRuleInterfaceRegistration); + } + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFloatingIPInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFloatingIPInterface.java new file mode 100644 index 000000000..20dc3c37f --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronFloatingIPInterface.java @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFloatingIP; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronFloatingIPCRUD; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.floatingips.attributes.Floatingips; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.floatingips.attributes.floatingips.Floatingip; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.floatingips.attributes.floatingips.FloatingipBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NeutronFloatingIPInterface extends AbstractNeutronInterface implements INeutronFloatingIPCRUD { + private static final Logger LOGGER = LoggerFactory.getLogger(NeutronFloatingIPInterface.class); + + NeutronFloatingIPInterface(ProviderContext providerContext) { + super(providerContext); + } + + // IfNBFloatingIPCRUD interface methods + + @Override + public boolean floatingIPExists(String uuid) { + Floatingip fip = readMd(createInstanceIdentifier(toMd(uuid))); + return (fip != null); + } + + @Override + public NeutronFloatingIP getFloatingIP(String uuid) { + Floatingip fip = readMd(createInstanceIdentifier(toMd(uuid))); + if (fip == null) { + return null; + } + return fromMd(fip); + } + + @Override + public List getAllFloatingIPs() { + Set allIPs = new HashSet(); + Floatingips fips = readMd(createInstanceIdentifier()); + if (fips != null) { + for (Floatingip fip: fips.getFloatingip()) { + allIPs.add(fromMd(fip)); + } + } + LOGGER.debug("Exiting getAllFloatingIPs, Found {} FloatingIPs", allIPs.size()); + List ans = new ArrayList(); + ans.addAll(allIPs); + return ans; + } + + @Override + public boolean addFloatingIP(NeutronFloatingIP input) { + if (floatingIPExists(input.getID())) { + return false; + } + return addMd(input); + } + + @Override + public boolean removeFloatingIP(String uuid) { + NeutronFloatingIP fip = getFloatingIP(uuid); + if (fip == null) { + return false; + } + return removeMd(toMd(uuid)); + } + + @Override + public boolean updateFloatingIP(String uuid, NeutronFloatingIP delta) { + NeutronFloatingIP target = getFloatingIP(uuid); + if (target == null) { + return false; + } + delta.setPortUUID(target.getPortUUID()); + delta.setFixedIPAddress(target.getFixedIPAddress()); + return updateMd(delta); + } + + @Override + protected Floatingip toMd(String uuid) { + FloatingipBuilder floatingipBuilder = new FloatingipBuilder(); + floatingipBuilder.setUuid(toUuid(uuid)); + return floatingipBuilder.build(); + } + + @Override + protected Floatingip toMd(NeutronFloatingIP floatingIp) { + FloatingipBuilder floatingipBuilder = new FloatingipBuilder(); + if (floatingIp.getFixedIPAddress() != null) { + floatingipBuilder.setFixedIpAddress(new IpAddress(floatingIp.getFixedIPAddress().toCharArray())); + } + if(floatingIp.getFloatingIPAddress() != null) { + floatingipBuilder.setFloatingIpAddress(new IpAddress(floatingIp.getFloatingIPAddress().toCharArray())); + } + if (floatingIp.getFloatingNetworkUUID() != null) { + floatingipBuilder.setFloatingNetworkId(toUuid(floatingIp.getFloatingNetworkUUID())); + } + if (floatingIp.getPortUUID() != null) { + floatingipBuilder.setPortId(toUuid(floatingIp.getPortUUID())); + } + if (floatingIp.getRouterUUID() != null) { + floatingipBuilder.setRouterId(toUuid(floatingIp.getRouterUUID())); + } + if (floatingIp.getStatus() != null) { + floatingipBuilder.setStatus(floatingIp.getStatus()); + } + if (floatingIp.getTenantUUID() != null) { + floatingipBuilder.setTenantId(toUuid(floatingIp.getTenantUUID())); + } + if (floatingIp.getID() != null) { + floatingipBuilder.setUuid(toUuid(floatingIp.getID())); + } + else { + LOGGER.warn("Attempting to write neutron floating IP without UUID"); + } + return floatingipBuilder.build(); + } + + protected NeutronFloatingIP fromMd(Floatingip fip) { + NeutronFloatingIP result = new NeutronFloatingIP(); + result.setID(String.valueOf(fip.getUuid().getValue())); + if (fip.getFloatingNetworkId() != null) { + result.setFloatingNetworkUUID(String.valueOf(fip.getFloatingNetworkId().getValue())); + } + if (fip.getPortId() != null) { + result.setPortUUID(String.valueOf(fip.getPortId().getValue())); + } + if (fip.getFixedIpAddress() != null ) { + result.setFixedIPAddress(String.valueOf(fip.getFixedIpAddress().getValue())); + } + if (fip.getFloatingIpAddress() != null) { + result.setFloatingIPAddress(String.valueOf(fip.getFloatingIpAddress().getValue())); + } + if (fip.getTenantId() != null) { + result.setTenantUUID(String.valueOf(fip.getTenantId().getValue())); + } + if (fip.getRouterId() != null) { + result.setRouterUUID(String.valueOf(fip.getRouterId().getValue())); + } + result.setStatus(fip.getStatus()); + return result; + } + + @Override + protected InstanceIdentifier createInstanceIdentifier( + Floatingip item) { + return InstanceIdentifier.create(Neutron.class) + .child(Floatingips.class) + .child(Floatingip.class,item.getKey()); + } + + protected InstanceIdentifier createInstanceIdentifier() { + return InstanceIdentifier.create(Neutron.class) + .child(Floatingips.class); + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronFloatingIPInterface neutronFloatingIPInterface = new NeutronFloatingIPInterface(providerContext); + ServiceRegistration neutronFloatingIPInterfaceRegistration = context.registerService(INeutronFloatingIPCRUD.class, neutronFloatingIPInterface, null); + if (neutronFloatingIPInterfaceRegistration != null) { + registrations.add(neutronFloatingIPInterfaceRegistration); + } + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerHealthMonitorInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerHealthMonitorInterface.java new file mode 100644 index 000000000..8f6cf2989 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerHealthMonitorInterface.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2014, 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.List; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerHealthMonitor; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerHealthMonitorCRUD; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.Healthmonitors; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +public class NeutronLoadBalancerHealthMonitorInterface extends AbstractNeutronInterface implements INeutronLoadBalancerHealthMonitorCRUD { + + NeutronLoadBalancerHealthMonitorInterface(ProviderContext providerContext) { + super(providerContext); + } + + @Override + public boolean neutronLoadBalancerHealthMonitorExists(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + public NeutronLoadBalancerHealthMonitor getNeutronLoadBalancerHealthMonitor( + String uuid) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllNeutronLoadBalancerHealthMonitors() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean addNeutronLoadBalancerHealthMonitor( + NeutronLoadBalancerHealthMonitor input) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean removeNeutronLoadBalancerHealthMonitor(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean updateNeutronLoadBalancerHealthMonitor(String uuid, + NeutronLoadBalancerHealthMonitor delta) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean neutronLoadBalancerHealthMonitorInUse(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + protected InstanceIdentifier createInstanceIdentifier( + Healthmonitors item) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Healthmonitors toMd(NeutronLoadBalancerHealthMonitor neutronObject) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Healthmonitors toMd(String uuid) { + // TODO Auto-generated method stub + return null; + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronLoadBalancerHealthMonitorInterface neutronLoadBalancerHealthMonitorInterface = new NeutronLoadBalancerHealthMonitorInterface(providerContext); + ServiceRegistration neutronLoadBalancerHealthMonitorInterfaceRegistration = context.registerService(INeutronLoadBalancerHealthMonitorCRUD.class, neutronLoadBalancerHealthMonitorInterface, null); + if(neutronLoadBalancerHealthMonitorInterfaceRegistration != null) { + registrations.add(neutronLoadBalancerHealthMonitorInterfaceRegistration); + } + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerInterface.java new file mode 100644 index 000000000..770516e23 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerInterface.java @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2014, 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud.impl; + +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.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerCRUD; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.Loadbalancers; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.loadbalancers.Loadbalancer; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.loadbalancers.LoadbalancerBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * TODO: Migrate this to consume the MD-SAL data store, so that it can read all the data from data store. + * No need to worry about the write/update related methods here. OVSDB net-virt will use these CRUD Interface + * only for reading. We will cleanup these interface/methods later. + */ +public class NeutronLoadBalancerInterface extends AbstractNeutronInterface implements INeutronLoadBalancerCRUD { + private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerInterface.class); + private ConcurrentMap loadBalancerDB = new ConcurrentHashMap(); + + + NeutronLoadBalancerInterface(ProviderContext providerContext) { + super(providerContext); + } + + @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.getID())) { + return false; + } + loadBalancerDB.putIfAbsent(input.getID(), 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); + } + + @Override + protected Loadbalancer toMd(String uuid) { + LoadbalancerBuilder loadBalancersBuilder = new LoadbalancerBuilder(); + loadBalancersBuilder.setUuid(toUuid(uuid)); + return loadBalancersBuilder.build(); + } + + @Override + protected InstanceIdentifier createInstanceIdentifier( + Loadbalancer loadBalancer) { + return InstanceIdentifier.create(Neutron.class) + .child(Loadbalancers.class) + .child(Loadbalancer.class, loadBalancer.getKey()); + } + + @Override + protected Loadbalancer toMd(NeutronLoadBalancer loadBalancer) { + LoadbalancerBuilder loadBalancersBuilder = new LoadbalancerBuilder(); + loadBalancersBuilder.setAdminStateUp(loadBalancer.getLoadBalancerAdminStateUp()); + if (loadBalancer.getLoadBalancerDescription() != null) { + loadBalancersBuilder.setDescr(loadBalancer.getLoadBalancerDescription()); + } + if (loadBalancer.getLoadBalancerName() != null) { + loadBalancersBuilder.setName(loadBalancer.getLoadBalancerName()); + } + if (loadBalancer.getLoadBalancerStatus() != null) { + loadBalancersBuilder.setStatus(loadBalancer.getLoadBalancerStatus()); + } + if (loadBalancer.getLoadBalancerTenantID() != null) { + loadBalancersBuilder.setTenantId(toUuid(loadBalancer.getLoadBalancerTenantID())); + } + if (loadBalancer.getLoadBalancerVipAddress() != null) { + loadBalancersBuilder.setVipAddress(new IpAddress(loadBalancer.getLoadBalancerVipAddress().toCharArray())); + } + if (loadBalancer.getLoadBalancerVipSubnetID() != null) { + loadBalancersBuilder.setVipSubnetId(toUuid(loadBalancer.getLoadBalancerVipSubnetID())); + } + if (loadBalancer.getID() != null) { + loadBalancersBuilder.setUuid(toUuid(loadBalancer.getID())); + } else { + LOGGER.warn("Attempting to write neutron load balancer without UUID"); + } + return loadBalancersBuilder.build(); + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronLoadBalancerInterface neutronLoadBalancerInterface = new NeutronLoadBalancerInterface(providerContext); + ServiceRegistration neutronLoadBalancerInterfaceRegistration = context.registerService(INeutronLoadBalancerCRUD.class, neutronLoadBalancerInterface, null); + if(neutronLoadBalancerInterfaceRegistration != null) { + registrations.add(neutronLoadBalancerInterfaceRegistration); + } + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerListenerInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerListenerInterface.java new file mode 100644 index 000000000..1d16029ef --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerListenerInterface.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2014, 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.List; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerListener; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerListenerCRUD; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.Listeners; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +public class NeutronLoadBalancerListenerInterface extends AbstractNeutronInterface implements INeutronLoadBalancerListenerCRUD { + + NeutronLoadBalancerListenerInterface(ProviderContext providerContext) { + super(providerContext); + } + + @Override + public boolean neutronLoadBalancerListenerExists(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + public NeutronLoadBalancerListener getNeutronLoadBalancerListener( + String uuid) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllNeutronLoadBalancerListeners() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean addNeutronLoadBalancerListener( + NeutronLoadBalancerListener input) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean removeNeutronLoadBalancerListener(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean updateNeutronLoadBalancerListener(String uuid, + NeutronLoadBalancerListener delta) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean neutronLoadBalancerListenerInUse(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + protected InstanceIdentifier createInstanceIdentifier( + Listeners item) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Listeners toMd(NeutronLoadBalancerListener neutronObject) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Listeners toMd(String uuid) { + // TODO Auto-generated method stub + return null; + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronLoadBalancerListenerInterface neutronLoadBalancerListenerInterface = new NeutronLoadBalancerListenerInterface(providerContext); + ServiceRegistration neutronLoadBalancerListenerInterfaceRegistration = context.registerService(INeutronLoadBalancerListenerCRUD.class, neutronLoadBalancerListenerInterface, null); + if(neutronLoadBalancerListenerInterfaceRegistration != null) { + registrations.add(neutronLoadBalancerListenerInterfaceRegistration); + } + } + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerPoolInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerPoolInterface.java new file mode 100644 index 000000000..adc1c3832 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerPoolInterface.java @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2014, 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud.impl; + +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.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer_SessionPersistence; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_ID; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerPoolCRUD; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolHttp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolHttps; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolTcp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.Pools; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.pools.Pool; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.pools.PoolBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.pool.attributes.SessionPersistenceBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.ImmutableBiMap; + +/** + * TODO: Migrate this to consume the MD-SAL data store, so that it can read all the data from data store. + * No need to worry about the write/update related methods here. OVSDB net-virt will use these CRUD Interface + * only for reading. We will cleanup these interface/methods later. + */ + +public class NeutronLoadBalancerPoolInterface extends AbstractNeutronInterface implements INeutronLoadBalancerPoolCRUD { + private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerPoolInterface.class); + private ConcurrentMap loadBalancerPoolDB = new ConcurrentHashMap(); + + private static final ImmutableBiMap,String> PROTOCOL_MAP + = new ImmutableBiMap.Builder,String>() + .put(ProtocolHttp.class,"HTTP") + .put(ProtocolHttps.class,"HTTPS") + .put(ProtocolTcp.class,"TCP") + .build(); + + NeutronLoadBalancerPoolInterface(ProviderContext providerContext) { + super(providerContext); + } + + @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.getID())) { + return false; + } + loadBalancerPoolDB.putIfAbsent(input.getID(), 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); + } + + @Override + protected Pool toMd(String uuid) { + PoolBuilder poolsBuilder = new PoolBuilder(); + poolsBuilder.setUuid(toUuid(uuid)); + return poolsBuilder.build(); + } + + @Override + protected InstanceIdentifier createInstanceIdentifier(Pool pools) { + return InstanceIdentifier.create(Neutron.class) + .child(Pools.class) + .child(Pool.class, pools.getKey()); + } + + @Override + protected Pool toMd(NeutronLoadBalancerPool pool) { + PoolBuilder poolBuilder = new PoolBuilder(); + poolBuilder.setAdminStateUp(pool.getLoadBalancerPoolAdminIsStateIsUp()); + if (pool.getLoadBalancerPoolDescription() != null) { + poolBuilder.setDescr(pool.getLoadBalancerPoolDescription()); + } + if (pool.getNeutronLoadBalancerPoolHealthMonitorID() != null) { + poolBuilder.setHealthmonitorId(toUuid(pool.getNeutronLoadBalancerPoolHealthMonitorID())); + } + if (pool.getLoadBalancerPoolLbAlgorithm() != null) { + poolBuilder.setLbAlgorithm(pool.getLoadBalancerPoolLbAlgorithm()); + } + if (pool.getLoadBalancerPoolListeners() != null) { + List listListener = new ArrayList(); + for (Neutron_ID neutron_id : pool.getLoadBalancerPoolListeners()) { + listListener.add(toUuid(neutron_id.getID())); + } + poolBuilder.setListeners(listListener); + } + // because members are another container, we don't want to copy + // it over, so just skip it here + if (pool.getLoadBalancerPoolName() != null) { + poolBuilder.setName(pool.getLoadBalancerPoolName()); + } + if (pool.getLoadBalancerPoolProtocol() != null) { + ImmutableBiMap> mapper = + PROTOCOL_MAP.inverse(); + poolBuilder.setProtocol((Class) mapper.get(pool.getLoadBalancerPoolProtocol())); + } + if (pool.getLoadBalancerPoolSessionPersistence() != null) { + NeutronLoadBalancer_SessionPersistence sessionPersistence = pool.getLoadBalancerPoolSessionPersistence(); + SessionPersistenceBuilder sessionPersistenceBuilder = new SessionPersistenceBuilder(); + sessionPersistenceBuilder.setCookieName(sessionPersistence.getCookieName()); + sessionPersistenceBuilder.setType(sessionPersistence.getType()); + poolBuilder.setSessionPersistence(sessionPersistenceBuilder.build()); + } + if (pool.getLoadBalancerPoolTenantID() != null) { + poolBuilder.setTenantId(toUuid(pool.getLoadBalancerPoolTenantID())); + } + if (pool.getID() != null) { + poolBuilder.setUuid(toUuid(pool.getID())); + } else { + LOGGER.warn("Attempting to write neutron load balancer pool without UUID"); + } + return poolBuilder.build(); + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronLoadBalancerPoolInterface neutronLoadBalancerPoolInterface = new NeutronLoadBalancerPoolInterface(providerContext); + ServiceRegistration neutronLoadBalancerPoolInterfaceRegistration = context.registerService(INeutronLoadBalancerPoolCRUD.class, neutronLoadBalancerPoolInterface, null); + if(neutronLoadBalancerPoolInterfaceRegistration != null) { + registrations.add(neutronLoadBalancerPoolInterfaceRegistration); + } + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerPoolMemberInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerPoolMemberInterface.java new file mode 100644 index 000000000..2e6aa92d4 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronLoadBalancerPoolMemberInterface.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2014, 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.List; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerPoolMemberCRUD; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.pools.pool.Members; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +public class NeutronLoadBalancerPoolMemberInterface extends + AbstractNeutronInterface implements INeutronLoadBalancerPoolMemberCRUD { + + NeutronLoadBalancerPoolMemberInterface(ProviderContext providerContext) { + super(providerContext); + } + + @Override + public boolean neutronLoadBalancerPoolMemberExists(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + public NeutronLoadBalancerPoolMember getNeutronLoadBalancerPoolMember( + String uuid) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAllNeutronLoadBalancerPoolMembers() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean addNeutronLoadBalancerPoolMember( + NeutronLoadBalancerPoolMember input) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean removeNeutronLoadBalancerPoolMember(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean updateNeutronLoadBalancerPoolMember(String uuid, + NeutronLoadBalancerPoolMember delta) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean neutronLoadBalancerPoolMemberInUse(String uuid) { + // TODO Auto-generated method stub + return false; + } + + @Override + protected InstanceIdentifier createInstanceIdentifier(Members item) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Members toMd(NeutronLoadBalancerPoolMember neutronObject) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Members toMd(String uuid) { + // TODO Auto-generated method stub + return null; + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronLoadBalancerPoolMemberInterface neutronLoadBalancerPoolMemberInterface = new NeutronLoadBalancerPoolMemberInterface(providerContext); + ServiceRegistration neutronLoadBalancerPoolMemberInterfaceRegistration = context.registerService(INeutronLoadBalancerPoolMemberCRUD.class, neutronLoadBalancerPoolMemberInterface, null); + if(neutronLoadBalancerPoolMemberInterfaceRegistration != null) { + registrations.add(neutronLoadBalancerPoolMemberInterfaceRegistration); + } + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronNetworkInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronNetworkInterface.java new file mode 100644 index 000000000..03e38ebe0 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronNetworkInterface.java @@ -0,0 +1,279 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork_Segment; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.ext.rev150712.NetworkL3Extension; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.ext.rev150712.NetworkL3ExtensionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeFlat; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeGre; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeVlan; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeVxlan; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.Networks; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.NetworkBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.NetworkProviderExtension; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.NetworkProviderExtensionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.neutron.networks.network.Segments; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.neutron.networks.network.SegmentsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.ImmutableBiMap; + +public class NeutronNetworkInterface extends AbstractNeutronInterface implements INeutronNetworkCRUD { + private static final Logger LOGGER = LoggerFactory.getLogger(NeutronNetworkInterface.class); + + private static final ImmutableBiMap,String> NETWORK_MAP + = new ImmutableBiMap.Builder,String>() + .put(NetworkTypeFlat.class,"flat") + .put(NetworkTypeGre.class,"gre") + .put(NetworkTypeVlan.class,"vlan") + .put(NetworkTypeVxlan.class,"vxlan") + .build(); + + NeutronNetworkInterface(ProviderContext providerContext) { + super(providerContext); + } + + // IfNBNetworkCRUD methods + + @Override + public boolean networkExists(String uuid) { + Network network = readMd(createInstanceIdentifier(toMd(uuid))); + if (network == null) { + return false; + } + return true; + } + + @Override + public NeutronNetwork getNetwork(String uuid) { + Network network = readMd(createInstanceIdentifier(toMd(uuid))); + if (network == null) { + return null; + } + return fromMd(network); + } + + @Override + public List getAllNetworks() { + Set allNetworks = new HashSet(); + Networks networks = readMd(createInstanceIdentifier()); + if (networks != null) { + for (Network network: networks.getNetwork()) { + allNetworks.add(fromMd(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; + } + addMd(input); + return true; + } + + @Override + public boolean removeNetwork(String uuid) { + if (!networkExists(uuid)) { + return false; + } + return removeMd(toMd(uuid)); + } + + @Override + public boolean updateNetwork(String uuid, NeutronNetwork delta) { + if (!networkExists(uuid)) { + return false; + } +/* note: because what we get is *not* a delta but (at this point) the updated + * object, this is much simpler - just replace the value and update the mdsal + * with it */ + updateMd(delta); + return true; + } + + @Override + public boolean networkInUse(String netUUID) { + if (!networkExists(netUUID)) { + return true; + } + return false; + } + + protected NeutronNetwork fromMd(Network network) { + NeutronNetwork result = new NeutronNetwork(); + result.setAdminStateUp(network.isAdminStateUp()); + result.setNetworkName(network.getName()); + result.setShared(network.isShared()); + result.setStatus(network.getStatus()); + if (network.getSubnets() != null) { + List neutronSubnets = new ArrayList(); + for( Uuid subnet : network.getSubnets()) { + neutronSubnets.add(subnet.getValue()); + } + result.setSubnets(neutronSubnets); + } +// todo remove '-' chars as tenant id doesn't use them + result.setTenantID(network.getTenantId().getValue()); + result.setID(network.getUuid().getValue()); + + NetworkL3Extension l3Extension = network.getAugmentation(NetworkL3Extension.class); + result.setRouterExternal(l3Extension.isExternal()); + + NetworkProviderExtension providerExtension = network.getAugmentation(NetworkProviderExtension.class); + result.setProviderPhysicalNetwork(providerExtension.getPhysicalNetwork()); + result.setProviderSegmentationID(providerExtension.getSegmentationId()); + result.setProviderNetworkType(NETWORK_MAP.get(providerExtension.getNetworkType())); + List segments = new ArrayList(); + if (providerExtension.getSegments() != null) { + for (Segments segment: providerExtension.getSegments()) { + NeutronNetwork_Segment neutronSegment = new NeutronNetwork_Segment(); + neutronSegment.setProviderPhysicalNetwork(segment.getPhysicalNetwork()); + neutronSegment.setProviderSegmentationID(segment.getSegmentationId()); + neutronSegment.setProviderNetworkType(NETWORK_MAP.get(segment.getNetworkType())); + segments.add(neutronSegment); + } + } + result.setSegments(segments); + return result; + } + + private void fillExtensions(NetworkBuilder networkBuilder, + NeutronNetwork network) { + NetworkL3ExtensionBuilder l3ExtensionBuilder = new NetworkL3ExtensionBuilder(); + if (network.getRouterExternal() != null) { + l3ExtensionBuilder.setExternal(network.getRouterExternal()); + } + + NetworkProviderExtensionBuilder providerExtensionBuilder = new NetworkProviderExtensionBuilder(); + if (network.getProviderPhysicalNetwork() != null) { + providerExtensionBuilder.setPhysicalNetwork(network.getProviderPhysicalNetwork()); + } + if (network.getProviderSegmentationID() != null) { + providerExtensionBuilder.setSegmentationId(network.getProviderSegmentationID()); + } + if (network.getProviderNetworkType() != null) { + ImmutableBiMap> mapper = + NETWORK_MAP.inverse(); + providerExtensionBuilder.setNetworkType((Class) mapper.get(network.getProviderNetworkType())); + } + if (network.getSegments() != null) { + List segments = new ArrayList(); + long count = 0; + for( NeutronNetwork_Segment segment : network.getSegments()) { + count++; + SegmentsBuilder segmentsBuilder = new SegmentsBuilder(); + if (segment.getProviderPhysicalNetwork() != null) { + segmentsBuilder.setPhysicalNetwork(segment.getProviderPhysicalNetwork()); + } + if (segment.getProviderSegmentationID() != null) { + segmentsBuilder.setSegmentationId(segment.getProviderSegmentationID()); + } + if (segment.getProviderNetworkType() != null) { + ImmutableBiMap> mapper = + NETWORK_MAP.inverse(); + segmentsBuilder.setNetworkType((Class) mapper.get(segment.getProviderNetworkType())); + } + segmentsBuilder.setSegmentationIndex(Long.valueOf(count)); + segments.add(segmentsBuilder.build()); + } + providerExtensionBuilder.setSegments(segments); + } + if (network.getProviderSegmentationID() != null) { + providerExtensionBuilder.setSegmentationId(network.getProviderSegmentationID()); + } + + networkBuilder.addAugmentation(NetworkL3Extension.class, + l3ExtensionBuilder.build()); + networkBuilder.addAugmentation(NetworkProviderExtension.class, + providerExtensionBuilder.build()); + } + + protected Network toMd(NeutronNetwork network) { + NetworkBuilder networkBuilder = new NetworkBuilder(); + fillExtensions(networkBuilder, network); + + networkBuilder.setAdminStateUp(network.getAdminStateUp()); + if (network.getNetworkName() != null) { + networkBuilder.setName(network.getNetworkName()); + } + if (network.getShared() != null) { + networkBuilder.setShared(network.getShared()); + } + if (network.getStatus() != null) { + networkBuilder.setStatus(network.getStatus()); + } + if (network.getSubnets() != null) { + List subnets = new ArrayList(); + for( String subnet : network.getSubnets()) { + subnets.add(toUuid(subnet)); + } + networkBuilder.setSubnets(subnets); + } + if (network.getTenantID() != null) { + networkBuilder.setTenantId(toUuid(network.getTenantID())); + } + if (network.getNetworkUUID() != null) { + networkBuilder.setUuid(toUuid(network.getNetworkUUID())); + } else { + LOGGER.warn("Attempting to write neutron network without UUID"); + } + return networkBuilder.build(); + } + + protected Network toMd(String uuid) { + NetworkBuilder networkBuilder = new NetworkBuilder(); + networkBuilder.setUuid(toUuid(uuid)); + return networkBuilder.build(); + } + + @Override + protected InstanceIdentifier createInstanceIdentifier(Network network) { + return InstanceIdentifier.create(Neutron.class) + .child(Networks.class) + .child(Network.class,network.getKey()); + } + + protected InstanceIdentifier createInstanceIdentifier() { + return InstanceIdentifier.create(Neutron.class) + .child(Networks.class); + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronNetworkInterface neutronNetworkInterface = new NeutronNetworkInterface(providerContext); + ServiceRegistration neutronNetworkInterfaceRegistration = context.registerService(INeutronNetworkCRUD.class, neutronNetworkInterface, null); + if(neutronNetworkInterfaceRegistration != null) { + registrations.add(neutronNetworkInterfaceRegistration); + } + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronPortInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronPortInterface.java new file mode 100644 index 000000000..c1ab92784 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronPortInterface.java @@ -0,0 +1,327 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort_AllowedAddressPairs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort_ExtraDHCPOption; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort_VIFDetail; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSecurityGroupCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.NeutronCRUDInterfaces; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtensionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.binding.attributes.VifDetails; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.binding.attributes.VifDetailsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.AllowedAddressPairs; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.AllowedAddressPairsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.ExtraDhcpOpts; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.ExtraDhcpOptsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIpsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.Ports; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NeutronPortInterface extends AbstractNeutronInterface implements INeutronPortCRUD { + private static final Logger LOGGER = LoggerFactory.getLogger(NeutronPortInterface.class); + + NeutronPortInterface(ProviderContext providerContext) { + super(providerContext); + } + + // IfNBPortCRUD methods + + @Override + public boolean portExists(String uuid) { + Port port = readMd(createInstanceIdentifier(toMd(uuid))); + return port != null; + } + + @Override + public NeutronPort getPort(String uuid) { + Port port = readMd(createInstanceIdentifier(toMd(uuid))); + if (port == null) { + return null; + } + return fromMd(port); + } + + @Override + public List getAllPorts() { + Set allPorts = new HashSet(); + Ports ports = readMd(createInstanceIdentifier()); + if (ports != null) { + for (Port port : ports.getPort()) { + allPorts.add(fromMd(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; + } + addMd(input); + return true; + } + + @Override + public boolean removePort(String uuid) { + if (!portExists(uuid)) { + return false; + } + return removeMd(toMd(uuid)); + } + + @Override + public boolean updatePort(String uuid, NeutronPort delta) { + if (!portExists(uuid)) { + return false; + } + updateMd(delta); + return true; + } + + // @deprecated, will be removed in Boron + @Override + public boolean macInUse(String macAddress) { + return false; + } + + // @deprecated, will be removed in Boron + @Override + public NeutronPort getGatewayPort(String subnetUUID) { + return null; + } + + @Override + protected InstanceIdentifier createInstanceIdentifier(Port port) { + return InstanceIdentifier.create(Neutron.class) + .child(Ports.class) + .child(Port.class, port.getKey()); + } + + protected InstanceIdentifier createInstanceIdentifier() { + return InstanceIdentifier.create(Neutron.class) + .child(Ports.class); + } + + protected void addExtensions(Port port, NeutronPort result) { + PortBindingExtension binding = port.getAugmentation(PortBindingExtension.class); + result.setBindinghostID(binding.getHostId()); + if (binding.getVifDetails() != null) { + List details = new ArrayList(); + for (VifDetails vifDetail : binding.getVifDetails()) { + NeutronPort_VIFDetail detail = new NeutronPort_VIFDetail(); + detail.setPortFilter(vifDetail.isPortFilter()); + detail.setOvsHybridPlug(vifDetail.isOvsHybridPlug()); + details.add(detail); + } + result.setVIFDetail(details); + } + result.setBindingvifType(binding.getVifType()); + result.setBindingvnicType(binding.getVnicType()); + } + + protected NeutronPort fromMd(Port port) { + NeutronPort result = new NeutronPort(); + result.setAdminStateUp(port.isAdminStateUp()); + if (port.getAllowedAddressPairs() != null) { + List pairs = new ArrayList(); + for (AllowedAddressPairs mdPair : port.getAllowedAddressPairs()) { + NeutronPort_AllowedAddressPairs pair = new NeutronPort_AllowedAddressPairs(); + pair.setIpAddress(mdPair.getIpAddress()); + pair.setMacAddress(mdPair.getMacAddress()); + pair.setPortID(mdPair.getPortId()); + pairs.add(pair); + } + result.setAllowedAddressPairs(pairs); + } + result.setDeviceID(port.getDeviceId()); + result.setDeviceOwner(port.getDeviceOwner()); + if (port.getExtraDhcpOpts() != null) { + List options = new ArrayList(); + for (ExtraDhcpOpts opt : port.getExtraDhcpOpts()) { + NeutronPort_ExtraDHCPOption arg = new NeutronPort_ExtraDHCPOption(); + arg.setName(opt.getOptName()); + arg.setValue(opt.getOptValue()); + options.add(arg); + } + result.setExtraDHCPOptions(options); + } + if (port.getFixedIps() != null) { + List ips = new ArrayList(); + for (FixedIps mdIP : port.getFixedIps()) { + Neutron_IPs ip = new Neutron_IPs(); + ip.setIpAddress(String.valueOf(mdIP.getIpAddress().getValue())); + ip.setSubnetUUID(mdIP.getSubnetId().getValue()); + ips.add(ip); + } + result.setFixedIPs(ips); + } + result.setMacAddress(port.getMacAddress()); + result.setName(port.getName()); + result.setNetworkUUID(String.valueOf(port.getNetworkId().getValue())); + if (port.getSecurityGroups() != null) { + Set allGroups = new HashSet(); + NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces().fetchINeutronSecurityGroupCRUD(this); + INeutronSecurityGroupCRUD sgIf = interfaces.getSecurityGroupInterface(); + for (Uuid sgUuid : port.getSecurityGroups()) { + allGroups.add(sgIf.getNeutronSecurityGroup(sgUuid.getValue())); + } + List groups = new ArrayList(); + groups.addAll(allGroups); + result.setSecurityGroups(groups); + } + result.setStatus(port.getStatus()); + if (port.getTenantId() != null) { + result.setTenantID(String.valueOf(port.getTenantId().getValue()).replace("-", "")); + } + result.setPortUUID(String.valueOf(port.getUuid().getValue())); + addExtensions(port, result); + return result; + } + + @Override + protected Port toMd(NeutronPort neutronPort) { + PortBindingExtensionBuilder bindingBuilder = new PortBindingExtensionBuilder(); + if (neutronPort.getBindinghostID() != null) { + bindingBuilder.setHostId(neutronPort.getBindinghostID()); + } + if (neutronPort.getVIFDetail() != null) { + List listVifDetail = new ArrayList(); + for (NeutronPort_VIFDetail detail: neutronPort.getVIFDetail()) { + VifDetailsBuilder vifDetailsBuilder = new VifDetailsBuilder(); + if (detail.getPortFilter() != null) { + vifDetailsBuilder.setPortFilter(detail.getPortFilter()); + } + if (detail.getOvsHybridPlug() != null) { + vifDetailsBuilder.setOvsHybridPlug(detail.getOvsHybridPlug()); + } + listVifDetail.add(vifDetailsBuilder.build()); + } + bindingBuilder.setVifDetails(listVifDetail); + } + if (neutronPort.getBindingvifType() != null) { + bindingBuilder.setVifType(neutronPort.getBindingvifType()); + } + if (neutronPort.getBindingvnicType() != null) { + bindingBuilder.setVnicType(neutronPort.getBindingvnicType()); + } + + PortBuilder portBuilder = new PortBuilder(); + portBuilder.addAugmentation(PortBindingExtension.class, + bindingBuilder.build()); + portBuilder.setAdminStateUp(neutronPort.isAdminStateUp()); + if(neutronPort.getAllowedAddressPairs() != null) { + List listAllowedAddressPairs = new ArrayList(); + for (NeutronPort_AllowedAddressPairs allowedAddressPairs : neutronPort.getAllowedAddressPairs()) { + AllowedAddressPairsBuilder allowedAddressPairsBuilder = new AllowedAddressPairsBuilder(); + allowedAddressPairsBuilder.setIpAddress(allowedAddressPairs.getIpAddress()); + allowedAddressPairsBuilder.setMacAddress(allowedAddressPairs.getMacAddress()); + allowedAddressPairsBuilder.setPortId(allowedAddressPairs.getPortID()); + listAllowedAddressPairs.add(allowedAddressPairsBuilder.build()); + } + portBuilder.setAllowedAddressPairs(listAllowedAddressPairs); + } + if (neutronPort.getDeviceID() != null) { + portBuilder.setDeviceId(neutronPort.getDeviceID()); + } + if (neutronPort.getDeviceOwner() != null) { + portBuilder.setDeviceOwner(neutronPort.getDeviceOwner()); + } + if (neutronPort.getExtraDHCPOptions() != null) { + List listExtraDHCPOptions = new ArrayList(); + for (NeutronPort_ExtraDHCPOption extraDHCPOption : neutronPort.getExtraDHCPOptions()) { + ExtraDhcpOptsBuilder extraDHCPOptsBuilder = new ExtraDhcpOptsBuilder(); + extraDHCPOptsBuilder.setOptName(extraDHCPOption.getName()); + extraDHCPOptsBuilder.setOptValue(extraDHCPOption.getValue()); + listExtraDHCPOptions.add(extraDHCPOptsBuilder.build()); + } + portBuilder.setExtraDhcpOpts(listExtraDHCPOptions); + } + if (neutronPort.getFixedIPs() != null) { + List listNeutronIPs = new ArrayList(); + for (Neutron_IPs neutron_IPs : neutronPort.getFixedIPs()) { + FixedIpsBuilder fixedIpsBuilder = new FixedIpsBuilder(); + fixedIpsBuilder.setIpAddress(new IpAddress(neutron_IPs.getIpAddress().toCharArray())); + fixedIpsBuilder.setSubnetId(toUuid(neutron_IPs.getSubnetUUID())); + listNeutronIPs.add(fixedIpsBuilder.build()); + } + portBuilder.setFixedIps(listNeutronIPs); + } + if (neutronPort.getMacAddress() != null) { + portBuilder.setMacAddress(neutronPort.getMacAddress()); + } + if (neutronPort.getName() != null) { + portBuilder.setName(neutronPort.getName()); + } + if (neutronPort.getNetworkUUID() != null) { + portBuilder.setNetworkId(toUuid(neutronPort.getNetworkUUID())); + } + if (neutronPort.getSecurityGroups() != null) { + List listSecurityGroups = new ArrayList(); + for (NeutronSecurityGroup neutronSecurityGroup : neutronPort.getSecurityGroups()) { + listSecurityGroups.add(toUuid(neutronSecurityGroup.getID())); + } + portBuilder.setSecurityGroups(listSecurityGroups); + } + if (neutronPort.getStatus() != null) { + portBuilder.setStatus(neutronPort.getStatus()); + } + if (neutronPort.getTenantID() != null) { + portBuilder.setTenantId(toUuid(neutronPort.getTenantID())); + } + if (neutronPort.getPortUUID() != null) { + portBuilder.setUuid(toUuid(neutronPort.getPortUUID())); + } else { + LOGGER.warn("Attempting to write neutron port without UUID"); + } + return portBuilder.build(); + } + + @Override + protected Port toMd(String uuid) { + PortBuilder portBuilder = new PortBuilder(); + portBuilder.setUuid(toUuid(uuid)); + return portBuilder.build(); + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronPortInterface neutronPortInterface = new NeutronPortInterface(providerContext); + ServiceRegistration neutronPortInterfaceRegistration = context.registerService(INeutronPortCRUD.class, neutronPortInterface, null); + if(neutronPortInterfaceRegistration != null) { + registrations.add(neutronPortInterfaceRegistration); + } + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronRouterInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronRouterInterface.java new file mode 100644 index 000000000..a1ab29329 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronRouterInterface.java @@ -0,0 +1,264 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter_Interface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter_NetworkReference; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronRouterCRUD; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.Routers; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.Router; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.RouterBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.ExternalGatewayInfo; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.ExternalGatewayInfoBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.Interfaces; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.external_gateway_info.ExternalFixedIps; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.external_gateway_info.ExternalFixedIpsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NeutronRouterInterface extends AbstractNeutronInterface implements INeutronRouterCRUD { + private static final Logger LOGGER = LoggerFactory.getLogger(NeutronRouterInterface.class); + // methods needed for creating caches + + + NeutronRouterInterface(ProviderContext providerContext) { + super(providerContext); + } + + + // IfNBRouterCRUD Interface methods + + @Override + public boolean routerExists(String uuid) { + Router router = readMd(createInstanceIdentifier(toMd(uuid))); + return router != null; + } + + @Override + public NeutronRouter getRouter(String uuid) { + Router router = readMd(createInstanceIdentifier(toMd(uuid))); + if (router == null) { + return null; + } + return fromMd(router); + } + + @Override + public List getAllRouters() { + Set allRouters = new HashSet(); + Routers routers = readMd(createInstanceIdentifier()); + if (routers != null) { + for (Router router: routers.getRouter()) { + allRouters.add(fromMd(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; + } + addMd(input); + return true; + } + + @Override + public boolean removeRouter(String uuid) { + if (!routerExists(uuid)) { + return false; + } + return removeMd(toMd(uuid)); + } + + @Override + public boolean updateRouter(String uuid, NeutronRouter delta) { + if (!routerExists(uuid)) { + return false; + } + updateMd(delta); + return true; + } + + @Override + public boolean routerInUse(String routerUUID) { + if (!routerExists(routerUUID)) { + return true; + } + NeutronRouter target = getRouter(routerUUID); + return (target.getInterfaces().size() > 0); + } + + @Override + protected Router toMd(NeutronRouter router) { + + RouterBuilder routerBuilder = new RouterBuilder(); + + if (router.getRouterUUID() != null) { + routerBuilder.setUuid(toUuid(router.getRouterUUID())); + } + if (router.getName() != null) { + routerBuilder.setName(router.getName()); + } + if (router.getTenantID() != null && !router.getTenantID().isEmpty()) { + routerBuilder.setTenantId(toUuid(router.getTenantID())); + } + if (router.getStatus() != null) { + routerBuilder.setStatus(router.getStatus()); + } + if (router.getGatewayPortId() != null && !router.getGatewayPortId().isEmpty()) { + routerBuilder.setGatewayPortId(toUuid(router.getGatewayPortId())); + } + routerBuilder.setAdminStateUp(router.getAdminStateUp()); + routerBuilder.setDistributed(router.getDistributed()); + if (router.getRoutes() != null) { + List routes = new ArrayList(); + for (String route : router.getRoutes()) { + routes.add(route); + } + routerBuilder.setRoutes(routes); + } + if (router.getExternalGatewayInfo() != null) { + ExternalGatewayInfo externalGatewayInfo = null; + List neutronRouter_NetworkReferences = new ArrayList(); + neutronRouter_NetworkReferences.add(router.getExternalGatewayInfo()); + for (NeutronRouter_NetworkReference externalGatewayInfos : neutronRouter_NetworkReferences) { + ExternalGatewayInfoBuilder builder = new ExternalGatewayInfoBuilder(); + builder.setEnableSnat(externalGatewayInfos.getEnableSNAT()); + builder.setExternalNetworkId(toUuid(externalGatewayInfos.getNetworkID())); + if (externalGatewayInfos.getExternalFixedIPs() != null) { + List externalFixedIps = new ArrayList(); + for (Neutron_IPs eIP : externalGatewayInfos.getExternalFixedIPs()) { + ExternalFixedIpsBuilder eFixedIpBuilder = new ExternalFixedIpsBuilder(); + eFixedIpBuilder.setIpAddress(new IpAddress(eIP.getIpAddress().toCharArray())); + eFixedIpBuilder.setSubnetId(toUuid(eIP.getSubnetUUID())); + externalFixedIps.add(eFixedIpBuilder.build()); + } + builder.setExternalFixedIps(externalFixedIps); + } + externalGatewayInfo = builder.build(); + } + routerBuilder.setExternalGatewayInfo(externalGatewayInfo); + } + if (router.getInterfaces() != null) { + Map mapInterfaces = new HashMap(); + List interfaces = new ArrayList(); + for (Entry entry : mapInterfaces.entrySet()) { + interfaces.add((Interfaces) entry.getValue()); + } + routerBuilder.setInterfaces(interfaces); + } + if (router.getID() != null) { + routerBuilder.setUuid(toUuid(router.getID())); + } else { + LOGGER.warn("Attempting to write neutron router without UUID"); + } + return routerBuilder.build(); + } + + @Override + protected InstanceIdentifier createInstanceIdentifier(Router router) { + return InstanceIdentifier.create(Neutron.class) + .child(Routers.class) + .child(Router.class, router.getKey()); + } + + protected InstanceIdentifier createInstanceIdentifier() { + return InstanceIdentifier.create(Neutron.class).child(Routers.class); + } + + @Override + protected Router toMd(String uuid) { + RouterBuilder routerBuilder = new RouterBuilder(); + routerBuilder.setUuid(toUuid(uuid)); + return routerBuilder.build(); + } + + public NeutronRouter fromMd(Router router) { + NeutronRouter result = new NeutronRouter(); + result.setID(String.valueOf(router.getUuid().getValue())); + result.setName(router.getName()); + result.setTenantID(String.valueOf(router.getTenantId().getValue())); + result.setAdminStateUp(router.isAdminStateUp()); + result.setStatus(router.getStatus()); + result.setDistributed(router.isDistributed()); + if (router.getGatewayPortId() != null) { + result.setGatewayPortId(String.valueOf(router.getGatewayPortId().getValue())); + } + if (router.getRoutes() != null) { + List routes = new ArrayList(); + for (String route : router.getRoutes()) { + routes.add(route); + } + result.setRoutes(routes); + } + + if (router.getExternalGatewayInfo() != null) { + NeutronRouter_NetworkReference extGwInfo = new NeutronRouter_NetworkReference(); + extGwInfo.setNetworkID(String.valueOf(router.getExternalGatewayInfo().getExternalNetworkId().getValue())); + extGwInfo.setEnableSNAT(router.getExternalGatewayInfo().isEnableSnat()); + if (router.getExternalGatewayInfo().getExternalFixedIps() != null) { + List fixedIPs = new ArrayList(); + for (ExternalFixedIps mdFixedIP : router.getExternalGatewayInfo().getExternalFixedIps()) { + Neutron_IPs fixedIP = new Neutron_IPs(); + fixedIP.setSubnetUUID(String.valueOf(mdFixedIP.getSubnetId().getValue())); + fixedIP.setIpAddress(String.valueOf(mdFixedIP.getIpAddress().getValue())); + fixedIPs.add(fixedIP); + } + extGwInfo.setExternalFixedIPs(fixedIPs); + } + result.setExternalGatewayInfo(extGwInfo); + } + + if (router.getInterfaces() != null) { + Map interfaces = new HashMap(); + for (Interfaces mdInterface : router.getInterfaces()) { + NeutronRouter_Interface pojoInterface = new NeutronRouter_Interface(); + String id = String.valueOf(mdInterface.getUuid().getValue()); + pojoInterface.setID(id); + pojoInterface.setTenantID(String.valueOf(mdInterface.getTenantId().getValue())); + pojoInterface.setSubnetUUID(String.valueOf(mdInterface.getSubnetId().getValue())); + pojoInterface.setPortUUID(String.valueOf(mdInterface.getPortId().getValue())); + interfaces.put(id, pojoInterface); + } + result.setInterfaces(interfaces); + } + return result; + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronRouterInterface neutronRouterInterface = new NeutronRouterInterface(providerContext); + ServiceRegistration neutronRouterInterfaceRegistration = context.registerService(INeutronRouterCRUD.class, neutronRouterInterface, null); + if(neutronRouterInterfaceRegistration != null) { + registrations.add(neutronRouterInterfaceRegistration); + } + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronSecurityGroupInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronSecurityGroupInterface.java new file mode 100644 index 000000000..c30dd5c49 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronSecurityGroupInterface.java @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2014, 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSecurityGroupCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSecurityRuleCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.NeutronCRUDInterfaces; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.SecurityGroups; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.security.groups.SecurityGroup; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.security.groups.SecurityGroupBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class NeutronSecurityGroupInterface extends AbstractNeutronInterface implements INeutronSecurityGroupCRUD { + + private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSecurityGroupInterface.class); + + NeutronSecurityGroupInterface(ProviderContext providerContext) { + super(providerContext); + } + + @Override + public boolean neutronSecurityGroupExists(String uuid) { + SecurityGroup group = readMd(createInstanceIdentifier(toMd(uuid))); + if (group == null) { + return false; + } + return true; + } + + @Override + public NeutronSecurityGroup getNeutronSecurityGroup(String uuid) { + SecurityGroup group = readMd(createInstanceIdentifier(toMd(uuid))); + if (group == null) { + return null; + } + return fromMd(group); + } + + @Override + public List getAllNeutronSecurityGroups() { + Set allSecurityGroups = new HashSet(); + SecurityGroups groups = readMd(createInstanceIdentifier()); + if (groups != null) { + for (SecurityGroup group: groups.getSecurityGroup()) { + allSecurityGroups.add(fromMd(group)); + } + } + 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.getID())) { + return false; + } + addMd(input); + return true; + } + + @Override + public boolean removeNeutronSecurityGroup(String uuid) { + if (!neutronSecurityGroupExists(uuid)) { + return false; + } + removeMd(toMd(uuid)); + return true; + } + + @Override + public boolean updateNeutronSecurityGroup(String uuid, NeutronSecurityGroup delta) { + if (!neutronSecurityGroupExists(uuid)) { + return false; + } + updateMd(delta); + return true; + } + + @Override + public boolean neutronSecurityGroupInUse(String securityGroupUUID) { + return !neutronSecurityGroupExists(securityGroupUUID); + } + + protected NeutronSecurityGroup fromMd(SecurityGroup group) { + NeutronSecurityGroup answer = new NeutronSecurityGroup(); + if (group.getName() != null) { + answer.setSecurityGroupName(group.getName()); + } + if (group.getDescription() != null) { + answer.setSecurityGroupDescription(group.getDescription()); + } + if (group.getTenantId() != null) { + answer.setSecurityGroupTenantID(group.getTenantId().getValue().replace("-","")); + } + if (group.getSecurityRules() != null) { + NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces() + .fetchINeutronSecurityRuleCRUD(this); + INeutronSecurityRuleCRUD srCrud = interfaces.getSecurityRuleInterface(); + + List rules = new ArrayList(); + for (Uuid uuid: group.getSecurityRules()) { + rules.add(srCrud.getNeutronSecurityRule(uuid.getValue())); + } + answer.setSecurityRules(rules); + } + if (group.getUuid() != null) { + answer.setID(group.getUuid().getValue()); + } + return answer; + } + + @Override + protected SecurityGroup toMd(NeutronSecurityGroup securityGroup) { + SecurityGroupBuilder securityGroupBuilder = new SecurityGroupBuilder(); + if (securityGroup.getSecurityGroupName() != null) { + securityGroupBuilder.setName(securityGroup.getSecurityGroupName()); + } + if (securityGroup.getSecurityGroupDescription() != null) { + securityGroupBuilder.setDescription(securityGroup.getSecurityGroupDescription()); + } + if (securityGroup.getSecurityGroupTenantID() != null) { + securityGroupBuilder.setTenantId(toUuid(securityGroup.getSecurityGroupTenantID())); + } + if (securityGroup.getSecurityRules() != null) { + List neutronSecurityRule = new ArrayList(); + for (NeutronSecurityRule securityRule : securityGroup.getSecurityRules()) { + if (securityRule.getID() != null) { + neutronSecurityRule.add(toUuid(securityRule.getID())); + } + } + securityGroupBuilder.setSecurityRules(neutronSecurityRule); + } + if (securityGroup.getID() != null) { + securityGroupBuilder.setUuid(toUuid(securityGroup.getID())); + } else { + LOGGER.warn("Attempting to write neutron securityGroup without UUID"); + } + + return securityGroupBuilder.build(); + } + + @Override + protected InstanceIdentifier createInstanceIdentifier(SecurityGroup securityGroup) { + return InstanceIdentifier.create(Neutron.class) + .child(SecurityGroups.class).child(SecurityGroup.class, + securityGroup.getKey()); + } + + protected InstanceIdentifier createInstanceIdentifier() { + return InstanceIdentifier.create(Neutron.class) + .child(SecurityGroups.class); + } + + @Override + protected SecurityGroup toMd(String uuid) { + SecurityGroupBuilder securityGroupBuilder = new SecurityGroupBuilder(); + securityGroupBuilder.setUuid(toUuid(uuid)); + return securityGroupBuilder.build(); + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronSecurityGroupInterface neutronSecurityGroupInterface = new NeutronSecurityGroupInterface(providerContext); + ServiceRegistration neutronSecurityGroupInterfaceRegistration = context.registerService(INeutronSecurityGroupCRUD.class, neutronSecurityGroupInterface, null); + if(neutronSecurityGroupInterfaceRegistration != null) { + registrations.add(neutronSecurityGroupInterfaceRegistration); + } + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronSecurityRuleInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronSecurityRuleInterface.java new file mode 100644 index 000000000..cfcc9cd8a --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronSecurityRuleInterface.java @@ -0,0 +1,284 @@ +/* + * Copyright (c) 2014, 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSecurityGroupCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSecurityRuleCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.NeutronCRUDInterfaces; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.DirectionBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.DirectionEgress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.DirectionIngress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeV4; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeV6; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolIcmp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolIcmpV6; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolTcp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolUdp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.SecurityRules; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRule; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRuleBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.ImmutableBiMap; + + +public class NeutronSecurityRuleInterface extends AbstractNeutronInterface implements INeutronSecurityRuleCRUD { + + private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSecurityRuleInterface.class); + + private static final ImmutableBiMap,String> DIRECTION_MAP + = new ImmutableBiMap.Builder,String>() + .put(DirectionEgress.class,"egress") + .put(DirectionIngress.class,"ingress") + .build(); + private static final ImmutableBiMap,String> PROTOCOL_MAP + = new ImmutableBiMap.Builder,String>() + .put(ProtocolIcmp.class,"icmp") + .put(ProtocolTcp.class,"tcp") + .put(ProtocolUdp.class,"udp") + .put(ProtocolIcmpV6.class,"icmpv6") + .build(); + private static final ImmutableBiMap,String> ETHERTYPE_MAP + = new ImmutableBiMap.Builder,String>() + .put(EthertypeV4.class,"IPv4") + .put(EthertypeV6.class,"IPv6") + .build(); + + NeutronSecurityRuleInterface(ProviderContext providerContext) { + super(providerContext); + } + + private void updateSecGroupRuleInSecurityGroup(NeutronSecurityRule input) { + NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces() + .fetchINeutronSecurityGroupCRUD(this); + INeutronSecurityGroupCRUD sgCrud = interfaces.getSecurityGroupInterface(); + NeutronSecurityGroup sg = sgCrud.getNeutronSecurityGroup(input.getSecurityRuleGroupID()); + if(sg != null && sg.getSecurityRules() != null) { + for(NeutronSecurityRule sgr :sg.getSecurityRules()) { + if(sgr != null && sgr.getID() != null && sgr.getID().equals(input.getID())) { + int index = sg.getSecurityRules().indexOf(sgr); + sg.getSecurityRules().set(index, input); + } + } + } + if (sg != null) { + sg.getSecurityRules().add(input); + } + } + + private void removeSecGroupRuleFromSecurityGroup(NeutronSecurityRule input) { + NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces() + .fetchINeutronSecurityGroupCRUD(this); + INeutronSecurityGroupCRUD sgCrud = interfaces.getSecurityGroupInterface(); + NeutronSecurityGroup sg = sgCrud.getNeutronSecurityGroup(input.getSecurityRuleGroupID()); + if(sg != null && sg.getSecurityRules() != null) { + List toRemove = new ArrayList(); + for(NeutronSecurityRule sgr :sg.getSecurityRules()) { + if(sgr.getID() != null && sgr.getID().equals(input.getID())) { + toRemove.add(sgr); + } + } + sg.getSecurityRules().removeAll(toRemove); + } + } + + @Override + public boolean neutronSecurityRuleExists(String uuid) { + SecurityRule rule = readMd(createInstanceIdentifier(toMd(uuid))); + if (rule == null) { + return false; + } + return true; + } + + @Override + public NeutronSecurityRule getNeutronSecurityRule(String uuid) { + SecurityRule rule = readMd(createInstanceIdentifier(toMd(uuid))); + if (rule == null) { + return null; + } + return fromMd(rule); + } + + @Override + public List getAllNeutronSecurityRules() { + Set allSecurityRules = new HashSet(); + SecurityRules rules = readMd(createInstanceIdentifier()); + if (rules != null) { + for (SecurityRule rule: rules.getSecurityRule()) { + allSecurityRules.add(fromMd(rule)); + } + } + 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.getID())) { + return false; + } + updateSecGroupRuleInSecurityGroup(input); + addMd(input); + return true; + } + + @Override + public boolean removeNeutronSecurityRule(String uuid) { + if (!neutronSecurityRuleExists(uuid)) { + return false; + } + removeSecGroupRuleFromSecurityGroup(getNeutronSecurityRule(uuid)); + removeMd(toMd(uuid)); + return true; + } + + @Override + public boolean updateNeutronSecurityRule(String uuid, NeutronSecurityRule delta) { + if (!neutronSecurityRuleExists(uuid)) { + return false; + } + updateSecGroupRuleInSecurityGroup(delta); + updateMd(delta); + return true; + } + + @Override + public boolean neutronSecurityRuleInUse(String securityRuleUUID) { + return !neutronSecurityRuleExists(securityRuleUUID); + } + + protected NeutronSecurityRule fromMd(SecurityRule rule) { + NeutronSecurityRule answer = new NeutronSecurityRule(); + if (rule.getTenantId() != null) { + answer.setSecurityRuleTenantID(rule.getTenantId().getValue().replace("-","")); + } + if (rule.getDirection() != null) { + answer.setSecurityRuleDirection(DIRECTION_MAP.get(rule.getDirection())); + } + if (rule.getSecurityGroupId() != null) { + answer.setSecurityRuleGroupID(rule.getSecurityGroupId().getValue()); + } + if (rule.getRemoteGroupId() != null) { + answer.setSecurityRemoteGroupID(rule.getRemoteGroupId().getValue()); + } + if (rule.getRemoteIpPrefix() != null) { + answer.setSecurityRuleRemoteIpPrefix(rule.getRemoteIpPrefix().getIpv4Prefix() != null? + rule.getRemoteIpPrefix().getIpv4Prefix().getValue():rule.getRemoteIpPrefix().getIpv6Prefix().getValue()); + } + if (rule.getProtocol() != null) { + answer.setSecurityRuleProtocol(PROTOCOL_MAP.get(rule.getProtocol())); + } + if (rule.getEthertype() != null) { + answer.setSecurityRuleEthertype(ETHERTYPE_MAP.get(rule.getEthertype())); + } + if (rule.getPortRangeMin() != null) { + answer.setSecurityRulePortMin(Integer.valueOf(rule.getPortRangeMin())); + } + if (rule.getPortRangeMax() != null) { + answer.setSecurityRulePortMax(Integer.valueOf(rule.getPortRangeMax())); + } + if (rule.getId() != null) { + answer.setID(rule.getId().getValue()); + } + return answer; + } + + @Override + protected SecurityRule toMd(NeutronSecurityRule securityRule) { + SecurityRuleBuilder securityRuleBuilder = new SecurityRuleBuilder(); + + if (securityRule.getSecurityRuleTenantID() != null) { + securityRuleBuilder.setTenantId(toUuid(securityRule.getSecurityRuleTenantID())); + } + if (securityRule.getSecurityRuleDirection() != null) { + ImmutableBiMap> mapper = + DIRECTION_MAP.inverse(); + securityRuleBuilder.setDirection((Class) mapper.get(securityRule.getSecurityRuleDirection())); + } + if (securityRule.getSecurityRuleGroupID() != null) { + securityRuleBuilder.setSecurityGroupId(toUuid(securityRule.getSecurityRuleGroupID())); + } + if (securityRule.getSecurityRemoteGroupID() != null) { + securityRuleBuilder.setRemoteGroupId(toUuid(securityRule.getSecurityRemoteGroupID())); + } + if (securityRule.getSecurityRuleRemoteIpPrefix() != null) { + securityRuleBuilder.setRemoteIpPrefix(new IpPrefix(securityRule.getSecurityRuleRemoteIpPrefix().toCharArray())); + } + if (securityRule.getSecurityRuleProtocol() != null) { + ImmutableBiMap> mapper = + PROTOCOL_MAP.inverse(); + securityRuleBuilder.setProtocol((Class) mapper.get(securityRule.getSecurityRuleProtocol())); + } + if (securityRule.getSecurityRuleEthertype() != null) { + ImmutableBiMap> mapper = + ETHERTYPE_MAP.inverse(); + securityRuleBuilder.setEthertype((Class) mapper.get(securityRule.getSecurityRuleEthertype())); + } + if (securityRule.getSecurityRulePortMin() != null) { + securityRuleBuilder.setPortRangeMin(Integer.valueOf(securityRule.getSecurityRulePortMin())); + } + if (securityRule.getSecurityRulePortMax() != null) { + securityRuleBuilder.setPortRangeMax(Integer.valueOf(securityRule.getSecurityRulePortMax())); + } + if (securityRule.getID() != null) { + securityRuleBuilder.setId(toUuid(securityRule.getID())); + } else { + LOGGER.warn("Attempting to write neutron securityRule without UUID"); + } + return securityRuleBuilder.build(); + } + + @Override + protected InstanceIdentifier createInstanceIdentifier(SecurityRule securityRule) { + return InstanceIdentifier.create(Neutron.class) + .child(SecurityRules.class).child(SecurityRule.class, + securityRule.getKey()); + } + + protected InstanceIdentifier createInstanceIdentifier() { + return InstanceIdentifier.create(Neutron.class) + .child(SecurityRules.class); + } + + @Override + protected SecurityRule toMd(String uuid) { + SecurityRuleBuilder securityRuleBuilder = new SecurityRuleBuilder(); + securityRuleBuilder.setId(toUuid(uuid)); + return securityRuleBuilder.build(); + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronSecurityRuleInterface neutronSecurityRuleInterface = new NeutronSecurityRuleInterface(providerContext); + ServiceRegistration neutronSecurityRuleInterfaceRegistration = context.registerService(INeutronSecurityRuleCRUD.class, neutronSecurityRuleInterface, null); + if(neutronSecurityRuleInterfaceRegistration != null) { + registrations.add(neutronSecurityRuleInterfaceRegistration); + } + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronSubnetInterface.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronSubnetInterface.java new file mode 100644 index 000000000..fd228087f --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronSubnetInterface.java @@ -0,0 +1,297 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.crud.impl; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnetIPAllocationPool; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.NeutronCRUDInterfaces; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Base; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Off; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Slaac; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Stateful; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Stateless; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.IpVersionBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.IpVersionV4; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.IpVersionV6; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnet.attributes.AllocationPools; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnet.attributes.AllocationPoolsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.Subnets; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.Subnet; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.SubnetBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.ImmutableBiMap; + +public class NeutronSubnetInterface extends AbstractNeutronInterface implements INeutronSubnetCRUD { + private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSubnetInterface.class); + + private static final ImmutableBiMap,Integer> IPV_MAP + = new ImmutableBiMap.Builder,Integer>() + .put(IpVersionV4.class,Integer.valueOf(4)) + .put(IpVersionV6.class,Integer.valueOf(6)) + .build(); + + private static final ImmutableBiMap,String> DHCPV6_MAP + = new ImmutableBiMap.Builder,String>() + .put(Dhcpv6Off.class,"off") + .put(Dhcpv6Stateful.class,"dhcpv6-stateful") + .put(Dhcpv6Slaac.class,"slaac") + .put(Dhcpv6Stateless.class,"dhcpv6-stateless") + .build(); + + NeutronSubnetInterface(ProviderContext providerContext) { + super(providerContext); + } + + // IfNBSubnetCRUD methods + + @Override + public boolean subnetExists(String uuid) { + Subnet subnet = readMd(createInstanceIdentifier(toMd(uuid))); + if (subnet == null) { + return false; + } + return true; + } + + @Override + public NeutronSubnet getSubnet(String uuid) { + Subnet subnet = readMd(createInstanceIdentifier(toMd(uuid))); + if (subnet == null) { + return null; + } + return fromMd(subnet); + } + + @Override + public List getAllSubnets() { + Set allSubnets = new HashSet(); + Subnets subnets = readMd(createInstanceIdentifier()); + if (subnets != null) { + for (Subnet subnet: subnets.getSubnet()) { + allSubnets.add(fromMd(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; + } + addMd(input); + NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces() + .fetchINeutronNetworkCRUD(this); + INeutronNetworkCRUD networkIf = interfaces.getNetworkInterface(); + + NeutronNetwork targetNet = networkIf.getNetwork(input.getNetworkUUID()); + targetNet.addSubnet(id); + return true; + } + + @Override + public boolean removeSubnet(String uuid) { + NeutronSubnet target = getSubnet(uuid); + if (target == null) { + return false; + } + removeMd(toMd(uuid)); + NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces() + .fetchINeutronNetworkCRUD(this); + INeutronNetworkCRUD networkIf = interfaces.getNetworkInterface(); + + NeutronNetwork targetNet = networkIf.getNetwork(target.getNetworkUUID()); + targetNet.removeSubnet(uuid); + return true; + } + + @Override + public boolean updateSubnet(String uuid, NeutronSubnet delta) { + if (!subnetExists(uuid)) { + return false; + } +/* note: because what we get is *not* a delta but (at this point) the updated + * object, this is much simpler - just replace the value and update the mdsal + * with it */ + updateMd(delta); + return true; + } + +// note: this is being set to false in preparation for deprecation and removal + @Override + public boolean subnetInUse(String subnetUUID) { + return false; + } + + protected NeutronSubnet fromMd(Subnet subnet) { + NeutronSubnet result = new NeutronSubnet(); + result.setName(subnet.getName()); + result.setTenantID(String.valueOf(subnet.getTenantId().getValue()).replace("-","")); + result.setNetworkUUID(subnet.getNetworkId().getValue()); + result.setIpVersion(IPV_MAP.get(subnet.getIpVersion())); + result.setCidr(subnet.getCidr()); + result.setGatewayIP(String.valueOf(subnet.getGatewayIp().getValue())); + result.setIpV6RaMode(DHCPV6_MAP.get(subnet.getIpv6RaMode())); + result.setIpV6AddressMode(DHCPV6_MAP.get(subnet.getIpv6AddressMode())); + result.setEnableDHCP(subnet.isEnableDhcp()); + if (subnet.getAllocationPools() != null) { + List allocationPools = new ArrayList(); + for (AllocationPools allocationPool : subnet.getAllocationPools()) { + NeutronSubnetIPAllocationPool pool = new NeutronSubnetIPAllocationPool(); + pool.setPoolStart(allocationPool.getStart()); + pool.setPoolEnd(allocationPool.getEnd()); + allocationPools.add(pool); + } + result.setAllocationPools(allocationPools); + } + if (subnet.getDnsNameservers() != null) { + List dnsNameServers = new ArrayList(); + for (IpAddress dnsNameServer : subnet.getDnsNameservers()) { + dnsNameServers.add(String.valueOf(dnsNameServer.getValue())); + } + result.setDnsNameservers(dnsNameServers); + } + result.setID(subnet.getUuid().getValue()); +// read through the ports and put the ones in this subnet into the internal +// myPorts object. +// @deprecated and will be removed in Boron + Set allPorts = new HashSet(); + NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces() + .fetchINeutronPortCRUD(this); + INeutronPortCRUD portIf = interfaces.getPortInterface(); + for (NeutronPort port : portIf.getAllPorts()) { + if (port.getFixedIPs() != null) { + for (Neutron_IPs ip : port.getFixedIPs()) { + if (ip.getSubnetUUID().equals(result.getID())) { + allPorts.add(port); + } + } + } + } + List ports = new ArrayList(); + ports.addAll(allPorts); + result.setPorts(ports); + return result; + } + + protected Subnet toMd(NeutronSubnet subnet) { + SubnetBuilder subnetBuilder = new SubnetBuilder(); + if (subnet.getName() != null) { + subnetBuilder.setName(subnet.getName()); + } + if (subnet.getTenantID() != null) { + subnetBuilder.setTenantId(toUuid(subnet.getTenantID())); + } + if (subnet.getNetworkUUID() != null) { + subnetBuilder.setNetworkId(toUuid(subnet.getNetworkUUID())); + } + if (subnet.getIpVersion() != null) { + ImmutableBiMap> mapper = + IPV_MAP.inverse(); + subnetBuilder.setIpVersion((Class) mapper.get(subnet + .getIpVersion())); + } + if (subnet.getCidr() != null) { + subnetBuilder.setCidr(subnet.getCidr()); + } + if (subnet.getGatewayIP() != null) { + IpAddress ipAddress = new IpAddress(subnet.getGatewayIP() + .toCharArray()); + subnetBuilder.setGatewayIp(ipAddress); + } + if (subnet.getIpV6RaMode() != null) { + ImmutableBiMap> mapper = + DHCPV6_MAP.inverse(); + subnetBuilder.setIpv6RaMode((Class) mapper.get(subnet.getIpV6RaMode())); + } + if (subnet.getIpV6AddressMode() != null) { + ImmutableBiMap> mapper = + DHCPV6_MAP.inverse(); + subnetBuilder.setIpv6AddressMode((Class) mapper.get(subnet.getIpV6AddressMode())); + } + subnetBuilder.setEnableDhcp(subnet.getEnableDHCP()); + if (subnet.getAllocationPools() != null) { + List allocationPools = new ArrayList(); + for (NeutronSubnetIPAllocationPool allocationPool : subnet + .getAllocationPools()) { + AllocationPoolsBuilder builder = new AllocationPoolsBuilder(); + builder.setStart(allocationPool.getPoolStart()); + builder.setEnd(allocationPool.getPoolEnd()); + AllocationPools temp = builder.build(); + allocationPools.add(temp); + } + subnetBuilder.setAllocationPools(allocationPools); + } + if (subnet.getDnsNameservers() != null) { + List dnsNameServers = new ArrayList(); + for (String dnsNameServer : subnet.getDnsNameservers()) { + IpAddress ipAddress = new IpAddress(dnsNameServer.toCharArray()); + dnsNameServers.add(ipAddress); + } + subnetBuilder.setDnsNameservers(dnsNameServers); + } + if (subnet.getID() != null) { + subnetBuilder.setUuid(toUuid(subnet.getID())); + } else { + LOGGER.warn("Attempting to write neutron subnet without UUID"); + } + return subnetBuilder.build(); + } + + @Override + protected InstanceIdentifier createInstanceIdentifier(Subnet subnet) { + return InstanceIdentifier.create(Neutron.class).child(Subnets.class) + .child(Subnet.class, subnet.getKey()); + } + + protected InstanceIdentifier createInstanceIdentifier() { + return InstanceIdentifier.create(Neutron.class) + .child(Subnets.class); + } + + @Override + protected Subnet toMd(String uuid) { + SubnetBuilder subnetBuilder = new SubnetBuilder(); + subnetBuilder.setUuid(toUuid(uuid)); + return subnetBuilder.build(); + } + + public static void registerNewInterface(BundleContext context, + ProviderContext providerContext, + List> registrations) { + NeutronSubnetInterface neutronSubnetInterface = new NeutronSubnetInterface(providerContext); + ServiceRegistration neutronSubnetInterfaceRegistration = context.registerService(INeutronSubnetCRUD.class, neutronSubnetInterface, null); + if(neutronSubnetInterfaceRegistration != null) { + registrations.add(neutronSubnetInterfaceRegistration); + } + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFirewallAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFirewallAware.java new file mode 100644 index 000000000..f5348cb45 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFirewallAware.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewall; + +/** + * This interface defines the methods a service that wishes to be aware of Firewall Rules needs to implement + * + */ + +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. + */ + 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 + */ + 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronFirewallDeleted(NeutronFirewall firewall); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFirewallPolicyAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFirewallPolicyAware.java new file mode 100644 index 000000000..2b8c0c4f4 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFirewallPolicyAware.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewallPolicy; + +/** + * This interface defines the methods a service that wishes to be aware of Firewall Policys needs to implement + * + */ + +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. + */ + 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 + */ + 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronFirewallPolicyDeleted(NeutronFirewallPolicy firewallPolicy); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFirewallRuleAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFirewallRuleAware.java new file mode 100644 index 000000000..efc5752a2 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFirewallRuleAware.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewallRule; + +/** + * This interface defines the methods a service that wishes to be aware of Firewall Rules needs to implement + * + */ + +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. + */ + 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 + */ + 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronFirewallRuleDeleted(NeutronFirewallRule firewallRule); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFloatingIPAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFloatingIPAware.java new file mode 100644 index 000000000..f9ca5e731 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronFloatingIPAware.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFloatingIP; + +/** + * This interface defines the methods a service that wishes to be aware of Neutron FloatingIPs needs to implement + * + */ + +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. + */ + 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 + */ + 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 original + * 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronFloatingIPDeleted(NeutronFloatingIP floatingIP); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerAware.java new file mode 100644 index 000000000..84f68cf18 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerAware.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer; + +/** + * This interface defines the methods a service that wishes to be aware of LoadBalancer Rules needs to implement + * + */ + +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. + */ + 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 + */ + 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronLoadBalancerDeleted(NeutronLoadBalancer loadBalancer); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerHealthMonitorAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerHealthMonitorAware.java new file mode 100644 index 000000000..bd463896b --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerHealthMonitorAware.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerHealthMonitor; + +/** + * This interface defines the methods a service that wishes to be aware of LoadBalancerHealthMonitor Rules needs to implement + * + */ + +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. + */ + 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 + */ + 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronLoadBalancerHealthMonitorDeleted(NeutronLoadBalancerHealthMonitor loadBalancerHealthMonitor); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerListenerAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerListenerAware.java new file mode 100644 index 000000000..a54689dc8 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerListenerAware.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerListener; + +/** + * This interface defines the methods a service that wishes to be aware of LoadBalancerListener Rules needs to implement + * + */ + +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. + */ + 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 + */ + 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronLoadBalancerListenerDeleted(NeutronLoadBalancerListener loadBalancerListener); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerPoolAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerPoolAware.java new file mode 100644 index 000000000..76d541033 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerPoolAware.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool; + +/** + * This interface defines the methods a service that wishes to be aware of LoadBalancerPool Rules needs to implement + * + */ + +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. + */ + 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 + */ + 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronLoadBalancerPoolDeleted(NeutronLoadBalancerPool loadBalancerPool); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerPoolMemberAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerPoolMemberAware.java new file mode 100644 index 000000000..d1e333f5b --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronLoadBalancerPoolMemberAware.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember; + +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. + */ + 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 + */ + 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronLoadBalancerPoolMemberDeleted(NeutronLoadBalancerPoolMember loadBalancerPoolMember); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronNetworkAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronNetworkAware.java new file mode 100644 index 000000000..70f69c4a8 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronNetworkAware.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; + +/** + * This interface defines the methods a service that wishes to be aware of Neutron Networks needs to implement + * + */ + +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. + */ + 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 + */ + 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 original + * 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronNetworkDeleted(NeutronNetwork network); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronPortAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronPortAware.java new file mode 100644 index 000000000..e6974822e --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronPortAware.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; + +/** + * This interface defines the methods a service that wishes to be aware of Neutron Ports needs to implement + * + */ + +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. + */ + 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 + */ + 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 original + * 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronPortDeleted(NeutronPort port); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronRouterAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronRouterAware.java new file mode 100644 index 000000000..8577e7d6a --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronRouterAware.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter_Interface; + +/** + * This interface defines the methods a service that wishes to be aware of Neutron Routers needs to implement + * + */ + +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. + */ + 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 + */ + 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 original + * 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronRouterDeleted(NeutronRouter router); + + /** + * Services provide this interface method to indicate if the + * specified interface can be attached to the specified router + * + * @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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronRouterInterfaceDetached(NeutronRouter router, NeutronRouter_Interface routerInterface); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronSecurityGroupAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronSecurityGroupAware.java new file mode 100644 index 000000000..d0323ebd7 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronSecurityGroupAware.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; + +/** + * This interface defines the methods a service that wishes to be aware of Neutron Security Groups needs to implement + */ + +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. + */ + 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 + */ + 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronSecurityGroupDeleted(NeutronSecurityGroup securityGroup); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronSecurityRuleAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronSecurityRuleAware.java new file mode 100644 index 000000000..6a8eaef3b --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronSecurityRuleAware.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2014 Red Hat, 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityRule; + +/** + * This interface defines the methods required to be aware of Neutron Security Rules + */ + +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. + */ + 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 + */ + 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronSecurityRuleDeleted(NeutronSecurityRule securityRule); +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronSubnetAware.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronSubnetAware.java new file mode 100644 index 000000000..55ae58bc6 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/INeutronSubnetAware.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2013, 2015 IBM Corporation 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.ovsdb.openstack.netvirt.translator.iaware; + +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet; + +/** + * This interface defines the methods a service that wishes to be aware of Neutron Subnets needs to implement + * + */ + +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. + */ + 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 + */ + 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 original + * 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. + */ + 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 + */ + 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. + */ + 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 + */ + void neutronSubnetDeleted(NeutronSubnet subnet); + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronFloatingIPChangeListener.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronFloatingIPChangeListener.java new file mode 100644 index 000000000..44adae86a --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronFloatingIPChangeListener.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2015 Brocade Communications 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.ovsdb.openstack.netvirt.translator.iaware.impl; + +import java.util.Map.Entry; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFloatingIP; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronFloatingIPAware; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.floatingips.attributes.Floatingips; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.floatingips.attributes.floatingips.Floatingip; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NeutronFloatingIPChangeListener implements DataChangeListener, AutoCloseable{ + private static final Logger LOG = LoggerFactory.getLogger(NeutronFloatingIPChangeListener.class); + + private ListenerRegistration registration; + private DataBroker db; + + public NeutronFloatingIPChangeListener(DataBroker db){ + this.db = db; + InstanceIdentifier path = InstanceIdentifier + .create(Neutron.class) + .child(Floatingips.class) + .child(Floatingip.class); + LOG.debug("Register listener for Neutron FloatingIp model data changes"); + registration = + this.db.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, path, this, DataChangeScope.ONE); + + } + + @Override + public void onDataChanged( + AsyncDataChangeEvent, DataObject> changes) { + LOG.trace("Data changes : {}",changes); + + Object[] subscribers = NeutronIAwareUtil.getInstances(INeutronFloatingIPAware.class, this); + createFloatingIP(changes, subscribers); + updateFloatingIP(changes, subscribers); + deleteFloatingIP(changes, subscribers); + } + + private void createFloatingIP( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> newFloatingIP : changes.getCreatedData().entrySet()) { + if(newFloatingIP.getValue() instanceof Floatingip){ + NeutronFloatingIP floatingip= fromMd((Floatingip)newFloatingIP.getValue()); + for(Object entry: subscribers){ + INeutronFloatingIPAware subscriber = (INeutronFloatingIPAware)entry; + subscriber.neutronFloatingIPCreated(floatingip); + } + } + } + } + + private void updateFloatingIP( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> updateFloatingIP : changes.getUpdatedData().entrySet()) { + if(updateFloatingIP.getValue() instanceof Floatingip){ + NeutronFloatingIP floatingip = fromMd((Floatingip)updateFloatingIP.getValue()); + for(Object entry: subscribers){ + INeutronFloatingIPAware subscriber = (INeutronFloatingIPAware)entry; + subscriber.neutronFloatingIPUpdated(floatingip); + } + } + } + } + + private void deleteFloatingIP( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (InstanceIdentifier deletedFloatingIPPath : changes.getRemovedPaths()) { + if(deletedFloatingIPPath.getTargetType().equals(Floatingip.class)){ + NeutronFloatingIP floatingip = fromMd((Floatingip)changes.getOriginalData().get(deletedFloatingIPPath)); + for(Object entry: subscribers){ + INeutronFloatingIPAware subscriber = (INeutronFloatingIPAware)entry; + subscriber.neutronFloatingIPDeleted(floatingip); + } + } + } + } + + /* + * This method is borrowed from NeutronFloatingIPInterface.java class of Neutron Northbound class. + * We will be utilizing similar code from other classes from the same package of neutron project. + */ + private NeutronFloatingIP fromMd(Floatingip fip) { + NeutronFloatingIP result = new NeutronFloatingIP(); + result.setID(String.valueOf(fip.getUuid().getValue())); + if (fip.getFloatingNetworkId() != null) { + result.setFloatingNetworkUUID(String.valueOf(fip.getFloatingNetworkId().getValue())); + } + if (fip.getPortId() != null) { + result.setPortUUID(String.valueOf(fip.getPortId().getValue())); + } + if (fip.getFixedIpAddress() != null ) { + result.setFixedIPAddress(String.valueOf(fip.getFixedIpAddress().getValue())); + } + if (fip.getFloatingIpAddress() != null) { + result.setFloatingIPAddress(String.valueOf(fip.getFloatingIpAddress().getValue())); + } + if (fip.getTenantId() != null) { + result.setTenantUUID(String.valueOf(fip.getTenantId().getValue())); + } + if (fip.getRouterId() != null) { + result.setRouterUUID(String.valueOf(fip.getRouterId().getValue())); + } + result.setStatus(fip.getStatus()); + return result; + } + + @Override + public void close() throws Exception { + registration.close(); + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronIAwareUtil.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronIAwareUtil.java new file mode 100644 index 000000000..c8466fec8 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronIAwareUtil.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2015 Brocade Communications 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.ovsdb.openstack.netvirt.translator.iaware.impl; + +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 NeutronIAwareUtil { + private static final Logger LOGGER = LoggerFactory + .getLogger(NeutronIAwareUtil.class); + + private NeutronIAwareUtil() { + } + + 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", e); + } + return instances; + } + +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronLoadBalancerPoolChangeListener.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronLoadBalancerPoolChangeListener.java new file mode 100644 index 000000000..84f398fe9 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronLoadBalancerPoolChangeListener.java @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator.iaware.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map.Entry; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer_SessionPersistence; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_ID; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronLoadBalancerPoolAware; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolHttp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolHttps; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolIcmp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolTcp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.Pools; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.pools.Pool; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.pools.pool.members.Member; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.ImmutableBiMap; + +public class NeutronLoadBalancerPoolChangeListener implements DataChangeListener, AutoCloseable { + private static final Logger LOG = LoggerFactory.getLogger(NeutronLoadBalancerPoolChangeListener.class); + + private static final ImmutableBiMap,String> PROTOCOL_MAP + = new ImmutableBiMap.Builder,String>() + .put(ProtocolHttp.class, "HTTP") + .put(ProtocolHttps.class, "HTTPS") + .put(ProtocolIcmp.class, "ICMP") + .put(ProtocolTcp.class,"TCP") + .build(); + + private ListenerRegistration registration; + private DataBroker db; + + public NeutronLoadBalancerPoolChangeListener(DataBroker db){ + this.db = db; + InstanceIdentifier path = InstanceIdentifier + .create(Neutron.class) + .child(Pools.class) + .child(Pool.class); + LOG.debug("Register listener for Neutron Load Balancer Pool model data changes"); + registration = + this.db.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, path, this, AsyncDataBroker.DataChangeScope.ONE); + } + + @Override + public void close() throws Exception { + registration.close(); + } + + @Override + public void onDataChanged(AsyncDataChangeEvent, DataObject> changes) { + LOG.trace("Data changes : {}", changes); + + Object[] subscribers = NeutronIAwareUtil.getInstances(INeutronLoadBalancerPoolAware.class, this); + createPool(changes, subscribers); + updatePool(changes, subscribers); + deletePool(changes, subscribers); + } + + private void createPool( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> newPool : changes.getCreatedData().entrySet()) { + if(newPool.getValue() instanceof Pool){ + NeutronLoadBalancerPool loadBalancerPool = fromMd((Pool) newPool.getValue()); + for (Object entry : subscribers) { + INeutronLoadBalancerPoolAware subscriber = (INeutronLoadBalancerPoolAware) entry; + subscriber.neutronLoadBalancerPoolCreated(loadBalancerPool); + } + } + } + } + private void updatePool( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> updatePool : changes.getUpdatedData().entrySet()) { + if(updatePool.getValue() instanceof Pool){ + NeutronLoadBalancerPool loadBalancerPool = fromMd((Pool)updatePool.getValue()); + for(Object entry: subscribers){ + INeutronLoadBalancerPoolAware subscriber = (INeutronLoadBalancerPoolAware) entry; + subscriber.neutronLoadBalancerPoolUpdated(loadBalancerPool); + } + } + } + } + private void deletePool( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (InstanceIdentifier deletedPoolPath : changes.getRemovedPaths()) { + if(deletedPoolPath.getTargetType().equals(Pool.class)){ + NeutronLoadBalancerPool loadBalancerPool = fromMd((Pool)changes.getOriginalData().get(deletedPoolPath)); + for(Object entry: subscribers){ + INeutronLoadBalancerPoolAware subscriber = (INeutronLoadBalancerPoolAware) entry; + subscriber.neutronLoadBalancerPoolDeleted(loadBalancerPool); + } + } + } + } + + /* + * This method is borrowed from NeutronLoadBalancerPool.java class of Neutron Northbound class. + * in the original location, this method is called extractFields. + * We will be utilizing similar code from other classes from the same package of neutron project. + */ + private NeutronLoadBalancerPool fromMd(Pool pool) { + NeutronLoadBalancerPool result = new NeutronLoadBalancerPool(); + + result.setID(pool.getUuid().getValue()); + result.setLoadBalancerPoolTenantID(pool.getTenantId().getValue()); + result.setLoadBalancerPoolName(pool.getName()); + result.setLoadBalancerPoolDescription(pool.getDescr()); + result.setLoadBalancerPoolProtocol(PROTOCOL_MAP.get(pool.getProtocol())); + result.setLoadBalancerPoolLbAlgorithm(pool.getLbAlgorithm()); + + // TODO: setNeutronLoadBalancerPoolHealthMonitorID is a list? Fill in, when its needed. + if (pool.getHealthmonitorId() != null) { + result.setNeutronLoadBalancerPoolHealthMonitorID(pool.getHealthmonitorId().getValue()); + } + + result.setLoadBalancerPoolAdminStateIsUp(pool.isAdminStateUp()); + + List listeners = new ArrayList(); + if (pool.getListeners() != null) { + for (Uuid listenerUuid : pool.getListeners()) { + listeners.add(new Neutron_ID(listenerUuid.getValue())); + } + } + result.setLoadBalancerPoolListeners(listeners); + + if (pool.getSessionPersistence() != null) { + NeutronLoadBalancer_SessionPersistence sessionPersistence = new NeutronLoadBalancer_SessionPersistence(); + sessionPersistence.setCookieName(pool.getSessionPersistence().getCookieName()); + sessionPersistence.setType(pool.getSessionPersistence().getType()); + result.setLoadBalancerSessionPersistence(sessionPersistence); + } + + List loadBalancerPoolMembers = new ArrayList(); + if (pool.getMembers() != null) { + for (Member member : pool.getMembers().getMember()) { + NeutronLoadBalancerPoolMember neutronMember = new NeutronLoadBalancerPoolMember(); + + neutronMember.setPoolID(pool.getUuid().getValue()); + neutronMember.setPoolMemberID(member.getUuid().getValue()); + + // TODO: locate and populate remainder attributes, when its needed + // member.setPoolMemberAddress(xxx); + // member.setPoolMemberAdminStateIsUp(xxx); + // member.setPoolMemberProtoPort(xxx); + // member.setPoolMemberSubnetID(xxx); + // member.setPoolMemberTenantID(xxx); + // member.setPoolMemberWeight(xxx); + + loadBalancerPoolMembers.add(neutronMember); + } + } + result.setLoadBalancerPoolMembers(loadBalancerPoolMembers); + + return result; + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronLoadBalancerPoolMemberChangeListener.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronLoadBalancerPoolMemberChangeListener.java new file mode 100644 index 000000000..b62583f63 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronLoadBalancerPoolMemberChangeListener.java @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2015 Red Hat, 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.ovsdb.openstack.netvirt.translator.iaware.impl; + +import java.util.Map.Entry; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronLoadBalancerPoolMemberAware; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.Pools; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.pools.Pool; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.pools.PoolKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.pools.pool.Members; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.pools.pool.members.Member; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NeutronLoadBalancerPoolMemberChangeListener implements DataChangeListener, AutoCloseable { + private static final Logger LOG = LoggerFactory.getLogger(NeutronLoadBalancerPoolMemberChangeListener.class); + + private ListenerRegistration registration; + private DataBroker db; + + public NeutronLoadBalancerPoolMemberChangeListener(DataBroker db){ + this.db = db; + InstanceIdentifier path = InstanceIdentifier + .create(Neutron.class) + .child(Pools.class) + .child(Pool.class) + .child(Members.class) + .child(Member.class); + LOG.debug("Register listener for Neutron Load Balancer Pool Member model data changes"); + registration = + this.db.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, path, this, + AsyncDataBroker.DataChangeScope.ONE); + } + + @Override + public void close() throws Exception { + registration.close(); + } + + @Override + public void onDataChanged(AsyncDataChangeEvent, DataObject> changes) { + LOG.trace("Data changes : {}", changes); + + Object[] subscribers = NeutronIAwareUtil.getInstances(INeutronLoadBalancerPoolMemberAware.class, this); + createPoolMember(changes, subscribers); + updatePoolMember(changes, subscribers); + deletePoolMember(changes, subscribers); + } + + private void createPoolMember( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> newPoolMember : changes.getCreatedData().entrySet()) { + if(newPoolMember.getValue() instanceof Member){ + NeutronLoadBalancerPoolMember neutronLBPoolMember = fromMd(newPoolMember.getKey(), (Member) newPoolMember.getValue()); + for (Object entry : subscribers) { + INeutronLoadBalancerPoolMemberAware subscriber = (INeutronLoadBalancerPoolMemberAware) entry; + subscriber.neutronLoadBalancerPoolMemberCreated(neutronLBPoolMember); + } + } + } + } + private void updatePoolMember( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> updatePoolMember : changes.getUpdatedData().entrySet()) { + if(updatePoolMember.getValue() instanceof Member){ + NeutronLoadBalancerPoolMember neutronLBPoolMember = + fromMd(updatePoolMember.getKey(), (Member) updatePoolMember.getValue()); + for(Object entry: subscribers){ + INeutronLoadBalancerPoolMemberAware subscriber = (INeutronLoadBalancerPoolMemberAware) entry; + subscriber.neutronLoadBalancerPoolMemberUpdated(neutronLBPoolMember); + } + } + } + } + private void deletePoolMember( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (InstanceIdentifier deletedPoolMemberPath : changes.getRemovedPaths()) { + if(deletedPoolMemberPath.getTargetType().equals(Member.class)){ + NeutronLoadBalancerPoolMember neutronLBPoolMember = + fromMd(deletedPoolMemberPath, (Member) changes.getOriginalData().get(deletedPoolMemberPath)); + for(Object entry: subscribers){ + INeutronLoadBalancerPoolMemberAware subscriber = (INeutronLoadBalancerPoolMemberAware) entry; + subscriber.neutronLoadBalancerPoolMemberDeleted(neutronLBPoolMember); + } + } + } + } + + /* + * This method is borrowed from NeutronLoadBalancerPoolMember.java class of Neutron Northbound class. + * in the original location, this method is called extractFields. + * We will be utilizing similar code from other classes from the same package of neutron project. + */ + private NeutronLoadBalancerPoolMember fromMd(InstanceIdentifier iid, Member member) { + NeutronLoadBalancerPoolMember result = new NeutronLoadBalancerPoolMember(); + + final PoolKey poolsKey = iid.firstKeyOf(Pool.class, PoolKey.class); + if (poolsKey != null) { + result.setPoolID(poolsKey.getUuid().getValue()); + } + + result.setID(member.getUuid().getValue()); + result.setPoolMemberAdminStateIsUp(member.isAdminStateUp()); + + final IpAddress memberIpAddress = member.getAddress(); + if (memberIpAddress != null) { + if (memberIpAddress.getIpv4Address() != null) { + result.setPoolMemberAddress(memberIpAddress.getIpv4Address().getValue()); + } else if (memberIpAddress.getIpv6Address() != null) { + result.setPoolMemberAddress(memberIpAddress.getIpv6Address().getValue()); + } + } + + result.setPoolMemberProtoPort(member.getProtocolPort()); + result.setPoolMemberSubnetID(member.getSubnetId().getValue()); + result.setPoolMemberTenantID(member.getTenantId().getValue()); + result.setPoolMemberWeight(member.getWeight()); + + return result; + } +} + diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronNetworkChangeListener.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronNetworkChangeListener.java new file mode 100644 index 000000000..bb045b4a8 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronNetworkChangeListener.java @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2015 Brocade Communications 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.ovsdb.openstack.netvirt.translator.iaware.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map.Entry; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork_Segment; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronNetworkAware; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.ext.rev150712.NetworkL3Extension; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeFlat; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeGre; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeVlan; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeVxlan; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.Networks; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.NetworkProviderExtension; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.neutron.networks.network.Segments; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.ImmutableBiMap; + +public class NeutronNetworkChangeListener implements DataChangeListener, AutoCloseable { + private static final Logger LOG = LoggerFactory.getLogger(NeutronNetworkChangeListener.class); + + private static final ImmutableBiMap,String> NETWORK_MAP + = new ImmutableBiMap.Builder,String>() + .put(NetworkTypeFlat.class,"flat") + .put(NetworkTypeGre.class,"gre") + .put(NetworkTypeVlan.class,"vlan") + .put(NetworkTypeVxlan.class,"vxlan") + .build(); + + private ListenerRegistration registration; + private DataBroker db; + + public NeutronNetworkChangeListener(DataBroker db){ + this.db = db; + InstanceIdentifier path = InstanceIdentifier + .create(Neutron.class) + .child(Networks.class) + .child(Network.class); + LOG.debug("Register listener for Neutron Network model data changes"); + registration = + this.db.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, path, this, DataChangeScope.ONE); + + } + + @Override + public void onDataChanged( + AsyncDataChangeEvent, DataObject> changes) { + LOG.trace("Data changes : {}",changes); + + Object[] subscribers = NeutronIAwareUtil.getInstances(INeutronNetworkAware.class, this); + createNetwork(changes, subscribers); + updateNetwork(changes, subscribers); + deleteNetwork(changes, subscribers); + } + + private void createNetwork( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> newNetwork : changes.getCreatedData().entrySet()) { + if(newNetwork.getValue() instanceof Network){ + NeutronNetwork network = fromMd((Network)newNetwork.getValue()); + for(Object entry: subscribers){ + INeutronNetworkAware subscriber = (INeutronNetworkAware)entry; + subscriber.neutronNetworkCreated(network); + } + } + } + } + + private void updateNetwork( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> updateNetwork : changes.getUpdatedData().entrySet()) { + if(updateNetwork.getValue() instanceof Network){ + NeutronNetwork network = fromMd((Network)updateNetwork.getValue()); + for(Object entry: subscribers){ + INeutronNetworkAware subscriber = (INeutronNetworkAware)entry; + subscriber.neutronNetworkUpdated(network); + } + } + } + } + + private void deleteNetwork( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (InstanceIdentifier deletedNetworkPath : changes.getRemovedPaths()) { + if(deletedNetworkPath.getTargetType().equals(Network.class)){ + NeutronNetwork network = fromMd((Network)changes.getOriginalData().get(deletedNetworkPath)); + for(Object entry: subscribers){ + INeutronNetworkAware subscriber = (INeutronNetworkAware)entry; + subscriber.neutronNetworkDeleted(network); + } + } + } + } + + /* + * This method is borrowed from NeutronNetworkInterface.java class of Neutron Northbound class. + * We will be utilizing similar code from other classes from the same package of neutron project. + */ + private NeutronNetwork fromMd(Network network) { + NeutronNetwork result = new NeutronNetwork(); + result.setAdminStateUp(network.isAdminStateUp()); + result.setNetworkName(network.getName()); + result.setShared(network.isShared()); + result.setStatus(network.getStatus()); + if (network.getSubnets() != null) { + List neutronSubnets = new ArrayList(); + for( Uuid subnet : network.getSubnets()) { + neutronSubnets.add(subnet.getValue()); + } + result.setSubnets(neutronSubnets); + } + + // todo remove '-' chars as tenant id doesn't use them + result.setTenantID(network.getTenantId().getValue()); + result.setID(network.getUuid().getValue()); + + NetworkL3Extension l3Extension = network.getAugmentation(NetworkL3Extension.class); + result.setRouterExternal(l3Extension.isExternal()); + + NetworkProviderExtension providerExtension = network.getAugmentation(NetworkProviderExtension.class); + result.setProviderPhysicalNetwork(providerExtension.getPhysicalNetwork()); + result.setProviderSegmentationID(providerExtension.getSegmentationId()); + result.setProviderNetworkType(NETWORK_MAP.get(providerExtension.getNetworkType())); + List segments = new ArrayList(); + if (providerExtension.getSegments() != null) { + for (Segments segment: providerExtension.getSegments()) { + NeutronNetwork_Segment neutronSegment = new NeutronNetwork_Segment(); + neutronSegment.setProviderPhysicalNetwork(segment.getPhysicalNetwork()); + neutronSegment.setProviderSegmentationID(segment.getSegmentationId()); + neutronSegment.setProviderNetworkType(NETWORK_MAP.get(segment.getNetworkType())); + segments.add(neutronSegment); + } + } + result.setSegments(segments); + return result; + } + + @Override + public void close() throws Exception { + registration.close(); + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronPortChangeListener.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronPortChangeListener.java new file mode 100644 index 000000000..35bf7ff30 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronPortChangeListener.java @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2015 Brocade Communications 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.ovsdb.openstack.netvirt.translator.iaware.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort_AllowedAddressPairs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort_ExtraDHCPOption; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort_VIFDetail; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSecurityGroupCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.NeutronCRUDInterfaces; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronPortAware; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.binding.attributes.VifDetails; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.AllowedAddressPairs; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.ExtraDhcpOpts; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.Ports; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NeutronPortChangeListener implements DataChangeListener, AutoCloseable{ + private static final Logger LOG = LoggerFactory.getLogger(NeutronPortChangeListener.class); + + private ListenerRegistration registration; + private DataBroker db; + + public NeutronPortChangeListener(DataBroker db){ + this.db = db; + InstanceIdentifier path = InstanceIdentifier + .create(Neutron.class) + .child(Ports.class) + .child(Port.class); + LOG.debug("Register listener for Neutron Port model data changes"); + registration = + this.db.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, path, this, DataChangeScope.ONE); + + } + + @Override + public void onDataChanged( + AsyncDataChangeEvent, DataObject> changes) { + LOG.trace("Data changes : {}",changes); + + Object[] subscribers = NeutronIAwareUtil.getInstances(INeutronPortAware.class, this); + createPort(changes, subscribers); + updatePort(changes, subscribers); + deletePort(changes, subscribers); + } + + private void createPort( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> newPort : changes.getCreatedData().entrySet()) { + if(newPort.getValue() instanceof Port){ + NeutronPort port = fromMd((Port)newPort.getValue()); + for(Object entry: subscribers){ + INeutronPortAware subscriber = (INeutronPortAware)entry; + subscriber.neutronPortCreated(port); + } + } + } + } + + private void updatePort( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + Map originalPortMap = getChangedPorts(changes.getOriginalData()); + for (Entry, DataObject> updatePort : changes.getUpdatedData().entrySet()) { + if (updatePort.getValue() instanceof Port) { + NeutronPort port = fromMd((Port)updatePort.getValue()); + NeutronPort originalPort = originalPortMap.get(port.getID()); + if (originalPort != null) { + port.setOriginalPort(originalPort); + } else { + LOG.warn("Original Port data is missing"); + } + for (Object entry: subscribers) { + INeutronPortAware subscriber = (INeutronPortAware)entry; + subscriber.neutronPortUpdated(port); + } + } + } + } + + private void deletePort( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (InstanceIdentifier deletedPortPath : changes.getRemovedPaths()) { + if(deletedPortPath.getTargetType().equals(Port.class)){ + NeutronPort port = fromMd((Port)changes.getOriginalData().get(deletedPortPath)); + for(Object entry: subscribers){ + INeutronPortAware subscriber = (INeutronPortAware)entry; + subscriber.neutronPortDeleted(port); + } + } + } + } + + /* + * This method is borrowed from NeutronPortInterface.java class of Neutron Northbound class. + * We will be utilizing similar code from other classes from the same package of neutron project. + */ + private NeutronPort fromMd(Port port) { + + NeutronPort result = new NeutronPort(); + result.setAdminStateUp(port.isAdminStateUp()); + if (port.getAllowedAddressPairs() != null) { + List pairs = new ArrayList(); + for (AllowedAddressPairs mdPair : port.getAllowedAddressPairs()) { + NeutronPort_AllowedAddressPairs pair = new NeutronPort_AllowedAddressPairs(); + pair.setIpAddress(mdPair.getIpAddress()); + pair.setMacAddress(mdPair.getMacAddress()); + pair.setPortID(mdPair.getPortId()); + pairs.add(pair); + } + result.setAllowedAddressPairs(pairs); + } + result.setDeviceID(port.getDeviceId()); + result.setDeviceOwner(port.getDeviceOwner()); + if (port.getExtraDhcpOpts() != null) { + List options = new ArrayList(); + for (ExtraDhcpOpts opt : port.getExtraDhcpOpts()) { + NeutronPort_ExtraDHCPOption arg = new NeutronPort_ExtraDHCPOption(); + arg.setName(opt.getOptName()); + arg.setValue(opt.getOptValue()); + options.add(arg); + } + result.setExtraDHCPOptions(options); + } + if (port.getFixedIps() != null) { + List ips = new ArrayList(); + for (FixedIps mdIP : port.getFixedIps()) { + Neutron_IPs ip = new Neutron_IPs(); + ip.setIpAddress(String.valueOf(mdIP.getIpAddress().getValue())); + ip.setSubnetUUID(mdIP.getSubnetId().getValue()); + ips.add(ip); + } + result.setFixedIPs(ips); + } + result.setMacAddress(port.getMacAddress()); + result.setName(port.getName()); + result.setNetworkUUID(String.valueOf(port.getNetworkId().getValue())); + if (port.getSecurityGroups() != null) { + Set allGroups = new HashSet(); + NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces().fetchINeutronSecurityGroupCRUD(this); + INeutronSecurityGroupCRUD sgIf = interfaces.getSecurityGroupInterface(); + for (Uuid sgUuid : port.getSecurityGroups()) { + allGroups.add(sgIf.getNeutronSecurityGroup(sgUuid.getValue())); + } + List groups = new ArrayList(); + groups.addAll(allGroups); + result.setSecurityGroups(groups); + } + result.setStatus(port.getStatus()); + if (port.getTenantId() != null) { + result.setTenantID(String.valueOf(port.getTenantId().getValue()).replace("-", "")); + } + result.setPortUUID(String.valueOf(port.getUuid().getValue())); + addExtensions(port, result); + return result; + } + + protected void addExtensions(Port port, NeutronPort result) { + PortBindingExtension binding = port.getAugmentation(PortBindingExtension.class); + result.setBindinghostID(binding.getHostId()); + if (binding.getVifDetails() != null) { + List details = new ArrayList(); + for (VifDetails vifDetail : binding.getVifDetails()) { + NeutronPort_VIFDetail detail = new NeutronPort_VIFDetail(); + detail.setPortFilter(vifDetail.isPortFilter()); + detail.setOvsHybridPlug(vifDetail.isOvsHybridPlug()); + details.add(detail); + } + result.setVIFDetail(details); + } + result.setBindingvifType(binding.getVifType()); + result.setBindingvnicType(binding.getVnicType()); + } + + private Map getChangedPorts(Map, DataObject> changedData) { + LOG.trace("getChangedPorts:" + changedData); + Map portMap = new HashMap(); + for (Map.Entry, DataObject> changed : changedData.entrySet()) { + if (changed.getValue() instanceof Port) { + NeutronPort port = fromMd((Port)changed.getValue()); + portMap.put(port.getID(), port); + } + } + return portMap; + } + + @Override + public void close() throws Exception { + registration.close(); + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronRouterChangeListener.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronRouterChangeListener.java new file mode 100644 index 000000000..5ad885d39 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronRouterChangeListener.java @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2015 Brocade Communications 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.ovsdb.openstack.netvirt.translator.iaware.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter_Interface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter_NetworkReference; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronRouterAware; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.Routers; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.Router; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.Interfaces; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.external_gateway_info.ExternalFixedIps; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NeutronRouterChangeListener implements DataChangeListener, AutoCloseable{ + private static final Logger LOG = LoggerFactory.getLogger(NeutronRouterChangeListener.class); + + private ListenerRegistration registration; + private DataBroker db; + + public NeutronRouterChangeListener(DataBroker db){ + this.db = db; + InstanceIdentifier path = InstanceIdentifier + .create(Neutron.class) + .child(Routers.class) + .child(Router.class); + LOG.debug("Register listener for Neutron Router model data changes"); + registration = + this.db.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, path, this, DataChangeScope.ONE); + + } + + @Override + public void onDataChanged( + AsyncDataChangeEvent, DataObject> changes) { + LOG.trace("Data changes : {}",changes); + + Object[] subscribers = NeutronIAwareUtil.getInstances(INeutronRouterAware.class, this); + createRouter(changes, subscribers); + updateRouter(changes, subscribers); + deleteRouter(changes, subscribers); + } + + private void createRouter( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> newRouter : changes.getCreatedData().entrySet()) { + if(newRouter.getValue() instanceof Router){ + NeutronRouter router = fromMd((Router)newRouter.getValue()); + for(Object entry: subscribers){ + INeutronRouterAware subscriber = (INeutronRouterAware)entry; + subscriber.neutronRouterCreated(router); + } + } + } + + } + + private void updateRouter( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> updateRouter : changes.getUpdatedData().entrySet()) { + if(updateRouter.getValue() instanceof Router){ + NeutronRouter router = fromMd((Router)updateRouter.getValue()); + for(Object entry: subscribers){ + INeutronRouterAware subscriber = (INeutronRouterAware)entry; + subscriber.neutronRouterUpdated(router); + } + } + } + } + + private void deleteRouter( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (InstanceIdentifier deletedRouterPath : changes.getRemovedPaths()) { + if(deletedRouterPath.getTargetType().equals(Router.class)){ + NeutronRouter router = fromMd((Router)changes.getOriginalData().get(deletedRouterPath)); + for(Object entry: subscribers){ + INeutronRouterAware subscriber = (INeutronRouterAware)entry; + subscriber.neutronRouterDeleted(router); + } + } + } + } + + /* + * This method is borrowed from NeutronRouterInterface.java class of Neutron Northbound class. + * We will be utilizing similar code from other classes from the same package of neutron project. + */ + private NeutronRouter fromMd(Router router) { + NeutronRouter result = new NeutronRouter(); + result.setID(String.valueOf(router.getUuid().getValue())); + result.setName(router.getName()); + result.setTenantID(String.valueOf(router.getTenantId().getValue())); + result.setAdminStateUp(router.isAdminStateUp()); + result.setStatus(router.getStatus()); + result.setDistributed(router.isDistributed()); + if (router.getGatewayPortId() != null) { + result.setGatewayPortId(String.valueOf(router.getGatewayPortId().getValue())); + } + if (router.getRoutes() != null) { + List routes = new ArrayList(); + for (String route : router.getRoutes()) { + routes.add(route); + } + result.setRoutes(routes); + } + + if (router.getExternalGatewayInfo() != null) { + NeutronRouter_NetworkReference extGwInfo = new NeutronRouter_NetworkReference(); + extGwInfo.setNetworkID(String.valueOf(router.getExternalGatewayInfo().getExternalNetworkId().getValue())); + extGwInfo.setEnableSNAT(router.getExternalGatewayInfo().isEnableSnat()); + if (router.getExternalGatewayInfo().getExternalFixedIps() != null) { + List fixedIPs = new ArrayList(); + for (ExternalFixedIps mdFixedIP : router.getExternalGatewayInfo().getExternalFixedIps()) { + Neutron_IPs fixedIP = new Neutron_IPs(); + fixedIP.setSubnetUUID(String.valueOf(mdFixedIP.getSubnetId().getValue())); + fixedIP.setIpAddress(String.valueOf(mdFixedIP.getIpAddress().getValue())); + fixedIPs.add(fixedIP); + } + extGwInfo.setExternalFixedIPs(fixedIPs); + } + result.setExternalGatewayInfo(extGwInfo); + } + + if (router.getInterfaces() != null) { + Map interfaces = new HashMap(); + for (Interfaces mdInterface : router.getInterfaces()) { + NeutronRouter_Interface pojoInterface = new NeutronRouter_Interface(); + String id = String.valueOf(mdInterface.getUuid().getValue()); + pojoInterface.setID(id); + pojoInterface.setTenantID(String.valueOf(mdInterface.getTenantId().getValue())); + pojoInterface.setSubnetUUID(String.valueOf(mdInterface.getSubnetId().getValue())); + pojoInterface.setPortUUID(String.valueOf(mdInterface.getPortId().getValue())); + interfaces.put(id, pojoInterface); + } + result.setInterfaces(interfaces); + } + return result; + } + + @Override + public void close() throws Exception { + registration.close(); + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronSecurityGroupDataChangeListener.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronSecurityGroupDataChangeListener.java new file mode 100644 index 000000000..796d1b1c2 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronSecurityGroupDataChangeListener.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2015 Brocade Communications 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.ovsdb.openstack.netvirt.translator.iaware.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map.Entry; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSecurityRuleCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.NeutronCRUDInterfaces; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronSecurityGroupAware; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.SecurityGroups; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.security.groups.SecurityGroup; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NeutronSecurityGroupDataChangeListener implements + DataChangeListener, AutoCloseable { + private static final Logger LOG = LoggerFactory + .getLogger(NeutronSecurityGroupDataChangeListener.class); + + private ListenerRegistration registration; + private DataBroker db; + + public NeutronSecurityGroupDataChangeListener(DataBroker db) { + this.db = db; + InstanceIdentifier path = InstanceIdentifier + .create(Neutron.class).child(SecurityGroups.class) + .child(SecurityGroup.class); + LOG.debug("Register listener for Neutron Secutiry group model data changes"); + registration = this.db.registerDataChangeListener( + LogicalDatastoreType.CONFIGURATION, path, this, + DataChangeScope.ONE); + + } + + @Override + public void onDataChanged( + AsyncDataChangeEvent, DataObject> changes) { + LOG.trace("Data changes : {}", changes); + + Object[] subscribers = NeutronIAwareUtil.getInstances( + INeutronSecurityGroupAware.class, this); + createSecurityGroup(changes, subscribers); + updateSecurityGroup(changes, subscribers); + deleteSecurityGroup(changes, subscribers); + } + + private void createSecurityGroup( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> newSecutiryGroup : changes + .getCreatedData().entrySet()) { + if (newSecutiryGroup.getValue() instanceof SecurityGroup) { + NeutronSecurityGroup secutiryGroup = fromMd((SecurityGroup) newSecutiryGroup + .getValue()); + for (Object entry : subscribers) { + INeutronSecurityGroupAware subscriber = (INeutronSecurityGroupAware) entry; + subscriber.neutronSecurityGroupCreated(secutiryGroup); + } + } + } + + } + + private void updateSecurityGroup( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> updateSecurityGroup : changes + .getUpdatedData().entrySet()) { + if (updateSecurityGroup.getValue() instanceof SecurityGroup) { + NeutronSecurityGroup securityGroup = fromMd((SecurityGroup) updateSecurityGroup + .getValue()); + for (Object entry : subscribers) { + INeutronSecurityGroupAware subscriber = (INeutronSecurityGroupAware) entry; + subscriber.neutronSecurityGroupUpdated(securityGroup); + } + } + } + } + + private void deleteSecurityGroup( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (InstanceIdentifier deletedSecurityGroup : changes + .getRemovedPaths()) { + if (deletedSecurityGroup.getTargetType() + .equals(SecurityGroup.class)) { + NeutronSecurityGroup securityGroup = fromMd((SecurityGroup) changes + .getOriginalData().get(deletedSecurityGroup)); + for (Object entry : subscribers) { + INeutronSecurityGroupAware subscriber = (INeutronSecurityGroupAware) entry; + subscriber.neutronSecurityGroupDeleted(securityGroup); + } + } + } + } + + private NeutronSecurityGroup fromMd(SecurityGroup group) { + NeutronSecurityGroup answer = new NeutronSecurityGroup(); + if (group.getName() != null) { + answer.setSecurityGroupName(group.getName()); + } + if (group.getDescription() != null) { + answer.setSecurityGroupDescription(group.getDescription()); + } + if (group.getTenantId() != null) { + answer.setSecurityGroupTenantID(group.getTenantId().getValue() + .replace("-", "")); + } + if (group.getSecurityRules() != null) { + NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces() + .fetchINeutronSecurityRuleCRUD(this); + INeutronSecurityRuleCRUD srCrud = interfaces + .getSecurityRuleInterface(); + + List rules = new ArrayList(); + for (Uuid uuid : group.getSecurityRules()) { + rules.add(srCrud.getNeutronSecurityRule(uuid.getValue())); + } + answer.setSecurityRules(rules); + } + if (group.getUuid() != null) { + answer.setID(group.getUuid().getValue()); + } + return answer; + } + + @Override + public void close() throws Exception { + registration.close(); + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronSecurityRuleDataChangeListener.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronSecurityRuleDataChangeListener.java new file mode 100644 index 000000000..488b32d88 --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronSecurityRuleDataChangeListener.java @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2015 Brocade Communications 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.ovsdb.openstack.netvirt.translator.iaware.impl; + +import java.util.Map.Entry; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronSecurityRuleAware; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.DirectionBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.DirectionEgress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.DirectionIngress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeV4; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeV6; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolHttp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolHttps; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolIcmp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolTcp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.SecurityRules; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRule; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.ImmutableBiMap; + +public class NeutronSecurityRuleDataChangeListener implements DataChangeListener, AutoCloseable { + + private static final Logger LOG = LoggerFactory.getLogger(NeutronSecurityRuleDataChangeListener.class); + + private static final ImmutableBiMap, String> DIRECTION_MAP + = new ImmutableBiMap.Builder, String>() + .put(DirectionEgress.class, "egress") + .put(DirectionIngress.class, "ingress").build(); + private static final ImmutableBiMap, String> PROTOCOL_MAP + = new ImmutableBiMap.Builder, String>() + .put(ProtocolHttp.class, "HTTP") + .put(ProtocolHttps.class, "HTTPS") + .put(ProtocolIcmp.class, "ICMP") + .put(ProtocolTcp.class, "TCP") + .build(); + private static final ImmutableBiMap, String> ETHERTYPE_MAP + = new ImmutableBiMap.Builder, String>() + .put(EthertypeV4.class, "v4") + .put(EthertypeV6.class, "v6") + .build(); + + private ListenerRegistration registration; + private DataBroker db; + + public NeutronSecurityRuleDataChangeListener(DataBroker db) { + this.db = db; + InstanceIdentifier path = InstanceIdentifier + .create(Neutron.class).child(SecurityRules.class) + .child(SecurityRule.class); + LOG.debug("Register listener for Neutron Secutiry rules model data changes"); + registration = this.db.registerDataChangeListener( + LogicalDatastoreType.CONFIGURATION, path, this, + DataChangeScope.ONE); + + } + + @Override + public void onDataChanged( + AsyncDataChangeEvent, DataObject> changes) { + LOG.trace("Data changes : {}", changes); + + Object[] subscribers = NeutronIAwareUtil.getInstances( + INeutronSecurityRuleAware.class, this); + createSecurityRule(changes, subscribers); + updateSecurityRule(changes, subscribers); + deleteSecurityRule(changes, subscribers); + } + + private void createSecurityRule( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> newSecutiryRule : changes + .getCreatedData().entrySet()) { + if (newSecutiryRule.getValue() instanceof SecurityRule) { + NeutronSecurityRule secutiryRule = fromMd((SecurityRule) newSecutiryRule + .getValue()); + for (Object entry : subscribers) { + INeutronSecurityRuleAware subscriber = (INeutronSecurityRuleAware) entry; + subscriber.neutronSecurityRuleCreated(secutiryRule); + } + } + } + + } + + private void updateSecurityRule( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> updateSecurityRule : changes + .getUpdatedData().entrySet()) { + if (updateSecurityRule.getValue() instanceof SecurityRule) { + NeutronSecurityRule securityRule = fromMd((SecurityRule) updateSecurityRule + .getValue()); + for (Object entry : subscribers) { + INeutronSecurityRuleAware subscriber = (INeutronSecurityRuleAware) entry; + subscriber.neutronSecurityRuleUpdated(securityRule); + } + } + } + } + + private void deleteSecurityRule( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (InstanceIdentifier deletedSecurityRule : changes + .getRemovedPaths()) { + if (deletedSecurityRule.getTargetType().equals(SecurityRule.class)) { + NeutronSecurityRule securityRule = fromMd((SecurityRule) changes + .getOriginalData().get(deletedSecurityRule)); + for (Object entry : subscribers) { + INeutronSecurityRuleAware subscriber = (INeutronSecurityRuleAware) entry; + subscriber.neutronSecurityRuleDeleted(securityRule); + } + } + } + } + + private NeutronSecurityRule fromMd(SecurityRule rule) { + NeutronSecurityRule answer = new NeutronSecurityRule(); + if (rule.getTenantId() != null) { + answer.setSecurityRuleTenantID(rule.getTenantId().getValue() + .replace("-", "")); + } + if (rule.getDirection() != null) { + answer.setSecurityRuleDirection(DIRECTION_MAP.get(rule + .getDirection())); + } + if (rule.getSecurityGroupId() != null) { + answer.setSecurityRuleGroupID(rule.getSecurityGroupId().getValue()); + } + if (rule.getRemoteGroupId() != null) { + answer.setSecurityRemoteGroupID(rule.getRemoteGroupId().getValue()); + } + if (rule.getRemoteIpPrefix() != null) { + answer.setSecurityRuleRemoteIpPrefix(rule.getRemoteIpPrefix().getIpv4Prefix()!= null? + rule.getRemoteIpPrefix().getIpv4Prefix().getValue():rule.getRemoteIpPrefix().getIpv6Prefix().getValue()); + } + if (rule.getProtocol() != null) { + answer.setSecurityRuleProtocol(PROTOCOL_MAP.get(rule.getProtocol())); + } + if (rule.getEthertype() != null) { + answer.setSecurityRuleEthertype(ETHERTYPE_MAP.get(rule + .getEthertype())); + } + if (rule.getPortRangeMin() != null) { + answer.setSecurityRulePortMin(Integer.valueOf(rule + .getPortRangeMin())); + } + if (rule.getPortRangeMax() != null) { + answer.setSecurityRulePortMax(Integer.valueOf(rule + .getPortRangeMax())); + } + if (rule.getId() != null) { + answer.setID(rule.getId().getValue()); + } + return answer; + } + + @Override + public void close() throws Exception { + registration.close(); + } +} diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronSubnetChangeListener.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronSubnetChangeListener.java new file mode 100644 index 000000000..7f3073aec --- /dev/null +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronSubnetChangeListener.java @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2015 Brocade Communications 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.ovsdb.openstack.netvirt.translator.iaware.impl; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map.Entry; +import java.util.Set; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnetIPAllocationPool; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.NeutronCRUDInterfaces; +import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronSubnetAware; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Base; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Off; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Slaac; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Stateful; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Stateless; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.IpVersionBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.IpVersionV4; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.IpVersionV6; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnet.attributes.AllocationPools; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.Subnets; +import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.Subnet; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.ImmutableBiMap; + +public class NeutronSubnetChangeListener implements DataChangeListener, AutoCloseable{ + private static final Logger LOG = LoggerFactory.getLogger(NeutronSubnetChangeListener.class); + + private static final ImmutableBiMap,Integer> IPV_MAP + = new ImmutableBiMap.Builder,Integer>() + .put(IpVersionV4.class,Integer.valueOf(4)) + .put(IpVersionV6.class,Integer.valueOf(6)) + .build(); + + private static final ImmutableBiMap,String> DHCPV6_MAP + = new ImmutableBiMap.Builder,String>() + .put(Dhcpv6Off.class,"off") + .put(Dhcpv6Stateful.class,"dhcpv6-stateful") + .put(Dhcpv6Slaac.class,"slaac") + .put(Dhcpv6Stateless.class,"dhcpv6-stateless") + .build(); + + private ListenerRegistration registration; + private DataBroker db; + + public NeutronSubnetChangeListener(DataBroker db){ + this.db = db; + InstanceIdentifier path = InstanceIdentifier + .create(Neutron.class) + .child(Subnets.class) + .child(Subnet.class); + LOG.debug("Register listener for Neutron Subnet model data changes"); + registration = + this.db.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, path, this, DataChangeScope.ONE); + + } + + @Override + public void onDataChanged( + AsyncDataChangeEvent, DataObject> changes) { + LOG.trace("Data changes : {}",changes); + + Object[] subscribers = NeutronIAwareUtil.getInstances(INeutronSubnetAware.class, this); + createSubnet(changes, subscribers); + updateSubnet(changes, subscribers); + deleteSubnet(changes, subscribers); + } + + private void createSubnet( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> newSubnet : changes.getCreatedData().entrySet()) { + if(newSubnet.getValue() instanceof Subnet){ + NeutronSubnet subnet = fromMd((Subnet)newSubnet.getValue()); + for(Object entry: subscribers){ + INeutronSubnetAware subscriber = (INeutronSubnetAware)entry; + subscriber.neutronSubnetCreated(subnet); + } + } + } + } + + private void updateSubnet( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (Entry, DataObject> updateSubnet : changes.getUpdatedData().entrySet()) { + if(updateSubnet.getValue() instanceof Subnet){ + NeutronSubnet subnet = fromMd((Subnet)updateSubnet.getValue()); + for(Object entry: subscribers){ + INeutronSubnetAware subscriber = (INeutronSubnetAware)entry; + subscriber.neutronSubnetUpdated(subnet); + } + } + } + } + + private void deleteSubnet( + AsyncDataChangeEvent, DataObject> changes, + Object[] subscribers) { + for (InstanceIdentifier deletedSubnetPath : changes.getRemovedPaths()) { + if(deletedSubnetPath.getTargetType().equals(Subnet.class)){ + NeutronSubnet subnet = fromMd((Subnet)changes.getOriginalData().get(deletedSubnetPath)); + for(Object entry: subscribers){ + INeutronSubnetAware subscriber = (INeutronSubnetAware)entry; + subscriber.neutronSubnetDeleted(subnet); + } + } + } + } + + /* + * This method is borrowed from NeutronSubnetInterface.java class of Neutron Northbound class. + * We will be utilizing similar code from other classes from the same package of neutron project. + */ + private NeutronSubnet fromMd(Subnet subnet) { + NeutronSubnet result = new NeutronSubnet(); + result.setName(subnet.getName()); + result.setTenantID(String.valueOf(subnet.getTenantId().getValue()).replace("-","")); + result.setNetworkUUID(subnet.getNetworkId().getValue()); + result.setIpVersion(IPV_MAP.get(subnet.getIpVersion())); + result.setCidr(subnet.getCidr()); + result.setGatewayIP(String.valueOf(subnet.getGatewayIp().getValue())); + result.setIpV6RaMode(DHCPV6_MAP.get(subnet.getIpv6RaMode())); + result.setIpV6AddressMode(DHCPV6_MAP.get(subnet.getIpv6AddressMode())); + result.setEnableDHCP(subnet.isEnableDhcp()); + if (subnet.getAllocationPools() != null) { + List allocationPools = new ArrayList(); + for (AllocationPools allocationPool : subnet.getAllocationPools()) { + NeutronSubnetIPAllocationPool pool = new NeutronSubnetIPAllocationPool(); + pool.setPoolStart(allocationPool.getStart()); + pool.setPoolEnd(allocationPool.getEnd()); + allocationPools.add(pool); + } + result.setAllocationPools(allocationPools); + } + if (subnet.getDnsNameservers() != null) { + List dnsNameServers = new ArrayList(); + for (IpAddress dnsNameServer : subnet.getDnsNameservers()) { + dnsNameServers.add(String.valueOf(dnsNameServer.getValue())); + } + result.setDnsNameservers(dnsNameServers); + } + result.setID(subnet.getUuid().getValue()); + + // read through the ports and put the ones in this subnet into the internal + // myPorts object. + Set allPorts = new HashSet(); + NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces() + .fetchINeutronPortCRUD(this); + INeutronPortCRUD portIf = interfaces.getPortInterface(); + for (NeutronPort port : portIf.getAllPorts()) { + if (port.getFixedIPs() != null) { + for (Neutron_IPs ip : port.getFixedIPs()) { + if (ip.getSubnetUUID().equals(result.getID())) { + allPorts.add(port); + } + } + } + } + List ports = new ArrayList(); + ports.addAll(allPorts); + result.setPorts(ports); + return result; + } + + @Override + public void close() throws Exception { + registration.close(); + } + +} diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/FWaasHandlerTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/FWaasHandlerTest.java index 7eade3180..9640e603d 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/FWaasHandlerTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/FWaasHandlerTest.java @@ -22,9 +22,9 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mockito; -import org.opendaylight.neutron.spi.NeutronFirewall; -import org.opendaylight.neutron.spi.NeutronFirewallPolicy; -import org.opendaylight.neutron.spi.NeutronFirewallRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewall; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewallPolicy; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFirewallRule; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper; import org.osgi.framework.ServiceReference; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/FloatingIPHandlerTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/FloatingIPHandlerTest.java index e18b7a4f4..a3976def3 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/FloatingIPHandlerTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/FloatingIPHandlerTest.java @@ -21,7 +21,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.opendaylight.neutron.spi.NeutronFloatingIP; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFloatingIP; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSHandlerTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSHandlerTest.java index 42ff6d4c2..806231e00 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSHandlerTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSHandlerTest.java @@ -31,14 +31,14 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.opendaylight.neutron.spi.INeutronLoadBalancerCRUD; -import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolCRUD; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.INeutronSubnetCRUD; -import org.opendaylight.neutron.spi.NeutronLoadBalancer; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPool; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerPoolCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.api.LoadBalancerConfiguration; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolHandlerTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolHandlerTest.java index 4cb99948a..52458c6e9 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolHandlerTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolHandlerTest.java @@ -30,14 +30,14 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.opendaylight.neutron.spi.INeutronLoadBalancerCRUD; -import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolCRUD; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.INeutronSubnetCRUD; -import org.opendaylight.neutron.spi.NeutronLoadBalancer; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPool; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerPoolCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.api.LoadBalancerConfiguration; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolMemberHandlerTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolMemberHandlerTest.java index 4bdce6ce0..d9c99df11 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolMemberHandlerTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/LBaaSPoolMemberHandlerTest.java @@ -30,14 +30,14 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.opendaylight.neutron.spi.INeutronLoadBalancerCRUD; -import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolCRUD; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.INeutronSubnetCRUD; -import org.opendaylight.neutron.spi.NeutronLoadBalancer; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPool; -import org.opendaylight.neutron.spi.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerPoolCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.api.LoadBalancerConfiguration; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/NetworkHandlerTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/NetworkHandlerTest.java index 8890cfaa9..455bee9cd 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/NetworkHandlerTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/NetworkHandlerTest.java @@ -28,8 +28,8 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/NeutronCacheUtilsTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/NeutronCacheUtilsTest.java index 87a8c6924..61b9e10d9 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/NeutronCacheUtilsTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/NeutronCacheUtilsTest.java @@ -19,13 +19,13 @@ import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.INeutronSubnetCRUD; -import org.opendaylight.neutron.spi.NeutronNetwork; -import org.opendaylight.neutron.spi.NeutronPort; -import org.opendaylight.neutron.spi.NeutronSubnet; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; import org.powermock.modules.junit4.PowerMockRunner; /** diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/PortHandlerTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/PortHandlerTest.java index fda2e7600..9e1e4859d 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/PortHandlerTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/PortHandlerTest.java @@ -26,7 +26,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.opendaylight.neutron.spi.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.api.NodeCacheManager; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/PortSecurityHandlerTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/PortSecurityHandlerTest.java index b3c4525af..b00c7a502 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/PortSecurityHandlerTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/PortSecurityHandlerTest.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mockito; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; -import org.opendaylight.neutron.spi.NeutronSecurityRule; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityRule; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper; import org.osgi.framework.ServiceReference; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/RouterHandlerTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/RouterHandlerTest.java index a00486416..c99398410 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/RouterHandlerTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/RouterHandlerTest.java @@ -21,8 +21,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.opendaylight.neutron.spi.NeutronRouter; -import org.opendaylight.neutron.spi.NeutronRouter_Interface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter_Interface; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/SouthboundHandlerTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/SouthboundHandlerTest.java index 57b94a319..707929416 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/SouthboundHandlerTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/SouthboundHandlerTest.java @@ -25,7 +25,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.opendaylight.neutron.spi.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; import org.opendaylight.ovsdb.openstack.netvirt.SouthboundEvent.Type; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/SubnetHandlerTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/SubnetHandlerTest.java index 543a4e030..1ca405c20 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/SubnetHandlerTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/SubnetHandlerTest.java @@ -21,7 +21,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.opendaylight.neutron.spi.NeutronSubnet; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher; import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImplTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImplTest.java index 8c48b2709..dec0f7358 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImplTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImplTest.java @@ -34,7 +34,7 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.opendaylight.neutron.spi.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService; import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager; import org.opendaylight.ovsdb.openstack.netvirt.api.OvsdbTables; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3AdapterTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3AdapterTest.java index 442863d69..521c7c6a2 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3AdapterTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3AdapterTest.java @@ -35,16 +35,16 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.INeutronSubnetCRUD; -import org.opendaylight.neutron.spi.NeutronFloatingIP; -import org.opendaylight.neutron.spi.NeutronNetwork; -import org.opendaylight.neutron.spi.NeutronPort; -import org.opendaylight.neutron.spi.NeutronRouter; -import org.opendaylight.neutron.spi.NeutronRouter_Interface; -import org.opendaylight.neutron.spi.NeutronSubnet; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronFloatingIP; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronRouter_Interface; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSubnet; +import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD; import org.opendaylight.ovsdb.openstack.netvirt.api.Action; import org.opendaylight.ovsdb.openstack.netvirt.api.ArpProvider; import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImplTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImplTest.java index a3fa51bb1..1888003e8 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImplTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImplTest.java @@ -23,9 +23,9 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.NeutronPort; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound; import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/TenantNetworkManagerImplTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/TenantNetworkManagerImplTest.java index 70cfd6c56..5a738a6a8 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/TenantNetworkManagerImplTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/TenantNetworkManagerImplTest.java @@ -26,10 +26,10 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.opendaylight.neutron.spi.INeutronNetworkCRUD; -import org.opendaylight.neutron.spi.INeutronPortCRUD; -import org.opendaylight.neutron.spi.NeutronNetwork; -import org.opendaylight.neutron.spi.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD; +import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD; import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager; import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound; import org.opendaylight.ovsdb.openstack.netvirt.api.VlanConfigurationCache; diff --git a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/VlanConfigurationCacheImplTest.java b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/VlanConfigurationCacheImplTest.java index d30fdacb1..7ab12eff4 100644 --- a/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/VlanConfigurationCacheImplTest.java +++ b/openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/VlanConfigurationCacheImplTest.java @@ -21,7 +21,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.opendaylight.neutron.spi.NeutronNetwork; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound; import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager; import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper; diff --git a/ovs-sfc/src/main/java/org/opendaylight/controller/config/yang/config/ovssfc_provider/impl/OvsSfcProviderModule.java b/ovs-sfc/src/main/java/org/opendaylight/controller/config/yang/config/ovssfc_provider/impl/OvsSfcProviderModule.java index 14bfb76a1..c42e7bbe1 100644 --- a/ovs-sfc/src/main/java/org/opendaylight/controller/config/yang/config/ovssfc_provider/impl/OvsSfcProviderModule.java +++ b/ovs-sfc/src/main/java/org/opendaylight/controller/config/yang/config/ovssfc_provider/impl/OvsSfcProviderModule.java @@ -1,5 +1,5 @@ /* -* Copyright (C) 2014 Red Hat, Inc. +* Copyright (C) 2014 Red Hat, 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, diff --git a/schemas/hardwarevtep/src/test/java/org/opendaylight/ovsdb/schema/hardwarevtep/HardwareVTEPTest.java b/schemas/hardwarevtep/src/test/java/org/opendaylight/ovsdb/schema/hardwarevtep/HardwareVTEPTest.java index 714ff69e8..2fe9a0459 100644 --- a/schemas/hardwarevtep/src/test/java/org/opendaylight/ovsdb/schema/hardwarevtep/HardwareVTEPTest.java +++ b/schemas/hardwarevtep/src/test/java/org/opendaylight/ovsdb/schema/hardwarevtep/HardwareVTEPTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Red Hat, Inc. + * Copyright (C) 2014 Red Hat, 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, diff --git a/schemas/openvswitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OpenVSwitchTest.java b/schemas/openvswitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OpenVSwitchTest.java index 72fcc9252..32adb5dd8 100644 --- a/schemas/openvswitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OpenVSwitchTest.java +++ b/schemas/openvswitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OpenVSwitchTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Red Hat, Inc. + * Copyright (C) 2014 Red Hat, 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, diff --git a/utils/config/src/test/java/org/opendaylight/ovsdb/utils/config/ConfigPropertiesTest.java b/utils/config/src/test/java/org/opendaylight/ovsdb/utils/config/ConfigPropertiesTest.java index 91d781732..d0fac74ad 100644 --- a/utils/config/src/test/java/org/opendaylight/ovsdb/utils/config/ConfigPropertiesTest.java +++ b/utils/config/src/test/java/org/opendaylight/ovsdb/utils/config/ConfigPropertiesTest.java @@ -1,5 +1,5 @@ /* -* Copyright (C) 2014 Red Hat, Inc. +* Copyright (C) 2014 Red Hat, 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, diff --git a/utils/mdsal-node/src/test/java/org/opendaylight/ovsdb/utils/mdsal/node/NodeUtilsTest.java b/utils/mdsal-node/src/test/java/org/opendaylight/ovsdb/utils/mdsal/node/NodeUtilsTest.java index 291b2349b..c6b0a2bfa 100644 --- a/utils/mdsal-node/src/test/java/org/opendaylight/ovsdb/utils/mdsal/node/NodeUtilsTest.java +++ b/utils/mdsal-node/src/test/java/org/opendaylight/ovsdb/utils/mdsal/node/NodeUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Red Hat, Inc. + * Copyright (C) 2015 Red Hat, 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, diff --git a/utils/mdsal-openflow/src/test/java/org/opendaylight/ovsdb/utils/mdsal/openflow/MatchUtilsTest.java b/utils/mdsal-openflow/src/test/java/org/opendaylight/ovsdb/utils/mdsal/openflow/MatchUtilsTest.java index 886ae541e..807895c9e 100644 --- a/utils/mdsal-openflow/src/test/java/org/opendaylight/ovsdb/utils/mdsal/openflow/MatchUtilsTest.java +++ b/utils/mdsal-openflow/src/test/java/org/opendaylight/ovsdb/utils/mdsal/openflow/MatchUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Red Hat, Inc. + * Copyright (C) 2014 Red Hat, 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, diff --git a/utils/servicehelper/src/test/java/org/opendaylight/ovsdb/utils/servicehelper/ServiceHelperTest.java b/utils/servicehelper/src/test/java/org/opendaylight/ovsdb/utils/servicehelper/ServiceHelperTest.java index 72a837e34..d04b15a97 100644 --- a/utils/servicehelper/src/test/java/org/opendaylight/ovsdb/utils/servicehelper/ServiceHelperTest.java +++ b/utils/servicehelper/src/test/java/org/opendaylight/ovsdb/utils/servicehelper/ServiceHelperTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Red Hat, Inc. + * Copyright (C) 2015 Red Hat, 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, -- 2.36.6