Merge "Bug 3269 Implementation of floating ip in neutron-mapper"
authorKeith Burns <alagalah@gmail.com>
Wed, 27 May 2015 13:41:27 +0000 (13:41 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 27 May 2015 13:41:28 +0000 (13:41 +0000)
1  2 
neutron-mapper/src/main/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/NeutronPortAware.java

index e153ffde2137078771cf2f9cf7a81f893ff3cff7,2346abcfe4e19c8396a5c402ceaa0b0856644321..24c44a14f0518679bb874747797bedd76b23286d
@@@ -224,12 -229,12 +230,12 @@@ public class NeutronPortAware implement
      }
  
      private static void addNeutronGbpMapping(NeutronPort port, EndpointKey epKey, ReadWriteTransaction rwTx) {
+         UniqueId portId = new UniqueId(port.getID());
          if (isRouterInterfacePort(port)) {
              LOG.trace("Adding RouterInterfacePort-Endpoint mapping for port {} and endpoint {}", port.getID(), epKey);
-             UniqueId portId = new UniqueId(port.getID());
              EndpointByRouterInterfacePort endpointByPort = MappingFactory.createEndpointByRouterInterfacePort(epKey,
                      portId);
 -            rwTx.put(LogicalDatastoreType.OPERATIONAL, IidFactory.endpointByRouterInterfacePortIid(portId),
 +            rwTx.put(LogicalDatastoreType.OPERATIONAL, NeutronGbpIidFactory.endpointByRouterInterfacePortIid(portId),
                      endpointByPort, true);
              RouterInterfacePortByEndpoint portByEndpoint = MappingFactory.createRouterInterfacePortByEndpoint(portId,
                      epKey);
                      portByEndpoint, true);
          } else if (isRouterGatewayPort(port)) {
              LOG.trace("Adding RouterGatewayPort-Endpoint mapping for port {} and endpoint {}", port.getID(), epKey);
-             UniqueId portId = new UniqueId(port.getID());
              EndpointByRouterGatewayPort endpointByPort = MappingFactory.createEndpointByRouterGatewayPort(epKey, portId);
 -            rwTx.put(LogicalDatastoreType.OPERATIONAL, IidFactory.endpointByRouterGatewayPortIid(portId),
 +            rwTx.put(LogicalDatastoreType.OPERATIONAL, NeutronGbpIidFactory.endpointByRouterGatewayPortIid(portId),
                      endpointByPort, true);
              RouterGatewayPortByEndpoint portByEndpoint = MappingFactory.createRouterGatewayPortByEndpoint(portId, epKey);
              rwTx.put(LogicalDatastoreType.OPERATIONAL,
 -                    IidFactory.routerGatewayPortByEndpointIid(epKey.getL2Context(), epKey.getMacAddress()),
 +                    NeutronGbpIidFactory.routerGatewayPortByEndpointIid(epKey.getL2Context(), epKey.getMacAddress()),
                      portByEndpoint, true);
+         } else if (isFloatingIpPort(port)) {
+             LOG.trace("Adding FloatingIpPort-Endpoint mapping for port {} and endpoint {}", port.getID(), epKey);
+             EndpointByFloatingIpPort endpointByPort = MappingFactory.createEndpointByFloatingIpPort(epKey, portId);
+             rwTx.put(LogicalDatastoreType.OPERATIONAL, IidFactory.endpointByFloatingIpPortIid(portId),
+                     endpointByPort, true);
+             FloatingIpPortByEndpoint portByEndpoint = MappingFactory.createFloatingIpPortByEndpoint(portId, epKey);
+             rwTx.put(LogicalDatastoreType.OPERATIONAL,
+                     IidFactory.floatingIpPortByEndpointIid(epKey.getL2Context(), epKey.getMacAddress()),
+                     portByEndpoint, true);
          } else {
              LOG.trace("Adding Port-Endpoint mapping for port {} (device owner {}) and endpoint {}", port.getID(),
                      port.getDeviceOwner(), epKey);
-             UniqueId portId = new UniqueId(port.getID());
              EndpointByPort endpointByPort = MappingFactory.createEndpointByPort(epKey, portId);
 -            rwTx.put(LogicalDatastoreType.OPERATIONAL, IidFactory.endpointByPortIid(portId), endpointByPort, true);
 +            rwTx.put(LogicalDatastoreType.OPERATIONAL, NeutronGbpIidFactory.endpointByPortIid(portId), endpointByPort, true);
              PortByEndpoint portByEndpoint = MappingFactory.createPortByEndpoint(portId, epKey);
              rwTx.put(LogicalDatastoreType.OPERATIONAL,
 -                    IidFactory.portByEndpointIid(epKey.getL2Context(), epKey.getMacAddress()), portByEndpoint, true);
 +                    NeutronGbpIidFactory.portByEndpointIid(epKey.getL2Context(), epKey.getMacAddress()), portByEndpoint, true);
          }
      }