2 * Copyright (C) 2014 Red Hat, Inc.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 * Authors : Dave Tucker, Flavio Fernandes
10 package org.opendaylight.ovsdb.openstack.netvirt;
12 import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPAware;
13 import org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP;
14 import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
15 import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
16 import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
21 import java.net.HttpURLConnection;
24 * Handle requests for Neutron Floating IP.
26 public class FloatingIPHandler extends AbstractHandler
27 implements INeutronFloatingIPAware {
32 static final Logger logger = LoggerFactory.getLogger(FloatingIPHandler.class);
34 private volatile OvsdbConfigurationService ovsdbConfigurationService;
35 private volatile OvsdbConnectionService connectionService;
36 private volatile OvsdbInventoryListener ovsdbInventoryListener;
39 * Services provide this interface method to indicate if the specified floatingIP can be created
42 * instance of proposed new Neutron FloatingIP object
44 * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
45 * results in the create operation being interrupted and the returned status value reflected in the
49 public int canCreateFloatingIP(NeutronFloatingIP floatingIP) {
50 return HttpURLConnection.HTTP_OK;
55 * Services provide this interface method for taking action after a floatingIP has been created
58 * instance of new Neutron FloatingIP object
61 public void neutronFloatingIPCreated(NeutronFloatingIP floatingIP) {
62 logger.debug(" Floating IP created {}, uuid {}",
63 floatingIP.getFixedIPAddress(),
64 floatingIP.getFloatingIPUUID());
68 * Services provide this interface method to indicate if the specified floatingIP can be changed using the specified
72 * updates to the floatingIP object using patch semantics
74 * instance of the Neutron FloatingIP object to be updated
76 * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
77 * results in the update operation being interrupted and the returned status value reflected in the
81 public int canUpdateFloatingIP(NeutronFloatingIP delta, NeutronFloatingIP original) {
82 return HttpURLConnection.HTTP_OK;
86 * Services provide this interface method for taking action after a floatingIP has been updated
89 * instance of modified Neutron FloatingIP object
92 public void neutronFloatingIPUpdated(NeutronFloatingIP floatingIP) {
93 logger.debug(" Floating IP updated {}, uuid {}",
94 floatingIP.getFixedIPAddress(),
95 floatingIP.getFloatingIPUUID());
99 * Services provide this interface method to indicate if the specified floatingIP can be deleted
102 * instance of the Neutron FloatingIP object to be deleted
104 * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
105 * results in the delete operation being interrupted and the returned status value reflected in the
109 public int canDeleteFloatingIP(NeutronFloatingIP floatingIP) {
110 return HttpURLConnection.HTTP_OK;
114 * Services provide this interface method for taking action after a floatingIP has been deleted
117 * instance of deleted Neutron FloatingIP object
120 public void neutronFloatingIPDeleted(NeutronFloatingIP floatingIP) {
121 logger.debug(" Floating IP deleted {}, uuid {}",
122 floatingIP.getFixedIPAddress(),
123 floatingIP.getFloatingIPUUID());